/* =====================================================================
   KAPTY — THÈME MODERNE — lanceur A « Aperçu message » + fenêtre 1d « Messagerie »
   À charger APRÈS chat.css. Réutilise les variables gérées par l'admin.
   ===================================================================== */

/* ---------- Conteneur ---------- */
#ahg-sc-container {
  bottom: max(24px, env(safe-area-inset-bottom));
  right: max(24px, env(safe-area-inset-right));
  z-index: 999999 !important;
}
#ahg-sc-container #ahg-sc-window,
#ahg-sc-container #ahg-sc-bubble-button,
#kapty-teaser {
  z-index: 999999 !important;
}

/* ---------- Lanceur rond ---------- */
#ahg-sc-container #ahg-sc-bubble-button {
  width: 60px !important; height: 60px !important;
  padding: 0 !important; gap: 0 !important;
  justify-content: center !important;
  border-radius: 50% !important;
  box-shadow: 0 10px 24px -6px rgba(15,17,21,.35), 0 2px 6px rgba(15,17,21,.12) !important;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1) !important;
  opacity: 1 !important; pointer-events: auto !important;
}
#ahg-sc-container #ahg-sc-bubble-button:hover  { transform: scale(1.07) !important; }
#ahg-sc-container #ahg-sc-bubble-button:active { transform: scale(.95) !important; }
/* le bouton reste visible quand le chat est ouvert (il sert à refermer) */
#ahg-sc-container #ahg-sc-bubble-button.hidden,
#ahg-sc-container #ahg-sc-bubble-button.is-hiding { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }

/* libellé texte masqué visuellement (conservé en aria-label par le JS) */
#ahg-sc-bubble-button > span:not(.ahg-sc-bubble-icon):not(.ahg-btn-notif):not(.kapty-close-icon) { display: none !important; }

/* icônes superposées : bulle ↔ chevron */
#ahg-sc-bubble-button .ahg-sc-bubble-icon,
#ahg-sc-bubble-button .kapty-close-icon {
  position: absolute; inset: 0;
  display: flex !important; align-items: center; justify-content: center;
  transition: opacity .25s ease, transform .4s cubic-bezier(.34,1.56,.64,1);
}
#ahg-sc-bubble-button .ahg-sc-bubble-icon svg { width: 26px !important; height: 26px !important; }
#ahg-sc-bubble-button .kapty-close-icon { opacity: 0; transform: rotate(90deg) scale(.5); }
#ahg-sc-bubble-button .kapty-close-icon svg { width: 22px; height: 22px; fill: none !important; stroke: currentColor; }
#ahg-sc-bubble-button.is-open .ahg-sc-bubble-icon { opacity: 0; transform: rotate(-90deg) scale(.5); }
#ahg-sc-bubble-button.is-open .kapty-close-icon  { opacity: 1; transform: none; }

/* ---------- Badge de notification « 1 » ---------- */
#ahg-sc-bubble-button .ahg-btn-notif {
  top: -3px !important; right: -3px !important;
  min-width: 20px; width: auto !important; height: 20px !important;
  padding: 0 5px; box-sizing: border-box;
  border-radius: 999px !important;
  background: #ef4444 !important; border: 2px solid #fff !important;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600; line-height: 1;
  animation: kapty-pop .45s cubic-bezier(.34,1.56,.64,1) .6s both !important;
}
#ahg-sc-bubble-button .ahg-btn-notif::after { content: "1"; }
#ahg-sc-bubble-button.kapty-badge-wait .ahg-btn-notif { display: none !important; }
#ahg-sc-bubble-button.kapty-badge-in .ahg-btn-notif { animation: kapty-pop .45s cubic-bezier(.34,1.56,.64,1) both !important; }
#ahg-sc-bubble-button.kapty-badge-static .ahg-btn-notif { animation: none !important; }
#ahg-sc-bubble-button.is-open .ahg-btn-notif { display: none; }

/* ---------- Carte d'aperçu (injectée par kapty-modern.js) ---------- */
#kapty-teaser {
  position: absolute; right: 0; bottom: 76px;
  width: 268px; max-width: calc(100vw - 48px); box-sizing: border-box;
  background: #fff; border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 16px 40px -10px rgba(15,17,21,.25), 0 1px 3px rgba(15,17,21,.08);
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; font-family: var(--ahg-body-font, var(--ahg-font-family));
  transform-origin: 100% 100%;
  opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none;
  transition: opacity .3s ease, transform .5s cubic-bezier(.34,1.56,.64,1);
}
#kapty-teaser.is-visible { opacity: 1; transform: none; pointer-events: auto; }
#kapty-teaser .kapty-teaser-head { display: flex; align-items: center; gap: 8px; }
#kapty-teaser .kapty-teaser-avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  background: var(--ahg-header-bg); color: var(--ahg-header-color);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
}
#kapty-teaser .kapty-teaser-name { font-size: 13px; font-weight: 600; color: #0b0b0f; }
#kapty-teaser .kapty-teaser-time { font-size: 12px; color: #9ca3af; }
#kapty-teaser .kapty-teaser-close {
  margin-left: auto; width: 24px; height: 24px; padding: 0 !important;
  border: none !important; border-radius: 50% !important; background: #f3f4f6 !important;
  color: #6b7280 !important; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#kapty-teaser .kapty-teaser-text { font-size: 14px; line-height: 1.45; color: #1f2937; white-space: pre-line; text-wrap: pretty; margin: 0; }

/* ---------- Fenêtre : ouverture « jaillit du bouton » ---------- */
#ahg-sc-container #ahg-sc-window,
#ahg-sc-container #ahg-sc-window.ahg-hidden { display: flex !important; }
#ahg-sc-container #ahg-sc-window {
  bottom: 80px;
  height: min(620px, calc(100vh - 128px)); max-height: none;
  border-radius: 22px;
  box-shadow: 0 24px 60px -12px rgba(15,17,21,.28), 0 2px 6px rgba(15,17,21,.08);
  transform-origin: 100% 100%;
  opacity: 0 !important; visibility: hidden;
  transform: translateY(12px) scale(.55) !important;
  pointer-events: none !important;
  transition: transform .28s cubic-bezier(.4,0,1,1), opacity .22s ease, visibility 0s linear .28s !important;
}
#ahg-sc-container #ahg-sc-window.active {
  opacity: 1 !important; visibility: visible;
  transform: none !important; pointer-events: auto !important;
  transition: transform .55s cubic-bezier(.34,1.45,.64,1), opacity .2s ease, visibility 0s !important;
}
#ahg-sc-container #ahg-sc-window.ahg-expanded { width: 480px; height: min(820px, calc(100vh - 128px)); }

/* contenu en cascade */
#ahg-sc-window #ahg-sc-header,
#ahg-sc-window #ahg-sc-messages,
#ahg-sc-window #ahg-sc-input,
#ahg-sc-window #ahg-sc-branding {
  opacity: 0; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
}
#ahg-sc-window.active #ahg-sc-header,
#ahg-sc-window.active #ahg-sc-messages,
#ahg-sc-window.active #ahg-sc-input,
#ahg-sc-window.active #ahg-sc-branding {
  opacity: 1; transform: none;
  transition: opacity .35s ease var(--kd, .12s), transform .45s cubic-bezier(.2,.8,.2,1) var(--kd, .12s);
}
#ahg-sc-window.active #ahg-sc-messages { --kd: .19s; }
#ahg-sc-window.active #ahg-sc-input,
#ahg-sc-window.active #ahg-sc-branding { --kd: .26s; }

/* ---------- Barre de défilement discrète (sans fond) ---------- */
#ahg-sc-window #ahg-sc-messages::-webkit-scrollbar,
#ahg-sc-window .ahg-sc-lead-card::-webkit-scrollbar,
#ahg-sc-rgpd ::-webkit-scrollbar { width: 6px; height: 6px; }
#ahg-sc-window #ahg-sc-messages::-webkit-scrollbar-track,
#ahg-sc-window .ahg-sc-lead-card::-webkit-scrollbar-track,
#ahg-sc-rgpd ::-webkit-scrollbar-track { background: transparent; }
#ahg-sc-window #ahg-sc-messages::-webkit-scrollbar-thumb,
#ahg-sc-window .ahg-sc-lead-card::-webkit-scrollbar-thumb,
#ahg-sc-rgpd ::-webkit-scrollbar-thumb { background: rgba(15,17,21,.16); border-radius: 999px; }
#ahg-sc-window #ahg-sc-messages::-webkit-scrollbar-thumb:hover,
#ahg-sc-window .ahg-sc-lead-card::-webkit-scrollbar-thumb:hover,
#ahg-sc-rgpd ::-webkit-scrollbar-thumb:hover { background: rgba(15,17,21,.3); }
/* Firefox (réservé à Firefox : ces propriétés désactiveraient le style ci-dessus dans Chrome) */
@supports (-moz-appearance: none) {
  #ahg-sc-window #ahg-sc-messages,
  #ahg-sc-window .ahg-sc-lead-card,
  #ahg-sc-rgpd * { scrollbar-width: thin; scrollbar-color: rgba(15,17,21,.2) transparent; }
}

/* ---------- Fond de fenêtre (style messagerie) ---------- */
#ahg-sc-container #ahg-sc-window { background: #f6f7f9; }

/* ---------- En-tête centré ---------- */
#ahg-sc-window #ahg-sc-topbar {
  top: 10px; left: 10px; right: 10px; height: 32px; padding: 0;
  gap: 2px; background: transparent; color: #6b7280; border-radius: 0; z-index: 60;
}
#ahg-sc-window #ahg-sc-header {
  margin-top: 0 !important;
  flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 56px 14px;
  background: #fff; color: #0b0b0f;
  border-bottom: 1px solid #eef0f3; text-align: center;
}
#ahg-sc-window #ahg-sc-expand,
#ahg-sc-window #ahg-sc-info,
#ahg-sc-window #ahg-sc-close {
  width: 32px; height: 32px; margin: 0 !important;
  color: #6b7280 !important; border-radius: 10px !important; transition: background .2s, color .2s;
}
#ahg-sc-window #ahg-sc-expand { margin-right: auto !important; }
#ahg-sc-window #ahg-sc-expand:hover,
#ahg-sc-window #ahg-sc-info:hover,
#ahg-sc-window #ahg-sc-close:hover { background: #f3f4f6 !important; color: #0b0b0f !important; opacity: 1; }

#ahg-sc-window #ahg-sc-expand::before,
#ahg-sc-window #ahg-sc-info::before,
#ahg-sc-window #ahg-sc-close::before {
  content: ""; width: 17px; height: 17px; display: block;
  background: currentColor;
  -webkit-mask: var(--ki) center / contain no-repeat; mask: var(--ki) center / contain no-repeat;
}
#ahg-sc-window #ahg-sc-expand { --ki: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E"); }
#ahg-sc-window #ahg-sc-expand.is-expanded { --ki: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7'/%3E%3C/svg%3E"); }
#ahg-sc-window #ahg-sc-info   { --ki: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); }
#ahg-sc-window #ahg-sc-close  { --ki: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }

/* avatar (photo admin, ou pastille initiale injectée par le JS) */
#ahg-sc-window #ahg-sc-header .ahg-sc-photo,
#ahg-sc-window #ahg-sc-header .kapty-avatar {
  width: 48px; height: 48px; border-radius: 50%;
}
#ahg-sc-window #ahg-sc-header .kapty-avatar {
  background: var(--ahg-header-bg); color: var(--ahg-header-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; flex-shrink: 0;
}
#ahg-sc-window .ahg-sc-title-wrap { align-items: center; gap: 4px; }
#ahg-sc-window #ahg-sc-header .ahg-sc-title  { font-size: 15px; font-weight: 600; line-height: 1.25; color: #0b0b0f; }
#ahg-sc-window #ahg-sc-header .ahg-sc-status { font-size: 12px; color: #6b7280; opacity: 1; }
/* le point de statut chevauche le bord de l'avatar (bas-droite, à 45°), sans halo */
#ahg-sc-window #ahg-sc-header .ahg-sc-dot {
  position: absolute; top: 48px; left: calc(50% + 8px);
  width: 11px; height: 11px; border: 2px solid #fff; box-sizing: content-box;
  animation: none !important; box-shadow: none !important;
}

/* ---------- Messages ---------- */
#ahg-sc-window #ahg-sc-messages { padding: 16px 14px; gap: 6px; background: #f6f7f9; }
#ahg-sc-window .ahg-sc-msg {
  position: relative;
  padding: 10px 14px; font-size: 14px; line-height: 1.45;
  animation: kapty-in .4s cubic-bezier(.2,.8,.2,1) both;
}
#ahg-sc-messages .ahg-sc-msg.ahg-sc-bot {
  margin-left: 34px; max-width: calc(88% - 34px);
  border-radius: 18px 18px 18px 6px;
  background: var(--ahg-bot-bubble-color, #fff) !important;
  box-shadow: 0 1px 2px rgba(15,17,21,.06);
}
#ahg-sc-messages .ahg-sc-msg.ahg-sc-user { border-radius: 18px 18px 6px 18px; }

/* avatar à gauche du dernier message d'une série */
#ahg-sc-messages .ahg-sc-msg.ahg-sc-bot::before {
  content: var(--kapty-initial, "");
  position: absolute; left: -34px; bottom: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ahg-header-bg) var(--kapty-avatar-img, none) center / cover no-repeat;
  color: var(--ahg-header-color);
  font-size: 10px; font-weight: 600; line-height: 26px; text-align: center;
}
/* heure sous le dernier message d'une série */
#ahg-sc-messages .ahg-sc-msg[data-kapty-time]::after {
  content: attr(data-kapty-time);
  position: absolute; bottom: -18px; left: 0;
  font-size: 11px; color: #9ca3af; white-space: nowrap;
}
#ahg-sc-messages .ahg-sc-msg.ahg-sc-user[data-kapty-time]::after { content: "Lu · " attr(data-kapty-time); left: auto; right: 0; }
#ahg-sc-messages .ahg-sc-msg[data-kapty-time] { margin-bottom: 18px; }
#ahg-sc-messages .ahg-sc-bot:has(+ .ahg-sc-bot)::before,
#ahg-sc-messages .ahg-sc-bot:has(+ .ahg-sc-bot)::after,
#ahg-sc-messages .ahg-sc-user:has(+ .ahg-sc-user)::after { display: none; }
#ahg-sc-messages .ahg-sc-bot:has(+ .ahg-sc-bot),
#ahg-sc-messages .ahg-sc-user:has(+ .ahg-sc-user) { margin-bottom: 0; }

/* réponses proposées alignées sous les bulles */
#ahg-sc-window .ahg-sc-option {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 0 34px; max-width: calc(88% - 34px);
  padding: 8px 14px;
  font-size: 13px; font-weight: 500; line-height: 1.35;
  border: none !important; border-radius: 999px;
  background: #fff !important;
  box-shadow: inset 0 0 0 1.5px var(--ahg-bot-action-color, #1677ff);
  transition: background .25s ease, color .25s ease, box-shadow .25s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
  /* arrivée en escalier : --kapty-i est posé par kapty-modern.js */
  animation: kapty-in .35s cubic-bezier(.2,.8,.2,1) both;
  /* .6s de pause après le message du bot, puis 160ms entre chaque réponse */
  animation-delay: calc(.6s + var(--kapty-i, 0) * 160ms);
}
/* survol : remplissage plein aux couleurs de l'admin, sans ombre */
#ahg-sc-window .ahg-sc-option:hover {
  background: var(--ahg-bot-action-hover-color, #1677ff) !important;
  color: var(--ahg-bot-action-hover-text-color, #fff) !important;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1.5px var(--ahg-bot-action-hover-color, #1677ff);
}
#ahg-sc-window .ahg-sc-option:active { transform: scale(.97); }
/* choix validé : remplissage plein (couleurs admin) */
#ahg-sc-window .ahg-sc-option-selected {
  background: var(--ahg-bot-action-hover-color, #1677ff) !important;
  color: var(--ahg-bot-action-hover-text-color, #fff) !important;
}
#ahg-sc-window .ahg-sc-link-preview { margin-left: 34px; max-width: calc(94% - 34px); }
/* icône retour : carré = couleur du texte, flèche = fond de la pilule (évidée) */
#ahg-sc-window .kapty-back-icon { width: 18px; height: 18px; flex-shrink: 0; display: block; }
#ahg-sc-window .kapty-back-icon path { fill: currentColor; }

/* ---------- Indicateur « en train d'écrire » ---------- */
#ahg-sc-messages .ahg-sc-msg.kapty-typing {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 13px 14px;
  animation: kapty-in .3s ease both;
}
#ahg-sc-messages .ahg-sc-msg.kapty-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9ca3af;
  animation: kapty-dot 1.2s infinite;
}
#ahg-sc-messages .ahg-sc-msg.kapty-typing span:nth-child(2) { animation-delay: .15s; }
#ahg-sc-messages .ahg-sc-msg.kapty-typing span:nth-child(3) { animation-delay: .3s; }
/* options masquées tant que le bot « écrit » */
#ahg-sc-messages.kapty-is-typing .ahg-sc-option { display: none !important; }

/* ---------- Zone de saisie ---------- */
#ahg-sc-window #ahg-sc-input {
  padding: 10px 14px 4px 18px; gap: 8px;
  background: #fff; border-top: 1px solid #eef0f3;
}
#ahg-sc-window #ahg-sc-text,
#ahg-sc-window #ahg-sc-text:hover,
#ahg-sc-window #ahg-sc-text:focus {
  padding: 10px 0; min-width: 0;
  background: transparent !important; box-shadow: none !important; border-radius: 0;
}
#ahg-sc-window #ahg-sc-text::placeholder { color: #8b8f97; }

#ahg-sc-window #ahg-sc-send {
  width: 38px !important; height: 38px !important; flex-shrink: 0; padding: 0;
  transition: transform .2s;
}
#ahg-sc-window #ahg-sc-send:hover  { transform: scale(1.06); opacity: 1; }
#ahg-sc-window #ahg-sc-send:active { transform: scale(.94); }
#ahg-sc-window #ahg-sc-send svg {
  width: 26px !important; height: 26px !important; transform: none; stroke-width: 1.6;
}

#ahg-sc-window #ahg-sc-branding { padding: 6px 12px 10px; background: #fff; }

/* ---------- RGPD en panneau glissant ---------- */
#ahg-sc-window #ahg-sc-rgpd {
  align-items: flex-end;
  background: rgba(11,11,15,.45);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: kapty-fade .25s ease both;
}
#ahg-sc-window .ahg-sc-rgpd-modal {
  width: 100%; max-width: none; height: auto; max-height: 75%;
  border-radius: 20px 20px 0 0;
  animation: kapty-sheet .4s cubic-bezier(.2,.8,.2,1) both;
}
#ahg-sc-window .ahg-sc-rgpd-modal h3 { justify-content: flex-start; padding: 0 60px 0 20px; border-bottom: 0; }
#ahg-sc-window .ahg-sc-rgpd-close { border-radius: 10px !important; background: #f3f4f6 !important; }
#ahg-sc-window .ahg-sc-rgpd-close::before { font-size: 14px; }
#ahg-sc-window .ahg-sc-rgpd-content { padding: 0 20px 24px; color: #374151; }

/* ---------- Formulaire coordonnées (panneau glissant) ---------- */
/* on neutralise le « grisé » d'origine : le flou du fond le remplace */
#ahg-sc-window #ahg-sc-messages[style*="grayscale"],
#ahg-sc-window #ahg-sc-input[style*="grayscale"] { opacity: 1 !important; filter: none !important; }

#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet { padding: 0 !important; z-index: 90 !important; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet.is-open { animation: kapty-fade .3s ease both; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-backdrop {
  border-radius: 0 !important;
  background: rgba(11,11,15,.35) !important;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-card {
  left: 0 !important; right: 0 !important; bottom: 0 !important;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 20px 20px !important;
  border-radius: 24px 24px 0 0 !important;
  box-shadow: 0 -12px 40px -12px rgba(15,17,21,.25) !important;
  font-family: var(--ahg-body-font, var(--ahg-font-family));
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet.is-open .ahg-sc-lead-card { animation: kapty-sheet .45s cubic-bezier(.2,.8,.2,1) both; }
/* poignée */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-card::before {
  content: ""; position: absolute; top: 10px; left: 50%;
  width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: #e5e7eb;
}

/* croix */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-close {
  top: 14px !important; right: 14px !important;
  width: 32px; height: 32px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px !important; background: #f3f4f6 !important;
  color: #6b7280 !important; font-size: 0 !important; opacity: 1 !important;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-close::before {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-close:hover { color: #0b0b0f !important; }

/* titre + sous-titre centrés */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-title {
  margin: 4px 36px 4px !important; text-align: center;
  font-size: 17px !important; font-weight: 600 !important; color: #0b0b0f !important;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-sub {
  margin: 0 36px 16px !important; text-align: center;
  font-size: 13px !important; line-height: 1.4 !important; color: #6b7280 !important;
  text-wrap: pretty;
}

/* champs : prénom + nom côte à côte, le reste en pleine largeur */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; gap: 8px !important; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-grid > .ahg-sc-lead-field:nth-child(n+3) { grid-column: 1 / -1; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-input {
  padding: 13px 14px !important;
  border-radius: 14px !important;
  border: none !important;
  background: #f4f5f7 !important;
  box-shadow: none !important;
  font-size: 15px !important; color: #0b0b0f;
  transition: background .2s, box-shadow .25s ease !important;
}
/* survol / focus : pas de liseré coloré, juste une ombre plus marquée */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-input:hover {
  background: #fff !important;
  box-shadow: 0 0 0 1px rgba(15,17,21,.06), 0 4px 12px -4px rgba(15,17,21,.12) !important;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-input:focus {
  background: #fff !important;
  box-shadow: 0 0 0 1px rgba(15,17,21,.08), 0 10px 24px -8px rgba(15,17,21,.28) !important;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-input::placeholder { color: #8b8f97 !important; }

/* case de consentement personnalisée */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent { margin-top: 14px !important; gap: 10px !important; font-size: 13px !important; color: #4b5563 !important; cursor: pointer; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent a { color: #0b0b0f !important; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; margin: 0 !important; flex-shrink: 0;
  border: 1.5px solid #d1d5db; border-radius: 6px; background: #fff;
  display: grid; place-content: center; cursor: pointer;
  transition: background .2s, border-color .2s;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent input[type="checkbox"]::before {
  content: ""; width: 12px; height: 12px; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0); transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent input[type="checkbox"]:checked {
  background: var(--ahg-bot-action-color, #1677ff); border-color: var(--ahg-bot-action-color, #1677ff);
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent input[type="checkbox"]:checked::before { transform: scale(1); }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-consent input[type="checkbox"]:focus-visible {
  outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ahg-bot-action-color, #1677ff) 18%, transparent);
}

/* erreur */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-error {
  position: relative;
  margin: 14px 0 0 !important; padding: 10px 12px 10px 36px;
  border-radius: 12px; background: #fef2f2;
  color: #b91c1c !important; font-size: 13px !important; font-weight: 500 !important;
  animation: kapty-in .25s ease both;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-error::before {
  content: ""; position: absolute; left: 12px; top: 50%; margin-top: -8px;
  width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* bouton d'envoi pleine largeur (couleurs appliquées par le JS d'origine) */
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-actions { margin-top: 16px !important; }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-btn {
  width: 100% !important; gap: 8px;
  padding: 14px !important; border-radius: 999px !important;
  font-size: 15px !important; font-weight: 600 !important;
  box-shadow: 0 8px 18px -8px rgba(15,17,21,.45);
  transition: transform .2s, opacity .2s;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-btn::after {
  content: ""; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 13L15.4564 8.5M11 13L6.38202 9.57695C5.7407 9.07229 5.94107 8.06115 6.72742 7.834L20 4L17.117 15.9189C16.9651 16.6489 16.0892 16.9637 15.5 16.5L13.5 15M11 13V18L13.5 15M13.5 15M7 20L9 18M4 19L8.5 14.5M4 15L6.5 12.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 13L15.4564 8.5M11 13L6.38202 9.57695C5.7407 9.07229 5.94107 8.06115 6.72742 7.834L20 4L17.117 15.9189C16.9651 16.6489 16.0892 16.9637 15.5 16.5L13.5 15M11 13V18L13.5 15M13.5 15M7 20L9 18M4 19L8.5 14.5M4 15L6.5 12.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-btn:hover  { transform: translateY(-1px); }
#ahg-sc-container #ahg-sc-window #ahg-sc-lead-sheet .ahg-sc-lead-btn:active { transform: scale(.98); }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  #ahg-sc-container #ahg-sc-window {
    bottom: 88px; left: 12px; right: 12px; width: auto;
    height: calc(100dvh - 112px);
  }
  #ahg-sc-container #ahg-sc-window.ahg-expanded { top: 8px; bottom: 8px; height: auto; }
  #ahg-sc-window #ahg-sc-topbar { justify-content: flex-end; }
}

/* ---------- Accessibilité : mouvements réduits ---------- */
@media (prefers-reduced-motion: reduce) {
  #ahg-sc-container *, #kapty-teaser { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Keyframes ---------- */
@keyframes kapty-dot   { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes kapty-in    { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes kapty-pop   { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes kapty-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes kapty-sheet { from { transform: translateY(100%); } to { transform: none; } }
