/* Preso da modello/stile.css a ogni generazione (AIUTI_CSS in genera.py): non correggere qui. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* «torna su» a sinistra, la chat a destra: compaiono quando l'apertura è passata */
.torna-su, .chat__apri { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 70; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; height: 52px; border: 0; cursor: pointer; font: 600 .95rem/1 Inter, system-ui, sans-serif;
  box-shadow: 0 16px 40px -14px rgba(0, 5, 56, .45); opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .3s, transform .3s; }
.dopo-apertura .torna-su, .dopo-apertura .chat__apri { opacity: 1; transform: none; pointer-events: auto; }
.torna-su { left: 18px; width: 52px; border-radius: 16px; background: #fff; color: #000538; }
.torna-su svg { width: 22px; height: 22px; }
.chat__apri { right: 18px; padding: 0 20px 0 16px; border-radius: 16px; background: #000538; color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22), 0 12px 28px -14px rgba(0, 5, 56, .7); }
.chat__apri svg { width: 22px; height: 22px; }
.torna-su:focus-visible, .chat__apri:focus-visible { outline: 3px solid #473AE0; outline-offset: 3px; }
.chat-aperta .chat__apri { opacity: 0; pointer-events: none; }
.chat__pannello { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100vh - 120px)); background: #fff; color: #000538; border-radius: 20px;
  box-shadow: 0 30px 80px -24px rgba(0, 5, 56, .5); overflow: hidden; font-family: Inter, system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
.chat__pannello[hidden] { display: none !important; }
.chat__testa { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; background: #000538; color: #fff; }
.chat__testa .pittogramma { width: 30px; height: auto; color: #fff; }
.chat__testa b { display: block; font-size: 1rem; }
.chat__testa small { display: block; margin-top: 2px; font-size: .8rem; color: rgba(255, 255, 255, .7); }
.chat__chiudi { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.3rem; cursor: pointer; }
.chat__messaggi { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #F6F7FB; }
.chat__msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .95rem; line-height: 1.45; white-space: pre-line; }
.chat__msg--noi { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.chat__msg--tu { align-self: flex-end; background: #473AE0; color: #fff; border-bottom-right-radius: 4px; }
.chat__msg a { color: inherit; font-weight: 600; }
.chat__rapide { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; background: #F6F7FB; }
.chat__rapide button { padding: 8px 12px; border: 1px solid rgba(0, 5, 56, .12); border-radius: 999px; background: #fff; color: #000538; font: 500 .85rem/1 inherit; cursor: pointer; }
@media (hover: hover) { .chat__rapide button:hover { border-color: #473AE0; } }
.chat__scrivi { display: flex; gap: 8px; padding: 12px 16px 16px; background: #F6F7FB; }
.chat__scrivi input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid rgba(0, 5, 56, .14); border-radius: 12px; font: 400 1rem/1 inherit; color: #000538; background: #fff; }
.chat__scrivi input:focus-visible { outline: 2px solid #473AE0; outline-offset: 1px; }
.chat__scrivi button { height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: #473AE0; color: #fff; font: 600 .95rem/1 inherit; cursor: pointer; }
@media (max-width: 640px) {
  .torna-su { left: 14px; width: 48px; height: 48px; }
  .chat__apri { right: 14px; height: 48px; padding: 0 14px; }
  .chat__apri span { display: none; }
  .chat__pannello { right: 10px; left: 10px; width: auto; bottom: 10px; height: min(560px, calc(100vh - 90px)); }
}
@media (prefers-reduced-motion: reduce) { .torna-su, .chat__apri, .altri__freccia { transition: none; } }

/* sulle demo dei gestionali: a destra della barra laterale e sopra la barra in basso dell'app (le misura aiuti.js) */
.torna-su { left: calc(var(--aiuti-sx, 0px) + 18px); }
.torna-su, .chat__apri, .chat__pannello { bottom: calc(var(--aiuti-giu, 0px) + max(18px, env(safe-area-inset-bottom))); }
@media (max-width: 640px) { .torna-su { left: calc(var(--aiuti-sx, 0px) + 14px); } .chat__pannello { bottom: calc(var(--aiuti-giu, 0px) + 10px); } }
/* nelle anteprime piccole dentro le pagine delle aree non servono */
.anteprima .torna-su, .anteprima [data-chat] { display: none !important; }
@media print { .torna-su, [data-chat] { display: none !important; } }
