/* ===========================================================================
   CRM de prospection — feuille de style
   Interface sombre, dense, pensée pour un usage intensif au clavier et un
   balayage visuel rapide d'une liste de leads.
   =========================================================================== */

:root {
  --fond: #0a0e17;
  --surface: #0f1523;
  --carte: #151d2e;
  --carte-2: #1b2436;
  --carte-3: #222c42;
  --bordure: #253049;
  --bordure-claire: #33415f;
  --texte: #e9eefb;
  --doux: #8b98b4;
  --tres-doux: #5d6a85;
  --accent: #6366f1;
  --accent-clair: #818cf8;
  --accent-fonce: #4f46e5;
  --vert: #34d399;
  --ambre: #fbbf24;
  --orange: #fb923c;
  --rouge: #f87171;
  --cyan: #38bdf8;

  --rayon: 10px;
  --rayon-petit: 7px;
  --ombre: 0 16px 40px rgba(0, 0, 0, 0.45);
  --ombre-douce: 0 3px 12px rgba(0, 0, 0, 0.25);

  --lateral: 236px;
  --pad-y: 10px;
  --pad-x: 12px;
}
.app.compact { --pad-y: 5px; --pad-x: 10px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; }
body.auth-verrouille #app { display: none; }
body.auth-connecte .auth-ecran { display: none; }
.auth-ecran {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--fond);
}
.auth-panneau {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px;
  padding: 28px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.auth-marque {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 800;
}
.auth-panneau h1 { margin: 8px 0 0; font-size: 20px; }
.auth-panneau p { color: var(--doux); margin: 0 0 12px; }
.auth-panneau label { color: var(--doux); font-size: 12px; }
.auth-password-entete { display: flex; align-items: center; justify-content: space-between; }
.auth-afficher { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.auth-afficher input { width: auto; margin: 0; accent-color: var(--accent); }
.auth-panneau input {
  width: 100%; padding: 10px 11px; border: 1px solid var(--bordure-claire); border-radius: 7px;
  outline: none; background: var(--carte); color: var(--texte);
}
.auth-panneau input:focus { border-color: var(--accent); }
.auth-panneau button { justify-content: center; margin-top: 8px; padding: 10px; }
.auth-erreur { min-height: 18px; color: var(--rouge); font-size: 12px; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-clair); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b3650; border-radius: 6px; border: 2px solid var(--fond); }
::-webkit-scrollbar-thumb:hover { background: #3a4870; }

/* ============================== coquille ================================= */
.app { display: grid; grid-template-columns: var(--lateral) 1fr; width: 100%; height: 100vh; transition: grid-template-columns .16s ease; }
.app.reduit { grid-template-columns: 68px 1fr; }

/* ------------------------------ barre latérale ---------------------------- */
.barre-laterale {
  background: var(--surface);
  border-right: 1px solid var(--bordure);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
  overflow: hidden;
}
.marque { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
.marque-logo {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
}
.marque-texte { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; white-space: nowrap; }
.marque-texte b { font-size: 14.5px; letter-spacing: .2px; }
.marque-texte small { color: var(--tres-doux); font-size: 10.5px; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-titre {
  font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--tres-doux); margin: 14px 8px 5px; white-space: nowrap;
}
.nav-bouton {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; border-radius: var(--rayon-petit);
  padding: 8px 9px; cursor: pointer; color: var(--doux);
  font-size: 13px; text-align: left; width: 100%; white-space: nowrap;
  transition: background .13s, color .13s;
}
.nav-bouton:hover { background: var(--carte-2); color: var(--texte); }
.nav-bouton.actif { background: var(--accent); color: #fff; font-weight: 600; }
.nav-bouton.actif .nav-compteur { background: rgba(255,255,255,.22); color: #fff; }
.nav-libelle { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-compteur {
  font-size: 11px; background: var(--carte-3); color: var(--doux);
  border-radius: 20px; padding: 1px 7px; min-width: 22px; text-align: center;
}
.barre-laterale-pied { border-top: 1px solid var(--bordure); padding-top: 8px; margin-top: 8px; }

.app.reduit .marque-texte,
.app.reduit .nav-libelle,
.app.reduit .nav-compteur,
.app.reduit .nav-titre { display: none; }
.app.reduit .marque { justify-content: center; padding-inline: 0; }
.app.reduit .nav-bouton { justify-content: center; padding-inline: 0; }

/* --------------------------------- zone principale ------------------------ */
.zone-principale { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }

.barre-haute {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--bordure);
  background: var(--surface); flex: none;
}
.titre-vue { font-size: 16px; margin: 0; white-space: nowrap; }
.sous-titre-vue { color: var(--tres-doux); font-size: 12px; white-space: nowrap; }

.recherche { position: relative; flex: 1; max-width: 420px; margin-left: 6px; }
.recherche-icone { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--tres-doux); width: 15px; height: 15px; }
.recherche input {
  width: 100%; background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 8px 12px 8px 33px; outline: none;
}
.recherche input:focus { border-color: var(--accent); background: var(--carte-2); }

.barre-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn, .btn-icone, .btn-lien {
  border-radius: 8px; cursor: pointer; transition: .14s; white-space: nowrap;
}
.btn {
  background: var(--carte-2); border: 1px solid var(--bordure-claire);
  padding: 8px 13px; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--carte-3); }
.btn-icone {
  background: transparent; border: 1px solid transparent; padding: 7px;
  color: var(--doux); display: grid; place-items: center;
}
.btn-icone:hover { background: var(--carte-2); color: var(--texte); }
.btn-lien { background: transparent; border: 0; color: var(--doux); padding: 6px 9px; }
.btn-lien:hover { color: var(--texte); background: var(--carte-2); }
.bouton-principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.bouton-principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.bouton-danger { color: var(--rouge); }
.btn:disabled, .btn-icone:disabled { opacity: .45; cursor: not-allowed; }
svg + span, .btn svg { margin-right: 1px; }

/* tâche en cours */
.tache {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--cyan); background: rgba(56,189,248,.09);
  border: 1px solid rgba(56,189,248,.3); border-radius: 20px; padding: 5px 12px;
}
.tache[hidden] { display: none; }
.tache-rotation {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(56,189,248,.3); border-top-color: var(--cyan);
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* --------------------------------- filtres -------------------------------- */
.filtres {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 18px; border-bottom: 1px solid var(--bordure);
  background: var(--fond); flex: none;
}
select.champ-mini, input.champ-mini {
  background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 7px; padding: 6px 9px; cursor: pointer; max-width: 190px;
}
select.champ-mini:focus, input.champ-mini:focus { outline: none; border-color: var(--accent); }
.curseur { display: flex; align-items: center; gap: 7px; color: var(--doux); font-size: 12px; }
.curseur input[type="range"] { width: 110px; accent-color: var(--accent); }
.curseur b { color: var(--texte); min-width: 20px; }
.bascule {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: 7px;
  padding: 6px 11px; cursor: pointer; font-size: 12.5px; color: var(--doux);
  user-select: none; transition: .13s;
}
.bascule:hover { border-color: var(--bordure-claire); color: var(--texte); }
.bascule.actif { background: rgba(99,102,241,.16); border-color: var(--accent); color: #fff; }

/* --------------------------------- contenu -------------------------------- */
.contenu { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.vue { display: none; flex: 1; min-width: 0; }
.vue.actif { display: flex; flex-direction: column; }

/* --------------------------------- tableau -------------------------------- */
.tableau-enveloppe { flex: 1; overflow: auto; min-height: 0; }
table.leads { width: 100%; min-width: 1020px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
/* Répartition fixe : garantit que la colonne Statut reste visible. */
table.leads th:nth-child(1) { width: 34px; }
table.leads th:nth-child(2) { width: 20%; }
table.leads th:nth-child(3) { width: 15%; }
table.leads th:nth-child(4) { width: 17%; }
table.leads th:nth-child(5) { width: 9%; }
table.leads th:nth-child(6) { width: 7%; }
table.leads th:nth-child(7) { width: 21%; }
table.leads th:nth-child(8) { width: 11%; }
table.leads td { overflow-wrap: anywhere; }
table.leads th {
  position: sticky; top: 0; z-index: 5;
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .7px; color: var(--tres-doux);
  padding: 9px var(--pad-x); background: var(--surface);
  border-bottom: 1px solid var(--bordure); white-space: nowrap;
}
table.leads th.triable { cursor: pointer; user-select: none; }
table.leads th.triable:hover { color: var(--texte); }
table.leads th.actif { color: var(--accent-clair); }
table.leads th.actif::after { content: " ▾"; font-size: 9px; }
table.leads th.actif.inverse::after { content: " ▴"; }
table.leads td { padding: var(--pad-y) var(--pad-x); border-bottom: 1px solid #1a2233; vertical-align: top; }
table.leads tbody tr { cursor: pointer; transition: background .1s; }
table.leads tbody tr:hover { background: #131b2b; }
table.leads tbody tr.selectionne { background: #17203a; box-shadow: inset 3px 0 0 var(--accent); }
table.leads tbody tr.coche { background: #16203a; }
table.leads tbody tr.surligne { outline: 1px solid var(--accent); outline-offset: -1px; }
.col-case { width: 34px; }
.col-actions { width: 48px; text-align: center; }
.col-actions .btn-icone { padding: 5px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.cellule-nom .nom { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.3; }
.cellule-nom .meta { color: var(--doux); font-size: 11.5px; display: block; margin-top: 1px; }
.contact a { display: block; font-size: 12.5px; line-height: 1.55; }
.contact .absent { color: var(--tres-doux); font-size: 12px; }
.google { font-size: 12.5px; line-height: 1.5; }
.google .etoiles { color: var(--ambre); }

.badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.pastille {
  font-size: 10px; padding: 1px 6px; border-radius: 20px; white-space: nowrap;
  background: var(--carte-3); color: var(--doux); border: 1px solid transparent;
}
.pastille.ok { color: var(--vert); background: rgba(52,211,153,.1); }
.pastille.alerte { color: var(--ambre); background: rgba(251,191,36,.1); }
.pastille.non { color: var(--rouge); background: rgba(248,113,113,.11); }
.pastille.info { color: var(--cyan); background: rgba(56,189,248,.1); }

.score-bloc { display: flex; flex-direction: column; gap: 4px; min-width: 46px; }
.score-num { font-size: 15px; font-weight: 700; line-height: 1; }
.score-num.chaude { color: var(--vert); }
.score-num.tiede { color: var(--ambre); }
.score-num.froide { color: var(--tres-doux); }
.jauge { height: 3px; border-radius: 3px; background: var(--carte-3); overflow: hidden; }
.jauge i { display: block; height: 100%; border-radius: 3px; }
.jauge i.chaude { background: var(--vert); }
.jauge i.tiede { background: var(--ambre); }
.jauge i.froide { background: #44506b; }

.statut-bloc { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.point { width: 7px; height: 7px; border-radius: 50%; background: var(--tres-doux); flex: none; }
select.statut {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: 20px;
  padding: 4px 8px; font-size: 12px; cursor: pointer; width: 100%; min-width: 0;
}
select.statut:focus { outline: none; border-color: var(--accent); }
.st-nouveau .point { background: #64748b; }
.st-a_contacter .point { background: var(--cyan); }
.st-contacte .point { background: var(--accent-clair); }
.st-relance .point { background: var(--ambre); }
.st-rdv .point { background: #a855f7; }
.st-client .point { background: var(--vert); }
.st-rejete .point { background: var(--rouge); }

.ligne-vide, .vide-etat { text-align: center; color: var(--doux); padding: 64px 20px; }
.vide-etat h3 { margin: 0 0 6px; font-size: 15px; color: var(--texte); }
.vide-etat p { margin: 0 0 14px; }

.pagination {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 9px 18px; border-top: 1px solid var(--bordure); color: var(--doux);
  background: var(--surface); flex: none; font-size: 12.5px;
}

/* ------------------------------ barre de sélection ------------------------ */
.barre-lot {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 120%);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  background: var(--carte-2); border: 1px solid var(--bordure-claire);
  border-radius: 12px; padding: 9px 14px; box-shadow: var(--ombre);
  z-index: 30; transition: transform .18s ease;
  width: max-content; max-width: 94vw;
}
.barre-lot.visible { transform: translate(-50%, 0); }
.lot-sep { width: 1px; height: 20px; background: var(--bordure); }

/* --------------------------------- tiroir --------------------------------- */
.tiroir {
  position: fixed; top: 0; right: 0; width: min(700px, 96vw); height: 100vh;
  background: var(--surface); border-left: 1px solid var(--bordure);
  box-shadow: var(--ombre); transform: translateX(102%);
  transition: transform .2s ease; z-index: 40; display: flex; flex-direction: column;
}
.tiroir.ouvert { transform: translateX(0); }
.tiroir-entete {
  padding: 15px 20px; border-bottom: 1px solid var(--bordure);
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex: none;
}
.tiroir-entete h2 { margin: 0 0 3px; font-size: 17px; line-height: 1.25; }
.tiroir-corps { overflow-y: auto; padding: 16px 20px 20px; flex: 1; min-height: 0; }
.tiroir-pied {
  border-top: 1px solid var(--bordure); padding: 11px 20px; background: var(--surface);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: none;
}

.bloc { margin-bottom: 18px; }
.bloc h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--tres-doux);
  margin: 0 0 9px; padding-bottom: 5px; border-bottom: 1px solid var(--bordure);
}
.duo { display: grid; grid-template-columns: 138px 1fr; gap: 5px 12px; font-size: 13px; margin: 0; }
.duo dt { color: var(--doux); }
.duo dd { margin: 0; word-break: break-word; }

.argumentaire {
  background: linear-gradient(180deg, #17203a, #151d2e);
  border: 1px solid #2c3a5e; border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 12px 14px; font-size: 13px; line-height: 1.55;
}
.angle { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #212a3d; font-size: 13px; }
.angle:last-child { border-bottom: 0; }
.angle .poids { font-weight: 700; min-width: 32px; font-variant-numeric: tabular-nums; }
.angle .poids.plus { color: var(--vert); }
.angle .poids.moins { color: var(--rouge); }
.angle small { color: var(--doux); display: block; margin-top: 2px; line-height: 1.45; }

input.champ, select.champ, textarea.notes {
  width: 100%; background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 8px 10px; outline: none;
}
input.champ:focus, select.champ:focus, textarea.notes:focus { border-color: var(--accent); }
textarea.notes { min-height: 82px; resize: vertical; line-height: 1.5; }
.etiquette { color: var(--doux); font-size: 11.5px; display: block; margin-bottom: 5px; }
.rangee-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rangee-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ------------------------------- mode appel ------------------------------- */
.mode-appel { flex: 1; overflow-y: auto; padding: 28px 20px 60px; display: flex; justify-content: center; }
.carte-appel {
  width: min(760px, 100%); background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 16px; padding: 26px 28px; box-shadow: var(--ombre-douce); height: fit-content;
}
.appel-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.appel-tete h2 { margin: 0 0 4px; font-size: 23px; line-height: 1.2; }
.appel-progression { color: var(--doux); font-size: 12.5px; }
.appel-tel {
  display: flex; align-items: center; gap: 14px; margin: 18px 0;
  background: var(--carte-2); border: 1px solid var(--bordure-claire);
  border-radius: 12px; padding: 16px 20px;
}
.appel-tel .numero { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.appel-tel .numero.absent { color: var(--tres-doux); font-size: 16px; font-weight: 400; }
.appel-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.appel-action {
  flex: 1; min-width: 140px; padding: 12px; border-radius: 10px; cursor: pointer;
  background: var(--carte-2); border: 1px solid var(--bordure-claire); font-weight: 600;
  transition: .14s; text-align: center;
}
.appel-action:hover { transform: translateY(-1px); }
.appel-action.ok { border-color: #2c6b53; color: var(--vert); }
.appel-action.ok:hover { background: rgba(52,211,153,.12); }
.appel-action.ambre { border-color: #6b5518; color: var(--ambre); }
.appel-action.ambre:hover { background: rgba(251,191,36,.12); }
.appel-action.rouge { border-color: #6d3030; color: var(--rouge); }
.appel-action.rouge:hover { background: rgba(248,113,113,.12); }
.appel-action.neutre:hover { background: var(--carte-3); }

/* ------------------------------- statistiques ----------------------------- */
#vue-stats { overflow-y: auto; }
#vue-doublons { overflow-y: auto; }
#vue-corbeille { overflow-y: auto; }
.corbeille-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chemin-sauvegarde { overflow-wrap: anywhere; }
#vue-corbeille .tableau-enveloppe { margin-top: 15px; }
.doublons-vue { width: min(1240px, 100%); margin: 0 auto; padding: 18px 24px 48px; }
.doublons-entete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0 16px; }
.doublons-entete b { font-size: 14px; }
.doublons-entete span, .doublons-vide span { color: var(--doux); font-size: 12px; }
.doublons-vide { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--texte); text-align: center; }
.doublon-paire { border-top: 1px solid var(--bordure); padding: 14px 0 18px; }
.doublon-paire-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.doublon-signaux { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doublon-signaux > span { padding: 4px 7px; border: 1px solid var(--bordure); border-radius: 5px; color: var(--doux); font-size: 11px; }
.doublon-niveau { color: var(--ambre); font-size: 11px; font-weight: 650; }
.doublon-niveau.fort { color: var(--vert); }
.doublon-comparaison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.doublon-lead { min-width: 0; padding: 10px 18px 4px 12px; border-left: 2px solid var(--bordure-claire); }
.doublon-lead + .doublon-lead { padding-left: 20px; border-left-color: var(--cyan); }
.doublon-lead-haut { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.doublon-lead-haut > span { flex: none; color: var(--tres-doux); font-size: 10px; text-transform: uppercase; }
.doublon-lead-haut > b { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.doublon-meta { margin: 5px 0 10px; color: var(--doux); font-size: 11.5px; }
.doublon-lead dl { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 5px 10px; margin: 0 0 12px; font-size: 11.5px; }
.doublon-lead dt { color: var(--tres-doux); }
.doublon-lead dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
#vue-pipeline { overflow: hidden; }
.pipeline-board {
  flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 12px;
  overflow: auto; padding: 16px 18px 22px; scroll-snap-type: x proximity;
}
.pipeline-col {
  --pipeline-accent: var(--bordure-claire);
  flex: 0 0 252px; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  border-top: 2px solid var(--pipeline-accent); scroll-snap-align: start;
}
.pipeline-col[data-statut="nouveau"] { --pipeline-accent: #818cf8; }
.pipeline-col[data-statut="a_contacter"] { --pipeline-accent: #38bdf8; }
.pipeline-col[data-statut="contacte"] { --pipeline-accent: #34d399; }
.pipeline-col[data-statut="relance"] { --pipeline-accent: #fbbf24; }
.pipeline-col[data-statut="rdv"] { --pipeline-accent: #fb923c; }
.pipeline-col[data-statut="client"] { --pipeline-accent: #4ade80; }
.pipeline-col[data-statut="rejete"] { --pipeline-accent: #f87171; }
.pipeline-col.survol { background: color-mix(in srgb, var(--pipeline-accent) 8%, transparent); }
.pipeline-col-entete {
  min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--bordure); padding: 0 5px;
}
.pipeline-col-entete h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.pipeline-col-entete > span {
  flex: none; min-width: 24px; padding: 3px 6px; border-radius: 12px; background: var(--carte-2);
  color: var(--doux); text-align: center; font-size: 11px; font-variant-numeric: tabular-nums;
}
.pipeline-col-corps { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 2px 4px; }
.pipeline-carte {
  flex: none; padding: 11px 12px; border: 1px solid var(--bordure); border-left: 3px solid var(--pipeline-accent);
  border-radius: 7px; background: var(--carte); cursor: grab; outline: none; transition: border-color .12s, background .12s, opacity .12s;
}
.pipeline-carte:hover, .pipeline-carte:focus-visible { border-color: var(--pipeline-accent); background: var(--carte-2); }
.pipeline-carte:active { cursor: grabbing; }
.pipeline-carte.en-deplacement { opacity: .38; }
.pipeline-carte-haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pipeline-carte-haut b { min-width: 0; font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.pipeline-score { flex: none; min-width: 28px; text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--doux); }
.pipeline-score.chaude { color: var(--vert); }
.pipeline-score.tiede { color: var(--ambre); }
.pipeline-meta { margin-top: 5px; color: var(--doux); font-size: 11.5px; line-height: 1.35; }
.pipeline-relance { display: inline-flex; margin-top: 8px; padding: 3px 6px; border-radius: 4px; background: rgba(56,189,248,.1); color: var(--cyan); font-size: 10.5px; }
.pipeline-relance.due { background: rgba(248,113,113,.12); color: var(--rouge); }
.pipeline-contact { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 11px; overflow-wrap: anywhere; }
.pipeline-vide { padding: 12px 6px; color: var(--tres-doux); font-size: 12px; }
.stats-grille { padding: 20px 22px 60px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.carte-stat { background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 16px 18px; }
.carte-stat h3 { margin: 0 0 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--doux); }
.carte-stat.large { grid-column: 1 / -1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.kpi { background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 13px 15px; }
.kpi b { display: block; font-size: 24px; line-height: 1.15; }
.kpi small { color: var(--doux); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.kpi.accent b { color: var(--accent-clair); }
.kpi.vert b { color: var(--vert); }
.kpi.ambre b { color: var(--ambre); }
.kpi.cyan b { color: var(--cyan); }

.barre-h { display: grid; grid-template-columns: 148px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.barre-h .piste { height: 8px; background: var(--carte-3); border-radius: 6px; overflow: hidden; }
.barre-h .piste i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.barre-h .piste i.vert { background: var(--vert); }
.barre-h .piste i.ambre { background: var(--ambre); }
.barre-h .piste i.orange { background: var(--orange); }
.barre-h .valeur { text-align: right; color: var(--doux); font-variant-numeric: tabular-nums; }
.barre-h .etiquette { margin: 0; color: var(--texte); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.entonnoir { display: flex; gap: 10px; flex-wrap: wrap; }
.entonnoir .etape {
  flex: 1; min-width: 108px; background: var(--carte-2); border: 1px solid var(--bordure);
  border-radius: 10px; padding: 12px; text-align: center;
}
.entonnoir .etape b { display: block; font-size: 22px; }
.entonnoir .etape small { color: var(--doux); font-size: 11px; }

/* --------------------------------- modales -------------------------------- */
.voile {
  position: fixed; inset: 0; background: rgba(5, 8, 15, .72); backdrop-filter: blur(3px);
  z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px;
}
.voile.ouvert { display: flex; }
.modale {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 16px;
  width: min(780px, 96vw); max-height: 90vh; overflow-y: auto; box-shadow: var(--ombre);
}
.modale-etroite { width: min(460px, 96vw); }
.modale-entete {
  padding: 16px 20px; border-bottom: 1px solid var(--bordure);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modale-entete h2 { margin: 0; font-size: 16px; }
.modale-corps { padding: 18px 20px; }
.modale-pied {
  padding: 13px 20px; border-top: 1px solid var(--bordure);
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  position: sticky; bottom: 0; background: var(--surface);
}
.champ-ligne { margin-bottom: 15px; }
.champ-ligne > label { display: block; color: var(--doux); font-size: 12px; margin-bottom: 6px; }
.champ-ligne input[type="text"], .champ-ligne input[type="number"] {
  width: 100%; background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 9px 11px; outline: none;
}
.champ-ligne input:focus { border-color: var(--accent); }
.champ-ligne.rangee { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.champ-ligne.rangee > div { flex: none; }
.champ-ligne.rangee input, .champ-ligne.rangee select { width: 140px; }
.case-ligne { display: flex; align-items: center; gap: 7px; color: var(--doux); font-size: 12.5px; }
.case-ligne small { color: var(--tres-doux); }

.onglets { display: flex; gap: 6px; margin-bottom: 18px; }
.onglet {
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--bordure); background: var(--carte); color: var(--doux);
}
.onglet.actif { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.panneau { display: none; }
.panneau.actif { display: block; }
.grille-choix { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow-y: auto; padding: 3px 0; }
.choix {
  border: 1px solid var(--bordure); background: var(--carte); border-radius: 20px;
  padding: 5px 12px; cursor: pointer; font-size: 12.5px; user-select: none; transition: .12s;
}
.choix:hover { border-color: var(--bordure-claire); }
.choix.actif { background: var(--accent); border-color: var(--accent); color: #fff; }

.file-recherches { margin-top: 18px; font-size: 12.5px; }
.file-recherches h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--tres-doux); margin: 0 0 8px; }
.file-recherches .item { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #212a3d; color: var(--doux); }
.file-recherches .item b { color: var(--texte); font-weight: 500; }
.file-recherches .item .encours { color: var(--cyan); }
.file-recherches .item > div { min-width: 0; }
.file-recherches .item > span { flex: none; }
.recherche-erreur { margin: 5px 0; color: var(--rouge); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.raccourcis { display: grid; gap: 9px; }
.raccourcis > div { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 12px; font-size: 13px; }
kbd {
  background: var(--carte-2); border: 1px solid var(--bordure-claire); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 7px; font-size: 11.5px; font-family: inherit; margin-right: 3px;
}
.note { color: var(--doux); font-size: 12.5px; line-height: 1.55; margin: 16px 0 0; }

/* ------------------------------- notifications ---------------------------- */
.notifications { position: fixed; bottom: 18px; left: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.notification {
  background: var(--carte-2); border: 1px solid var(--bordure-claire); border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 10px 14px; font-size: 13px; box-shadow: var(--ombre);
  animation: apparait .2s ease; max-width: 380px; transition: opacity .3s;
}
.notification.ok { border-left-color: var(--vert); }
.notification.erreur { border-left-color: var(--rouge); }
@keyframes apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

.vide { color: var(--tres-doux); font-style: italic; }
.charge { opacity: .5; }

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 68px 1fr; }
  .marque-texte, .nav-libelle, .nav-compteur, .nav-titre { display: none; }
  .marque, .nav-bouton { justify-content: center; padding-inline: 0; }
  .sous-titre-vue { display: none; }
}
@media (max-width: 820px) {
  /* La barre latérale passe en surcouche : elle quitte le flux, la zone
     principale doit donc occuper l'unique colonne restante. */
  .app { grid-template-columns: 1fr; }
  .barre-laterale {
    position: fixed; z-index: 45; width: 236px; height: 100vh;
    transform: translateX(-100%); transition: transform .2s;
  }
  .app.menu-ouvert .barre-laterale { transform: translateX(0); box-shadow: var(--ombre); }
  .app.menu-ouvert .marque-texte, .app.menu-ouvert .nav-libelle, .app.menu-ouvert .nav-compteur, .app.menu-ouvert .nav-titre { display: block; }
  .app.menu-ouvert .marque, .app.menu-ouvert .nav-bouton { justify-content: flex-start; padding-inline: 9px; }
  .recherche { max-width: none; }
  .titre-vue { font-size: 14px; }
  .barre-actions .btn { font-size: 12px; padding: 7px 10px; }
  .libelle-bouton { display: none; }
  /* Les filtres tiennent sur une seule ligne défilante : le tableau remonte. */
  .filtres { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; }
  .filtres > * { flex: none; }
  .pagination { flex-wrap: wrap; padding: 8px 12px; }
  .sous-titre-vue { display: none; }
  .duo { grid-template-columns: 1fr; gap: 2px 0; }
  .duo dt { margin-top: 6px; font-size: 11.5px; }
  .tiroir { width: 100vw; }
  .rangee-2, .rangee-3 { grid-template-columns: 1fr; }
  table.leads { min-width: 900px; }
  .filtres { padding: 8px 12px; }
  .barre-haute { padding: 9px 12px; gap: 8px; }
  .doublons-vue { padding: 14px 13px 36px; }
  .doublons-entete { align-items: flex-start; flex-direction: column; gap: 4px; }
  .doublon-comparaison { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .doublon-lead, .doublon-lead + .doublon-lead { padding: 8px 8px 4px 10px; }
}
