/* ============================================================================
   vrs-assistente.css — la finestra dell'assistente (js: vrs-assistente.js)
   ----------------------------------------------------------------------------
   IDENTICO nei due repository: planning/web/src/styles/vrs-assistente.css e
   cronoservice/web/css/vrs-assistente.css. Si cambia in uno e si copia nell'altro.

   Come vrs-segnala.css usa solo le primitive di vrs-famiglia.css (--vrs-*) e
   misure in px. Pannello a destra che non copre la pagina oltre la sua
   larghezza (la pagina resta usabile: si può leggere e copiare mentre si
   chiede); sul telefono a tutto schermo, campo a 16px (niente zoom di iOS) e
   bersagli ≥ 44px. Movimento solo su transform e opacity, fermo con «riduci il
   movimento». Sta sotto il foglio di Segnala (z-index 1000).
   ========================================================================== */

.vrs-ast {
  position: fixed; z-index: 990;
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 24px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--vrs-surface); color: var(--vrs-text);
  border: 1px solid var(--vrs-border); border-radius: 18px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 24px 64px rgb(4 20 34 / 0.28);
  font-size: 15px; line-height: 1.5; font-feature-settings: var(--vrs-font-feat);
  text-align: left;
  animation: vrs-ast-entra 320ms var(--vrs-ease) both;
}
.vrs-ast:focus { outline: none; }
@keyframes vrs-ast-entra { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---- testata ---- */
.vrs-ast-testa {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--vrs-border);
}
.vrs-ast-logo {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  color: var(--vrs-on-accent);
  background: linear-gradient(135deg, var(--vrs-accent), var(--vrs-brand));
}
.vrs-ast-logo.vrs-ast-grande { width: 52px; height: 52px; border-radius: 16px; }
.vrs-ast-titoli { flex: 1; min-width: 0; }
.vrs-ast-tit { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.25; }
.vrs-ast-sotto { margin: 2px 0 0; font-size: 12px; color: var(--vrs-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrs-ast-ico {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--vrs-text-2); cursor: var(--vrs-cursore-mano, pointer);
  transition: background var(--vrs-t-fast) var(--vrs-ease), color var(--vrs-t-fast) var(--vrs-ease);
}
.vrs-ast-ico:hover { background: var(--vrs-surface-2); color: var(--vrs-text); }
.vrs-ast-ico:focus-visible, .vrs-ast-btn:focus-visible, .vrs-ast-chip:focus-visible, .vrs-ast-invia:focus-visible, .vrs-ast-voce:focus-visible,
.vrs-ast-lista:focus-visible, .vrs-ast a:focus-visible {
  outline: 2px solid var(--vrs-accent); outline-offset: 2px;
}

/* ---- conversazione ---- */
.vrs-ast-lista {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.vrs-ast-msg { max-width: 100%; overflow-wrap: anywhere; }
.vrs-ast-utente {
  align-self: flex-end; max-width: 85%;
  padding: 9px 13px; border-radius: 16px 16px 4px 16px;
  background: var(--vrs-accent); color: var(--vrs-on-accent);
}
.vrs-ast-utente p { margin: 0; white-space: pre-wrap; }
.vrs-ast-assistente { align-self: stretch; }
.vrs-ast-testo p, .vrs-ast-testo ul, .vrs-ast-testo ol { margin: 0 0 8px; }
.vrs-ast-testo ul, .vrs-ast-testo ol { padding-left: 20px; }
.vrs-ast-testo li + li { margin-top: 3px; }
.vrs-ast-testo > :last-child { margin-bottom: 0; }
.vrs-ast-testo strong { font-weight: 650; }
.vrs-ast a { color: var(--vrs-accent); text-decoration: underline; text-underline-offset: 2px; }
.vrs-ast-errore .vrs-ast-testo { color: var(--vrs-text-2); font-style: italic; }
.vrs-ast-lavoro {
  margin: 0 0 6px; font-size: 13px; color: var(--vrs-muted);
  display: flex; align-items: center; gap: 8px;
}
.vrs-ast-lavoro::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--vrs-accent);
  animation: vrs-ast-pulsa 1.1s var(--vrs-ease) infinite alternate;
}
@keyframes vrs-ast-pulsa { from { opacity: 0.25; transform: scale(0.8); } to { opacity: 1; transform: scale(1.1); } }
.vrs-ast-azioni { display: flex; gap: 2px; margin-top: 4px; }
.vrs-ast-consumo { margin: 2px 0 0; font-size: 11px; color: var(--vrs-muted); font-variant-numeric: tabular-nums; }
.vrs-ast-sottotit { margin: 8px 0 4px; font-size: 13px; font-weight: 650; color: var(--vrs-text-2); }
.vrs-ast-nota { margin: 0 0 6px; font-size: 12px; color: var(--vrs-muted); }
.vrs-ast-ricordi { padding: 8px 10px; border-radius: 12px; background: var(--vrs-surface-2); }
.vrs-ast-elenco-ricordi { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.vrs-ast-elenco-ricordi li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.vrs-ast-elenco-ricordi li span { flex: 1; min-width: 0; }
.vrs-ast-pic { width: 30px; height: 30px; color: var(--vrs-muted); }
.vrs-ast-pic[aria-pressed='true'] { color: var(--vrs-accent); background: var(--vrs-accent-soft); }
.vrs-ast-pic.vrs-ast-fatto { color: var(--vrs-accent); }

/* ---- vuota: saluto e domande suggerite ---- */
.vrs-ast-vuota { margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 8px 4px; }
.vrs-ast-ciao { margin: 0; color: var(--vrs-text-2); max-width: 34ch; }
.vrs-ast-sugg { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.vrs-ast-chip {
  width: 100%; padding: 10px 14px; border-radius: 12px; cursor: var(--vrs-cursore-mano, pointer);
  border: 1px solid var(--vrs-border); background: var(--vrs-surface-2); color: var(--vrs-text);
  font: inherit; font-size: 14px; text-align: left;
  transition: border-color var(--vrs-t-fast) var(--vrs-ease), background var(--vrs-t-fast) var(--vrs-ease);
}
.vrs-ast-chip:hover { border-color: var(--vrs-accent); background: var(--vrs-accent-soft); }

/* ---- proposte ---- */
.vrs-ast-scheda {
  margin-top: 10px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--vrs-border-strong); background: var(--vrs-surface-2);
}
.vrs-ast-scheda p { margin: 0; }
.vrs-ast-cosa { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--vrs-accent); }
.vrs-ast-ptit { margin-top: 2px !important; font-weight: 650; }
.vrs-ast-pdesc { margin-top: 4px !important; color: var(--vrs-text-2); white-space: pre-wrap; font-size: 14px; }
.vrs-ast-pdet { margin-top: 6px !important; color: var(--vrs-muted); font-size: 13px; }
.vrs-ast-bottoni { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vrs-ast-esito { margin-top: 6px !important; font-size: 13px; color: var(--vrs-text-2); }
.vrs-ast-esito:empty { display: none; }
.vrs-ast-fatta { border-color: var(--vrs-accent); }
.vrs-ast-fatta .vrs-ast-cosa::before { content: '✓ '; }
.vrs-ast-scartata { opacity: 0.6; }
.vrs-ast-righe { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--vrs-text-2); }
.vrs-ast-righe li { margin: 1px 0; }
.vrs-ast-avviso { margin-top: 6px !important; padding: 6px 8px; border-radius: 8px; font-size: 13px; background: var(--vrs-surface-3); color: var(--vrs-text); }
.vrs-ast-rischiosa:not(.vrs-ast-fatta):not(.vrs-ast-scartata) { border-color: #c2410c; }
.vrs-ast-rischiosa .vrs-ast-cosa { color: #c2410c; }
.vrs-ast-btn {
  min-height: 36px; padding: 0 14px; border-radius: 10px; cursor: var(--vrs-cursore-mano, pointer);
  border: 1px solid var(--vrs-border-strong); background: var(--vrs-surface); color: var(--vrs-text);
  font: inherit; font-size: 14px; font-weight: 550;
}
.vrs-ast-btn:hover { background: var(--vrs-surface-3); }
.vrs-ast-btn:disabled { opacity: 0.6; cursor: var(--vrs-cursore-freccia, default); }
.vrs-ast-primario { background: var(--vrs-accent); border-color: var(--vrs-accent); color: var(--vrs-on-accent); }
.vrs-ast-primario:hover { background: var(--vrs-accent-hover); }
/* la «Mail pronta»: il testo con gli a capo, scorrevole se è lungo */
.vrs-ast-mail-testo {
  margin-top: 6px; max-height: 260px; overflow: auto; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--vrs-border); background: var(--vrs-surface);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; color: var(--vrs-text);
}
.vrs-ast-mail-testo:focus-visible { outline: 2px solid var(--vrs-accent); outline-offset: 2px; }

/* ---- cronologia ---- */
.vrs-ast-carica { margin: 0; color: var(--vrs-muted); text-align: center; }
.vrs-ast-storia { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.vrs-ast-voce {
  width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: var(--vrs-cursore-mano, pointer);
  border: 0; background: transparent; color: var(--vrs-text); font: inherit; font-size: 14px; text-align: left;
}
.vrs-ast-voce:hover { background: var(--vrs-surface-2); }
.vrs-ast-riga-storia { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vrs-ast-riga-storia .vrs-ast-voce { flex: 1; min-width: 0; }
.vrs-ast-chiedi { flex: 1 1 100%; padding: 6px 12px 0; font-size: 14px; }
.vrs-ast-riga-storia .vrs-ast-bottoni { margin: 0 0 6px 12px; }
.vrs-ast-voce span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrs-ast-voce time { flex: none; font-size: 12px; color: var(--vrs-muted); }

/* ---- campo ---- */
.vrs-ast-vivo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.vrs-ast-scrivi { padding: 10px 12px 12px; border-top: 1px solid var(--vrs-border); }
.vrs-ast-riga {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 12px; border-radius: 14px;
  border: 1px solid var(--vrs-border-strong); background: var(--vrs-surface-2);
}
.vrs-ast-riga:focus-within { border-color: var(--vrs-accent); box-shadow: 0 0 0 3px var(--vrs-accent-soft); }
.vrs-ast-campo {
  flex: 1; min-height: 24px; max-height: 160px; resize: none; padding: 6px 0;
  border: 0; outline: none; background: transparent; color: var(--vrs-text);
  font: inherit; font-size: 15px; line-height: 1.45;
}
.vrs-ast-campo::placeholder { color: var(--vrs-muted); }
.vrs-ast-invia {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; cursor: var(--vrs-cursore-mano, pointer);
  background: var(--vrs-accent); color: var(--vrs-on-accent);
}
.vrs-ast-invia:hover { background: var(--vrs-accent-hover); }
.vrs-ast-invia.vrs-ast-ferma { background: var(--vrs-text-2); }
.vrs-ast-opzioni { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--vrs-muted); }
.vrs-ast-spunta { display: inline-flex; align-items: center; gap: 6px; cursor: var(--vrs-cursore-mano, pointer); }
.vrs-ast-spunta input { margin: 0; accent-color: var(--vrs-accent); }
.vrs-ast-piede { margin: 0; }
.vrs-ast-scrivi[hidden], .vrs-ast-fermo[hidden] { display: none; }
/* sospeso per domande non di lavoro: al posto del campo, fino a quando */
.vrs-ast-fermo {
  margin: 0; padding: 12px 14px 14px; border-top: 1px solid var(--vrs-border);
  font-size: 14px; color: var(--vrs-text-2); background: var(--vrs-surface-2);
}

/* ---- telefono: a tutto schermo, comandi sotto il pollice ---- */
@media (max-width: 640px) {
  html.vrs-ast-aperta { overflow: hidden; }
  .vrs-ast { inset: 0; width: 100%; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  .vrs-ast-ico { width: 44px; height: 44px; }
  .vrs-ast-invia { width: 44px; height: 44px; }
  .vrs-ast-campo { font-size: 16px; }
  .vrs-ast-btn { min-height: 44px; }
  .vrs-ast-chip { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .vrs-ast, .vrs-ast-lavoro::before { animation: none; }
  .vrs-ast-lista { scroll-behavior: auto; }
}
@media print { .vrs-ast { display: none; } }
