/* Assistant IA et bouton WhatsApp, en bas à gauche : le retour en haut de page occupe la droite. */
.msa { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 996; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; transition: bottom .3s; }
.msa.is-open { z-index: 1001; }
.msa.is-open .msa-btn { display: none; }
@media (max-width: 767px) {
	/* Au-dessus de la barre « Parler à un voyant », une fois affichée. */
	body:has(.msv-mobile-bar.is-visible) .msa { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
	/* Rien par-dessus un champ pendant la saisie. */
	body:has(:is(input, textarea, select):focus) .msa:not(.is-open) { display: none; }
}
.msa .msa-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; margin: 0; padding: 5px 16px 5px 11px; border: 0; border-radius: 999px; color: #fff; font: 600 14px/1.15 var(--msv-font, inherit); text-align: left; text-decoration: none; text-transform: none; letter-spacing: 0; cursor: pointer; box-shadow: 0 8px 22px rgb(0 0 0 / .24); }
.msa .msa-btn:hover, .msa .msa-btn:focus { color: #fff; filter: brightness(1.1); }
.msa .msa-btn svg { width: 25px; height: 25px; flex: none; fill: currentColor; }
.msa .msa-btn span { display: block; white-space: nowrap; }
.msa .msa-btn small { display: block; font-size: 11px; font-weight: 500; opacity: .92; }
.msa .msa-ask, .msa .msa-ask:hover, .msa .msa-ask:focus { background: var(--msv-violet, #5b2a86); }
.msa .msa-wa, .msa .msa-wa:hover, .msa .msa-wa:focus { background: #0e7a4f; }

.msa-panel { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: #fff; color: #231c35; border-radius: 18px; overflow: hidden; box-shadow: 0 22px 60px rgb(0 0 0 / .32); }
.msa-panel[hidden] { display: none; }
.msa-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; background: var(--msv-violet, #5b2a86); color: #fff; }
.msa-head strong { color: #fff; font-size: 16px; }
.msa-panel .msa-close { width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / .16); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.msa-panel .msa-close:hover, .msa-panel .msa-close:focus { background: rgb(255 255 255 / .28); color: #fff; }
.msa-panel .msa-note { margin: 0; padding: 8px 16px; background: #f3effa; color: #4a4160; font-size: 12.5px; line-height: 1.35; }
.msa-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.msa-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.msa-msg.is-assistant { align-self: flex-start; background: #f1f0f4; border-end-start-radius: 4px; }
.msa-msg.is-user { align-self: flex-end; background: var(--msv-violet, #5b2a86); color: #fff; border-end-end-radius: 4px; }
.msa-msg.is-typing { color: #6a6278; font-style: italic; }
.msa-msg a { color: inherit; text-decoration: underline; }
.msa-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.msa-chips[hidden] { display: none; }
.msa-panel .msa-chips button { min-height: 36px; margin: 0; padding: 6px 12px; border: 1px solid var(--msv-violet, #5b2a86); border-radius: 999px; background: #fff; color: var(--msv-violet, #5b2a86); font: 500 13px/1.2 var(--msv-font, inherit); text-transform: none; letter-spacing: 0; cursor: pointer; }
.msa-panel .msa-chips button:hover, .msa-panel .msa-chips button:focus { background: #f3effa; color: var(--msv-violet, #5b2a86); }
.msa-form { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px; border-top: 1px solid #e7e4ee; }
.msa-panel .msa-form textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 110px; margin: 0; padding: 10px 12px; border: 1px solid #cfcadb; border-radius: 12px; background: #fff; color: #231c35; font: 16px/1.3 var(--msv-font, inherit); resize: none; }
.msa-panel .msa-form button { flex: none; min-height: 44px; margin: 0; padding: 0 14px; border: 0; border-radius: 12px; background: var(--msv-violet, #5b2a86); color: #fff; font: 600 14px/1 var(--msv-font, inherit); text-transform: none; letter-spacing: 0; cursor: pointer; }
.msa-panel .msa-form button:disabled { opacity: .55; cursor: default; }
.msa-panel .msa-human { display: block; padding: 0 16px 12px; color: #0e7a4f; font-size: 13px; font-weight: 600; text-decoration: underline; }
.msa-msg .msa-human { display: inline; padding: 0; }

/* Téléphone : plein écran, une seule colonne. */
@media (max-width: 767px) {
	.msa-panel { inset: 0 0 auto 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
}

/* Téléphone : deux pastilles rondes côte à côte, sans texte visible, pour ne cacher ni bouton ni champ.
   Le texte reste lu par les lecteurs d'écran. */
@media (max-width: 767px) {
	.msa { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); flex-direction: row; align-items: center; gap: 10px; }
	.msa .msa-btn { position: relative; width: 50px; height: 50px; min-height: 50px; padding: 0; gap: 0; justify-content: center; box-shadow: 0 6px 16px rgb(0 0 0 / .24); }
	.msa .msa-btn svg { width: 25px; height: 25px; }
	.msa .msa-btn span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
	/* Bas de page : de la place sous le pied de page, pour que les pastilles n'y cachent rien. */
	.msv-site-footer .msv-footer-legal::after { content: ""; display: block; height: 66px; }
}

/* Posées sur un bouton, un lien ou un champ de la page : les pastilles s'effacent et laissent passer le doigt. */
.msa .msa-btn { transition: opacity .2s, transform .2s; }
.msa:not(.is-open) .msa-btn.is-over { opacity: 0; transform: translateY(10px); pointer-events: none; }
/* Le cadre qui porte les pastilles ne bloque jamais le doigt : seules les pastilles visibles le font. */
.msa { pointer-events: none; }
.msa > * { pointer-events: auto; }

/* Assistant à gauche, WhatsApp à droite. Sur ordinateur, WhatsApp est décalé pour laisser la place à la flèche « haut de page ». */
.msa .msa-wa { position: fixed; right: 90px; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transition: bottom .3s, opacity .2s, transform .2s; }
@media (min-width: 768px) { .msa { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 767px) {
	.msa .msa-wa { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
	body:has(.msv-mobile-bar.is-visible) .msa .msa-wa { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
