/* Charte du CRM. Composants communs : chaque écran les réutilise, et n'ajoute dans sa propre feuille
   (dossiers.css, contacts.css, chiffres.css) que ce qui lui est propre, sous un préfixe de classe. */

:root {
  --fond: #f6f5f2;
  --surface: #ffffff;
  --surface-douce: #fbfaf8;
  --trait: #e4e1da;
  --trait-fort: #cfcbc2;
  --texte: #1c1b19;
  --texte-doux: #62605a;
  --texte-leger: #8d8a82;
  --accent: #5b4bd6;
  --accent-fond: #efedfc;
  --danger: #c2372d;
  --danger-fond: #fcebe9;
  --attention: #9a6200;
  --attention-fond: #fdf1d7;
  --succes: #1c7c3a;
  --succes-fond: #e6f4ea;
  --soprano: #5b4bd6;
  --soprano-fond: #efedfc;
  --guarana: #1c7c3a;
  --guarana-fond: #e6f4ea;
  --builders: #b25a00;
  --builders-fond: #fdeedd;
  --rayon: 8px;
  --rayon-carte: 12px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; font-weight: 600; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; }
h3 { font-size: .93rem; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0 0 .6rem; }
.icone { flex: none; vertical-align: -3px; }
.discret { color: var(--texte-doux); }
.petit { font-size: .87rem; }
.retard { color: var(--danger); font-weight: 600; }
.droite { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--trait);
}
.marque { font-weight: 700; color: var(--texte); letter-spacing: .02em; }
.marque:hover { text-decoration: none; }
.menu { display: flex; gap: .25rem; }
.menu a { padding: .4rem .75rem; border-radius: var(--rayon); color: var(--texte-doux); font-weight: 500; }
.menu a:hover { background: var(--fond); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--accent-fond); color: var(--accent); }
.recherche { margin-left: auto; position: relative; display: flex; align-items: center; color: var(--texte-leger); }
.recherche .icone { position: absolute; left: .6rem; }
.recherche input[type="search"] { width: 17rem; padding-left: 2rem; }
.compte { display: flex; align-items: center; gap: .5rem; }
.initiales, a.initiales:hover {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--fond); border: 1px solid var(--trait); color: var(--texte-doux);
  font-size: .75rem; font-weight: 600; text-decoration: none;
}

/* Page */
.page { max-width: 1240px; margin: 0 auto; padding: 1.5rem; }
.page.etroite { max-width: 760px; }
.entete { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.entete .pousse { margin-left: auto; }
.entete .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.grille-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) {
  .grille-2 { grid-template-columns: minmax(0, 1fr); }
  .recherche input[type="search"] { width: 10rem; }
  .barre { flex-wrap: wrap; padding: .6rem 1rem; }
  .page { padding: 1rem; }
}

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-carte); padding: 1rem 1.15rem; }
.carte + .carte { margin-top: 1rem; }
.carte > h2:first-child { margin-top: 0; }

/* Boutons : un clic, un effet ; le libellé dit ce que le clic fait. */
.bouton {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .85rem; border-radius: var(--rayon);
  border: 1px solid var(--trait-fort); background: var(--surface); color: var(--texte);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.bouton:hover { background: var(--fond); text-decoration: none; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: #4a3bc2; }
.bouton.danger { color: var(--danger); border-color: #e6b8b3; }
.bouton.petit { padding: .25rem .6rem; }
.bouton.large { width: 100%; justify-content: center; padding: .6rem; }
button.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
button.lien:hover { text-decoration: underline; }

/* Pastilles et étiquettes */
.pastille, .etiquette {
  display: inline-block; padding: .05rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; white-space: nowrap; vertical-align: 1px;
}
.pastille.soprano { background: var(--soprano-fond); color: var(--soprano); }
.pastille.guarana { background: var(--guarana-fond); color: var(--guarana); }
.pastille.builders { background: var(--builders-fond); color: var(--builders); }
.etiquette { background: var(--fond); color: var(--texte-doux); border: 1px solid var(--trait); font-weight: 500; }
.etiquette.attention { background: var(--attention-fond); color: var(--attention); border-color: transparent; }
.etiquette.danger { background: var(--danger-fond); color: var(--danger); border-color: transparent; }
.etiquette.succes { background: var(--succes-fond); color: var(--succes); border-color: transparent; }

/* Onglets (activités, vues) */
.onglets { display: inline-flex; gap: .2rem; padding: .2rem; background: #ebe9e3; border-radius: var(--rayon); }
.onglets a { padding: .3rem .8rem; border-radius: 6px; color: var(--texte-doux); font-weight: 500; }
.onglets a:hover { text-decoration: none; color: var(--texte); }
.onglets a[aria-current="page"] { background: var(--surface); color: var(--texte); box-shadow: 0 0 0 1px var(--trait); }

/* Formulaires */
input[type="text"], input[type="email"], input[type="search"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="tel"], select, textarea {
  width: 100%; padding: .45rem .6rem;
  border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); font: inherit;
}
input:focus, select:focus, textarea:focus, .bouton:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { min-height: 5rem; resize: vertical; }
.formulaire { display: grid; gap: .8rem; }
.formulaire .rang { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.champ { display: grid; gap: .25rem; }
.champ > span, .champ > label { font-size: .87rem; font-weight: 500; color: var(--texte-doux); }
.champ .aide { font-size: .82rem; color: var(--texte-leger); }
.champ .erreur, .errorlist { margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--danger); }
.champ.case { display: flex; align-items: center; gap: .5rem; }
.champ.case input { width: auto; }
.formulaire .pied { display: flex; gap: .5rem; align-items: center; margin-top: .3rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: .5rem; padding: 0; }

/* Messages */
.messages { margin-bottom: 1rem; }
.message { padding: .55rem .85rem; border-radius: var(--rayon); background: var(--succes-fond); color: var(--succes); margin: 0 0 .4rem; }
.message.error { background: var(--danger-fond); color: var(--danger); }
.message.warning { background: var(--attention-fond); color: var(--attention); }
.alerte { padding: .6rem .85rem; border-radius: var(--rayon); background: var(--attention-fond); color: var(--attention); }

/* Tableaux de données */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--texte-leger); padding: .4rem .6rem; border-bottom: 1px solid var(--trait); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--trait); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-douce); }
.table .nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Paires libellé / valeur des fiches */
.paires { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .1rem 1.25rem; }
.paires dt { color: var(--texte-doux); padding: .35rem 0; border-top: 1px solid var(--trait); }
.paires dd { margin: 0; padding: .35rem 0; border-top: 1px solid var(--trait); text-align: right; }
.paires dt:first-of-type, .paires dd:first-of-type { border-top: 0; }

/* Prochaine action : le bloc le plus visible d'une fiche */
.prochaine { padding: .65rem .85rem; border-radius: var(--rayon); background: var(--accent-fond); color: #3a2fa0; }
.prochaine.en-retard { background: var(--danger-fond); color: var(--danger); }
.prochaine .quand { font-size: .82rem; font-weight: 600; margin: 0; }
.prochaine .quoi { margin: 0; font-weight: 500; }

/* Chiffres clés */
.cles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.cle { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-carte); padding: .75rem 1rem; }
.cle .libelle { font-size: .82rem; color: var(--texte-doux); margin: 0; }
.cle .valeur { font-size: 1.45rem; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.cle .detail { font-size: .82rem; color: var(--texte-leger); margin: 0; }

/* Fil de suivi */
.fil { list-style: none; margin: 0; padding: 0; }
.fil-ligne { display: flex; gap: .7rem; padding: .7rem 0; border-top: 1px solid var(--trait); }
.fil-ligne:first-child { border-top: 0; }
.fil-icone { color: var(--texte-leger); padding-top: .1rem; }
.fil-corps { flex: 1; min-width: 0; }
.fil-texte { margin: 0; overflow-wrap: anywhere; }
.fil-objet { margin: 0; font-weight: 600; }
.fil-meta { margin: .15rem 0 0; font-size: .82rem; color: var(--texte-leger); }
.fil-ligne.automatique .fil-texte { color: var(--texte-doux); font-size: .9rem; }
.fil-ligne.question-ouverte .fil-icone { color: var(--attention); }
.fil-question { display: flex; align-items: center; gap: .8rem; margin-top: .3rem; font-size: .87rem; }

/* États vides */
.vide { padding: 1.2rem; text-align: center; color: var(--texte-leger); list-style: none; }

/* Connexion */
body.connexion { display: grid; place-items: center; min-height: 100vh; }
.connexion-carte { width: min(22rem, 92vw); }
.connexion-carte h1 { margin-bottom: .1rem; }
