:root {
  --fond: #f5f6f8; --surface: #fff; --texte: #1d2433; --discret: #5f6b7a; --bord: #e2e5ea;
  --accent: #2f5d8a; --accent-clair: #e6eef6; --succes: #1f7a4d; --succes-clair: #e3f3ea;
  --alerte: #a8641a; --alerte-clair: #fcf0df; --danger: #b3261e; --danger-clair: #fbe4e2;
  --rayon: 8px; --ombre: 0 1px 2px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.mise-en-page { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.menu { background: #1f2a3a; color: #cfd6e0; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.menu .marque { color: #fff; font-weight: 700; font-size: 1.1rem; padding: .25rem .5rem 1rem; display: block; }
.menu a { display: block; color: #cfd6e0; padding: .45rem .6rem; border-radius: 6px; }
.menu a:hover, .menu a.actif { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.menu .section { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #8693a5; margin: 1rem .6rem .25rem; }
.menu .bouton { margin: .5rem 0 1rem; text-align: center; }
.menu .utilisateur { margin-top: 1.5rem; font-size: .85rem; padding: 0 .6rem; color: #8693a5; }
.menu .utilisateur button { background: none; border: 0; padding: 0; color: #cfd6e0; cursor: pointer; font: inherit; }
main { padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.entete .sous-titre { color: var(--discret); margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.bouton, button.bouton { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .5rem .9rem; font: inherit; font-weight: 600; cursor: pointer; }
.bouton:hover { filter: brightness(1.1); text-decoration: none; }
.bouton.secondaire { background: var(--surface); color: var(--accent); border: 1px solid var(--bord); }
.bouton.danger { background: var(--danger); }
.tableau-defilant { overflow-x: auto; }
.titre-carte { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.titre-carte h2 { margin: 0; }
.besoin-adaptation { display: block; margin-top: .3rem; padding: .25rem .5rem; border-radius: 6px; background: #fff4e0; color: #7a4b00; font-size: .85rem; white-space: normal; min-width: 14rem; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.grille { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grille-large > * { min-width: 0; }
.grille-large { grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr)); }
.grille-large .jauge { width: 80px; }
.chiffres { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.chiffre { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .9rem 1.1rem; }
.chiffre strong { display: block; font-size: 1.6rem; }
.chiffre span { color: var(--discret); font-size: .9rem; }
a.chiffre { color: inherit; text-decoration: none; }
a.chiffre:hover, a.chiffre:focus-visible { border-color: var(--accent, currentColor); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--discret); font-weight: 600; }
tr:hover td { background: #fafbfc; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
.pastille { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--accent-clair); color: var(--accent); white-space: nowrap; }
.pastille.ok { background: var(--succes-clair); color: var(--succes); }
.pastille.attention { background: var(--alerte-clair); color: var(--alerte); }
.pastille.danger { background: var(--danger-clair); color: var(--danger); }
.pastille.neutre { background: #eef0f3; color: var(--discret); }
.jauge { background: #eef0f3; border-radius: 999px; height: 8px; width: 120px; overflow: hidden; display: inline-block; vertical-align: middle; }
.jauge span { display: block; height: 100%; background: var(--accent); }
.discret { color: var(--discret); font-size: .9rem; }
dl.infos { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.infos dt { color: var(--discret); }
dl.infos dd { margin: 0; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .65rem 1rem; border-radius: 6px; margin-bottom: .5rem; background: var(--accent-clair); }
.messages li.success { background: var(--succes-clair); color: var(--succes); }
.messages li.error { background: var(--danger-clair); color: var(--danger); }
.messages li.warning { background: var(--alerte-clair); color: var(--alerte); }
.recherche { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.onglets { display: flex; gap: .25rem; margin-bottom: 1rem; }
.onglets a { padding: .4rem .8rem; border-radius: 6px; color: var(--discret); }
.onglets a.actif { background: var(--surface); border: 1px solid var(--bord); color: var(--texte); font-weight: 600; }
input, select, textarea { font: inherit; padding: .45rem .6rem; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; width: 100%; max-width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
.recherche input { max-width: 360px; }
form .champ { margin-bottom: .9rem; }
form .champ label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .92rem; }
form .champ.case label { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
form .aide { color: var(--discret); font-size: .82rem; margin-top: .2rem; }
form .erreur, .errorlist { color: var(--danger); font-size: .88rem; list-style: none; padding: 0; margin: .25rem 0 0; }
form .colonnes { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
fieldset { border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1rem 1.25rem .25rem; margin: 0 0 1.25rem; background: var(--surface); }
legend { font-weight: 700; padding: 0 .4rem; }
ul.choix { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
ul.choix label { font-weight: 500 !important; display: flex !important; gap: .4rem; align-items: center; }
.barre-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .75rem 0 0; }
.barre-actions select { width: auto; }
.cache { display: none !important; }
.connexion { max-width: 380px; margin: 12vh auto; }
.pagination { margin-top: 1rem; display: flex; gap: 1rem; align-items: center; }
@media (max-width: 800px) {
  .mise-en-page { grid-template-columns: minmax(0, 1fr); }
  .menu { position: static; height: auto; display: flex; flex-wrap: wrap; gap: .25rem; padding: .75rem; }
  .menu .marque { width: 100%; padding-bottom: .25rem; }
  .menu .section { display: none; }
  .menu .bouton { width: 100%; margin: .25rem 0; }
  .menu a { padding: .3rem .5rem; font-size: .9rem; }
  .menu .utilisateur { width: 100%; margin-top: .5rem; }
  main { padding: 1rem; }
}
.generation { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.generation select { width: auto; }
.generation label { display: flex; gap: .3rem; align-items: center; font-weight: 400; }
/* Champ de recherche (recherche.js) */
.recherche-auto { position: relative; }
.recherche-auto .suggestions { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: .25rem 0; list-style: none; background: var(--surface); border: 1px solid #c9ced6; border-radius: 6px; box-shadow: 0 6px 16px rgba(16, 24, 40, .12); max-height: 320px; overflow-y: auto; }
.recherche-auto .suggestions li { padding: .4rem .65rem; cursor: pointer; }
.recherche-auto .suggestions li span { display: block; color: var(--discret); font-size: .82rem; }
.recherche-auto .suggestions li.actif, .recherche-auto .suggestions li[role=option]:hover { background: var(--accent-clair); }
.recherche-auto .suggestions li.vide { color: var(--discret); cursor: default; }
/* Rôles des personnes */
.pastille.role-stagiaire { background: var(--succes-clair); color: var(--succes); }
.pastille.role-commercial { background: var(--alerte-clair); color: var(--alerte); }
.pastille.role-administratif { background: var(--accent-clair); color: var(--accent); }
.pastille.role-facturation { background: #eef0f3; color: var(--discret); }
.pastille.role-signataire { background: #efe7f7; color: #6a3d9a; }
.roles { margin: .35rem 0 0; }
h3.sous-section { font-size: .95rem; margin: 1rem 0 .4rem; }
h3.sous-section:first-of-type { margin-top: 0; }
.personne-ligne { margin: 0 0 .5rem; }
.apercu-mail { background: var(--fond, #f7f7f7); border-left: 3px solid var(--bordure, #ddd); padding: .5rem 1rem; white-space: normal; }

.carte.alerte { border-left: 4px solid var(--alerte); background: var(--alerte-clair); }

/* Menu par espaces */
.menu details.espace { margin: .15rem 0; }
.menu details.espace summary { cursor: pointer; list-style: none; padding: .45rem .6rem; border-radius: 6px; color: #fff; font-weight: 600; display: flex; justify-content: space-between; }
.menu details.espace summary::-webkit-details-marker { display: none; }
.menu details.espace summary::after { content: "▸"; color: #8693a5; }
.menu details.espace[open] summary::after { content: "▾"; }
.menu details.espace summary:hover { background: rgba(255,255,255,.08); }
.menu details.espace a { padding-left: 1.2rem; font-size: .93rem; }
.menu details.espace.courant summary { background: rgba(255,255,255,.06); }
.menu .recherche-globale input { width: 100%; padding: .45rem .6rem; border-radius: 6px; border: 1px solid #39475b; background: #273448; color: #fff; font: inherit; }
.menu .recherche-globale input::placeholder { color: #8693a5; }
.fil { margin: 0 0 .75rem; font-size: .85rem; color: var(--discret); }
/* Accueil par espace */
.domaines { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); margin-bottom: 1.25rem; }
.domaine h2 { display: flex; justify-content: space-between; align-items: center; }
.domaine ul { list-style: none; padding: 0; margin: 0; }
.domaine li { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--bord); }
.domaine li:last-child { border-bottom: 0; }
.domaine .vide { color: var(--succes); }
.codes-secours { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; font-size: 1.05rem; }
.en-ligne { display: inline; }
button.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.annuaire { margin-bottom: 1rem; padding: .75rem; border: 1px dashed #c9ced6; border-radius: 6px; }
.annuaire-ligne { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.annuaire-ligne input { flex: 1 1 16rem; }
.annuaire-resultats { list-style: none; margin: .4rem 0 0; padding: 0; }
.annuaire-resultats li { padding: .35rem 0; border-top: 1px solid #eef0f3; }
.filtres-liste { margin: -.25rem 0 .75rem; }
/* Tunnel de vente (suivi commercial) */
.tunnel { display: grid; gap: 1rem; grid-template-columns: repeat(5, minmax(220px, 1fr)); overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; }
.tunnel-colonne { background: #eef0f3; border-radius: var(--rayon); padding: .75rem; min-width: 220px; }
.tunnel-colonne h2 { font-size: 1rem; display: flex; flex-direction: column; }
.tunnel-carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 6px; padding: .6rem .7rem; margin-bottom: .6rem; }
.tunnel-carte.en-retard { border-left: 4px solid var(--danger); }
.tunnel-carte .retard { color: var(--danger); font-size: .9rem; font-weight: 600; }
.tunnel-carte form { margin-top: .4rem; }
