:root {
  --bg: #eef4fc;
  --panel: #ffffff;
  --panel2: #f1f6fd;
  --border: #d7e3f2;
  --text: #0f2740;
  --muted: #5b7089;
  --primary: #2563eb;
  --primary-h: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--primary); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; width: 100%;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 8px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.btn {
  background: var(--primary); color: #fff; border: none; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--primary-h); }
.btn.sec { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }
.btn.sec:hover { background: var(--border); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--panel); padding: 36px; border-radius: 16px; width: 360px;
  border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(37,99,235,.18);
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .demo { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  box-shadow: 2px 0 16px rgba(37,99,235,.05);
}
.brand { font-size: 20px; font-weight: 800; padding: 6px 10px 16px; letter-spacing: .5px; }
.brand span { color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 14px;
}
.nav a:hover { background: var(--panel2); }
.nav a.active { background: var(--primary); color: #fff; }
.side-foot { font-size: 12px; color: var(--muted); padding: 10px; border-top: 1px solid var(--border); }
.main { flex: 1; padding: 24px 28px; max-width: 100%; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.topbar h2 { margin: 0; font-size: 22px; }
.date { color: var(--muted); font-size: 13px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; animation: cardIn .28s ease both; box-shadow: 0 2px 12px rgba(37,99,235,.06); }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.test-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.test-result { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; opacity: 0; transform: translateX(-4px); transition: .25s; }
.test-result.show { opacity: 1; transform: none; }
.test-result.ok { color: var(--green); }
.test-result.err { color: var(--red); }
.mini-spin { width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.stat .n { font-size: 30px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 2px 12px rgba(37,99,235,.05); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: var(--panel2); cursor: pointer; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.spacer { flex: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-nouveau { background: #dbeafe; color: #1e40af; }
.b-en_cours { background: #fef3c7; color: #92400e; }
.b-a_relancer { background: #ffedd5; color: #9a3412; }
.b-signe, .b-paye, .b-delivre, .b-envoye { background: #dcfce7; color: #166534; }
.b-perdu, .b-echec, .b-refuse { background: #fee2e2; color: #991b1b; }
.b-en_attente, .b-cree, .b-brouillon { background: #e6edf6; color: #475569; }
.b-appele { background: #fef3c7; color: #92400e; }
.b-sms_envoye { background: #dbeafe; color: #1e40af; }
.b-rdv { background: #ede9fe; color: #6d28d9; }
.b-valide { background: #d1fae5; color: #065f46; }
.b-sans_reponse { background: #ffedd5; color: #9a3412; }
.b-en_paiement { background: #fef9c3; color: #854d0e; }
.reserved-tag { display:inline-block; background:#e6edf6; color:#475569; border-radius:6px; padding:2px 8px; font-size:12px; }
.agent-badge { display:inline-block; background:#dbeafe; color:#1e40af; border-radius:999px; padding:4px 12px; font-size:13px; font-weight:700; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal { background: var(--panel); border-radius: 16px; width: 100%; max-width: 640px; padding: 24px; border: 1px solid var(--border); box-shadow: 0 24px 70px rgba(15,39,64,.25); }
.modal.lg { max-width: 860px; }
.modal h3 { margin: 0 0 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.close-x { float: right; background: none; border: none; color: var(--muted); font-size: 22px; }

/* ---------- Intégrations : bloc « fournisseurs configurés » ---------- */
.cfg-box { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.cfg-box .cfg-h { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.cfg-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.cfg-item:last-child { border-bottom: none; }
.cfg-item .cfg-n { flex: 1; min-width: 0; }
.cfg-item .cfg-state { font-size: 12px; font-weight: 700; white-space: nowrap; }
.cfg-empty { color: var(--muted); font-size: 13px; }
.cat-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 4px 0 8px; }

/* ---------- Intégrations : navigation par catégories ---------- */
.int-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.int-tabs button { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 1px 4px rgba(37,99,235,.05); transition: all .12s; }
.int-tabs button:hover { border-color: var(--primary); }
.int-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 14px rgba(37,99,235,.28); }
.int-intro { display: flex; align-items: flex-start; gap: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.int-intro .ii-ic { font-size: 22px; line-height: 1; }
.int-intro .ii-t { font-weight: 700; margin-bottom: 2px; }
.int-save { position: sticky; bottom: 0; background: linear-gradient(0deg, var(--bg) 70%, transparent); padding: 14px 0 6px; margin-top: 18px; display: flex; justify-content: flex-end; }

/* ---------- Modale de confirmation animée ---------- */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15,39,64,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s ease;
}
.confirm-overlay.show { opacity: 1; }
.confirm-overlay.closing { opacity: 0; }
.confirm-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  width: 100%; max-width: 420px; padding: 30px 28px 24px; text-align: center;
  box-shadow: 0 30px 80px rgba(15,39,64,.35);
  transform: translateY(16px) scale(.92); opacity: 0;
  transition: transform .24s cubic-bezier(.2,.9,.3,1.35), opacity .24s ease;
}
.confirm-overlay.show .confirm-box { transform: translateY(0) scale(1); opacity: 1; }
.confirm-overlay.closing .confirm-box { transform: translateY(8px) scale(.97); opacity: 0; }
.confirm-icon {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 16px; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 35px; color: #fff;
  background: radial-gradient(circle at 50% 34%, #60a5fa, #2563eb 78%);
  box-shadow: 0 12px 32px rgba(37,99,235,.42);
}
.confirm-icon .ci-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(37,99,235,.5); animation: orbpulse 2.2s infinite ease-out; }
.confirm-icon .ci-ring:nth-child(2) { animation-delay: 1.1s; }
.cvar-danger .confirm-icon { background: radial-gradient(circle at 50% 34%, #f87171, #dc2626 78%); box-shadow: 0 12px 32px rgba(220,38,38,.42); }
.cvar-danger .confirm-icon .ci-ring { border-color: rgba(220,38,38,.5); }
.cvar-success .confirm-icon { background: radial-gradient(circle at 50% 34%, #34d399, #059669 78%); box-shadow: 0 12px 32px rgba(5,150,105,.42); }
.cvar-success .confirm-icon .ci-ring { border-color: rgba(5,150,105,.5); }
.confirm-title { margin: 0 0 8px; font-size: 21px; font-weight: 800; }
.confirm-msg { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin-bottom: 22px; }
.confirm-msg b { color: var(--text); }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 12px 16px; font-weight: 700; font-size: 15px; }
.cvar-danger .confirm-yes { background: var(--red); }
.cvar-danger .confirm-yes:hover { background: #b91c1c; }
.cvar-success .confirm-yes { background: var(--green); }
.cvar-success .confirm-yes:hover { background: #15803d; }

/* ---------- Tabs (fiche client) ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 16px 0; flex-wrap: wrap; }
.tabs button { background: none; border: none; color: var(--muted); padding: 10px 14px; font-size: 14px; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.timeline .meta { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--panel); border: 1px solid var(--border);
  padding: 14px 18px; border-radius: 10px; z-index: 100; max-width: 340px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(15,39,64,.15);
}
.toast.ok { border-color: var(--green); }
.toast.err { border-color: var(--red); }

/* ==================== ROBO D'APPEL — design premium ==================== */
.dialer-hero {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #3b82f6 100%);
  color: #fff; border-radius: 18px; padding: 22px 26px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 12px 40px rgba(30, 58, 138, .35); position: relative; overflow: hidden;
}
.dialer-hero::after { content: ''; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(255,255,255,.15), transparent 70%); }
.dialer-hero .ttl { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.dialer-hero .sub { opacity: .85; font-size: 13px; margin-top: 3px; }

.dial-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dial-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; text-align: center; transition: transform .12s; }
.dial-stat .n { font-size: 26px; font-weight: 800; line-height: 1; }
.dial-stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }
.dial-stat.hot { border-color: var(--green); }
.dial-stat.hot .n { color: var(--green); }

/* Écran de lancement du robot */
.launch-panel {
  max-width: 660px; margin: 22px auto 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 24px; padding: 38px 34px 34px; text-align: center; box-shadow: 0 16px 50px rgba(37,99,235,.14);
}
.launch-orb {
  width: 156px; height: 156px; border-radius: 50%; margin: 0 auto 22px; cursor: pointer; position: relative;
  background: radial-gradient(circle at 50% 32%, #34d399, #059669 75%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 16px 45px rgba(5,150,105,.5); transition: transform .12s; z-index: 1;
}
.launch-orb:hover { transform: scale(1.05); }
.launch-orb .oico { font-size: 46px; line-height: 1; }
.launch-orb .olbl { font-size: 15px; font-weight: 800; letter-spacing: 1px; margin-top: 4px; text-transform: uppercase; }
.launch-orb::before, .launch-orb::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(16,185,129,.55); animation: orbpulse 2.4s infinite ease-out; z-index: -1; }
.launch-orb::after { animation-delay: 1.2s; }
@keyframes orbpulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.55); opacity: 0; } }
.launch-panel h3 { margin: 4px 0 8px; font-size: 23px; }
.launch-panel p { max-width: 460px; margin: 0 auto; }
.launch-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 14px; background: var(--panel2); padding: 8px 14px; border-radius: 999px; }

.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 26px; }
.how-step { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px 20px; text-align: center; }
.how-step .how-num { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; margin-bottom: 10px; }
.how-step .ic { font-size: 30px; }
.how-step .t { font-weight: 700; margin: 8px 0 5px; font-size: 15px; }
.how-step .d { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* Recherche en cours (radar) + appels actifs */
.searching-panel { text-align: center; padding: 30px 20px 26px; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; margin-bottom: 16px; }
.radar { width: 104px; height: 104px; margin: 0 auto 16px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; font-size: 34px; background: radial-gradient(circle, rgba(59,130,246,.16), transparent 70%); }
.radar .r { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(59,130,246,.55); animation: orbpulse 2s infinite ease-out; }
.radar .r:nth-child(2) { animation-delay: .66s; }
.radar .r:nth-child(3) { animation-delay: 1.33s; }
.searching-panel h3 { margin: 6px 0; font-size: 20px; }
.active-calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 12px; }
.acall { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.acall .ic { position: relative; width: 44px; height: 44px; border-radius: 50%; background: rgba(59,130,246,.15); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.acall .ic .rr { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(59,130,246,.55); animation: cring 1.6s infinite ease-out; }
.acall .nm { font-weight: 700; font-size: 14px; }
.acall .ph { color: var(--muted); font-size: 12px; margin-top: 2px; }
.acall .st { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.queue-note { text-align: center; color: var(--muted); font-size: 14px; padding: 8px; }

.dialing-banner {
  display: flex; align-items: center; gap: 18px; background: var(--panel);
  border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: 16px;
  padding: 20px 24px; margin-bottom: 18px;
}
.dialing-dots { display: flex; gap: 7px; }
.dialing-dots span { width: 11px; height: 11px; border-radius: 50%; background: var(--primary); animation: dotp 1.2s infinite ease-in-out; }
.dialing-dots span:nth-child(2) { animation-delay: .2s; }
.dialing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotp { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.25); } }

/* Panneau d'appel connecté */
.call-panel {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: 26px 30px; margin-bottom: 18px;
  background: linear-gradient(135deg, #065f46 0%, #0f766e 55%, #10b981 100%);
  box-shadow: 0 18px 55px rgba(6, 95, 70, .45); display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.call-panel::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% -30%, rgba(255,255,255,.22), transparent 55%); pointer-events: none; }
.call-avatar { position: relative; width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; flex: none; }
.call-avatar .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); animation: cring 2.2s infinite ease-out; }
.call-avatar .ring:nth-child(2) { animation-delay: 1.1s; }
@keyframes cring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
.call-info { flex: 1; min-width: 180px; z-index: 1; }
.call-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 999px; }
.call-live .dot { width: 9px; height: 9px; border-radius: 50%; background: #f87171; animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.call-name { font-size: 26px; font-weight: 800; margin: 9px 0 2px; }
.call-phone { opacity: .92; font-size: 15px; letter-spacing: .5px; }
.call-right { text-align: center; z-index: 1; }
.call-timer { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 2px; line-height: 1; }
.call-timer-l { font-size: 10px; opacity: .8; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; }
.wavebars { display: flex; gap: 3px; align-items: center; height: 30px; margin: 12px 0 4px; justify-content: center; }
.wavebars span { width: 4px; border-radius: 2px; background: rgba(255,255,255,.9); animation: wave 1s infinite ease-in-out; }
@keyframes wave { 0%, 100% { height: 7px; } 50% { height: 28px; } }
.btn-hangup { background: #ef4444; color: #fff; border: none; border-radius: 14px; padding: 13px 22px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgba(239,68,68,.4); }
.btn-hangup:hover { background: #dc2626; transform: translateY(-1px); }
.call-panel.ended { background: linear-gradient(135deg, #334155 0%, #475569 100%); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.call-panel.ended .call-avatar .ring { display: none; }
.badge.live-badge { animation: badgepulse 1.1s infinite; }
@keyframes badgepulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Assistant de vente (wizard) ---------- */
.wiz-steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.wiz-steps .s {
  flex: 1; min-width: 70px; text-align: center; font-size: 11px; color: var(--muted);
  padding-bottom: 8px; border-bottom: 3px solid var(--border); line-height: 1.3;
}
.wiz-steps .s .num {
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--border);
  color: var(--text); align-items: center; justify-content: center; font-weight: 700; margin-bottom: 4px;
}
.wiz-steps .s.active { color: var(--text); border-color: var(--primary); font-weight: 700; }
.wiz-steps .s.active .num { background: var(--primary); color: #fff; }
.wiz-steps .s.done { color: var(--green); border-color: var(--green); }
.wiz-steps .s.done .num { background: var(--green); color: #fff; }
.wiz-body { min-height: 240px; }
.wiz-body h4 { margin: 0 0 4px; font-size: 18px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.sigpad {
  width: 100%; height: 200px; background: #fff; border-radius: 10px; border: 2px dashed var(--border);
  touch-action: none; cursor: crosshair; display: block;
}
.pay-status { text-align: center; padding: 26px 10px; }
.pay-status .dot { font-size: 54px; line-height: 1; }
.pay-status .lbl { font-size: 18px; font-weight: 700; margin-top: 10px; }
.pay-status.wait .lbl { color: var(--amber); }
.pay-status.ok .lbl { color: var(--green); }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; margin: 0 auto 8px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.rec-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.sale-summary { background: var(--panel2); border-radius: 10px; padding: 14px 16px; font-size: 14px; margin-bottom: 14px; }
.sale-summary b { color: var(--text); }
.amt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.amt-grid button {
  padding: 16px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel2);
  color: var(--text); font-size: 17px; font-weight: 700; transition: all .12s;
}
.amt-grid button:hover { border-color: var(--primary); }
.amt-grid button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.co-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 14px 0; }
.co-tile {
  background: #fff; border: 2px solid var(--border); border-radius: 14px; padding: 16px 12px;
  text-align: center; cursor: pointer; transition: all .12s; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.co-tile:hover { border-color: var(--primary); transform: translateY(-2px); }
.co-tile.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.4); }
.co-tile .logo-box { height: 68px; display: flex; align-items: center; justify-content: center; width: 100%; }
.co-tile img { max-width: 100%; max-height: 68px; object-fit: contain; }
.co-tile .ph {
  width: 60px; height: 60px; border-radius: 12px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800;
}
.co-tile .nm { font-weight: 700; font-size: 14px; color: #0f172a; }
.co-logo-thumb { height: 30px; max-width: 80px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
/* Interrupteur on/off */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
/* ---------- Fiche détaillée (infos importées, par sections) ---------- */
.detail-sec { margin-top: 18px; }
.detail-sec h4 {
  margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; letter-spacing: .2px;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 22px; }
.detail-item { min-width: 0; }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 2px; }
.detail-item .v { font-size: 15px; color: var(--text); word-break: break-word; white-space: pre-wrap; }
.detail-empty { color: var(--muted); font-style: italic; }
.msg-preview {
  background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 14px 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; margin-top: 6px;
}
.send-to { list-style: none; padding: 0; margin: 8px 0; }
.send-to li { padding: 8px 12px; background: var(--panel2); border-radius: 8px; margin-bottom: 6px; font-size: 15px; }
.chan-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.chan-choice .chan {
  background: var(--panel2); border: 2px solid var(--border); border-radius: 12px; padding: 18px 12px;
  color: var(--text); font-size: 16px; font-weight: 700; text-align: center; cursor: pointer; line-height: 1.5;
}
.chan-choice .chan span { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.chan-choice .chan:hover { border-color: var(--primary); }
.chan-choice .chan.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.chan-choice .chan.active span { color: #dbeafe; }

/* ---------- Mode fiche agent (plein écran, défilement) ---------- */
.deck { display: flex; flex-direction: column; gap: 16px; }
.deck-search {
  position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 4px 0 12px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.deck-search .search-box { flex: 1; position: relative; min-width: 220px; }
.deck-search .search-box input { padding-left: 38px; font-size: 16px; height: 48px; }
.deck-search .search-box::before {
  content: '🔎'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 16px;
}
.deck-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.deck-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 28px 30px; min-height: 60vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(37,99,235,.12);
}
.deck-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.deck-name { font-size: 30px; font-weight: 800; margin: 0; }
.deck-sub { color: var(--muted); margin-top: 4px; font-size: 15px; }
.deck-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin: 22px 0; }
.deck-fields .f label { margin: 0 0 2px; }
.deck-fields .f .v { font-size: 17px; }
.deck-notes { background: var(--panel2); border-radius: 10px; padding: 14px 16px; min-height: 48px; white-space: pre-wrap; }
.deck-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 20px; }
.deck-actions .btn { padding: 12px 16px; }
.deck-nav { display: flex; gap: 14px; }
.deck-nav .btn { flex: 1; padding: 18px; font-size: 17px; font-weight: 700; }
.deck-empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 18px; }
.deck-quicknote { display: flex; gap: 10px; margin-top: 14px; }
.deck-quicknote input { flex: 1; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .deck-name { font-size: 24px; }
  .deck-nav .btn { padding: 14px; font-size: 15px; }
}



/* ---------- DÉTAIL D'UN COMPTE BREVO (Intégrations > Messagerie) ---------- */
.brevo-det { margin-top: 10px; }
.bd-wrap {
  background: var(--bg, #f8fafc); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; animation: cardIn .22s ease both;
}
.bd-h {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--navy, #16304f); margin: 18px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.bd-wrap .bd-h:first-child { margin-top: 0; }
.bd-kv {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border);
}
.bd-kv:last-child { border-bottom: none; }
.bd-kv span { color: var(--muted); }
.bd-kv b { text-align: right; word-break: break-word; }
.bd-wrap .dial-stats { margin: 10px 0 12px; }
.bd-wrap .dial-stat .n { font-size: 21px; }
.dial-stat.warn { border-color: var(--amber, #d99b21); }
.dial-stat.warn .n { color: var(--amber, #d99b21); }

/* Barre d'actions client en version compacte (listes de fiches) */
.deck-actions.compact {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.deck-actions.compact .btn { font-size: 13px; padding: 8px 14px; }

/* ---------- SOFTPHONE (téléphone dans le navigateur) ---------- */
#softphone {
  position: fixed; right: 18px; bottom: 18px; z-index: 9500;
  width: 260px; background: var(--panel, #fff); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(22,48,79,.18);
  font-size: 13px; overflow: hidden;
}
#softphone .sp-tete {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #16304f; color: #fff;
}
#softphone .sp-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
#softphone .sp-ext { font-size: 11px; opacity: .75; }
#softphone .sp-etat { margin-left: auto; font-size: 11px; opacity: .9; }
#softphone .sp-corps { padding: 12px 14px; }
#softphone .sp-qui { font-weight: 700; margin-bottom: 10px; word-break: break-all; }
#softphone .sp-duree { float: right; font-family: monospace; color: var(--muted); font-weight: 400; }
#softphone .sp-actions { display: flex; gap: 8px; }
#softphone .sp-actions .btn { flex: 1; }
#softphone .sp-compose { display: flex; gap: 8px; }
#softphone .sp-compose input { flex: 1; margin: 0; }
@media (max-width: 600px) { #softphone { left: 12px; right: 12px; width: auto; } }
