/* Irvola Web, la chat di ai.irvola.com (31/10/2026).
   Ricalca ChatGPT / Open WebUI: colori neutri, un solo accento (#2957f5), font di sistema.
   Niente stili in linea: la CSP non li ammette. */

/* ---------- colori ---------- */
:root {
  color-scheme: light;
  --accento: #2957f5;
  --accento-forte: #1f45d6;
  --accento-testo: #2449d8;
  --sfondo: #ffffff;
  --sfondo-barra: #f9f9f9;
  --bolla: #f4f4f4;
  --composer: #ffffff;
  --composer-bordo: rgba(0, 0, 0, .1);
  --composer-ombra: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .06);
  --testo: #0d0d0d;
  --testo-2: #5d5d5d;
  --testo-3: #6b6b6b;
  --bordo: #e5e5e5;
  --bordo-forte: #d4d4d4;
  --passaggio: #ececec;
  --passaggio-leggero: rgba(0, 0, 0, .05);
  --attivo: #e3e3e3;
  --menu: #ffffff;
  --menu-ombra: 0 0 0 1px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 0, 0, .14);
  --invia: #000000;
  --invia-testo: #ffffff;
  --invia-spento: #d7d7d7;
  --invia-spento-testo: #f4f4f4;
  --velo: rgba(0, 0, 0, .4);
  --verde: #12825e;
  --pallino-verde: #16a34a;
  --pallino-arancio: #f59e0b;
  --pallino-rosso: #ef4444;
  --rosso-testo: #c42b1c;
  --arancio-testo: #a15c00;
  --scintilla-a: #8f8f8f;
  --scintilla-b: #0d0d0d;
  --fuoco: #2957f5;
  --notifica: #0d0d0d;
  --notifica-testo: #ffffff;
}

/* tema scuro: automatico (preferenza del sistema) oppure scelto */
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="chiaro"]) {
    color-scheme: dark;
    --accento-testo: #8aa6ff;
    --sfondo: #212121;
    --sfondo-barra: #171717;
    --bolla: #2f2f2f;
    --composer: #303030;
    --composer-bordo: rgba(255, 255, 255, .08);
    --composer-ombra: 0 1px 2px rgba(0, 0, 0, .2);
    --testo: #ececec;
    --testo-2: #b4b4b4;
    --testo-3: #9b9b9b;
    --bordo: #3a3a3a;
    --bordo-forte: #4a4a4a;
    --passaggio: #2f2f2f;
    --passaggio-leggero: rgba(255, 255, 255, .06);
    --attivo: #383838;
    --menu: #353535;
    --menu-ombra: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .45);
    --invia: #ffffff;
    --invia-testo: #000000;
    --invia-spento: #4a4a4a;
    --invia-spento-testo: #2a2a2a;
    --velo: rgba(0, 0, 0, .6);
    --verde: #3ecf8e;
    --rosso-testo: #ff8a80;
    --arancio-testo: #fbbf24;
    --scintilla-a: #7a7a7a;
    --scintilla-b: #f2f2f2;
    --fuoco: #8aa6ff;
    --notifica: #ececec;
    --notifica-testo: #0d0d0d;
  }
}
:root[data-tema="scuro"] {
  color-scheme: dark;
  --accento-testo: #8aa6ff;
  --sfondo: #212121;
  --sfondo-barra: #171717;
  --bolla: #2f2f2f;
  --composer: #303030;
  --composer-bordo: rgba(255, 255, 255, .08);
  --composer-ombra: 0 1px 2px rgba(0, 0, 0, .2);
  --testo: #ececec;
  --testo-2: #b4b4b4;
  --testo-3: #9b9b9b;
  --bordo: #3a3a3a;
  --bordo-forte: #4a4a4a;
  --passaggio: #2f2f2f;
  --passaggio-leggero: rgba(255, 255, 255, .06);
  --attivo: #383838;
  --menu: #353535;
  --menu-ombra: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .45);
  --invia: #ffffff;
  --invia-testo: #000000;
  --invia-spento: #4a4a4a;
  --invia-spento-testo: #2a2a2a;
  --velo: rgba(0, 0, 0, .6);
  --verde: #3ecf8e;
  --rosso-testo: #ff8a80;
  --arancio-testo: #fbbf24;
  --scintilla-a: #7a7a7a;
  --scintilla-b: #f2f2f2;
  --fuoco: #8aa6ff;
  --notifica: #ececec;
  --notifica-testo: #0d0d0d;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sfondo);
  color: var(--testo);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accento-testo); }
img { max-width: 100%; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--fuoco); outline-offset: 2px; }
.nascosto {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-piccola { width: 16px; height: 16px; }
.ic-grande { width: 32px; height: 32px; }

/* bottoni generici */
.tasto {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; color: var(--testo-2); position: relative;
  transition: background-color .15s, color .15s, opacity .15s;
}
.tasto-icona { width: 40px; height: 40px; }
.tasto-mini { width: 32px; height: 32px; border-radius: 8px; }
@media (hover: hover) {
  .tasto:not(:disabled):hover { background: var(--passaggio); color: var(--testo); }
}
.tasto-tondo { width: 36px; height: 36px; border-radius: 50%; color: var(--testo); flex: none; }

.bottone-primario {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  background: var(--accento); color: #fff; font-weight: 600; font-size: 15px;
  transition: background-color .15s, opacity .15s;
}
.bottone-primario:not(:disabled):hover { background: var(--accento-forte); }
.bottone-primario:disabled { opacity: .6; }
.bottone-secondario {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  background: transparent; color: var(--testo); font-weight: 500; font-size: 15px;
  border: 1px solid var(--bordo-forte);
  transition: background-color .15s;
}
.bottone-secondario:not(:disabled):hover { background: var(--passaggio-leggero); }
.bottone-secondario:disabled { opacity: .6; }
.bottone-largo { width: 100%; }

/* tocchi comodi: almeno 44 px di bersaglio sul telefono */
@media (pointer: coarse) {
  .tasto-icona { width: 44px; height: 44px; }
  .tasto-tondo { width: 40px; height: 40px; }
  .tasto-tondo::after, .tasto-mini::after { content: ""; position: absolute; inset: -4px; }
  .tasto-mini::after { inset: -6px; }
}

/* ---------- accesso ---------- */
.accesso {
  min-height: 100%; height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.accesso-centro { width: 100%; max-width: 360px; margin: auto 0; padding: 24px 0; display: flex; flex-direction: column; align-items: center; }
.accesso-icona { width: 56px; height: 56px; margin-bottom: 20px; }
.accesso-titolo { font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.accesso-sotto { margin-top: 8px; color: var(--testo-2); font-size: 16px; }
.modulo { width: 100%; margin-top: 32px; display: flex; flex-direction: column; }
.campo { font-size: 14px; font-weight: 500; margin: 0 0 6px 2px; }
.campo + .input, .campo + .input-pw { margin-bottom: 16px; }
.input {
  width: 100%; height: 52px; padding: 0 16px; font-size: 16px;
  background: var(--sfondo); border: 1px solid var(--bordo-forte); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus-visible { outline: none; }
.input:focus { border-color: var(--accento); box-shadow: 0 0 0 3px rgba(41, 87, 245, .2); }
.input-pw { position: relative; }
.input-pw .input { padding-right: 52px; }
.tasto-pw { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; }
.errore { color: var(--rosso-testo); font-size: 14px; margin: -4px 2px 14px; }
.modulo .bottone-primario { min-height: 52px; font-size: 16px; margin-top: 4px; }
.accesso-piede { color: var(--testo-3); font-size: 12px; text-align: center; padding-top: 16px; }

/* ---------- impalcatura dell'app ---------- */
.app {
  position: fixed; left: 0; right: 0; top: 0;
  height: var(--altezza, 100dvh);
  display: flex; overflow: hidden;
  background: var(--sfondo);
}
@supports not (height: 100dvh) { .app { height: var(--altezza, 100vh); } }

/* barra laterale */
.barra {
  width: 260px; flex: none; display: flex; flex-direction: column;
  background: var(--sfondo-barra); overflow: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: margin-left .22s ease, transform .25s ease, visibility .25s;
}
.barra-testa { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 8px 0 14px; flex: none; }
.marchio { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; min-width: 0; }
.marchio-icona { width: 26px; height: 26px; flex: none; }
.voce-barra {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 0 8px;
  min-height: 40px; padding: 0 10px; border-radius: 10px; text-align: left; font-size: 14px; color: var(--testo);
}
.voce-barra:hover { background: var(--passaggio); }
.voce-nuova { font-weight: 500; flex: none; }
.scelta-sito { padding: 0 8px 8px; flex: none; }
.sito-select {
  width: 100%; height: 40px; padding: 0 10px; font-size: 14px; border-radius: 10px;
  border: 1px solid var(--bordo-forte); background: var(--sfondo);
}

.elenco { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 8px 16px; }
.gruppo-titolo { font-size: 12px; font-weight: 600; color: var(--testo-3); padding: 16px 10px 6px; }
.gruppo-titolo:first-child { padding-top: 8px; }
.conv {
  display: block; padding: 8px 10px; border-radius: 10px; font-size: 14px; line-height: 20px;
  color: var(--testo); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv:hover { background: var(--passaggio); }
.conv[aria-current="page"] { background: var(--attivo); }
.elenco-vuoto { font-size: 13px; color: var(--testo-3); padding: 12px 10px; }

.barra-piede { flex: none; padding: 8px 0; border-top: 1px solid var(--bordo); position: relative; }
.utente { min-height: 48px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accento); color: #fff; font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.utente-nome { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* parte principale */
.principale { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.testa {
  flex: none; display: flex; align-items: center; gap: 2px;
  height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: var(--sfondo);
}
.testa-sito { position: relative; min-width: 0; flex: 1; display: flex; }
.bottone-sito {
  height: 40px; padding: 0 10px; font-size: 17px; font-weight: 600; color: var(--testo);
  min-width: 0; max-width: 100%; justify-content: flex-start;
}
.bottone-sito:disabled { cursor: default; }
.bottone-sito:disabled:hover { background: none; }
.nome-sito { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottone-apri-sito {
  height: 40px; padding: 0 12px; font-size: 14px; font-weight: 500; text-decoration: none;
  color: var(--testo); border: 1px solid var(--bordo); border-radius: 999px; flex: none;
}
.bottone-apri-sito .ic { width: 16px; height: 16px; }

/* sulla scrivania la barra si chiude spostandola; il bottone in testa compare solo quando è chiusa */
@media (min-width: 900px) {
  .app:not(.barra-chiusa) #apri-barra, .app:not(.barra-chiusa) #nuova-testa { display: none; }
  .app.barra-chiusa .barra { margin-left: -260px; visibility: hidden; }
  .velo { display: none !important; }
}

/* telefono e tablet in verticale: la barra è un cassetto */
@media (max-width: 899.98px) {
  .barra {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(300px, 86vw);
    transform: translateX(-102%); visibility: hidden; box-shadow: none;
  }
  .app.cassetto-aperto .barra { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .velo { position: fixed; inset: 0; z-index: 39; background: var(--velo); opacity: 0; transition: opacity .25s; }
  .app.cassetto-aperto .velo { opacity: 1; }
  .barra-testa #chiudi-barra .ic { transform: none; }
  .bottone-apri-sito { width: 40px; padding: 0; border: 0; border-radius: 10px; color: var(--testo-2); }
  .bottone-apri-sito .ic { width: 20px; height: 20px; }
  .solo-largo { display: none; }
  .testa { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
  .testa #nuova-testa { order: 3; }
  .testa .bottone-apri-sito { order: 2; }
}
@media (pointer: coarse) and (max-width: 899.98px) {
  .bottone-apri-sito { width: 44px; height: 44px; }
  .bottone-sito { height: 44px; }
}

/* ---------- area dei messaggi ---------- */
.scorri {
  flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  scrollbar-gutter: stable both-edges;
}
.vuota { margin: auto; padding: 24px 16px 40px; text-align: center; }
.vuota-titolo { font-size: 28px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.messaggi {
  width: 100%; max-width: 768px; margin: 0 auto; padding: 8px 24px 24px;
}
.app.vuota-attiva .messaggi { display: none; }
.app:not(.vuota-attiva) .vuota { display: none; }

.msg { margin: 0 0 24px; }
.msg.cliente { display: flex; flex-direction: column; align-items: flex-end; }
.bolla {
  background: var(--bolla); border-radius: 22px; padding: 10px 18px;
  max-width: 75%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.msg.in-volo .bolla { opacity: .7; }
.allegati-msg { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 8px; max-width: 75%; }
.miniatura-msg {
  display: block; position: relative; width: 112px; height: 112px; border-radius: 14px; overflow: hidden;
  background: var(--bolla); border: 1px solid var(--bordo);
}
.miniatura-msg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.allegati-msg.una .miniatura-msg { width: auto; height: auto; max-width: 240px; }
.allegati-msg.una .miniatura-msg img { width: auto; height: auto; max-height: 240px; max-width: 100%; }
.miniatura-msg .play {
  position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: flex; align-items: center; justify-content: center;
}
.miniatura-msg .play .ic { width: 18px; height: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 10px; max-width: 260px;
  padding: 8px 14px 8px 8px; border-radius: 14px; border: 1px solid var(--bordo); background: var(--sfondo);
  font-size: 14px;
}
.chip-icona { width: 36px; height: 36px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--accento); color: #fff; }
.chip-icona.pdf { background: #e5484d; }
.chip-testi { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.chip-nome { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-tipo { font-size: 12px; color: var(--testo-3); }

.msg.sistema { display: flex; justify-content: flex-end; margin-top: -16px; }
.msg.sistema p { max-width: 75%; font-size: 13px; font-style: italic; color: var(--testo-3); padding: 0 6px; overflow-wrap: anywhere; text-align: right; }

.msg.irvola { display: flex; gap: 14px; align-items: flex-start; }
.msg-icona { width: 28px; height: 28px; flex: none; margin-top: 0; }
.corpo { flex: 1; min-width: 0; padding-top: 2px; }
.testo-irvola { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.testo-irvola strong { font-weight: 600; }
.azioni-msg { display: flex; gap: 2px; margin: 6px 0 0 -8px; min-height: 32px; transition: opacity .15s; }
.azioni-msg .tasto { width: 32px; height: 32px; border-radius: 8px; }
.azioni-msg .ic { width: 18px; height: 18px; }
.azioni-msg .tasto[aria-pressed="true"] { color: var(--accento-testo); }
@media (hover: hover) and (pointer: fine) {
  .msg.irvola .azioni-msg { opacity: 0; }
  .msg.irvola:hover .azioni-msg, .msg.irvola:focus-within .azioni-msg, .msg.irvola.ultimo .azioni-msg { opacity: 1; }
}
@media (pointer: coarse) {
  .azioni-msg { gap: 4px; }
  .azioni-msg .tasto { width: 40px; height: 40px; }
}

/* la fase del lavoro (come «Thinking…») */
.fase { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; min-height: 28px; }
.fase-testo {
  font-size: 15px; font-weight: 500;
  background: linear-gradient(90deg, var(--scintilla-a) 0%, var(--scintilla-a) 35%, var(--scintilla-b) 50%, var(--scintilla-a) 65%, var(--scintilla-a) 100%);
  background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: scintilla 2.2s linear infinite;
}
@keyframes scintilla { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.msg-icona.pulsa { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 0%, 100% { transform: scale(1); } 50% { transform: scale(.88); } }

/* ---------- card dell'anteprima ---------- */
.card {
  margin-top: 14px; border: 1px solid var(--bordo); border-radius: 16px; padding: 16px;
  background: var(--sfondo);
}
.card-titolo { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.fatti { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fatti li { display: flex; gap: 8px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.fatti .ic { width: 18px; height: 18px; color: var(--accento-testo); margin-top: 2px; }
.schermate {
  display: grid; grid-template-columns: 1.6fr .462fr; gap: 12px; align-items: stretch; margin-bottom: 12px;
}
.schermate.sola { grid-template-columns: 1fr; max-width: 480px; }
.schermata { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.schermata button {
  display: block; width: 100%; flex: 1; min-height: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--bordo);
  background: var(--bolla); cursor: zoom-in; transition: border-color .15s;
}
.schermata button:hover { border-color: var(--bordo-forte); }
.schermata img { display: block; width: 100%; height: 100%; }
.schermata.computer img { aspect-ratio: 1440 / 900; object-fit: cover; object-position: top; }
.schermata.telefono img { aspect-ratio: 390 / 844; object-fit: cover; object-position: top; }
.schermata figcaption { font-size: 12px; color: var(--testo-3); margin-top: 6px; text-align: center; }
.link-vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; text-decoration: none; padding: 6px 0; }
.link-vivo:hover { text-decoration: underline; }
.link-vivo .ic { width: 15px; height: 15px; }
.azioni-card { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.azioni-card .bottone-primario.armato { background: #b42318; }
.azioni-card .bottone-primario.armato:hover { background: #9a1d14; }
.stato-card { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.stato-card.pubblicata { color: var(--verde); }
.stato-card.scartata { color: var(--testo-3); }
.stato-card .ic { width: 18px; height: 18px; }
.stato-card.pubblicata .ic { stroke-width: 2.5; }

@media (max-width: 599.98px) {
  .messaggi { padding: 8px 16px 20px; }
  .msg.irvola { gap: 10px; }
  .msg-icona { width: 24px; height: 24px; margin-top: 2px; }
  .bolla, .allegati-msg, .msg.sistema p { max-width: 85%; }
  .card { padding: 14px; margin-left: -34px; }
  .schermate { gap: 8px; }
  .azioni-card .bottone-primario, .azioni-card .bottone-secondario { flex: 1; }
}

/* ---------- fondo: suggerimenti + campo di scrittura ---------- */
.fondo {
  flex: none; position: relative; width: 100%; max-width: 816px; margin: 0 auto;
  padding: 0 24px calc(8px + env(safe-area-inset-bottom));
}
.bottone-giu {
  position: absolute; left: 50%; top: -52px; margin-left: -18px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--sfondo); border: 1px solid var(--bordo-forte); color: var(--testo); z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.bottone-giu:hover { background: var(--passaggio) !important; }

.suggerimenti { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.app:not(.vuota-attiva) .suggerimenti, .app.registra .suggerimenti, .app.scrive .suggerimenti { display: none; }
.suggerimento {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 12px 16px; border-radius: 16px; border: 1px solid var(--bordo); background: var(--sfondo);
  font-size: 14px; line-height: 1.35; min-height: 44px; transition: background-color .15s;
}
.suggerimento:hover { background: var(--passaggio-leggero); }
.suggerimento strong { font-weight: 600; color: var(--testo); }
.suggerimento span { color: var(--testo-3); }

.avviso {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px;
  padding: 10px 8px 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45;
  background: var(--bolla); border: 1px solid var(--bordo);
}
.avviso > .ic { color: var(--arancio-testo); margin-top: 1px; width: 18px; height: 18px; }
.avviso p { flex: 1; padding-top: 0; }
.avviso .tasto-mini { margin: -6px 0 -6px 0; }

.composer {
  background: var(--composer); border-radius: 26px; padding: 8px;
  box-shadow: 0 0 0 1px var(--composer-bordo), var(--composer-ombra);
  transition: box-shadow .15s;
}
.riga { display: flex; align-items: flex-end; gap: 4px; }
.testo {
  flex: 1; min-width: 0; border: 0; background: transparent; resize: none; outline: none;
  font-size: 16px; line-height: 24px; padding: 6px 6px; margin: 0;
  min-height: 36px; max-height: calc(24px * 8 + 12px); overflow-y: auto;
}
.testo::placeholder { color: var(--testo-3); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.testo:focus-visible { outline: none; }
.composer:focus-within { box-shadow: 0 0 0 1px var(--bordo-forte), var(--composer-ombra); }
.tasto-mic { color: var(--testo-2); touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.tasto-tondo:not(.tasto-invia):hover { background: var(--passaggio); }

.tasto-invia { background: var(--invia); color: var(--invia-testo); }
.tasto-invia .ic { stroke-width: 2.4; }
.tasto-invia:disabled { background: var(--invia-spento); color: var(--invia-spento-testo); }
.tasto-invia .ic-stop, .tasto-invia .rotella { display: none; }
.tasto-invia.lavoro { background: var(--invia); color: var(--invia-testo); opacity: 1; }
.tasto-invia.lavoro .ic-su { display: none; }
.tasto-invia.lavoro .ic-stop { display: block; }
.tasto-invia.coda .ic-su { display: none; }
.tasto-invia.coda .rotella { display: block; }
.tasto-invia:not(:disabled):hover { opacity: .85; }
.rotella {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

.piu-ancora { position: relative; flex: none; }

/* allegati in attesa */
.in-attesa { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px; scrollbar-width: thin; }
.tessera {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 14px;
  background: var(--bolla); border: 1px solid var(--bordo); cursor: pointer; padding: 0; overflow: visible;
}
.tessera-dentro { position: absolute; inset: 0; border-radius: 13px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--testo-2); }
.tessera-dentro img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tessera.larga { width: 200px; }
.tessera.larga .tessera-dentro { justify-content: flex-start; gap: 10px; padding: 0 10px; }
.tessera .chip-icona { width: 40px; height: 40px; }
.tessera .chip-testi { text-align: left; font-size: 13px; }
.tessera .barra-avanzamento {
  position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px;
  background: rgba(0, 0, 0, .35); overflow: hidden;
}
.tessera .barra-avanzamento span { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; transition: width .2s; }
.tessera.larga .barra-avanzamento { background: var(--bordo); }
.tessera.larga .barra-avanzamento span { background: var(--accento); }
.tessera .velo-carica { position: absolute; inset: 0; background: rgba(0, 0, 0, .25); }
.tessera.larga .velo-carica { display: none; }
.togli {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--testo); color: var(--sfondo); display: flex; align-items: center; justify-content: center; z-index: 2;
  border: 2px solid var(--composer);
}
.togli .ic { width: 12px; height: 12px; stroke-width: 3; }
.togli::after { content: ""; position: absolute; inset: -10px; }
.pallino {
  position: absolute; left: -3px; top: -3px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--composer); z-index: 2;
}
.pallino.verde { background: var(--pallino-verde); }
.pallino.arancio { background: var(--pallino-arancio); }
.pallino.rosso { background: var(--pallino-rosso); }
.tessera.errore .tessera-dentro { box-shadow: inset 0 0 0 2px var(--pallino-rosso); }
.tessera .icona-errore { color: var(--rosso-testo); }
.tessera[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--accento); }

.nota-allegato {
  margin: 0 4px 10px; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45;
  background: var(--bolla); position: relative; padding-right: 40px;
}
.nota-allegato .nota-nome { font-weight: 600; margin-bottom: 2px; overflow-wrap: anywhere; }
.nota-allegato ul { margin: 4px 0 0; padding-left: 18px; }
.nota-allegato li.motivo { color: var(--rosso-testo); }
.nota-allegato li.avviso-voce { color: var(--arancio-testo); }
.nota-allegato .nota-ok { color: var(--verde); }
.nota-allegato .tasto-mini { position: absolute; right: 4px; top: 4px; }

/* registrazione */
.registrazione { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.reg-onda { flex: 1; min-width: 0; position: relative; height: 36px; display: flex; align-items: center; }
.onda { width: 100%; height: 32px; display: block; }
.reg-suggerimento { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--testo-3); pointer-events: none; }
.reg-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--pallino-rosso); flex: none; animation: pulsa-punto 1.2s ease-in-out infinite; }
@keyframes pulsa-punto { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.reg-tempo { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--testo-2); min-width: 38px; text-align: right; }

.nota-piede { font-size: 12px; color: var(--testo-3); text-align: center; padding: 8px 8px 0; line-height: 1.4; }

@media (max-width: 599.98px) {
  .fondo { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .vuota-titolo { font-size: 24px; }
  .bottone-sito { font-size: 16px; padding: 0 6px; }
  /* sul telefono i suggerimenti scorrono in orizzontale sopra il campo */
  .suggerimenti {
    display: flex; overflow-x: auto; gap: 8px; margin: 0 -10px 10px; padding: 0 10px;
    scroll-snap-type: x proximity; scrollbar-width: none; scroll-padding: 0 10px;
  }
  .suggerimenti::-webkit-scrollbar { display: none; }
  .suggerimento { flex: none; scroll-snap-align: start; padding: 10px 14px; max-width: 70vw; }
  .suggerimento strong, .suggerimento span { white-space: nowrap; }
  .nota-piede { font-size: 11px; padding-top: 6px; }
}

/* ---------- menu a comparsa ---------- */
.menu {
  position: absolute; z-index: 50; min-width: 220px; padding: 6px;
  background: var(--menu); border-radius: 16px; box-shadow: var(--menu-ombra);
}
.menu-piu { bottom: calc(100% + 10px); left: 0; }
.menu-utente { bottom: calc(100% + 4px); left: 8px; right: 8px; }
.menu-sito { top: calc(100% + 4px); left: 0; max-width: min(320px, 90vw); }
.menu-voce {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px;
  border-radius: 10px; font-size: 14px; text-align: left; color: var(--testo); text-decoration: none; white-space: nowrap;
}
.menu-voce > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.menu-voce:hover, .menu-voce:focus-visible { background: var(--passaggio); outline: none; }
.menu-voce .ic { width: 18px; height: 18px; color: var(--testo-2); }
.menu-voce .ic-spunta { visibility: hidden; color: var(--accento-testo); }
.menu-voce[aria-checked="true"] .ic-spunta { visibility: visible; }
.menu-etichetta { font-size: 12px; font-weight: 600; color: var(--testo-3); padding: 6px 12px 4px; }
.menu-separatore { height: 1px; background: var(--bordo); margin: 6px 4px; }
@media (pointer: coarse) { .menu-voce { min-height: 44px; } }
@media (pointer: fine) { .solo-tocco { display: none !important; } }

/* ---------- trascina, visore, notifiche ---------- */
.trascina {
  position: fixed; inset: 0; z-index: 60; background: rgba(41, 87, 245, .08); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px; pointer-events: none;
}
.trascina-riquadro {
  width: min(520px, 100%); padding: 40px 24px; border-radius: 24px; border: 2px dashed var(--accento);
  background: var(--sfondo); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--accento-testo);
}
.trascina-riquadro p { font-size: 18px; font-weight: 600; color: var(--testo); }
.trascina-riquadro span { font-size: 14px; color: var(--testo-3); }

.visore {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(0, 0, 0, .92); color: #fff;
}
.visore::backdrop { background: rgba(0, 0, 0, .6); }
.visore[open] { display: flex; align-items: center; justify-content: center; }
.visore-figura { margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(56px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
.visore-figura img { max-width: 100%; max-height: calc(100% - 32px); object-fit: contain; border-radius: 8px; }
.visore-figura figcaption { font-size: 14px; color: #d0d0d0; margin-top: 10px; text-align: center; }
.visore-chiudi { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; color: #fff; z-index: 2; }
.visore-chiudi:hover { background: rgba(255, 255, 255, .12) !important; color: #fff !important; }

.notifica {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); z-index: 70;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  max-width: min(480px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 14px;
  background: var(--notifica); color: var(--notifica-testo); font-size: 14px; line-height: 1.4; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); transition: opacity .2s, transform .2s;
}
.notifica.vista { opacity: 1; transform: translate(-50%, 0); }

/* ---------- meno movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .fase-testo { background: none; color: var(--testo-2); animation: none; }
  .msg-icona.pulsa, .reg-punto { animation: none; }
  .rotella { animation: gira 1.5s linear infinite !important; }
}

/* ---------- dialogo (Collega Telegram) ---------- */
.dialogo {
  width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 20px;
  background: var(--menu); color: var(--testo); box-shadow: var(--menu-ombra);
}
.dialogo::backdrop { background: var(--velo); }
.dialogo-testa { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 20px; }
.dialogo-titolo { font-size: 18px; font-weight: 600; }
.dialogo-corpo { padding: 4px 20px 20px; }
.tg-carica { display: flex; align-items: center; gap: 10px; color: var(--testo-2); font-size: 15px; padding-top: 12px; }
.tg-spiega { font-size: 15px; color: var(--testo-2); line-height: 1.5; }
.tg-codice-riga {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 8px;
  padding: 8px 8px 8px 18px; border-radius: 14px; background: var(--bolla);
}
.tg-codice { font-size: 28px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.tg-nota { font-size: 13px; color: var(--testo-3); margin-bottom: 16px; }
.tg-errore-testo { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
#tg-errore .tg-nota { margin-bottom: 0; }
#tg-apri { text-decoration: none; min-height: 48px; }
