/* ============================================================
   Tourak Prospect — Design system sombre, mobile-first
   ============================================================ */
:root{
  --bg:#0a0a0a; --surface-1:#121214; --surface-2:#18181b; --surface-3:#222226;
  --border:#2a2a30; --border-light:#34343c;
  --text:#f4f4f5; --text-muted:#a1a1aa; --text-faint:#6b7280;
  --accent:#6366f1; --accent-hover:#818cf8; --accent-weak:rgba(99,102,241,.14);
  --green:#22c55e; --green-weak:rgba(34,197,94,.14);
  --amber:#f59e0b; --amber-weak:rgba(245,158,11,.14);
  --blue:#3b82f6; --blue-weak:rgba(59,130,246,.14);
  --purple:#a855f7; --purple-weak:rgba(168,85,247,.14);
  --red:#ef4444; --red-weak:rgba(239,68,68,.14);
  --radius:16px; --radius-sm:12px; --radius-xs:9px;
  --nav-h:64px; --top-h:56px; --gutter:16px;
  --shadow:0 8px 30px rgba(0,0,0,.5);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--font); background:var(--bg); color:var(--text);
  font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer}
[x-cloak]{display:none!important}
::selection{background:var(--accent-weak)}

/* Scrollbar */
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:8px}

/* ---------- App shell ---------- */
.app{min-height:100dvh;display:flex;flex-direction:column;padding-bottom:calc(var(--nav-h) + env(safe-area-inset-bottom))}
.topbar{
  position:sticky;top:0;z-index:40;height:var(--top-h);
  display:flex;align-items:center;gap:12px;padding:0 var(--gutter);
  background:rgba(10,10,10,.85);backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
}
.topbar h1{font-size:17px;font-weight:650;letter-spacing:-.01em;flex:1;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .logo{width:30px;height:30px;border-radius:9px;
  background:linear-gradient(135deg,var(--accent),#4f46e5);
  display:grid;place-items:center;font-weight:800;font-size:15px;color:#fff;flex-shrink:0}
.content{flex:1;padding:var(--gutter);max-width:980px;width:100%;margin:0 auto}

/* ---------- Bottom nav ---------- */
.bottomnav{
  position:fixed;bottom:0;left:0;right:0;z-index:50;height:calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);
  display:flex;background:rgba(18,18,20,.92);backdrop-filter:blur(14px);
  border-top:1px solid var(--border);
}
.bottomnav a{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:var(--text-faint);font-size:10.5px;font-weight:550;position:relative;transition:color .15s;
}
.bottomnav a .ic{width:23px;height:23px;display:block}
.bottomnav a.is-active{color:var(--accent-hover)}
.bottomnav a .dot{position:absolute;top:8px;right:calc(50% - 18px);
  min-width:16px;height:16px;padding:0 4px;border-radius:9px;background:var(--red);color:#fff;
  font-size:9.5px;font-weight:700;display:grid;place-items:center}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;
  height:42px;padding:0 16px;border:1px solid var(--border-light);border-radius:var(--radius-sm);
  background:var(--surface-2);color:var(--text);font-size:14px;font-weight:600;
  transition:transform .08s,background .15s,border-color .15s;white-space:nowrap}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.5;pointer-events:none}
.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-hover)}
.btn-ghost{background:transparent;border-color:transparent;color:var(--text-muted)}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-danger{background:var(--red-weak);border-color:transparent;color:#fca5a5}
.btn-sm{height:34px;padding:0 12px;font-size:13px;border-radius:var(--radius-xs)}
.btn-block{width:100%}
.btn .ic{width:18px;height:18px}

/* ---------- Cards ---------- */
.card{background:var(--surface-1);border:1px solid var(--border);border-radius:var(--radius);padding:16px}
.card + .card{margin-top:12px}
.card-title{font-size:13px;font-weight:650;color:var(--text-muted);text-transform:uppercase;letter-spacing:.04em;margin-bottom:12px}

.lead-card{display:flex;gap:12px;align-items:flex-start;background:var(--surface-1);
  border:1px solid var(--border);border-radius:var(--radius);padding:14px;transition:border-color .15s,transform .08s}
.lead-card:active{transform:scale(.99)}
.lead-card .ava{width:42px;height:42px;border-radius:11px;background:var(--surface-3);
  display:grid;place-items:center;font-size:20px;flex-shrink:0}
.lead-card .body{flex:1;min-width:0}
.lead-card .name{font-weight:650;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lead-card .meta{color:var(--text-muted);font-size:12.5px;margin-top:2px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lead-card .tags{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}

/* ---------- Badges ---------- */
.badge{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 9px;border-radius:7px;
  font-size:11.5px;font-weight:650;border:1px solid transparent;white-space:nowrap}
.badge-a_contacter{background:var(--blue-weak);color:#93c5fd}
.badge-contacte{background:var(--amber-weak);color:#fcd34d}
.badge-repondu{background:var(--purple-weak);color:#d8b4fe}
.badge-sans_interet{background:var(--surface-3);color:var(--text-muted)}
.badge-client{background:var(--green-weak);color:#86efac}
.badge-hot{background:var(--red-weak);color:#fca5a5}
.badge-warm{background:var(--amber-weak);color:#fcd34d}
.badge-cold{background:var(--surface-3);color:var(--text-muted)}
.badge-nosite{background:var(--red-weak);color:#fca5a5}
.badge-accent{background:var(--accent-weak);color:var(--accent-hover)}

/* lead score pill */
.score{display:inline-grid;place-items:center;min-width:34px;height:34px;border-radius:10px;
  font-weight:750;font-size:13px;flex-shrink:0}
.score-hot{background:rgba(34,197,94,.14);color:#86efac}
.score-warm{background:var(--amber-weak);color:#fcd34d}
.score-cold{background:var(--surface-3);color:var(--text-muted)}

/* ---------- Forms ---------- */
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;font-weight:600;color:var(--text-muted);margin-bottom:6px}
.input,.select,textarea.input{
  width:100%;height:44px;padding:0 13px;background:var(--surface-2);
  border:1px solid var(--border-light);border-radius:var(--radius-sm);color:var(--text);
  font-size:15px;font-family:inherit;transition:border-color .15s}
textarea.input{height:auto;padding:11px 13px;resize:vertical;min-height:90px}
.input:focus,.select:focus,textarea.input:focus{outline:none;border-color:var(--accent)}
.input::placeholder{color:var(--text-faint)}
.select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}

/* search input with icon */
.search{position:relative}
.search .ic{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--text-faint)}
.search .input{padding-left:40px}

/* ---------- Chips / filter bar ---------- */
.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 0 8px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex-shrink:0;height:34px;padding:0 13px;border-radius:999px;border:1px solid var(--border-light);
  background:var(--surface-2);color:var(--text-muted);font-size:13px;font-weight:600;
  display:inline-flex;align-items:center;gap:6px;transition:all .15s}
.chip.is-on{background:var(--accent-weak);border-color:var(--accent);color:var(--accent-hover)}

/* ---------- Stat / KPI ---------- */
.kpis{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.kpi{background:var(--surface-1);border:1px solid var(--border);border-radius:var(--radius);padding:14px}
.kpi .val{font-size:26px;font-weight:780;letter-spacing:-.02em}
.kpi .lbl{font-size:12px;color:var(--text-muted);margin-top:2px}
.kpi .val.accent{color:var(--accent-hover)}
.kpi .val.green{color:#86efac}
.kpi .val.red{color:#fca5a5}
@media(min-width:560px){.kpis{grid-template-columns:repeat(4,1fr)}}

/* ---------- Pipeline ---------- */
.pipeline{display:flex;gap:12px;overflow-x:auto;padding-bottom:8px;scrollbar-width:none}
.pipeline::-webkit-scrollbar{display:none}
.pcol{flex:0 0 80%;max-width:300px;background:var(--surface-1);border:1px solid var(--border);
  border-radius:var(--radius);padding:12px;display:flex;flex-direction:column;gap:10px}
.pcol h3{font-size:13px;font-weight:650;display:flex;align-items:center;justify-content:space-between}
.pcol .cnt{background:var(--surface-3);color:var(--text-muted);border-radius:7px;padding:1px 8px;font-size:11.5px}
@media(min-width:760px){.pcol{flex:1}}

/* ---------- Skeleton ---------- */
.skel{background:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 50%,var(--surface-2) 75%);
  background-size:200% 100%;animation:shimmer 1.3s infinite;border-radius:8px}
@keyframes shimmer{to{background-position:-200% 0}}
.skel-card{height:72px;margin-bottom:12px}

/* ---------- Empty state ---------- */
.empty{text-align:center;padding:48px 20px;color:var(--text-muted)}
.empty .ic{width:48px;height:48px;margin:0 auto 14px;color:var(--text-faint)}
.empty h3{font-size:16px;color:var(--text);margin-bottom:6px}
.empty p{font-size:13.5px;max-width:300px;margin:0 auto}

/* ---------- Toasts ---------- */
.toasts{position:fixed;left:0;right:0;bottom:calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  z-index:90;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;padding:0 16px}
.toast{pointer-events:auto;max-width:420px;width:100%;background:var(--surface-3);
  border:1px solid var(--border-light);border-radius:var(--radius-sm);padding:12px 14px;
  font-size:14px;box-shadow:var(--shadow);display:flex;gap:10px;align-items:center;
  animation:slideup .25s ease}
.toast.ok{border-color:rgba(34,197,94,.4)}
.toast.err{border-color:rgba(239,68,68,.4)}
@keyframes slideup{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}

/* ---------- Modal / sheet ---------- */
.sheet-bg{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.6);backdrop-filter:blur(2px)}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:81;max-height:90dvh;overflow-y:auto;
  background:var(--surface-1);border-top-left-radius:22px;border-top-right-radius:22px;
  border-top:1px solid var(--border);padding:20px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  box-shadow:var(--shadow);animation:slideup .28s ease}
.sheet .grab{width:38px;height:4px;border-radius:3px;background:var(--surface-3);margin:0 auto 16px}
@media(min-width:680px){.sheet{left:50%;right:auto;bottom:auto;top:50%;transform:translate(-50%,-50%);
  width:560px;max-width:92vw;border-radius:var(--radius)}}

/* ---------- Misc utilities ---------- */
.row{display:flex;align-items:center;gap:10px}
.row.wrap{flex-wrap:wrap}
.between{justify-content:space-between}
.col{display:flex;flex-direction:column}
.gap6{gap:6px}.gap8{gap:8px}.gap12{gap:12px}
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt24{margin-top:24px}
.mb12{margin-top:0;margin-bottom:12px}
.grow{flex:1;min-width:0}
.muted{color:var(--text-muted)}.faint{color:var(--text-faint)}
.small{font-size:12.5px}.tiny{font-size:11.5px}
.bold{font-weight:680}
.center{text-align:center}
.hide{display:none}
.section-title{font-size:13px;font-weight:650;color:var(--text-muted);
  text-transform:uppercase;letter-spacing:.04em;margin:20px 2px 10px}
.list{display:flex;flex-direction:column;gap:10px}
.divider{height:1px;background:var(--border);margin:14px 0}
.link{color:var(--accent-hover);font-weight:600}
.spin{width:18px;height:18px;border:2px solid var(--surface-3);border-top-color:var(--accent);
  border-radius:50%;animation:rot .7s linear infinite}
@keyframes rot{to{transform:rotate(360deg)}}

/* ---------- Auth page ---------- */
.auth{min-height:100dvh;display:grid;place-items:center;padding:24px}
.auth .box{width:100%;max-width:380px}
.auth .brand{text-align:center;margin-bottom:28px}
.auth .brand .logo{width:54px;height:54px;border-radius:15px;margin:0 auto 14px;
  background:linear-gradient(135deg,var(--accent),#4f46e5);display:grid;place-items:center;
  font-weight:800;font-size:24px;color:#fff}
.auth .brand h1{font-size:22px;font-weight:750}
.auth .brand p{color:var(--text-muted);font-size:13.5px;margin-top:4px}

/* offline banner */
.offline-banner{background:var(--amber-weak);color:#fcd34d;text-align:center;
  font-size:12.5px;font-weight:600;padding:6px}

/* PIN pad */
.pin-dots{display:flex;gap:16px;justify-content:center;margin:22px 0 26px}
.pin-dot{width:14px;height:14px;border-radius:50%;border:2px solid var(--border-light);transition:all .15s}
.pin-dot.on{background:var(--accent);border-color:var(--accent);box-shadow:0 0 12px var(--accent-weak)}
.pin-pad{display:grid;grid-template-columns:repeat(3,1fr);gap:13px;max-width:288px;margin:0 auto}
.pin-key{height:62px;border-radius:16px;background:var(--surface-2);border:1px solid var(--border);color:var(--text);font-size:24px;font-weight:600;transition:transform .08s,background .15s}
.pin-key:active{transform:scale(.93);background:var(--surface-3)}
.pin-key.blank{background:transparent;border:none;pointer-events:none}

/* progress bar (audit score) */
.gauge{position:relative;width:88px;height:88px;flex-shrink:0}
.gauge svg{transform:rotate(-90deg)}
.gauge .val{position:absolute;inset:0;display:grid;place-items:center;font-size:22px;font-weight:780}
