/* Le conseiller de Factu iA : un onglet cartonné en bas à droite de chaque page, qui ouvre une fiche de correspondance
   (en-tête bleu nuit, réponses sur papier avec la marge au bic, messages du visiteur en encre pâle). En grand sur /conseiller/. */
.conseiller-onglet { position: fixed; right: 20px; bottom: 0; z-index: 60; display: inline-flex; align-items: center; gap: 9px; min-height: 48px;
  padding: 0 18px 4px 16px; border: 0; border-radius: 10px 10px 0 0; background: var(--sous-main); color: #fff; font: 700 15.5px/1 var(--font-sans);
  cursor: pointer; box-shadow: 0 -6px 18px -8px rgba(29, 35, 64, .45); transform: translateY(110%); transition: transform .35s cubic-bezier(.3, 1.3, .5, 1); }
.conseiller-onglet.est-pret { transform: translateY(0); }
.conseiller-onglet:hover { transform: translateY(-3px); }
.conseiller-onglet svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.conseiller-onglet .pastille, .conseiller__etat .pastille { width: 9px; height: 9px; border-radius: 50%; background: #3ccf7f; box-shadow: 0 0 0 3px rgba(60, 207, 127, .25); }
.conseiller-onglet.est-absent .pastille, .conseiller__etat.est-absent .pastille { background: #c9a14a; box-shadow: 0 0 0 3px rgba(201, 161, 74, .25); }
.conseiller-onglet[aria-expanded="true"] { transform: translateY(110%); }

.conseiller { display: flex; flex-direction: column; background: #fdfcf8; color: var(--carbone); font-size: 15.5px; }
.conseiller:not(.conseiller--page) { position: fixed; right: 20px; bottom: 20px; z-index: 61; width: min(400px, calc(100vw - 40px));
  height: min(620px, calc(100svh - var(--entete) - 40px)); border-radius: var(--radius-feuille); box-shadow: 0 30px 60px -20px rgba(29, 35, 64, .55), 0 0 0 1px rgba(29, 35, 64, .08);
  overflow: hidden; animation: conseiller-entree .28s cubic-bezier(.3, 1.2, .5, 1); }
.conseiller[hidden] { display: none; }
@keyframes conseiller-entree { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.conseiller--page { height: min(680px, 78svh); border-radius: var(--radius-feuille); box-shadow: var(--ombre-soulevee); overflow: hidden; }

.conseiller__tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 14px; background: var(--sous-main); color: #fff; }
.conseiller__nom { margin: 0; font: 800 17px/1.2 var(--font-sans); }
.conseiller__etat { display: flex; align-items: center; gap: 8px; margin: 5px 0 0; font: 500 12.5px/1.2 var(--font-mono); color: var(--on-sous-main-doux); }
.conseiller__fermer { width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--radius-papier); background: transparent; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; }
.conseiller__fermer:hover { background: rgba(255, 255, 255, .1); }

.conseiller__fil { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(201, 211, 239, .45) 27px 28px); }
.bulle { max-width: 88%; }
.bulle p { margin: 0; padding: 10px 13px; line-height: 1.5; overflow-wrap: anywhere; }
.bulle--conseiller { align-self: flex-start; }
.bulle--conseiller p { background: #fff; border-left: 3px solid var(--bic); border-radius: 0 8px 8px 0; box-shadow: 0 1px 0 rgba(29, 35, 64, .06), 0 6px 14px -10px rgba(29, 35, 64, .35); }
.bulle--conseiller a { color: var(--bic); font-weight: 600; word-break: break-all; }
.bulle--visiteur { align-self: flex-end; }
.bulle--visiteur p { background: var(--bic-voile); color: var(--carbone); border-radius: 8px 8px 0 8px; }
.bulle--ecrit p { display: flex; gap: 5px; padding: 14px 16px; }
.bulle--ecrit p > span:not(.visuellement-cache) { width: 7px; height: 7px; border-radius: 50%; background: var(--bic); opacity: .3; animation: ecrit 1s infinite; }
.bulle--ecrit p > span:nth-child(2) { animation-delay: .15s; } .bulle--ecrit p > span:nth-child(3) { animation-delay: .3s; }
@keyframes ecrit { 50% { opacity: 1; transform: translateY(-2px); } }

.conseiller__amorces { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; }
.conseiller__amorces[hidden] { display: none; }
.conseiller__amorces button { padding: 7px 11px; border: 1.5px solid var(--filet-fort); border-radius: var(--radius-papier); background: #fff; color: var(--carbone);
  font: 600 13.5px/1.25 var(--font-sans); cursor: pointer; text-align: left; }
.conseiller__amorces button:hover { border-color: var(--bic); color: var(--bic); }

.conseiller__saisie { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--filet); background: #fff; }
.conseiller__saisie textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 11px 12px; border: 1.5px solid var(--filet-fort); border-radius: var(--radius-papier);
  background: var(--papier); color: var(--carbone); font: 400 16px/1.4 var(--font-sans); resize: none; }
.conseiller__saisie textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--bic); }
.conseiller__envoyer { flex: none; width: 46px; height: 44px; border: 0; border-radius: var(--radius-papier); background: var(--bic); cursor: pointer; display: grid; place-items: center; }
.conseiller__envoyer:hover { background: var(--bic-fonce); }
.conseiller__envoyer svg { width: 20px; height: 20px; fill: #fff; }
.conseiller__mention { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11.5px; line-height: 1.45; color: var(--carbone-doux); }
.conseiller__mention a { color: var(--carbone-doux); }

@media (prefers-reduced-motion: reduce) {
  .conseiller-onglet, .conseiller { transition: none; animation: none; }
  .bulle--ecrit p > span { animation: none; opacity: .6; }
}
/* Téléphone : l'onglet se fait plus petit, la conversation prend tout l'écran sous l'en-tête */
@media (max-width: 560px) {
  .conseiller-onglet { right: 12px; min-height: 44px; padding: 0 14px 3px 12px; font-size: 14.5px; }
  .conseiller:not(.conseiller--page) { inset: var(--entete) 0 0 0; width: auto; height: auto; border-radius: 0; }
  html.conseiller-ouvert { overflow: hidden; }
  .conseiller--page { height: 74svh; margin-inline: calc(-1 * var(--gouttiere)); border-radius: 0; }
  .bulle { max-width: 92%; }
}

/* La bulle d'accueil de l'onglet flottant */
.conseiller-bulle { position: fixed; right: 20px; bottom: 62px; z-index: 59; max-width: min(300px, calc(100vw - 40px)); padding: 14px 40px 14px 16px; border-radius: 12px 12px 4px 12px;
  background: #fff; color: var(--carbone); font-size: 15px; line-height: 1.45; box-shadow: 0 18px 40px -16px rgba(29, 35, 64, .55), 0 0 0 1px rgba(29, 35, 64, .08);
  animation: conseiller-bulle .4s cubic-bezier(.3, 1.3, .5, 1) both; cursor: pointer; }
.conseiller-bulle strong { display: block; margin-bottom: 2px; }
.conseiller-bulle button { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--carbone-doux); font-size: 20px; cursor: pointer; }

@keyframes conseiller-bulle { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (max-width: 560px) { .conseiller-bulle { right: 12px; bottom: 56px; font-size: 14.5px; } }
@media (prefers-reduced-motion: reduce) { .conseiller-bulle { animation: none; } }
