/* Tableau de Bord Direction — coquille applicative premium.
   HTML/CSS/JS vanilla, mobile-first, sans dépendance. Palette et
   composants pensés pour être reskinnés par entreprise (multi-tenant). */

* { box-sizing: border-box; }

:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --vert: #0a8f3c;
  --vert-fond: #e6f7ec;
  --orange: #d97a00;
  --orange-fond: #fdf1de;
  --rouge: #dc2626;
  --rouge-fond: #fde8e8;
  --violet: #7c3aed;

  --fond: #f6f7fb;
  --surface: #ffffff;
  --surface-alt: #fafbfc;
  --bordure: #e6e8ef;
  --texte: #16181d;
  --texte-clair: #6b7280;
  --texte-tres-clair: #9aa1ac;

  --rayon-sm: 10px;
  --rayon-md: 14px;
  --rayon-lg: 20px;
  --ombre-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --ombre-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --ombre-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  --sidebar-largeur: 240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f1115;
    --surface: #171a21;
    --surface-alt: #1d2129;
    --bordure: #2a2e38;
    --texte: #f1f2f4;
    --texte-clair: #a2a8b4;
    --texte-tres-clair: #6b7280;
    --brand-light: #1e2247;
  }
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

button, input, select { font-family: inherit; }

/* ---------- Barre supérieure (mobile) / coquille générale ---------- */

.coquille {
  display: flex;
  min-height: 100vh;
}

.barre-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 0;
  z-index: 20;
}

.barre-haut-gauche { display: flex; align-items: center; gap: 10px; min-width: 0; }

.bouton-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface-alt);
  border-radius: var(--rayon-sm);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}
.bouton-menu:active { background: var(--bordure); }

.marque {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  min-width: 0;
}
.marque-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.marque-entreprise {
  color: var(--texte-clair);
  font-weight: 500;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-deconnexion {
  border: 1px solid var(--bordure);
  background: transparent;
  color: var(--texte-clair);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-deconnexion:active { background: var(--surface-alt); }

/* ---------- Navigation ---------- */

.voile-nav {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.voile-nav.ouvert { opacity: 1; pointer-events: auto; }

.nav-laterale {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(78vw, 300px);
  background: var(--surface);
  border-right: 1px solid var(--bordure);
  z-index: 30;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  overflow-y: auto;
}
.nav-laterale.ouvert { transform: translateX(0); }

.nav-entete {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  font-weight: 800;
  font-size: 1.05rem;
}

.nav-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }

.nav-lien {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: transparent;
  border-radius: var(--rayon-sm);
  color: var(--texte);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.nav-lien:active { background: var(--surface-alt); }
.nav-lien.actif { background: var(--brand-light); color: var(--brand-dark); }
.nav-icone { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--texte-tres-clair);
  background: var(--surface-alt);
  border: 1px solid var(--bordure);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .bouton-menu { display: none; }
  .voile-nav { display: none; }
  .nav-laterale {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none;
    width: var(--sidebar-largeur);
    flex-shrink: 0;
  }
  .coquille { align-items: flex-start; }
}

/* ---------- Contenu principal ---------- */

.contenu {
  flex: 1;
  min-width: 0;
  padding: 18px 16px 60px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.entete-page { margin-bottom: 18px; }
.entete-page-titre { font-size: 1.4rem; font-weight: 800; margin: 0 0 2px; }
.entete-page-date { color: var(--texte-clair); font-size: 0.85rem; }

.etat, .message-vide {
  text-align: center;
  color: var(--texte-clair);
  padding: 60px 16px;
  font-size: 1.05rem;
}

.vue[hidden] { display: none; }

.item-anomalie {
  text-align: left;
  color: var(--texte-clair);
  background: #fff8e6;
  border: 1px solid #f0d98c;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* ---------- Connexion ---------- */

.form-connexion {
  max-width: 340px;
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  padding: 32px 26px;
  border-radius: var(--rayon-lg);
  box-shadow: var(--ombre-lg);
  border: 1px solid var(--bordure);
}
.form-connexion-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  margin: 0 auto 8px;
}
.question { font-size: 1.25rem; text-align: center; margin: 0 0 4px; font-weight: 800; }
.sous-titre { text-align: center; color: var(--texte-clair); font-size: 0.9rem; margin: 0 0 10px; }
#champ-mot-de-passe {
  font-size: 1.05rem;
  padding: 14px 16px;
  border: 2px solid var(--bordure);
  border-radius: var(--rayon-sm);
  min-height: 52px;
  background: var(--surface-alt);
  color: var(--texte);
}
#champ-mot-de-passe:focus { outline: none; border-color: var(--brand); }
.champ-avec-oeil { position: relative; }
.champ-avec-oeil input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.bouton-oeil {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 18px; line-height: 1; padding: 6px;
  cursor: pointer; border-radius: var(--rayon-sm);
}
.bouton-oeil:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.lien-portail { text-align: center; font-size: 0.85rem; color: var(--texte-clair); margin-top: 4px; }
.btn-connexion {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: var(--rayon-sm);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn-connexion:active { transform: scale(0.98); background: var(--brand-dark); }
.erreur-connexion { color: var(--rouge); text-align: center; font-size: 0.9rem; margin: 0; }

/* ---------- Under construction ---------- */

.construction {
  text-align: center;
  padding: 70px 20px;
  color: var(--texte-clair);
}
.construction-icone { font-size: 2.6rem; margin-bottom: 12px; }
.construction h2 { color: var(--texte); margin: 0 0 8px; }

/* ---------- KPI ---------- */

.grille-kpi {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
@media (min-width: 640px) {
  .grille-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 1000px) {
  .grille-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.carte-kpi {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-md);
  padding: 14px 16px;
  box-shadow: var(--ombre-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: apparition 0.25s ease both;
}
.carte-kpi.placeholder { opacity: 0.55; }
.kpi-ligne1 { display: flex; align-items: center; justify-content: space-between; }
.kpi-icone { font-size: 1.15rem; }
.kpi-valeur { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.kpi-label { font-size: 0.78rem; color: var(--texte-clair); font-weight: 600; }
.kpi-note { font-size: 0.68rem; color: var(--texte-tres-clair); }

/* ---------- Barre de filtres ---------- */

.barre-filtres {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 720px) {
  .barre-filtres { flex-direction: row; align-items: center; }
}

.champ-recherche-conteneur {
  position: relative;
  flex: 1;
  min-width: 0;
}
.champ-recherche-conteneur .icone {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texte-tres-clair);
  pointer-events: none;
}
#champ-recherche {
  width: 100%;
  padding: 11px 12px 11px 36px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  background: var(--surface);
  color: var(--texte);
  font-size: 0.95rem;
}
#champ-recherche:focus { outline: none; border-color: var(--brand); }

.groupe-selects { display: flex; gap: 8px; flex-wrap: wrap; }

select.filtre {
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  background: var(--surface);
  color: var(--texte);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-masquer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--texte-clair);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.compteur-resultats {
  font-size: 0.82rem;
  color: var(--texte-tres-clair);
  margin: -6px 0 14px;
}

/* ---------- Liste d'actions ---------- */

.liste-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.carte-action {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-md);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--ombre-sm);
  transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  animation: apparition 0.25s ease both;
}
.carte-action:hover { box-shadow: var(--ombre-md); border-color: #d7d9e3; }
.carte-action:active { transform: scale(0.997); }
.carte-action.estompee { opacity: 0.5; }

.action-ligne1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}
.action-etoiles { color: var(--orange); font-size: 0.9rem; letter-spacing: 1px; }
.action-priorite {
  background: var(--violet);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.action-titre { font-size: 1.05rem; margin: 0 0 6px; font-weight: 700; }
.action-pourquoi { color: var(--texte-clair); font-size: 0.92rem; margin: 0 0 10px; line-height: 1.4; }
.action-impact {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--vert);
  margin: 0 0 12px;
}

.action-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.action-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--bordure);
}

.action-personnes { display: flex; flex-wrap: wrap; gap: 6px; }
.action-personnes span {
  background: var(--surface-alt);
  color: var(--texte-clair);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--bordure);
}

select.select-etat {
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-alt);
  color: var(--texte);
}
select.select-etat[data-etat="a_faire"] { color: var(--texte-clair); }
select.select-etat[data-etat="en_cours"] { background: var(--orange-fond); color: var(--orange); border-color: transparent; }
select.select-etat[data-etat="terminee"] { background: var(--vert-fond); color: var(--vert); border-color: transparent; }
select.select-etat[data-etat="annulee"] { background: var(--rouge-fond); color: var(--rouge); border-color: transparent; }
select.select-etat[data-etat="en_attente"] { color: var(--texte-clair); }
select.select-etat[data-etat="traite"] { background: var(--vert-fond); color: var(--vert); border-color: transparent; }
select.select-etat[data-etat="rejete"] { background: var(--rouge-fond); color: var(--rouge); border-color: transparent; }
select.select-etat[data-etat="envoyee_client"] { background: var(--orange-fond); color: var(--orange); border-color: transparent; }
select.select-etat[data-etat="validee_client"] { background: var(--vert-fond); color: var(--vert); border-color: transparent; }
select.select-etat[data-etat="refusee_client"] { background: var(--rouge-fond); color: var(--rouge); border-color: transparent; }

/* ---------- Demandes de devis (Mission 027.2 + phase Facturation) ---------- */
.carte-demande-devis {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-lg, 12px);
  padding: 14px 16px; margin-bottom: 12px;
}
.demande-devis-entete { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.demande-devis-client { font-weight: 700; font-size: 1rem; }
.demande-devis-client-telephone { color: var(--texte-clair); font-size: 0.85rem; margin: 2px 0; font-weight: 600; }
.demande-devis-meta { color: var(--texte-clair); font-size: 0.8rem; margin: 4px 0 10px; }
.demande-devis-version { color: var(--texte-clair); font-size: 0.78rem; margin: 0 0 8px; font-weight: 600; }
.demande-devis-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.demande-devis-badges span { background: var(--surface-alt, var(--bordure)); border-radius: 999px; padding: 3px 10px; font-size: 0.74rem; font-weight: 600; color: var(--texte-clair); }
.demande-devis-transmission { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.82rem; }
.demande-devis-transmission[hidden] { display: none; }

.demande-devis-reverif-dispo, .demande-devis-paiement { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.reverif-dispo-resultat { font-size: 0.82rem; margin: 0; }
.reverif-dispo-resultat.ok { color: var(--vert); }
.reverif-dispo-resultat.alerte { color: var(--rouge); font-weight: 600; }
.demande-devis-transmission .transmission-etat.transmis { color: var(--vert); font-weight: 600; }
.demande-devis-transmission .transmission-etat.non-transmis { color: var(--texte-clair); }

.panneau-demande-directe {
  border: 1px solid var(--bordure); border-radius: var(--rayon-lg, 12px); padding: 16px; margin: 12px 0 20px;
  display: flex; flex-direction: column; gap: 10px; max-width: 480px;
}
.panneau-demande-directe[hidden] { display: none; }
.panneau-demande-directe label { display: block; font-size: 0.82rem; font-weight: 600; }
.panneau-demande-directe input, .panneau-demande-directe textarea {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--bordure); border-radius: var(--rayon-sm); font: inherit; background: var(--surface); color: var(--texte);
}
.demande-devis-lignes { list-style: none; margin: 0 0 10px; padding: 0; font-size: 0.85rem; }
.demande-devis-lignes li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--bordure); }
.demande-devis-total { text-align: right; font-weight: 700; margin-bottom: 10px; }
.demande-devis-proforma { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.demande-devis-proforma input {
  flex: 1; min-width: 120px; padding: 7px 10px; border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  font: inherit; background: var(--surface); color: var(--texte);
}
.bouton-reviser-devis { margin-bottom: 10px; }
.demande-devis-verification { font-size: 0.82rem; margin: 0 0 10px; }
.demande-devis-verification.verifie { color: var(--vert); }
.demande-devis-verification.non-verifie { color: var(--texte-clair); }
.demande-devis-verification.erreur { color: var(--rouge); }
.demande-devis-remise { display: flex; gap: 8px; margin-bottom: 10px; }
.demande-devis-remise input { flex: 1; max-width: 200px; padding: 7px 10px; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); font: inherit; background: var(--surface); color: var(--texte); }

.demande-devis-proforma-gescom {
  border: 1px solid var(--bordure); border-radius: var(--rayon-sm); padding: 10px; margin-bottom: 10px;
}
.proforma-creer-details input, .proforma-creer-details textarea {
  width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  font: inherit; background: var(--surface); color: var(--texte); margin: 6px 0;
}
.proforma-creer-details .note-avertissement { font-size: 0.76rem; color: var(--texte-clair); margin: 4px 0 8px; }
.proforma-etat-creation { font-size: 0.85rem; font-weight: 600; margin: 8px 0 0; }
.proforma-etat-creation.en-cours { color: var(--texte-clair); }
.proforma-etat-creation.ok { color: var(--vert); }
.proforma-etat-creation.erreur { color: var(--rouge); }
.proforma-titre { font-size: 0.78rem; color: var(--texte-clair); margin: 0 0 2px; text-transform: uppercase; }
.proforma-ref { font-weight: 700; font-size: 1.05rem; color: var(--vert); margin: 0 0 4px; }
.proforma-statut { font-size: 0.85rem; margin: 0 0 10px; }
.proforma-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.proforma-transmission-etat { font-size: 0.82rem; color: var(--texte-clair); margin: 8px 0 0; }
.lien-whatsapp-proforma {
  display: inline-flex; align-items: center; padding: 7px 12px; border-radius: var(--rayon-sm);
  background: var(--vert-fond, #dcfce7); color: var(--vert); text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.lien-whatsapp-proforma[hidden] { display: none; }

.demande-devis-facture-gescom {
  border: 1px dashed var(--bordure); border-radius: var(--rayon-sm); padding: 10px; margin-bottom: 10px;
}
.demande-devis-facture-gescom input, .demande-devis-facture-gescom textarea {
  width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  font: inherit; background: var(--surface); color: var(--texte); margin-bottom: 6px;
}
.demande-devis-verification-facture-gescom { font-size: 0.82rem; margin: 4px 0; }
.demande-devis-verification-facture-gescom.verifie { color: var(--vert); }
.demande-devis-verification-facture-gescom.non-verifie { color: var(--texte-clair); }
.demande-devis-verification-facture-gescom.erreur { color: var(--rouge); }
.demande-devis-facture-gescom .note-avertissement { font-size: 0.76rem; color: var(--texte-clair); margin: 4px 0 8px; }
.bouton-facturer { margin-bottom: 10px; font-weight: 700; }
.demande-devis-facture-terminee {
  border: 1px solid var(--vert); border-radius: var(--rayon-sm); padding: 10px; margin-bottom: 10px;
}
.facture-terminee-titre { font-size: 0.78rem; color: var(--texte-clair); margin: 0 0 2px; text-transform: uppercase; }
.facture-terminee-ref { font-weight: 700; color: var(--vert); margin: 0 0 4px; }
.facture-terminee-montants { font-size: 0.85rem; margin: 0; }
.demande-devis-fil { margin: 8px 0; }
.fil-commentaire { font-size: 0.82rem; background: var(--fond); border-radius: var(--rayon-sm); padding: 6px 10px; margin-bottom: 6px; }
.demande-devis-commenter { display: flex; gap: 8px; }
.demande-devis-commenter input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  font: inherit; background: var(--surface); color: var(--texte);
}
.msg-commentaire { font-size: 0.8rem; margin: 6px 0 0; }
.msg-commentaire.ok { color: var(--vert); }
.msg-commentaire.erreur { color: var(--rouge); }

/* ---------- Fiche détaillée (panneau latéral) ---------- */

.voile-fiche {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.voile-fiche.ouvert { opacity: 1; pointer-events: auto; }

.panneau-fiche {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(92vw, 480px);
  background: var(--surface);
  z-index: 41;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  box-shadow: var(--ombre-lg);
}
.panneau-fiche.ouvert { transform: translateX(0); }

.fiche-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.fiche-entete h2 { margin: 0; font-size: 1.15rem; }
.bouton-fermer {
  border: none;
  background: var(--surface-alt);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.bouton-fermer:active { background: var(--bordure); }

.fiche-corps { padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 20px; }

.fiche-section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--texte-tres-clair);
  margin: 0 0 6px;
  font-weight: 700;
}
.fiche-section p { margin: 0; line-height: 1.5; font-size: 0.95rem; }

.fiche-grille {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.fiche-grille .fiche-section p { font-weight: 700; font-size: 1rem; }

.fiche-placeholder {
  background: var(--surface-alt);
  border: 1px dashed var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 12px 14px;
  color: var(--texte-clair);
  font-size: 0.88rem;
  font-style: italic;
}

/* ---------- Badge "plan d'exécution" sur la carte d'action ---------- */

.action-badge-plan {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 3px 9px;
  border-radius: 999px;
  margin: -2px 0 8px;
}
.action-badge-plan:empty { display: none; }

/* ---------- Mission 023 : Plan d'exécution (dans la fiche détaillée) ---------- */

.fiche-note-plan {
  font-size: 0.82rem;
  color: var(--texte-clair);
  background: var(--surface-alt);
  border-radius: var(--rayon-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
  line-height: 1.4;
}

/* ---------- Learning Engine : ce que le Cerveau a appris ---------- */

.fiche-note-apprentissage {
  font-size: 0.85rem;
  color: var(--texte);
  background: var(--brand-light);
  border-left: 3px solid var(--brand);
  border-radius: var(--rayon-sm);
  padding: 10px 12px;
  margin: 10px 0 0;
  line-height: 1.45;
}
.fiche-note-apprentissage.biais-detecte {
  background: #fff8e6;
  border-left-color: #d9a521;
}

.liste-plan-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carte-sous-action {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 12px 14px;
  background: var(--surface-alt);
}

.sous-action-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.sous-action-systeme {
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sous-action-risque {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sous-action-risque.faible { background: var(--vert-fond); color: var(--vert); }
.sous-action-risque.moyen { background: var(--orange-fond); color: var(--orange); }
.sous-action-risque.élevé { background: var(--rouge-fond); color: var(--rouge); }

.sous-action-libelle { font-size: 0.9rem; margin: 0 0 6px; line-height: 1.4; }
.sous-action-impact { font-size: 0.85rem; font-weight: 700; color: var(--vert); margin: 0 0 10px; }
.sous-action-impact:empty { display: none; }

.sous-action-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--bordure);
}
.sous-action-etat {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  color: var(--texte-clair);
}
.sous-action-etat.previsualisee { color: var(--brand-dark); background: var(--brand-light); border-color: transparent; }
.sous-action-etat.validee { color: var(--orange); background: var(--orange-fond); border-color: transparent; }
.sous-action-etat.executee { color: var(--vert); background: var(--vert-fond); border-color: transparent; }
.sous-action-etat.annulee { color: var(--rouge); background: var(--rouge-fond); border-color: transparent; }

.sous-action-boutons { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-transition {
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--texte);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.btn-transition:active { background: var(--surface-alt); }
.btn-transition.principal { background: var(--brand); color: #fff; border-color: transparent; }
.btn-transition.danger { color: var(--rouge); }
.btn-transition.succes { color: var(--vert); }
.btn-transition.echec { color: var(--rouge); }

/* ---------- Mission 024 : Decision Engine — étapes numérotées ---------- */

.fiche-etape {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--bordure);
}
.fiche-etape:first-of-type { border-top: none; padding-top: 4px; }

.fiche-etape-numero {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.fiche-etape-contenu { flex: 1; min-width: 0; }
.fiche-etape-titre {
  font-size: 1.05rem;
  margin: 0 0 12px;
  font-weight: 800;
}

/* Comparaison des composantes du score (Pourquoi prioritaire) */
.liste-composantes { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.composante-ligne { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.composante-nom { font-size: 0.82rem; font-weight: 700; text-transform: capitalize; }
.composante-valeurs { font-size: 0.75rem; color: var(--texte-clair); }
.composante-barre-fond {
  position: relative;
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: visible;
}
.composante-barre { height: 100%; background: var(--brand); border-radius: 999px; }
.composante-barre.au-dessus { background: var(--vert); }
.composante-barre.en-dessous { background: var(--orange); }
.composante-repere-moyenne {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--texte-tres-clair);
}

/* Historique */
.liste-historique { display: flex; flex-direction: column; gap: 10px; }
.carte-historique {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 12px 14px;
  background: var(--surface-alt);
}
.historique-entete { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.historique-titre { font-weight: 700; font-size: 0.9rem; }
.historique-date { font-size: 0.75rem; color: var(--texte-tres-clair); white-space: nowrap; }
.historique-resultat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.historique-resultat.succes { background: var(--vert-fond); color: var(--vert); }
.historique-resultat.echec { background: var(--rouge-fond); color: var(--rouge); }
.historique-resultat.attente { background: var(--surface); color: var(--texte-clair); border: 1px solid var(--bordure); }
.historique-impacts { font-size: 0.82rem; color: var(--texte-clair); margin: 0; }
.historique-form { display: flex; gap: 6px; margin-top: 8px; }
.historique-form[hidden] { display: none; }

/* Simulation */
.grille-simulation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
@media (min-width: 420px) { .grille-simulation { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tuile-simulation {
  background: var(--surface-alt);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.tuile-simulation-icone { font-size: 1.1rem; }
.tuile-simulation-valeur { font-weight: 800; font-size: 0.95rem; }
.tuile-simulation-label { font-size: 0.68rem; color: var(--texte-clair); }

/* Scénarios */
.liste-scenarios { display: flex; flex-direction: column; gap: 12px; }
.carte-scenario {
  border: 2px solid var(--bordure);
  border-radius: var(--rayon-sm);
  padding: 14px;
}
.carte-scenario.recommande { border-color: var(--vert); background: var(--vert-fond); }
.scenario-entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.scenario-nom { font-weight: 800; font-size: 0.95rem; }
.scenario-badge-recommande {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--vert);
  display: none;
}
.carte-scenario.recommande .scenario-badge-recommande { display: inline; }
.scenario-description { font-size: 0.82rem; color: var(--texte-clair); margin: 0 0 10px; }
.scenario-chiffres {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.scenario-label { display: block; font-size: 0.68rem; color: var(--texte-tres-clair); }
.scenario-gain, .scenario-risque, .scenario-temps, .scenario-confiance { display: block; font-weight: 700; font-size: 0.85rem; }
.scenario-pourquoi { font-size: 0.8rem; color: var(--vert); font-weight: 600; margin: 6px 0 0; }

/* ---------- Intelligence Produits ---------- */

.sous-titre-page { color: var(--texte-clair); font-size: 0.88rem; margin: 4px 0 0; }
.titre-section { font-size: 1.1rem; margin: 24px 0 12px; font-weight: 800; }

.liste-produits {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
@media (min-width: 640px) {
  .liste-produits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .liste-produits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.carte-produit-historique {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-md);
  padding: 14px 16px;
  box-shadow: var(--ombre-sm);
}
.produit-historique-entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.produit-historique-nom { font-weight: 700; font-size: 0.95rem; }
.produit-historique-fiabilite {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-alt);
  color: var(--texte-clair);
  border: 1px solid var(--bordure);
}
.produit-historique-fiabilite.fiable { color: var(--vert); }
.produit-historique-fiabilite.limitee { color: var(--orange); }

.produit-historique-chiffres {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ph-label { display: block; font-size: 0.68rem; color: var(--texte-tres-clair); }
.ph-marge, .ph-ca, .ph-taux, .ph-qte { display: block; font-weight: 700; font-size: 0.85rem; }

/* ---------- Ventes (Phase 3, Décision 038 §16) ---------- */

.avertissement-partiel {
  background: var(--orange-fond); color: var(--orange); font-weight: 600;
  font-size: 0.82rem; padding: 10px 14px; border-radius: var(--rayon-sm); margin: 0 0 16px;
}

.liste-ventes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }

.carte-vente {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-lg, 12px);
  padding: 14px 16px;
}
.vente-ligne1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.vente-commercial { font-weight: 700; }
.vente-categorie {
  font-size: 0.74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-alt); color: var(--texte-clair);
}
.vente-categorie.attribuable { background: var(--vert-fond); color: var(--vert); }
.vente-categorie.brouillon { background: var(--orange-fond); color: var(--orange); }
.vente-categorie.introuvable, .vente-categorie.doublon { background: var(--rouge-fond); color: var(--rouge); }
.vente-detail { font-size: 0.85rem; margin: 6px 0 0; }
.vente-reglement { font-size: 0.82rem; margin: 4px 0 0; font-weight: 600; }
.vente-raison { font-size: 0.8rem; color: var(--texte-clair); margin: 4px 0 0; }

/* ---------- Classement (Décision 038 §16 Phase 6) ---------- */

.vente-categorie.rang-ca { background: var(--brand-light); color: var(--brand-dark); }

/* ---------- Objectifs (période mensuelle, indicateur CA HT) ---------- */

.vente-categorie.atteint { background: var(--vert-fond); color: var(--vert); }
.vente-categorie.en_cours { background: var(--orange-fond); color: var(--orange); }
.vente-categorie.non_calculable { background: var(--surface-alt); color: var(--texte-clair); }

/* ---------- Animations légères ---------- */

@keyframes apparition {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .carte-kpi, .carte-action, .nav-laterale, .panneau-fiche, .voile-fiche, .voile-nav {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Accréditation opérationnelle ("Mon rôle") ---------- */

.acc-intro { color: var(--texte-clair); font-size: 0.95rem; margin: 0 0 12px; }

.acc-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.acc-tag { font-size: 0.8rem; }
.acc-tag-neutre { background: var(--surface-alt); color: var(--texte-clair); }
.acc-tags-neutre .acc-tag { background: var(--surface-alt); color: var(--texte-clair); }

.acc-banniere {
  background: var(--vert-fond);
  color: var(--vert);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 14px;
  border-radius: var(--rayon-md);
  margin-bottom: 22px;
}

.acc-section { margin-bottom: 26px; }
.acc-section-titre { font-size: 1.02rem; font-weight: 800; margin: 0 0 8px; }
.acc-note { color: var(--texte-clair); font-size: 0.85rem; margin: 0 0 10px; }

.acc-liste { display: flex; flex-direction: column; gap: 10px; }

.acc-carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--bordure);
  border-radius: var(--rayon-md);
  padding: 12px 14px;
  box-shadow: var(--ombre-sm);
}
.acc-carte-ok { border-left-color: var(--vert); }
.acc-carte-non { border-left-color: var(--rouge); opacity: 0.9; }
.acc-carte-entete { margin-bottom: 6px; }
.acc-carte-titre { font-size: 0.95rem; font-weight: 700; margin: 0 0 4px; }
.acc-carte-pourquoi { color: var(--texte-clair); font-size: 0.85rem; margin: 0; line-height: 1.4; }

.acc-conditions {
  margin: 0;
  padding-left: 20px;
  color: var(--texte-clair);
  font-size: 0.85rem;
  line-height: 1.6;
}

.acc-pied {
  color: var(--texte-tres-clair);
  font-size: 0.78rem;
  text-align: center;
  margin: 30px 0 10px;
}
