/* ============================================================
   Nord Pay CRM — design moderne (oct. 2026)
   Palette : bleu Nord Pay #4D8CFF, marine profond, fond clair
   ============================================================ */
:root{
  --bleu:#4D8CFF; --bleu-fonce:#2f6fe0; --bleu-clair:#e7efff;
  --marine:#0b1c36; --marine-2:#12294d;
  --fond:#eef2f9; --carte:#ffffff;
  --texte:#16233a; --gris:#66738a; --gris-clair:#93a0b4;
  --bord:#e2e8f4; --bord-fort:#cdd8ec;
  --vert:#16a35c; --vert-bg:#e3f7ec;
  --rouge:#d64541; --rouge-bg:#fdecea;
  --orange:#dd8503; --orange-bg:#fdf1de;
  --ombre:0 1px 2px rgba(16,42,90,.05),0 10px 30px -12px rgba(16,42,90,.14);
  --ombre-survol:0 2px 4px rgba(16,42,90,.06),0 18px 40px -14px rgba(16,42,90,.22);
  --rayon:16px;
  --transition:.18s ease;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:"Segoe UI",system-ui,-apple-system,Roboto,"Helvetica Neue",Arial,sans-serif;
  color:var(--texte);
  background:
    radial-gradient(1100px 500px at 85% -10%,rgba(77,140,255,.14),transparent 60%),
    radial-gradient(900px 480px at -10% 0%,rgba(22,163,92,.07),transparent 55%),
    var(--fond);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--bleu);color:#fff}
a{color:var(--bleu-fonce);text-decoration:none;font-weight:500}
a:hover{text-decoration:underline}

/* ---------- Barre supérieure ---------- */
header.topbar{
  position:sticky;top:0;z-index:50;
  background:linear-gradient(100deg,var(--marine) 0%,var(--marine-2) 55%,#1a3a6b 100%);
  color:#fff;display:flex;align-items:center;gap:1.1rem;flex-wrap:wrap;
  padding:.6rem 1.25rem;
  box-shadow:0 6px 24px -8px rgba(7,20,44,.55);
}
header.topbar .brand{display:flex;align-items:center;gap:.65rem;font-weight:800;font-size:1.12rem;letter-spacing:.01em;color:#fff}
header.topbar .brand:hover{text-decoration:none}
header.topbar .brand img{height:40px;width:40px;border-radius:11px;background:#fff;object-fit:cover;box-shadow:0 4px 14px rgba(0,0,0,.35)}
header.topbar nav{display:flex;gap:.35rem;flex-wrap:wrap;margin-left:.6rem}
header.topbar nav a{
  color:#bcd2f7;padding:.48rem .85rem;border-radius:999px;font-weight:600;font-size:.94rem;
  transition:background var(--transition),color var(--transition);
}
header.topbar nav a:hover{background:rgba(255,255,255,.13);color:#fff;text-decoration:none}
header.topbar nav a.actif{background:var(--bleu);color:#fff;box-shadow:0 4px 14px -2px rgba(77,140,255,.65)}
header.topbar .user{margin-left:auto;display:flex;align-items:center;gap:.8rem;font-size:.9rem;color:#bcd2f7}
header.topbar .user form{margin:0}
header.topbar .user a{color:#dbe8ff}

/* ---------- Boutons ---------- */
.btn{
  display:inline-block;border:0;cursor:pointer;
  background:linear-gradient(135deg,var(--bleu) 0%,var(--bleu-fonce) 100%);
  color:#fff;font-weight:600;font-size:.94rem;
  padding:.58rem 1.1rem;border-radius:11px;
  box-shadow:0 6px 16px -6px rgba(47,111,224,.55);
  transition:transform var(--transition),box-shadow var(--transition),background var(--transition);
}
.btn:hover{background:linear-gradient(135deg,#5f97ff 0%,#3978e8 100%);transform:translateY(-1px);box-shadow:0 10px 22px -8px rgba(47,111,224,.6);text-decoration:none}
.btn:active{transform:translateY(0)}
.btn.secondaire{background:#fff;color:var(--bleu-fonce);border:1px solid var(--bord-fort);box-shadow:0 2px 8px -4px rgba(16,42,90,.25)}
.btn.secondaire:hover{background:var(--bleu-clair);border-color:var(--bleu)}
.btn.danger{background:linear-gradient(135deg,#e2574f,#c93a34);box-shadow:0 6px 16px -6px rgba(201,58,52,.55)}
.btn.danger:hover{background:linear-gradient(135deg,#e96a61,#d64541)}
.btn.mini{padding:.34rem .7rem;font-size:.84rem;border-radius:9px}
button.btn:focus-visible,a.btn:focus-visible{outline:3px solid rgba(77,140,255,.45);outline-offset:2px}

/* ---------- Structure ---------- */
main{max-width:1180px;margin:0 auto;padding:1.6rem 1.15rem 2.6rem}
h1{font-size:1.65rem;font-weight:800;letter-spacing:-.015em;margin:.1rem 0 1.1rem}
h2{font-size:1.13rem;font-weight:700;margin:.2rem 0 .75rem}
.carte{
  background:var(--carte);border:1px solid var(--bord);border-radius:var(--rayon);
  padding:1.15rem 1.25rem;margin-bottom:1.1rem;box-shadow:var(--ombre);
}
.muted{color:var(--gris);font-size:.88rem}

/* ---------- Tableaux ---------- */
table{width:100%;border-collapse:separate;border-spacing:0;font-size:.94rem}
th,td{text-align:left;padding:.68rem .6rem;vertical-align:top}
th{
  color:var(--gris);font-weight:700;font-size:.76rem;text-transform:uppercase;letter-spacing:.07em;
  border-bottom:2px solid var(--bord);background:#fbfcfe;
}
td{border-bottom:1px solid var(--bord)}
tbody tr{transition:background var(--transition)}
tbody tr:hover td{background:#f4f8ff}
tbody tr:last-child td{border-bottom:0}

/* ---------- Badges de statut ---------- */
.badge{
  display:inline-flex;align-items:center;gap:.4rem;
  padding:.22rem .65rem;border-radius:999px;font-size:.79rem;font-weight:700;white-space:nowrap;
}
.badge::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.badge.Nouveau{background:#eceff5;color:#5a6a84}
.badge.Contacté{background:var(--bleu-clair);color:var(--bleu-fonce)}
.badge.Suivi{background:var(--orange-bg);color:var(--orange)}
.badge.Gagné{background:var(--vert-bg);color:var(--vert)}
.badge.Perdu{background:var(--rouge-bg);color:var(--rouge)}
.retard{color:var(--rouge);font-weight:700}

/* ---------- Messages flash ---------- */
.flash{
  padding:.8rem 1.05rem;border-radius:12px;margin-bottom:1rem;font-weight:500;
  border:1px solid;box-shadow:var(--ombre);
  animation:entree .3s ease both;
}
.flash.succes{background:var(--vert-bg);border-color:#9fd8b4;color:#0d6e3c}
.flash.erreur{background:var(--rouge-bg);border-color:#f2b3af;color:#99231f}
@keyframes entree{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}

/* ---------- Formulaires ---------- */
form.grille{display:grid;grid-template-columns:repeat(auto-fit,minmax(215px,1fr));gap:.9rem}
label{display:block;font-size:.83rem;font-weight:700;color:var(--gris);margin-bottom:.32rem;letter-spacing:.01em}
input,select,textarea{
  width:100%;padding:.58rem .7rem;font-size:.95rem;color:var(--texte);
  background:#fbfcfe;border:1.5px solid var(--bord);border-radius:11px;
  transition:border-color var(--transition),box-shadow var(--transition),background var(--transition);
}
input:hover,select:hover,textarea:hover{border-color:var(--bord-fort)}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--bleu);background:#fff;
  box-shadow:0 0 0 4px rgba(77,140,255,.18);
}
textarea{min-height:110px;resize:vertical}
.filtres{display:flex;gap:.65rem;flex-wrap:wrap;align-items:end}
.filtres>div{flex:1 1 150px}
.pagination{display:flex;gap:.55rem;align-items:center;margin-top:.9rem;flex-wrap:wrap}

/* ---------- Statistiques (Ventes / Aujourd'hui) ---------- */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:1.05rem;margin-bottom:1.1rem}
.stat{
  position:relative;overflow:hidden;
  background:var(--carte);border:1px solid var(--bord);border-radius:var(--rayon);
  padding:1.15rem 1.25rem 1.05rem;box-shadow:var(--ombre);
  transition:transform var(--transition),box-shadow var(--transition);
}
.stat:hover{transform:translateY(-3px);box-shadow:var(--ombre-survol)}
.stat::before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:var(--bleu)}
.stat:nth-child(2)::before{background:var(--vert)}
.stat:nth-child(3)::before{background:var(--orange)}
.stat:nth-child(4)::before{background:#8b5cf6}
.stat .chiffre{font-size:2rem;font-weight:800;letter-spacing:-.02em;line-height:1.1}
.stat .libelle{color:var(--gris);font-size:.88rem;font-weight:600;margin-top:.15rem}

/* ---------- Graphique des ventes ---------- */
.graph{display:flex;align-items:flex-end;gap:.7rem;height:160px;padding-top:.6rem}
.graph .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:.32rem;height:100%;justify-content:flex-end}
.graph .barre{
  width:70%;max-width:46px;min-height:4px;
  background:linear-gradient(180deg,#6ea3ff 0%,var(--bleu-fonce) 100%);
  border-radius:8px 8px 3px 3px;
  box-shadow:0 6px 14px -6px rgba(47,111,224,.55);
  transition:filter var(--transition);
}
.graph .col:hover .barre{filter:brightness(1.13)}
.graph .j{font-size:.78rem;color:var(--gris);font-weight:600}
.graph .v{font-size:.8rem;font-weight:800}

/* ---------- Mon tableau : progression, série, badges, classement ---------- */
.barre-prog{
  background:#e4ebf8;border-radius:999px;height:16px;overflow:hidden;
  box-shadow:inset 0 1px 3px rgba(16,42,90,.18);
}
.barre-prog>.rempli{
  height:100%;border-radius:999px;min-width:0;
  background:linear-gradient(90deg,#6ea3ff 0%,var(--bleu-fonce) 100%);
  transition:width .5s ease;
}
.barre-prog>.rempli.plein{background:linear-gradient(90deg,var(--bleu) 0%,var(--vert) 100%)}
.serie{
  display:inline-flex;align-items:center;gap:.45rem;
  background:var(--orange-bg);color:var(--orange);
  font-weight:700;font-size:.9rem;
  padding:.36rem .85rem;border-radius:999px;border:1px solid #f0d9a8;
}
.serie::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--orange)}
.badges{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:.8rem}
.badge-perso{
  display:flex;gap:.7rem;align-items:flex-start;
  background:var(--vert-bg);border:1px solid #a9dec0;border-radius:13px;
  padding:.8rem .95rem;
}
.badge-perso .point{flex:none;width:11px;height:11px;border-radius:50%;background:var(--vert);margin-top:.32rem}
.badge-perso .nom{font-weight:700}
.badge-perso.non{background:#eef1f7;border-color:var(--bord);color:var(--gris)}
.badge-perso.non .point{background:#c3cede}
table.classement tr.moi td{background:var(--bleu-clair);font-weight:700}

/* ---------- Sécurité : alertes, présence, résultats ---------- */
.alerte-secu{
  padding:.85rem 1.05rem;border-radius:12px;margin-bottom:1.1rem;
  background:var(--rouge-bg);border:1px solid #f2b3af;border-left:6px solid var(--rouge);
  color:#99231f;box-shadow:var(--ombre);
  animation:entree .3s ease both;
}
.presence{display:inline-flex;align-items:center;gap:.45rem;font-weight:600;white-space:nowrap}
.presence .point{flex:none;width:9px;height:9px;border-radius:50%;background:#c3cede}
.presence.enligne .point{background:var(--vert);box-shadow:0 0 0 3px var(--vert-bg)}
.presence.aujourdhui .point{background:var(--orange);box-shadow:0 0 0 3px var(--orange-bg)}
.badge.role-admin{background:var(--bleu-clair);color:var(--bleu-fonce)}
.badge.role-admin::before,.badge.role-vendeur::before{display:none}
.badge.role-vendeur{background:#eceff5;color:#5a6a84}
.badge.succes{background:var(--vert-bg);color:var(--vert)}
.badge.echec{background:var(--rouge-bg);color:var(--rouge)}

/* ---------- Doublons de téléphone : surlignage, alertes, pop-up ---------- */
tr.doublon td{background:#fff6cf}
tbody tr.doublon:hover td{background:#ffedb3}
.badge-doublon{
  display:inline-block;vertical-align:middle;
  background:#ffd94d;color:#5c4300;border:1px solid #e8bc33;
  font-size:.7rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;
  padding:.15rem .55rem;border-radius:999px;white-space:nowrap;
}
.alerte-doublon{
  background:#fff8d6;color:#5c4300;
  border:1px solid #e8bc33;border-left:6px solid #e0a800;border-radius:12px;
  padding:.9rem 1.05rem;margin-bottom:1.1rem;box-shadow:var(--ombre);
}
.alerte-doublon ul{margin:.5rem 0 0;padding-left:1.2rem}
.alerte-doublon li{margin:.25rem 0}
.popup-fond{
  position:fixed;inset:0;z-index:100;
  background:rgba(11,28,54,.55);
  display:flex;align-items:center;justify-content:center;padding:1rem;
}
.popup-carte{
  background:#fff;border-radius:18px;border-top:6px solid #e0a800;
  max-width:450px;width:100%;padding:1.6rem 1.7rem 1.4rem;
  box-shadow:0 30px 70px -18px rgba(0,0,0,.55);
  animation:entree .3s ease both;
}
.popup-carte h2{margin-top:0}

/* ---------- Fiche lead : appel en un clic, actions rapides, historique ---------- */
.flash.info{background:var(--bleu-clair);border-color:#b9d0f7;color:var(--bleu-fonce)}
a.tel{color:inherit;font-weight:600;text-decoration:none}
a.tel:hover{color:var(--bleu-fonce);text-decoration:underline}
.actions-rapides{
  display:flex;align-items:center;gap:.85rem;flex-wrap:wrap;
  background:var(--carte);border:1px solid var(--bord);border-radius:var(--rayon);
  padding:.9rem 1.1rem;margin-bottom:1.1rem;box-shadow:var(--ombre);
}
.actions-rapides .btn{font-size:1.02rem;padding:.68rem 1.5rem}
.historique{list-style:none;margin:0;padding:0}
.historique li{padding:.55rem .15rem;border-bottom:1px solid var(--bord)}
.historique li:last-child{border-bottom:0}

/* ---------- Page de connexion ---------- */
body:has(.login-wrap){
  background:
    radial-gradient(900px 480px at 80% -10%,rgba(77,140,255,.4),transparent 60%),
    radial-gradient(700px 420px at 8% 108%,rgba(22,163,92,.22),transparent 55%),
    linear-gradient(150deg,#081630 0%,var(--marine-2) 55%,#1a3a6b 100%);
  min-height:100vh;
}
body:has(.login-wrap) main{max-width:none;padding:0}
.login-wrap{max-width:420px;margin:0 auto;padding:9vh 1rem 2rem}
.login-wrap .carte{
  padding:2.1rem 2rem 1.8rem;border-radius:22px;border:0;
  box-shadow:0 30px 70px -18px rgba(0,0,0,.55);
  animation:entree .45s ease both;
}
.login-wrap img{
  display:block;margin:0 auto .8rem;height:78px;width:78px;border-radius:19px;
  box-shadow:0 10px 26px -8px rgba(16,42,90,.4);
}
.login-wrap h1{text-align:center;font-size:1.5rem;margin-bottom:1.2rem}
label.souvenir{
  display:flex;align-items:center;gap:.55rem;cursor:pointer;
  font-size:.92rem;font-weight:600;color:var(--texte);margin:0;
}
label.souvenir input[type=checkbox]{
  width:19px;height:19px;margin:0;flex:none;accent-color:var(--bleu-fonce);cursor:pointer;
}
.login-wrap .btn{padding:.72rem 1.1rem;font-size:1rem;border-radius:12px}

/* ---------- Divers ---------- */
::-webkit-scrollbar{width:11px;height:11px}
::-webkit-scrollbar-thumb{background:#c3d0e6;border-radius:8px;border:2px solid var(--fond)}
::-webkit-scrollbar-thumb:hover{background:#a7b9d8}

@media (max-width:720px){
  main{padding:1rem .7rem 2rem}
  table{font-size:.86rem}
  th,td{padding:.55rem .42rem}
  header.topbar{gap:.6rem;padding:.55rem .8rem}
  header.topbar .user{margin-left:0}
  .stat .chiffre{font-size:1.6rem}
  .login-wrap{padding-top:6vh}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
  html{scroll-behavior:auto}
}
