/* bottom: 76px et pas 24px : le cadenas du bandeau cookies (tarteaucitron) occupe le coin bas droit. */
#tb-bulle {
    position: fixed; bottom: 76px; right: 24px; z-index: 999;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border: 0; border-radius: 50px; cursor: pointer;
    background: var(--primary, #2563EB); color: #fff;
    font: 600 15px/1 'Inter', system-ui, sans-serif;
    box-shadow: 0 8px 30px rgba(37, 99, 235, .35);
    opacity: 0; transform: translateY(12px); transition: opacity .3s ease, transform .3s ease;
}
#tb-bulle.tb-visible { opacity: 1; transform: none; }
#tb-bulle.tb-cachee { display: none; }

#tb-fenetre {
    position: fixed; bottom: 76px; right: 24px; z-index: 1000;
    width: 380px; max-width: calc(100vw - 32px); max-height: min(640px, calc(100vh - 100px));
    display: none; flex-direction: column;
    background: var(--background, #fff); color: var(--text-primary, #111827);
    border-radius: 16px; box-shadow: 0 20px 60px rgba(17, 24, 39, .18); overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
}
#tb-fenetre.tb-ouverte { display: flex; }

.tb-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; background: var(--primary, #2563EB); color: #fff; }
.tb-nom { font-weight: 600; font-size: 15px; }
.tb-role { font-size: 12px; opacity: .85; margin-top: 2px; }
.tb-fermer { border: 0; background: transparent; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; }
.tb-fermer:hover { background: rgba(255, 255, 255, .15); }

.tb-fil { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.5; }
.tb-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.tb-msg-visiteur { align-self: flex-end; background: var(--primary, #2563EB); color: #fff; border-bottom-right-radius: 4px; }
.tb-msg-bot { align-self: flex-start; background: #F3F4F6; border-bottom-left-radius: 4px; }
.tb-msg-bot a { color: var(--primary, #2563EB); text-decoration: underline; }
.tb-msg-attente::after { content: '…'; animation: tb-points 1s steps(3, end) infinite; }
@keyframes tb-points { 0% { content: '.'; } 50% { content: '..'; } 100% { content: '...'; } }

.tb-saisie { border-top: 1px solid #E5E7EB; padding: 12px 16px 8px; }
#tb-texte { width: 100%; resize: none; border: 1px solid #E5E7EB; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; }
#tb-texte:focus { outline: 2px solid var(--primary, #2563EB); outline-offset: 1px; }
.tb-bas { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tb-compteur { font-size: 12px; color: #6B7280; margin-right: auto; }
.tb-compteur.tb-limite { color: #B91C1C; }
.tb-rdv, .tb-envoyer { border-radius: 10px; padding: 8px 14px; font: 600 13px/1 inherit; cursor: pointer; }
.tb-rdv { border: 1px solid var(--primary, #2563EB); background: transparent; color: var(--primary, #2563EB); }
.tb-envoyer { border: 0; background: var(--primary, #2563EB); color: #fff; }
.tb-envoyer[disabled] { opacity: .5; cursor: default; }
.tb-rgpd { margin: 0; padding: 0 16px 12px; font-size: 11px; color: #6B7280; }
.tb-rgpd a { color: inherit; }

@media (max-width: 768px) {
    #tb-bulle { right: 16px; }
    /* Plein écran, devant le cadenas des cookies : c'est une fenêtre de dialogue, rien ne doit la recouvrir. */
    #tb-fenetre { bottom: 0; right: 0; width: 100vw; max-width: none; max-height: 100dvh; height: 100dvh; border-radius: 0; z-index: 2147483647; }
}
@media (prefers-reduced-motion: reduce) {
    #tb-bulle { transition: none; }
    .tb-msg-attente::after { animation: none; content: '…'; }
}
