/* ============================================================
   Parelo.tel — thème « console d'opérateur »
   Sombre, précis, accent émeraude (connecté/appeler), rouge (raccrocher).
   Layout : plein-fenêtre. Desktop large = panneau de marque + cadran.
   ============================================================ */
:root {
  --bg-0:#0a0e14; --bg-1:#111823; --surface:#141b26; --surface-2:#1c2735;
  --line:#273444; --line-soft:#1d2836;
  --txt:#eaf0f7; --muted:#8a97ab; --faint:#586678;
  --em:#37d99a; --em-deep:#1f9d6f; --em-glow:rgba(55,217,154,.30);
  --red:#f0616d; --red-deep:#c0343f; --amber:#f2c14e;
  --amber-glow:rgba(242,193,78,.20); --red-glow:rgba(240,97,109,.16); --faint-glow:rgba(88,102,120,.28);
  /* Présence — tokens sémantiques (mappent sur les accents) : dispo=émeraude, agent=ambre, indispo=rouge */
  --pres-dispo:var(--em);   --pres-dispo-glow:var(--em-glow);
  --pres-agent:var(--amber); --pres-agent-glow:var(--amber-glow);
  --pres-indispo:var(--red); --pres-indispo-glow:var(--red-glow);
  --key-size:clamp(58px, 15vh, 72px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --num: "SF Mono", "Segoe UI Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
}

* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
/* Scrollbars fines et thématisées (Firefox + WebKit) */
* { scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
::-webkit-scrollbar { width:9px; height:9px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--line); border-radius:9px; border:2px solid transparent; background-clip:padding-box; }
::-webkit-scrollbar-thumb:hover { background:var(--surface-2); background-clip:padding-box; }
html, body { height:100%; }
body {
  margin:0; font-family:var(--font); color:var(--txt); overflow:hidden;
  height:100dvh;
  background:
    radial-gradient(1000px 700px at 50% -20%, #16212e 0%, transparent 60%),
    radial-gradient(820px 600px at 50% 120%, #0f2019 0%, transparent 55%),
    var(--bg-0);
}
[hidden] { display:none !important; }

/* ---------- ossature : app COMPACTE (largeur téléphone), centrée ---------- */
.device { height:100dvh; display:flex; }
.stage { flex:1; display:flex; justify-content:center; min-width:0; position:relative; }

/* plus de panneau latéral : on veut un téléphone compact, pas un étalement */
.sidebar { display:none !important; }

/* Panneau interactif (login / cadran) — largeur téléphone, centré */
.panel {
  width:100%; max-width:460px; height:100dvh; min-width:0; position:relative;
  display:flex; flex-direction:column; align-items:center;
  background:linear-gradient(180deg,#141b26 0%,#0e141d 100%);
  border-left:1px solid var(--line-soft); border-right:1px solid var(--line-soft);
  box-shadow:0 0 90px -30px #000;
}
.view {
  width:100%; max-width:440px; flex:1; min-height:0; display:flex; flex-direction:column;
  padding:24px 22px calc(16px + env(safe-area-inset-bottom));
  animation:rise .4s ease both;
}
@keyframes rise { from { opacity:0; transform:translateY(8px);} to { opacity:1; transform:none; } }

/* (panneau latéral desktop retiré : l'app reste un téléphone compact et centré) */

/* ---------- Sidebar (contenu) ---------- */
.s-brand { display:flex; flex-direction:column; gap:2px; }
.s-brand h1 { font-size:24px; font-weight:800; letter-spacing:-.02em; margin:16px 0 0; }
.s-brand p { margin:2px 0 0; color:var(--muted); font-size:13px; }
.s-tag { position:relative; z-index:1; color:var(--muted); font-size:14px; line-height:1.6; max-width:230px; }
.s-tag b { color:var(--txt); font-weight:650; }
.s-foot { position:relative; z-index:1; color:var(--faint); font-size:11.5px; letter-spacing:.03em; }

/* pastille de marque (sidebar + login mobile) */
.mark { width:48px; height:48px; border-radius:14px; flex:none; display:grid; place-items:center;
  background:linear-gradient(180deg,#3fe0a4,#1f9d6f);
  box-shadow:0 0 0 1px rgba(255,255,255,.12), 0 12px 26px -10px var(--em-glow); }
.mark svg { width:28px; height:28px; fill:#08130d; }

/* ---------- Login ---------- */
.brand { display:flex; align-items:center; gap:14px; margin-top:6px; }
.brand h1 { font-size:20px; font-weight:750; margin:0; letter-spacing:-.01em; }
.brand p { margin:2px 0 0; font-size:12.5px; color:var(--muted); }
.login-body { display:flex; flex-direction:column; justify-content:center; flex:1; gap:0; }
label { font-size:11px; text-transform:uppercase; letter-spacing:.09em; color:var(--faint); margin:16px 2px 7px; display:block; }
input {
  width:100%; padding:14px; font-size:15px; color:var(--txt);
  background:var(--bg-0); border:1px solid var(--line-soft); border-radius:12px; outline:none;
  transition:border-color .15s, box-shadow .15s;
}
input:focus { border-color:var(--em-deep); box-shadow:0 0 0 3px var(--em-glow); }
/* Champ mot de passe avec œil « afficher » (mobile : aucun retour visuel de saisie) */
.pwWrap { position:relative; }
.pwWrap input { padding-right:48px; }
.pwEye {
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  border:0; background:transparent; cursor:pointer; padding:8px 10px;
  font-size:17px; line-height:1; opacity:.55;
}
.pwEye:hover, .pwEye.on { opacity:1; }
/* Bouton « Scanner un QR » (login) + overlay caméra plein écran */
.qrbtn { margin-top:10px; background:var(--bg-0); color:var(--txt); border:1px solid var(--line-soft); }
.qrscan { position:fixed; inset:0; z-index:80; background:#000; }
.qrscan[hidden] { display:none; }
.qrscan video { width:100%; height:100%; object-fit:cover; }
.qrscan-hint { position:absolute; top:20px; left:0; right:0; text-align:center; color:#fff;
  font-size:14px; text-shadow:0 1px 4px rgba(0,0,0,.9); }
.qrscan .btn { position:absolute; bottom:26px; left:50%; transform:translateX(-50%);
  width:auto; padding:12px 30px; margin:0; }
.btn {
  border:0; border-radius:13px; font-size:15px; font-weight:700; cursor:pointer;
  padding:15px; color:#062018; background:linear-gradient(180deg,#3fe0a4,#1f9d6f);
  box-shadow:0 14px 30px -14px var(--em-glow); transition:transform .08s, filter .15s;
}
.btn:active { transform:translateY(1px) scale(.99); }
.btn.block { width:100%; margin-top:26px; }
.hint { font-size:11.5px; color:var(--faint); text-align:center; margin-top:16px; line-height:1.6; }

/* ---------- Icônes (line-icons SVG, cohérence « app ») ---------- */
.ic { width:20px; height:20px; display:block; flex:none; fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.ic--fill { fill:currentColor; stroke:none; }

/* ---------- App header (barre d'onglets) ---------- */
.appbar { display:flex; align-items:center; gap:8px; padding:6px 2px 14px; border-bottom:1px solid var(--line-soft); }
/* Témoin de disponibilité = point coloré (présence) + statut, cliquable -> menu */
.status-wrap { position:relative; display:flex; min-width:0; }
.status { display:flex; align-items:center; gap:8px; min-width:0; padding:4px 7px 4px 6px; margin-left:-4px;
  border:0; background:transparent; color:inherit; cursor:pointer; border-radius:10px; transition:background .16s; }
.status:hover { background:var(--surface); }
.status .caret { width:15px; height:15px; flex:none; fill:none; stroke:var(--muted); stroke-width:2;
  stroke-linecap:round; stroke-linejoin:round; opacity:.7; }
.pip { width:9px; height:9px; border-radius:50%; flex:none; background:var(--faint);
  transition:background .3s, box-shadow .3s; }
.pip.connecting { background:var(--faint); box-shadow:0 0 0 3px var(--faint-glow); animation:pulse 1.8s infinite; }
.pip.pd-dispo   { background:var(--pres-dispo);   box-shadow:0 0 0 3px var(--pres-dispo-glow); }
.pip.pd-agent   { background:var(--pres-agent);   box-shadow:0 0 0 3px var(--pres-agent-glow); }
.pip.pd-indispo { background:var(--pres-indispo); box-shadow:0 0 0 3px var(--pres-indispo-glow); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 var(--faint-glow);} 70%{box-shadow:0 0 0 7px transparent;} 100%{box-shadow:0 0 0 0 transparent;} }
/* Menu de présence */
.presmenu { position:absolute; top:100%; left:0; z-index:60; margin-top:6px; min-width:218px;
  background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:5px;
  box-shadow:0 18px 44px -14px rgba(0,0,0,.72); }
.presmenu[hidden] { display:none; }
.presmenu button { display:flex; align-items:center; gap:10px; width:100%; padding:9px 10px; border:0;
  background:transparent; color:var(--txt); font-size:13.5px; text-align:left; border-radius:8px; cursor:pointer; }
.presmenu button:hover { background:var(--surface-2); }
.presmenu button.cur { color:var(--em); font-weight:650; }
.presmenu .pdot { width:9px; height:9px; border-radius:50%; flex:none; }
.presmenu .pd-dispo { background:var(--pres-dispo); }
.presmenu .pd-agent { background:var(--pres-agent); }
.presmenu .pd-indispo { background:var(--pres-indispo); }
.presmenu-sep { height:1px; background:var(--line); margin:5px 6px; }
.presmenu-logout { color:var(--muted); }
.presmenu-logout svg { width:15px; height:15px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.presmenu-logout:hover { color:var(--red); background:rgba(240,97,109,.08); }
.lang-sel { background:var(--bg-0); color:var(--txt); border:1px solid var(--line); border-radius:8px; padding:6px 8px; font-size:13px; cursor:pointer; }
.lang-sel:focus { outline:none; border-color:var(--em); }
.who { display:flex; flex-direction:column; line-height:1.15; min-width:0; margin-right:2px; text-align:left; }
.who .ext { font-weight:750; font-size:15px; letter-spacing:-.01em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.who .st { font-size:11px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.appbar .spacer { flex:1; min-width:4px; }

/* Contrôle segmenté : Clavier / Récents / Annuaire */
.tabs { display:flex; align-items:center; gap:2px; padding:3px; border-radius:13px;
  background:var(--bg-0); border:1px solid var(--line-soft); box-shadow:inset 0 1px 2px rgba(0,0,0,.35); }
.tab { position:relative; width:37px; height:33px; border:0; border-radius:9px; background:transparent;
  color:var(--muted); cursor:pointer; display:grid; place-items:center;
  transition:color .16s, background .16s, box-shadow .16s, transform .06s; }
.tab:hover { color:var(--txt); }
.tab:active { transform:scale(.93); }
/* onglet actif : Clavier quand aucun panneau, sinon Récents / Annuaire */
body:not(.in-call):not(.show-dir):not(.show-hist):not(.show-settings) #btnPad,
body.in-call.show-pad #btnPad,
body.show-hist #btnHist,
body.show-dir #btnDir {
  color:var(--em); background:var(--surface-2);
  box-shadow:inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.4);
}

.icon-btn { width:37px; height:37px; border-radius:11px; border:1px solid var(--line-soft);
  background:var(--surface-2); color:var(--muted); cursor:pointer; display:grid; place-items:center;
  transition:color .16s, border-color .16s, background .16s, transform .06s; }
.icon-btn:hover { color:var(--txt); border-color:var(--line); }
.icon-btn:active { transform:scale(.94); }

/* ---------- Écran (numéro / appel) ---------- */
.screen { flex:1; min-height:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:12px 4px; }
.display { font-family:var(--num); font-size:clamp(30px,8vw,40px); letter-spacing:.02em; font-variant-numeric:tabular-nums; min-height:46px; word-break:break-all; cursor:pointer; }
.display.empty { color:var(--faint); font-family:var(--font); font-size:16px; letter-spacing:0; cursor:default; }
.callmeta { display:none; flex-direction:column; align-items:center; gap:6px; }
.callmeta .party { font-size:26px; font-weight:700; }
.callmeta .cstate { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.12em; }
.callmeta .timer { font-family:var(--num); font-variant-numeric:tabular-nums; font-size:16px; color:var(--em); letter-spacing:.06em; }
body.in-call .display { display:none; }
body.in-call .callmeta { display:flex; }
.callmeta .callnum { font-family:var(--num); font-variant-numeric:tabular-nums; font-size:15px; color:var(--muted); letter-spacing:.02em; margin-top:-2px; }
.callmeta .callline { font-size:12px; color:var(--muted); }
/* En appel : le pavé DTMF est masqué par défaut ; il n'apparaît que si on bascule
   dessus via l'onglet clavier (classe show-pad). L'écran d'appel (appelant + ligne
   + minuteur) occupe alors toute la place. */
body.in-call .dialpad { display:none; }
body.in-call.show-pad .dialpad { display:grid; }
body.in-call.show-pad .screen { flex:0 0 auto; padding:6px 4px; }
body.in-call.show-pad .callmeta .party { font-size:18px; }
body.in-call.show-pad .callmeta .callline { display:none; }

/* ---------- Annuaire ---------- */
.directory { display:none; flex:1; min-height:0; overflow:hidden; padding:4px 0; }
.dir-list { overflow-y:auto; overflow-x:hidden; flex:1; min-height:0; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
.dir-list::-webkit-scrollbar { width:6px; }
.dir-list::-webkit-scrollbar-track { background:transparent; }
.dir-list::-webkit-scrollbar-thumb { background:var(--line); border-radius:8px; }
.dir-list::-webkit-scrollbar-thumb:hover { background:var(--faint); }
.dir-list::-webkit-scrollbar-thumb:active { background:var(--muted); }
body.show-dir .screen, body.show-dir .dialpad, body.show-dir .callbar,
body.show-hist .screen, body.show-hist .dialpad, body.show-hist .callbar,
body.show-settings .screen, body.show-settings .dialpad, body.show-settings .callbar { display:none; }
body.show-dir #directory { display:flex; flex-direction:column; }
body.show-hist #history { display:flex; flex-direction:column; }
body.show-settings #settings { display:flex; flex-direction:column; }
body.in-call .directory { display:none !important; }
body.show-settings #btnAudio { color:var(--em); border-color:var(--em-deep); background:rgba(55,217,154,.08); }
.dir-item { display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:12px; cursor:pointer; transition:background .12s; }
.dir-item:hover, .dir-item:active { background:var(--surface-2); }
.dir-avatar { width:40px; height:40px; border-radius:50%; flex:none; display:grid; place-items:center; font-weight:700; color:var(--em); background:radial-gradient(120% 120% at 50% 0,#243244,#161e2a); }
.dir-meta { display:flex; flex-direction:column; line-height:1.3; flex:1; min-width:0; }
.dir-name { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dir-ext { font-family:var(--num); font-size:12px; color:var(--muted); }
.dir-call { color:var(--em); font-size:17px; flex:none; }
.dir-section { font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--faint); font-weight:600; padding:12px 12px 5px; }
.dir-search { flex:none; margin:2px 6px 6px; padding:10px 12px; font-size:14px; color:inherit; background:var(--surface-2); border:1px solid transparent; border-radius:12px; outline:none; }
.dir-search:focus { border-color:var(--em-deep); }
.dir-search::placeholder { color:var(--faint); }
.dir-contact { padding:8px 4px 4px; }
/* Hiérarchie de l'annuaire : l'ORGANISATION est un en-tête de groupe (avatar 🏢,
   filet au-dessus), ses fiches s'indentent dessous avec un guide vertical. */
.dir-org { margin-top:6px; border-top:1px solid var(--surface-2); padding-top:10px; }
.dir-org .dir-avatar { border-radius:12px; font-size:18px; }
.dir-org .dir-name { text-transform:uppercase; letter-spacing:.04em; font-size:13px; }
.dir-in-org { margin-left:20px; padding-left:8px; border-left:2px solid var(--surface-2); }
.dir-in-org .dir-avatar { width:30px; height:30px; font-size:13px; }
.dir-in-org .dir-nums { padding-left:42px; }
.dir-chead { display:flex; align-items:center; gap:12px; padding:3px 8px; }
.dir-chead .dir-meta .dir-ext { color:var(--muted); }
.dir-nums { display:flex; flex-direction:column; gap:2px; padding:2px 0 6px 52px; }
.dir-num { display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:transparent; border:0; color:inherit; font:inherit; padding:8px 12px; border-radius:10px; cursor:pointer; }
.dir-num:hover, .dir-num:active { background:var(--surface-2); }
.num-meta { display:flex; flex-direction:column; line-height:1.25; flex:1; min-width:0; }
.num-label { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--faint); }
.num-phone { font-family:var(--num); font-size:14px; }
.dir-empty { display:none; color:var(--faint); text-align:center; padding:34px 12px; font-size:14px; }

/* ---------- Historique (Récents) ---------- */
.icon-btn { position:relative; }
.badge { position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px; border-radius:999px;
  background:var(--red); color:#fff; font-size:10px; font-weight:700; line-height:16px; text-align:center; box-shadow:0 0 0 2px var(--bg-0); }
.hist-head { display:flex; align-items:center; justify-content:space-between; padding:6px 10px 8px; }
.hist-title { font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--faint); font-weight:600; }
.hist-clear { background:transparent; border:0; color:var(--muted); font:inherit; font-size:12px; cursor:pointer; padding:4px 6px; border-radius:8px; }
.hist-clear:hover { color:var(--em); }
.hist-item { display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:12px; cursor:pointer; transition:background .12s; }
.hist-item:hover, .hist-item:active { background:var(--surface-2); }
.hist-dir { width:40px; height:40px; border-radius:50%; flex:none; display:grid; place-items:center; font-size:18px; font-weight:700;
  color:var(--em); background:radial-gradient(120% 120% at 50% 0,#243244,#161e2a); }
.hist-missed .hist-dir { color:var(--red); }
.hist-missed .dir-name { color:var(--red); }
.hist-ai { color:var(--amber); font-size:10.5px; font-weight:700; letter-spacing:.02em; }
.hist-ai-call .hist-dir { color:var(--amber); }

/* ---------- Réglages audio (périphériques) ---------- */
.set-list { display:flex; flex-direction:column; gap:22px; padding:10px 12px 16px; overflow:auto; }
/* Sections de réglages (extensible) */
.set-section { display:flex; flex-direction:column; gap:9px; }
.set-body { display:flex; flex-direction:column; gap:11px; }
.set-section.collapsed .set-body { display:none; }
.set-head { display:flex; align-items:center; gap:7px; width:100%; padding:2px; margin:0; border:0; background:transparent;
  font-size:10.5px; text-transform:uppercase; letter-spacing:.11em; color:var(--faint); font-weight:700; cursor:pointer; text-align:left; }
.set-head:hover { color:var(--muted); }
.set-head .sec-caret { width:13px; height:13px; flex:none; fill:none; stroke:currentColor; stroke-width:2.4;
  stroke-linecap:round; stroke-linejoin:round; transform:rotate(90deg); transition:transform .16s; }
.set-section.collapsed .set-head .sec-caret { transform:rotate(0deg); }
/* Ligne label ↔ contrôle (toggle / bouton), alignée horizontalement.
   Sélecteur .set-row.set-toggle (spécificité 0,2,0) pour battre .set-row{flex-direction:column}
   quelle que soit la position dans le fichier. */
.set-row.set-toggle { flex-direction:row; align-items:center; justify-content:space-between; gap:14px; }
.set-row.set-toggle .tg-lbl { display:flex; flex-direction:column; gap:2px; min-width:0;
  text-transform:none; letter-spacing:0; font-size:13.5px; font-weight:500; color:var(--txt); }
.set-row.set-toggle .tg-lbl small { font-size:11.5px; font-weight:400; color:var(--muted); }
/* Interrupteur on/off */
.toggle { position:relative; display:inline-flex; width:42px; height:24px; flex:none; }
.toggle input { position:absolute; inset:0; width:100%; height:100%; opacity:0; margin:0; cursor:pointer; z-index:1; }
.toggle .track { position:absolute; inset:0; border-radius:999px; background:var(--surface-2); border:1px solid var(--line); transition:background .18s, border-color .18s; }
.toggle .track::after { content:""; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%;
  background:var(--muted); transition:transform .18s, background .18s; }
.toggle input:checked ~ .track { background:var(--em-deep); border-color:var(--em); }
.toggle input:checked ~ .track::after { transform:translateX(18px); background:#effbf5; }
.toggle input:focus-visible ~ .track { box-shadow:0 0 0 3px var(--em-glow); }
.set-row { display:flex; flex-direction:column; gap:7px; }
.set-row > span { font-size:11px; text-transform:uppercase; letter-spacing:.07em; color:var(--faint); font-weight:600; }
.set-row select { width:100%; padding:11px 12px; font-size:14px; color:var(--txt); background:var(--surface-2);
  border:1px solid transparent; border-radius:10px; outline:none; appearance:none; cursor:pointer; }
.set-row select:focus { border-color:var(--em-deep); }
.set-inline { display:flex; gap:8px; align-items:center; }
.set-inline select { flex:1; }
.set-inline .hist-clear { flex:none; border:1px solid var(--em-deep); color:var(--em); padding:8px 12px; }
.set-note { color:var(--faint); font-size:12px; line-height:1.5; margin:2px 2px 0; }

/* ---------- Pavé ---------- */
.dialpad { display:grid; grid-template-columns:repeat(3,1fr); gap:13px 14px; padding:6px 6px 12px; justify-items:center; max-width:320px; width:100%; margin:0 auto; }
.key {
  position:relative; width:var(--key-size); height:var(--key-size); border-radius:50%;
  border:1px solid var(--line-soft); background:radial-gradient(130% 130% at 50% 0,#232f40,#141c28);
  color:var(--txt); cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:center;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 2px 6px -3px rgba(0,0,0,.6);
  transition:transform .07s ease, background .16s, border-color .16s, box-shadow .16s;
}
.key:hover { border-color:var(--line); box-shadow:inset 0 1px 0 rgba(255,255,255,.07), 0 3px 10px -4px rgba(0,0,0,.7); }
.key:active { transform:scale(.92); border-color:var(--em-deep);
  background:radial-gradient(130% 130% at 50% 0,#2c3d52,#1a2431);
  box-shadow:inset 0 0 0 1px var(--em-glow), inset 0 2px 6px rgba(0,0,0,.5); }
.key .d { font-family:var(--num); font-size:26px; font-weight:600; line-height:1; letter-spacing:.01em; }
.key .l { font-size:8.5px; letter-spacing:.18em; color:var(--faint); margin-top:3px; height:9px; text-indent:.18em; }

/* ---------- Barre d'action ---------- */
.callbar { padding:6px 0 4px; display:flex; flex-direction:column; gap:14px; max-width:320px; width:100%; margin:0 auto; }
.incall-ctrls { display:none; justify-content:center; gap:8px; }
body.in-call .incall-ctrls { display:flex; }
.ctrl { flex:1; border:1px solid var(--line-soft); background:var(--surface-2); color:var(--muted);
  border-radius:14px; padding:10px 6px; font-size:10.5px; font-weight:600; letter-spacing:.01em; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:5px; transition:color .15s, border-color .15s, background .15s, transform .07s; }
.ctrl .g { display:grid; place-items:center; }
.ctrl .g .ic { width:19px; height:19px; }
.ctrl:hover { color:var(--txt); border-color:var(--line); }
.ctrl.active { color:var(--amber); border-color:var(--amber); background:rgba(242,193,78,.10); }
/* Enregistrement en cours : rouge qui pulse — l'agent doit VOIR que ça tourne */
.ctrl.rec-on { color:#f0616d; border-color:#f0616d; background:rgba(240,97,109,.10); }
.ctrl.rec-on .g { animation:recblink 1.3s ease-in-out infinite; }
@keyframes recblink { 50% { opacity:.35; } }
#btnHandsFree.active { color:var(--em); border-color:var(--em); background:var(--em-glow); }
.ctrl:active { transform:scale(.95); }

.bigbtn { height:66px; border:0; border-radius:19px; font-size:16px; font-weight:750; letter-spacing:.01em; cursor:pointer; color:#fff;
  display:flex; align-items:center; justify-content:center; gap:10px; transition:transform .09s ease, filter .15s, box-shadow .15s; }
.bigbtn .g { display:grid; place-items:center; }
.bigbtn .g .ic { width:22px; height:22px; }
.bigbtn:hover { filter:brightness(1.05); }
.bigbtn:active { transform:translateY(1px) scale(.985); }
.bigbtn:disabled { opacity:.4; cursor:not-allowed; filter:none; }
.call { background:linear-gradient(180deg,#3fe0a4,#1f9d6f); color:#062018; box-shadow:0 16px 34px -16px var(--em-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.hang { background:linear-gradient(180deg,#f4747f,#c0343f); box-shadow:0 16px 34px -16px rgba(240,97,109,.4), inset 0 1px 0 rgba(255,255,255,.2); }
body.in-call #btnCall { display:none; }
body:not(.in-call) #btnHang { display:none; }

/* ---------- Appel entrant ---------- */
.incoming { position:absolute; inset:0; z-index:6; background:linear-gradient(180deg,#0f2a1f,#0a0e14);
  display:flex; flex-direction:column; align-items:center; justify-content:center; padding:32px; animation:rise .25s ease both; }
.incoming .avatar { width:104px; height:104px; border-radius:50%; margin-bottom:16px; display:grid; place-items:center;
  background:radial-gradient(120% 120% at 50% 0,#37d99a,#1f9d6f); color:#062018; font-size:42px; font-weight:800;
  animation:ringpulse 1.4s ease-in-out infinite; }
@keyframes ringpulse { 0%,100%{ box-shadow:0 0 0 0 var(--em-glow);} 50%{ box-shadow:0 0 0 24px transparent;} }
.incoming .lbl { font-size:12px; letter-spacing:.16em; text-transform:uppercase; color:var(--muted); }
.incoming .from { font-size:28px; font-weight:750; margin:6px 0 3px; }
.incoming .incnum { font-family:var(--num); font-size:14px; color:var(--muted); min-height:16px; margin-bottom:28px; }
/* Ligne appelée (DID + libellé) : chip discret sous le numéro, quand l'appel est routé. */
.incoming .incnum:has(+ .incline:not([hidden])) { margin-bottom:8px; }
.incoming .incline { max-width:90%; margin-bottom:26px; padding:5px 13px; border-radius:999px; font-size:13px;
  color:var(--em); background:rgba(55,217,154,.10); border:1px solid var(--em-deep); text-align:center; }
.incoming .incline[hidden] { display:none; }
.incoming .row { display:flex; gap:26px; align-items:center; }
.rbtn { width:72px; height:72px; border-radius:50%; border:0; cursor:pointer; color:#fff; display:grid; place-items:center; transition:transform .08s; flex:none; }
.rbtn .ic { width:30px; height:30px; stroke-width:2; }
.rbtn:active { transform:scale(.95); }
.rbtn.acc { background:linear-gradient(180deg,#3fe0a4,#1f9d6f); color:#062018; box-shadow:0 14px 28px -12px var(--em-glow); animation:bob 1.4s ease-in-out infinite; }
.rbtn.rej { background:linear-gradient(180deg,#f4747f,#c0343f); box-shadow:0 14px 28px -12px rgba(240,97,109,.4); }
/* Bouton « Agent IA » (bascule vers le voicebot) — plus petit, accent ambre */
.rbtn.ai { width:56px; height:56px; background:var(--surface-2); color:var(--amber); border:1px solid var(--amber); }
.rbtn.ai .ic { width:24px; height:24px; }
@keyframes bob { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-5px);} }
.rlabel { display:flex; gap:26px; margin-top:10px; align-items:flex-start; }
.rlabel span { width:72px; text-align:center; font-size:11px; color:var(--muted); }
.rlabel.rlabel-3 span:nth-child(2) { width:56px; }

/* ---- Transfert supervisé / conférence (consultation) ---- */
.xfer { background:linear-gradient(180deg,#12203a,#0a0e14); justify-content:flex-start; padding:22px 18px 18px; }
.xfer-pick, .xfer-live { display:flex; flex-direction:column; width:100%; flex:1; min-height:0; }
.xfer-pick[hidden], .xfer-live[hidden] { display:none; }
.xfer .lbl { flex:none; margin-bottom:12px; text-align:center; }
.xfer .dir-search { width:100%; margin:0 0 8px; box-sizing:border-box; }
.xfer-list { width:100%; flex:1; min-height:0; }
.xfer-dial { flex:none; width:100%; margin:0 0 8px; padding:11px 12px; box-sizing:border-box; cursor:pointer;
  font-size:14px; font-weight:650; color:var(--em); background:rgba(55,217,154,.10);
  border:1px solid var(--em-deep); border-radius:12px; text-align:left; }
.xfer-dial:active { transform:scale(.99); }
.xfer-close { flex:none; margin-top:10px; padding:9px; cursor:pointer; font-size:13px; color:var(--muted);
  background:transparent; border:1px solid var(--line); border-radius:12px; }
/* Étape 2 : consultation en cours (A en attente + B) */
.xfer-live { align-items:center; justify-content:center; text-align:center; gap:4px; }
.xlive-hold { font-size:13px; color:var(--muted); background:var(--surface-2); border:1px solid var(--line);
  padding:5px 13px; border-radius:999px; margin-bottom:14px; }
.xfer-live .from { font-size:26px; font-weight:750; }
.xfer-live .cstate { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.12em; margin-bottom:26px; }
.xfer-actions { display:flex; flex-direction:column; gap:12px; width:100%; max-width:300px; }
.xact { padding:15px; border:0; border-radius:14px; cursor:pointer; font-size:15px; font-weight:700; transition:transform .08s; }
.xact:active { transform:scale(.98); }
.xact-ok { background:linear-gradient(180deg,#3fe0a4,#1f9d6f); color:#062018; box-shadow:0 14px 28px -14px var(--em-glow); }
.xact-conf { background:var(--surface-2); color:var(--amber); border:1px solid var(--amber); }
.xact-cancel { background:transparent; color:var(--muted); border:1px solid var(--line); }

/* ---------- Divers ---------- */
.log { position:absolute; left:0; right:0; bottom:0; max-height:36%; overflow:auto; background:#070a0eee; border-top:1px solid var(--line);
  font-family:var(--num); font-size:10.5px; color:var(--faint); padding:8px 12px; white-space:pre-wrap; z-index:7; }
.toast { position:absolute; left:50%; top:16px; transform:translateX(-50%); background:#0b0f16; border:1px solid var(--line);
  color:var(--txt); font-size:12.5px; padding:9px 15px; border-radius:11px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:9; box-shadow:0 10px 24px -12px #000; }
.toast.show { opacity:1; }
.appver { text-align:center; color:var(--faint); font-size:11px; letter-spacing:.03em; margin:10px 2px 0; font-family:var(--num); }

/* ---------- Accessibilité : focus clavier soigné ---------- */
:focus-visible { outline:none; }
.tab:focus-visible, .icon-btn:focus-visible, .key:focus-visible,
.ctrl:focus-visible, .bigbtn:focus-visible, .rbtn:focus-visible,
.dir-item:focus-visible, .hist-item:focus-visible, .dir-num:focus-visible,
.hist-clear:focus-visible, .btn:focus-visible {
  box-shadow:0 0 0 2px var(--bg-0), 0 0 0 4px var(--em-glow);
}
input:focus-visible, select:focus-visible { border-color:var(--em-deep); box-shadow:0 0 0 3px var(--em-glow); }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
  .view { animation:none !important; }
}

/* ---------- Installation (écran de connexion) ----------
   Proposée sous le formulaire : c'est le seul moment où l'utilisateur n'a rien
   d'autre à faire. Chaque bloc est masqué par le script s'il n'a pas lieu d'être
   (déjà installé, navigateur qui ne sait pas installer, installeur Windows absent
   du serveur) — on n'annonce jamais un téléchargement qui n'existe pas. */
.install { margin-top:30px; padding-top:24px; border-top:1px solid var(--line-soft); }
.install h2 { font-size:14px; font-weight:700; margin:0 0 4px; color:var(--txt); letter-spacing:.01em; }
.install .hint { text-align:left; margin-top:0; }
.inst-grille { display:grid; gap:10px; margin-top:16px; }
.inst-carte {
  display:flex; align-items:center; gap:13px; width:100%; text-align:left;
  padding:13px 15px; border-radius:13px; border:1px solid var(--line);
  background:var(--surface); color:var(--txt); text-decoration:none;
  font:inherit; cursor:pointer; transition:border-color .15s, transform .15s, background .15s;
}
.inst-carte:hover { border-color:var(--em-deep); background:var(--surface-2); transform:translateY(-1px); }
.inst-carte .inst-ic { font-size:21px; line-height:1; flex:none; width:34px; text-align:center; }
.inst-carte b { display:block; font-size:14px; font-weight:650; }
.inst-carte em { display:block; font-style:normal; font-size:11.5px; color:var(--muted); margin-top:2px; line-height:1.5; }
.inst-carte a { display:inline-block; margin-top:5px; font-size:11.5px; color:var(--em); text-decoration:none; }
.inst-carte a:hover { text-decoration:underline; }
/* Le QR n'est pas cliquable : il se scanne avec l'AUTRE appareil. */
.inst-qr { cursor:default; align-items:center; }
.inst-qr:hover { transform:none; border-color:var(--line); background:var(--surface); }
.inst-qr img { border-radius:8px; background:#fff; padding:6px; flex:none; }
@media (max-width:420px) { .inst-qr img { width:70px; height:70px; } }
/* Logo de plateforme dans les cartes d'installation. */
.inst-carte .inst-ic svg { width:22px; height:22px; display:block; margin:0 auto; }
.inst-titre-and { display:flex; align-items:center; gap:6px; }
.inst-ic-and svg { width:15px; height:15px; display:block; color:var(--em); }
/* Carte annoncée mais pas encore téléchargeable : visible, jamais cliquable —
   un lien mort serait pire que l'attente annoncée. */
.inst-carte.inerte { opacity:.5; cursor:default; }
.inst-carte.inerte:hover { transform:none; border-color:var(--line); background:var(--surface); }
