:root{--hd-primary:#222;--hd-primary-text:#fff;--hd-bg:#fff;--hd-customer:#e8f0fe;--hd-agent:#f1f1f1;--hd-radius:14px;--hd-z:9999}
.hd-chat{position:fixed;right:20px;bottom:20px;z-index:var(--hd-z);font:14px/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
.hd-chat-bubble{position:relative;width:56px;height:56px;border:0;border-radius:50%;background:var(--hd-primary);color:var(--hd-primary-text);cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center}
.hd-chat-badge{position:absolute;top:-4px;right:-4px;background:#e53935;color:#fff;font-size:11px;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center}
.hd-chat-panel{position:absolute;right:0;bottom:70px;width:340px;max-width:calc(100vw - 40px);height:480px;max-height:calc(100vh - 110px);background:var(--hd-bg);border-radius:var(--hd-radius);box-shadow:0 10px 40px rgba(0,0,0,.25);display:flex;flex-direction:column;overflow:hidden}
.hd-chat-panel[hidden]{display:none}
.hd-chat-head{background:var(--hd-primary);color:var(--hd-primary-text);padding:12px 14px;display:flex;align-items:center;gap:10px}
.hd-chat-head strong{flex:1}
.hd-chat-presence{font-size:12px;opacity:1;display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;background:#f1f3f7;border:1px solid #e2e6ee;white-space:nowrap}
.hd-chat-presence i{width:9px;height:9px;border-radius:50%;background:#9aa0ac;display:inline-block;flex:0 0 9px}
.hd-chat-presence.is-online i{background:#4caf50}.hd-chat-presence.is-offline i{background:#ff9800}
.hd-chat-presence em{font-style:normal;font-weight:600;color:#2b3340;letter-spacing:.01em}
.hd-chat-close{background:none;border:0;color:inherit;font-size:22px;line-height:1;cursor:pointer;opacity:.8}
.hd-chat-start{padding:14px;display:flex;flex-direction:column;gap:8px}
.hd-chat-start input,.hd-chat-start textarea,.hd-chat-compose textarea{width:100%;border:1px solid #ddd;border-radius:8px;padding:8px 10px;font:inherit;resize:none}
.hd-chat-intro{margin:0 0 4px;color:#555;font-size:13px}
.hd-chat-thread{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px;background:#fafafa}
.hd-m{max-width:85%;padding:8px 12px;border-radius:12px;word-wrap:break-word}
.hd-m-customer{align-self:flex-end;background:var(--hd-customer);border-bottom-right-radius:4px}
.hd-m-agent,.hd-m-ai{align-self:flex-start;background:var(--hd-agent);border-bottom-left-radius:4px}
.hd-m-system{align-self:center;background:none;color:#888;font-size:12px;text-align:center;max-width:100%}
.hd-chat-compose{display:flex;gap:6px;padding:10px;border-top:1px solid #eee}
.hd-chat-compose button{border:0;background:var(--hd-primary);color:var(--hd-primary-text);border-radius:8px;width:42px;cursor:pointer}
.hd-chat-foot{text-align:center;font-size:11px;padding:0 0 8px}
.hd-chat-foot a{color:#888}
@media (max-width:480px){.hd-chat{right:12px;bottom:12px}.hd-chat-panel{width:calc(100vw - 24px)}}
.hd-chat-offline{padding:18px 16px;font-size:13px;color:#444;text-align:center}
.hd-chat-offline p{margin:0 0 10px}
.hd-chat-offline-btn{display:inline-block;margin-top:6px;padding:10px 20px;border-radius:999px;background:var(--hd-primary);color:var(--hd-primary-text)!important;text-decoration:none;font-weight:600}
.hd-chat-aibar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 12px;background:#f5f0ff;border-bottom:1px solid #e3d8ff;font-size:12px;color:#5b3fa0}
.hd-chat-aibar__txt{flex:1}
.hd-chat-human{border:1px solid #c3aeef;background:#fff;color:#5b3fa0;border-radius:999px;padding:4px 12px;font-size:12px;cursor:pointer}
.hd-chat-human:hover{background:#f0eaff}
.hd-typing{display:inline-flex!important;gap:4px;align-items:center;padding:12px 14px!important}
.hd-typing span{width:7px;height:7px;border-radius:50%;background:#b9b9c6;display:inline-block;animation:hdtype 1.2s infinite}
.hd-typing span:nth-child(2){animation-delay:.18s}
.hd-typing span:nth-child(3){animation-delay:.36s}
@keyframes hdtype{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
/* états : pastilles lisibles quel que soit le fond de l'en-tête */
.hd-chat-presence.is-online{background:#e9f7ec;border-color:#bfe6c9}
.hd-chat-presence.is-online i{background:#2e9c4a}
.hd-chat-presence.is-online em{color:#1c6b32}
.hd-chat-presence.is-ai{background:#f0eaff;border-color:#d3c2f5}
.hd-chat-presence.is-ai i{background:#7645bd}
.hd-chat-presence.is-ai em{color:#4a2f86}
.hd-chat-presence.is-offline{background:#fff3e6;border-color:#f2d6ae}
.hd-chat-presence.is-offline i{background:#e07c00}
.hd-chat-presence.is-offline em{color:#8a4b00}
/* --- Portage WordPress : le widget ne doit pas hériter des styles du thème --- */
.hd-chat,.hd-chat *{box-sizing:border-box}
.hd-chat button{text-transform:none;letter-spacing:normal;line-height:1.2;min-height:0;margin:0}
.hd-chat-bubble{padding:0}
.hd-chat-bubble svg{display:block}
.hd-chat-badge[hidden],.hd-chat-start[hidden],.hd-chat-aibar[hidden],.hd-chat-offline[hidden],.hd-chat-thread[hidden],.hd-chat-compose[hidden],.hd-chat-foot[hidden]{display:none!important}
.hd-chat-start input,.hd-chat-start textarea,.hd-chat-compose textarea{background:#fff;color:#222;font-size:14px;margin:0;box-shadow:none}
.hd-chat-submit{border:0;border-radius:8px;padding:10px 14px;background:var(--hd-primary);color:var(--hd-primary-text);font:inherit;font-weight:600;cursor:pointer}
.hd-chat-submit:hover,.hd-chat-compose button:hover{opacity:.9}
.hd-chat-thread .hd-m p{margin:0}
.hd-chat em{font-style:normal}
body.admin-bar .hd-chat{z-index:99999}

/* Message d'accueil automatique : bulle au-dessus du bouton de chat */
.hd-chat-invite{position:absolute;right:0;bottom:70px;width:280px;max-width:calc(100vw - 40px);background:var(--hd-bg);color:#222;border-radius:var(--hd-radius);border-bottom-right-radius:4px;box-shadow:0 8px 30px rgba(0,0,0,.22);animation:hd-invite-in .35s ease-out}
.hd-chat-invite-txt{display:block;width:100%;text-align:left;background:none;border:0;padding:14px 34px 14px 16px;font:inherit;font-size:15px;line-height:1.5;color:inherit;cursor:pointer}
.hd-chat-invite-x{position:absolute;top:4px;right:6px;background:none;border:0;font-size:20px;line-height:1;color:#888;cursor:pointer;padding:4px}
.hd-chat-invite-x:hover{color:#222}
.hd-chat-invite-msg{margin-bottom:6px}
@keyframes hd-invite-in{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.hd-chat-invite{animation:none}}
