/* La bulle Aria. Autonome : ne dépend d'aucune feuille d'application, pour
   s'afficher pareil sur le portail, SofIA, la comptabilité et l'écran iPhone. */
:root { --aria-accent: #4f46e5; --aria-fond: #ffffff; --aria-texte: #1e293b; }

#aria-assistant { font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--aria-texte); line-height: 1.45; }
#aria-assistant * { box-sizing: border-box; }
#aria-assistant button, #aria-assistant textarea { touch-action: manipulation; }

.aria-bouton { position: fixed; right: 20px; bottom: 20px; z-index: 9000;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 10px 12px;
  border: 0; border-radius: 999px; background: var(--aria-accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .22); transition: transform .12s ease; }
.aria-bouton:hover { transform: translateY(-1px); }
/* S'efface quand un bouton, un lien ou un champ se trouve dessous (voir
   useEsquive dans assistant.js) ; revient dès que la place est libre. */
.aria-bouton.aria-esquive { opacity: 0; pointer-events: none; transform: translateY(14px); }
.aria-bouton { transition: transform .12s ease, opacity .18s ease; }
.aria-bouton.aria-actif { background: #1e293b; }

.aria-panneau { position: fixed; right: 20px; bottom: 76px; z-index: 9001;
  width: 390px; max-width: calc(100vw - 40px); height: min(640px, calc(100vh - 100px));
  display: flex; flex-direction: column; background: var(--aria-fond);
  border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .25); }

.aria-tete { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: #0f172a; color: #fff; }
.aria-avatar { width: 30px; height: 30px; border-radius: 50%; background: #fff;
  color: #0f172a; font-weight: 800; display: inline-flex; align-items: center;
  justify-content: center; font-family: "Bodoni 72", Didot, Georgia, serif; }
.aria-titre { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.aria-titre small { opacity: .7; font-size: 11px; }
.aria-icone { border: 0; background: transparent; color: #fff; opacity: .75;
  cursor: pointer; font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.aria-icone:hover { opacity: 1; background: rgba(255, 255, 255, .12); }

.aria-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 10px; background: #f8fafc; }
.aria-avis { background: #fef3c7; color: #92400e; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.aria-intro p { margin: 0 0 10px; color: #475569; }
.aria-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.aria-chip { border: 1px solid #cbd5e1; background: #fff; color: #1e293b; border-radius: 999px;
  padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.aria-chip:hover { border-color: var(--aria-accent); color: var(--aria-accent); }

.aria-msg { display: flex; flex-direction: column; max-width: 92%; }
.aria-moi { align-self: flex-end; align-items: flex-end; }
.aria-elle { align-self: flex-start; align-items: flex-start; }
.aria-bulle { padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.aria-moi .aria-bulle { background: var(--aria-accent); color: #fff; border-bottom-right-radius: 4px; }
.aria-elle .aria-bulle { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
  white-space: normal; }
.aria-bulle p { margin: 0 0 8px; }
.aria-bulle p:last-child, .aria-bulle ul:last-child, .aria-bulle ol:last-child { margin-bottom: 0; }
.aria-bulle ul, .aria-bulle ol { margin: 0 0 8px; padding-left: 18px; }
.aria-bulle li { margin: 2px 0; }
.aria-bulle a { color: var(--aria-accent); text-decoration: underline; }
.aria-bulle code { background: #f1f5f9; padding: 1px 4px; border-radius: 4px; font-size: 12.5px; }
.aria-attente { color: #64748b; font-style: italic; }
.aria-outils { margin-top: 6px; font-size: 11px; color: #94a3b8; }
.aria-erreur { color: #b91c1c; font-size: 13px; }

.aria-proposition { margin-top: 6px; border: 1px solid #c7d2fe; background: #eef2ff;
  border-radius: 10px; padding: 8px 10px; width: 100%; }
.aria-proposition-titre { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: #4338ca; font-weight: 700; }
.aria-proposition-resume { margin: 4px 0 6px; }
.aria-proposition-boutons { display: flex; gap: 6px; }
.aria-faite { border-color: #bbf7d0; background: #f0fdf4; }
.aria-faite .aria-proposition-titre { color: #15803d; }
.aria-annulee, .aria-perimee { border-color: #e2e8f0; background: #f8fafc; opacity: .8; }
.aria-annulee .aria-proposition-titre, .aria-perimee .aria-proposition-titre { color: #64748b; }
.aria-echouee { border-color: #fecaca; background: #fef2f2; }
.aria-echouee .aria-proposition-titre { color: #b91c1c; }
.aria-btn { border: 1px solid #cbd5e1; background: #fff; color: #1e293b; border-radius: 8px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.aria-btn-plein { background: var(--aria-accent); border-color: var(--aria-accent); color: #fff; }
.aria-btn:disabled { opacity: .5; cursor: default; }

.aria-saisie { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e2e8f0; background: #fff; }
/* 16 px, pas moins : en dessous, Safari sur iPhone zoome la page dès qu'on
   touche le champ, et le panneau déborde de l'écran (micro et bouton
   d'envoi coupés). */
.aria-saisie textarea { flex: 1; min-width: 0; resize: none; border: 1px solid #cbd5e1; border-radius: 10px;
  padding: 9px 11px; font: inherit; font-size: 16px; line-height: 1.4; min-height: 40px; max-height: 120px; }
.aria-saisie textarea:focus { outline: 2px solid var(--aria-accent); outline-offset: 0; border-color: transparent; }
.aria-micro { border: 1px solid #cbd5e1; border-radius: 10px; width: 42px; background: #fff;
  font-size: 18px; cursor: pointer; flex: none; }
.aria-micro.aria-enregistre { background: #dc2626; border-color: #dc2626; color: #fff;
  animation: aria-pulse 1s ease-in-out infinite; }
@keyframes aria-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); } }
.aria-micro:disabled { opacity: .4; cursor: default; }
.aria-vocal { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.aria-vocal-tete { font-weight: 600; }
.aria-vocal audio { width: 100%; max-width: 260px; height: 36px; }
.aria-transcription { font-size: 13px; opacity: .92; white-space: pre-wrap; }
.aria-envoyer { border: 0; border-radius: 10px; width: 42px; background: var(--aria-accent);
  color: #fff; font-size: 18px; cursor: pointer; }
.aria-envoyer:disabled { opacity: .4; cursor: default; }

@media (max-width: 640px) {
  .aria-bouton { right: 14px; bottom: 84px; padding: 10px 12px; }
  .aria-bouton span { display: none; }
  /* Plein écran, calé sur la fenêtre visible (le clavier la réduit) et
     jamais plus large qu'elle. */
  .aria-panneau { inset: 0; width: 100%; max-width: 100%; height: 100%; height: 100dvh;
    max-height: none; border-radius: 0; }
  /* Calé sur la fenêtre visible par le script (top/height en ligne). */
  .aria-panneau.aria-plein { left: 0; right: 0; }
  /* La page derrière ne bouge plus tant que le panneau est ouvert : c'est
     elle que Safari faisait défiler sous le clavier. */
  html.aria-plein-ecran, html.aria-plein-ecran body { overflow: hidden; height: 100%; overscroll-behavior: none; }
  .aria-messages, .aria-saisie { max-width: 100%; }
  .aria-msg { max-width: 94%; }
  .aria-saisie { padding: 8px; gap: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .aria-micro, .aria-envoyer { width: 40px; flex: none; }
}
@media print { #aria-assistant { display: none; } }

/* La comptabilité charge Tailwind, dont la remise à zéro
   `[type="button"], [type="submit"] { background-color: initial }` a la même
   spécificité qu'une classe et vient après cette feuille : les fonds des
   boutons de la bulle disparaissaient — bulle « transparente » en bas à
   droite, vue le 24/09/2026. L'identifiant du conteneur tranche, partout. */
#aria-assistant .aria-bouton { background: var(--aria-accent); }
#aria-assistant .aria-bouton.aria-actif { background: #1e293b; }
#aria-assistant .aria-envoyer { background: var(--aria-accent); }
#aria-assistant .aria-micro { background: #fff; }
#aria-assistant .aria-micro.aria-enregistre { background: #dc2626; }
#aria-assistant .aria-btn { background: #fff; }
#aria-assistant .aria-btn-plein { background: var(--aria-accent); }
#aria-assistant .aria-chip { background: #fff; }
#aria-assistant .aria-icone { background: transparent; }
#aria-assistant .aria-icone:hover { background: rgba(255, 255, 255, .12); }
