/*
 * crm.css — APPARENCE DU CRM
 * Sobre et lisible, utilisable sur téléphone (les artisans appellent depuis leur mobile).
 */
:root {
  --vert-fonce: #14532d; --vert: #166534; --vert-clair: #dcfce7;
  --orange: #f59e0b; --texte: #1c1917; --doux: #57534e; --bordure: #e7e5e4;
  --fond: #f7f5f0; --carte: #fff; --rouge: #b91c1c;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--police); font-size: 15px; line-height: 1.45; color: var(--texte); background: var(--fond); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--vert); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }

/* Barre du haut + onglets */
.barre { background: var(--carte); border-bottom: 1px solid var(--bordure); position: sticky; top: 0; z-index: 5; }
.barre-interieur { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marque { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--vert-fonce); }
.marque svg { width: 28px; height: 28px; }
.marque-crm { font-size: .7rem; background: var(--vert-clair); padding: 2px 6px; border-radius: 6px; }
.qui { font-size: .8rem; color: var(--doux); text-align: right; overflow-wrap: anywhere; }
.onglets { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.onglets:empty { display: none; }
.onglet { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--doux); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.onglet[aria-current="true"] { color: var(--vert-fonce); border-bottom-color: var(--vert); }

.contenu { max-width: 1200px; margin: 0 auto; padding: 16px; }
.vide { color: var(--doux); text-align: center; padding: 40px 0; }

/* Filtres */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filtres input, .filtres select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--carte); }
.filtres input[type="search"] { flex: 1 1 200px; }
.compteur { color: var(--doux); font-size: .85rem; }

/* Pastilles d'état */
.resume { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pastille { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.c-bleu { background: #dbeafe; color: #1e3a8a; } .c-orange { background: #ffedd5; color: #9a3412; }
.c-jaune { background: #fef9c3; color: #854d0e; } .c-violet { background: #ede9fe; color: #5b21b6; }
.c-vert { background: var(--vert-clair); color: var(--vert-fonce); } .c-gris { background: #e7e5e4; color: #44403c; }
.c-rouge { background: #fee2e2; color: #991b1b; } .c-neutre { background: #f5f5f4; color: var(--doux); }

/* Fiches (une par lead) */
.fiches { display: grid; gap: 12px; }
@media (min-width: 900px) { .fiches { grid-template-columns: repeat(2, 1fr); } }
.fiche { background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.fiche-tete { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.fiche-nom { font-weight: 800; font-size: 1.05rem; }
.fiche-date { font-size: .8rem; color: var(--doux); }
.tel { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.infos { font-size: .85rem; color: var(--doux); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions select { min-height: 40px; padding: 6px 8px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--carte); font-weight: 600; }
.btn { min-height: 40px; padding: 6px 12px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--carte); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--vert); }
.btn-nrp { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.btn-principal { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-danger { color: var(--rouge); }
.btn-lien { border: 0; background: none; padding: 4px 0; min-height: 0; color: var(--vert); text-decoration: underline; }
.notes { width: 100%; min-height: 64px; padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 8px; resize: vertical; }
.notes-lecture { white-space: pre-wrap; background: var(--fond); border-radius: 8px; padding: 8px 10px; font-size: .9rem; margin: 0; }
.etat-sauvegarde { font-size: .75rem; color: var(--vert); min-height: 1em; }
.nrp-info { font-size: .8rem; color: #9a3412; }

/* Formulaires (modification, ajout) */
.form-grille { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grille label { display: grid; gap: 2px; font-size: .8rem; font-weight: 600; color: var(--doux); }
.form-grille input, .form-grille select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--bordure); border-radius: 8px; font-weight: 400; color: var(--texte); background: var(--carte); }
.encadre { background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.encadre h2 { font-size: 1.05rem; }

/* Historique */
.journal { list-style: none; margin: 0; padding: 0; font-size: .8rem; color: var(--doux); border-left: 2px solid var(--bordure); }
.journal li { padding: 2px 0 2px 10px; }

/* Tableaux (statistiques, équipe) */
.tableau { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: 12px; overflow: hidden; font-size: .9rem; }
.tableau th, .tableau td { padding: 8px 10px; border-bottom: 1px solid var(--bordure); text-align: left; vertical-align: top; }
.tableau th { background: #fafaf9; font-size: .8rem; color: var(--doux); }
.tableau td.nombre, .tableau th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.defile { overflow-x: auto; }
.barre-pct { height: 6px; background: var(--vert-clair); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.barre-pct > span { display: block; height: 100%; background: var(--vert); }

/* Message temporaire */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--texte); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
.toast.visible { opacity: 1; }
.toast.erreur { background: var(--rouge); }
[hidden] { display: none !important; }
.tableau input:not([type="checkbox"]) { width: 100%; min-height: 36px; padding: 4px 8px; border: 1px solid var(--bordure); border-radius: 6px; }
.tableau input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--vert); }
