/* Portale AID — interfaccia. Palette ispirata all'identità UniPD (rosso istituzionale + grigi caldi),
   resa più leggera: superfici chiare, angoli morbidi, un solo colore d'accento. */
@font-face { font-family:"Titillium Web"; font-style:normal; font-weight:400; font-display:swap; src:url("../fonts/TitilliumWeb-Regular.woff2") format("woff2"); }
@font-face { font-family:"Titillium Web"; font-style:normal; font-weight:600; font-display:swap; src:url("../fonts/TitilliumWeb-SemiBold.woff2") format("woff2"); }
@font-face { font-family:"Titillium Web"; font-style:normal; font-weight:700; font-display:swap; src:url("../fonts/TitilliumWeb-Bold.woff2") format("woff2"); }
@font-face { font-family:"Roboto Mono"; font-style:normal; font-weight:400; font-display:swap; src:url("../fonts/RobotoMono-Regular.woff2") format("woff2"); }

:root {
  --brand:#9B0014; --brand-hover:#7C0010; --brand-soft:#F8E8EA; --on-brand:#fff;
  --bg:#F6F4F1; --surface:#fff; --surface-2:#FAF8F6; --border:#E4DFDA; --border-strong:#CFC8C1;
  --text:#1E1B19; --muted:#625B55; --disabled:#9A938D;
  --ok:#0B7A4B; --ok-soft:#E6F5EE; --warn:#8A5300; --warn-soft:#FBF1DF; --err:#B3261E; --err-soft:#FCEAE8; --info:#1F5FA8; --info-soft:#E7F0FA;
  --code-bg:#F1EEEA; --code-head:#E7E2DC; --focus:#1F5FA8;
  --hl-kw:#B3261E; --hl-str:#0B6B43; --hl-num:#1F5FA8; --hl-com:#7A736D; --hl-fn:#6B3FA0; --hl-attr:#8A5300;
  --font:"Titillium Web",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; --mono:"Roboto Mono",ui-monospace,Menlo,monospace;
  --r-sm:6px; --r:10px; --r-lg:16px; --sh:0 1px 2px rgba(30,27,25,.06),0 4px 14px rgba(30,27,25,.06); --sh-lg:0 12px 36px rgba(30,27,25,.18);
  --side-w:288px;
}
[data-theme="dark"] {
  --brand:#FF6B7D; --brand-hover:#FF93A0; --brand-soft:#3A1A20; --on-brand:#2A0509;
  --bg:#151413; --surface:#1E1C1B; --surface-2:#252220; --border:#38332F; --border-strong:#4A433E;
  --text:#F2EEEA; --muted:#B9B0A8; --disabled:#7A726B;
  --ok:#5FD0A0; --ok-soft:#10261D; --warn:#F2C078; --warn-soft:#2D2412; --err:#FF8F86; --err-soft:#32171A; --info:#8DB8F0; --info-soft:#14243A;
  --code-bg:#121110; --code-head:#2A2624; --focus:#8DB8F0;
  --hl-kw:#FF8F86; --hl-str:#7BD9A8; --hl-num:#8DB8F0; --hl-com:#8E867F; --hl-fn:#C9A6F2; --hl-attr:#F2C078;
  --sh:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.35); --sh-lg:0 12px 36px rgba(0,0,0,.6);
}

*,*::before,*::after { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font-family:var(--font); font-size:1rem; line-height:1.55; color:var(--text); background:var(--bg); }
h1,h2,h3 { line-height:1.2; margin:0 0 .5em; font-weight:600; }
h1 { font-size:1.6rem; } h2 { font-size:1.2rem; }
p { margin:0 0 .8em; } a { color:var(--brand); }
a:hover { color:var(--brand-hover); }
:focus-visible { outline:3px solid var(--focus); outline-offset:2px; border-radius:var(--r-sm); }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-link { position:absolute; left:8px; top:-60px; background:var(--brand); color:var(--on-brand); padding:.5rem 1rem; border-radius:var(--r-sm); z-index:200; }
.skip-link:focus { top:8px; }
.muted { color:var(--muted); } .small { font-size:.85rem; }
[hidden] { display:none !important; }
.icona { flex:none; }
.inline { display:inline; margin:0; }

/* ---------- Pulsanti e campi ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; min-height:40px; padding:.45rem 1rem; border:1px solid transparent; border-radius:var(--r); font:inherit; font-weight:600; cursor:pointer; text-decoration:none; background:var(--surface); color:var(--text); transition:background .15s,border-color .15s,box-shadow .15s; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary { background:var(--brand); color:var(--on-brand); }
.btn-primary:hover:not(:disabled) { background:var(--brand-hover); color:var(--on-brand); }
.btn-ghost { border-color:var(--border-strong); background:transparent; }
.btn-ghost:hover:not(:disabled) { background:var(--surface-2); }
.btn-pericolo { color:var(--err); }
.btn-sm { min-height:34px; padding:.25rem .7rem; font-size:.9rem; }
.btn-block { width:100%; }
.btn-link { background:none; border:0; color:var(--brand); text-decoration:underline; padding:0; min-height:0; font-weight:400; }
.icon-btn { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; border:0; border-radius:var(--r); background:transparent; color:inherit; cursor:pointer; text-decoration:none; }
.icon-btn:hover { background:var(--surface-2); }
.icon-btn-sm { width:32px; height:32px; }
.field { margin-bottom:1rem; flex:1; min-width:0; }
.field label { display:block; font-weight:600; margin-bottom:.25rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea { width:100%; min-height:42px; padding:.5rem .75rem; border:1px solid var(--border-strong); border-radius:var(--r); background:var(--surface); color:var(--text); font:inherit; }
textarea { resize:vertical; min-height:80px; }
input:disabled { background:var(--surface-2); color:var(--muted); }
small { display:block; margin-top:.25rem; }
.check { display:flex; align-items:flex-start; gap:.5rem; margin:.4rem 0; font-weight:400; cursor:pointer; }
.check input { margin-top:.35rem; width:1.05rem; height:1.05rem; accent-color:var(--brand); }
.row { display:flex; gap:1rem; flex-wrap:wrap; } .row > .field { min-width:150px; }
fieldset { border:1px solid var(--border); border-radius:var(--r); padding:1rem 1.1rem; margin:0 0 1.2rem; }
legend { padding:0 .4rem; font-weight:700; }
.mini-select { width:auto !important; min-height:34px !important; padding:.2rem .5rem !important; font-size:.9rem; }
.lista-check { max-height:240px; overflow:auto; border:1px solid var(--border); border-radius:var(--r); padding:.4rem .8rem; margin-top:.5rem; }

.alert { padding:.7rem 1rem; border-radius:var(--r); border:1px solid; margin:0 0 1rem; }
.alert ul { margin:0; padding-left:1.1rem; }
.alert-success { background:var(--ok-soft); color:var(--ok); border-color:var(--ok); }
.alert-error { background:var(--err-soft); color:var(--err); border-color:var(--err); }
.alert-warning { background:var(--warn-soft); color:var(--warn); border-color:var(--warn); }
.badge { display:inline-block; padding:0 .55rem; border-radius:999px; background:var(--surface-2); border:1px solid var(--border); font-size:.8rem; }
.badge-warn { background:var(--warn-soft); color:var(--warn); border-color:var(--warn); }
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); padding:1.1rem 1.25rem; margin-bottom:1rem; box-shadow:var(--sh); }
.card-link { display:flex; flex-direction:column; gap:.2rem; text-decoration:none; color:inherit; height:100%; }
.card-link:hover { border-color:var(--brand); }
.card-link .icona { color:var(--brand); }

/* ---------- Pagine pubbliche (login, registrazione) ---------- */
.auth-page { background:linear-gradient(160deg,var(--bg) 0%,var(--brand-soft) 140%); min-height:100vh; }
.auth-wrap { max-width:480px; margin:0 auto; padding:2.5rem 1rem 2rem; }
.auth-brand { display:flex; align-items:center; gap:.7rem; font-weight:700; font-size:1.3rem; margin-bottom:1.2rem; justify-content:center; }
.auth-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); padding:1.6rem; box-shadow:var(--sh-lg); }
.auth-links { margin:1rem 0 0; text-align:center; font-size:.95rem; }
.auth-lang { display:flex; flex-wrap:wrap; gap:.4rem .9rem; justify-content:center; margin-top:1.2rem; font-size:.9rem; }
.auth-lang a[aria-current] { font-weight:700; text-decoration:none; color:var(--text); }
.auth-legal { text-align:center; font-size:.85rem; }
.logo-mark { display:inline-grid; place-items:center; width:38px; height:38px; border-radius:11px; background:var(--brand); color:var(--on-brand); font-weight:700; font-size:.82rem; letter-spacing:.04em; }

/* ---------- Guscio applicazione ---------- */
body.app { display:grid; grid-template-columns:var(--side-w) minmax(0,1fr); height:100vh; height:100dvh; overflow:hidden; }
.sidebar { display:flex; flex-direction:column; background:var(--surface); border-right:1px solid var(--border); min-height:0; }
.side-head { display:flex; align-items:center; justify-content:space-between; padding:.9rem 1rem .5rem; }
.brand { display:flex; align-items:center; gap:.6rem; text-decoration:none; color:var(--text); font-weight:700; font-size:1.1rem; }
.side-nuova { margin:.4rem 1rem .8rem; }
.side-scroll { flex:1; overflow-y:auto; padding:0 .6rem; }
.side-lista { list-style:none; margin:0; padding:0; }
.side-link { display:flex; align-items:center; gap:.65rem; padding:.5rem .7rem; border-radius:var(--r); color:var(--text); text-decoration:none; position:relative; min-height:40px; }
.side-link span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.side-link small { display:none; }
.side-link:hover { background:var(--surface-2); color:var(--text); }
.side-link.attivo { background:var(--brand-soft); font-weight:600; }
.side-link.attivo::before { content:""; position:absolute; left:-6px; top:8px; bottom:8px; width:3px; border-radius:3px; background:var(--brand); }
.side-link .icona { color:var(--muted); } .side-link.attivo .icona { color:var(--brand); }
.side-gruppo { margin-top:.6rem; }
.side-gruppo > summary { display:flex; align-items:center; gap:.5rem; padding:.4rem .7rem; font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); cursor:pointer; list-style:none; font-weight:600; }
.side-gruppo > summary::-webkit-details-marker { display:none; }
.side-gruppo > summary .icona { width:15px; height:15px; }
.side-gruppo > summary::after { content:""; margin-left:auto; width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg); transition:transform .15s; }
.side-gruppo[open] > summary::after { transform:rotate(45deg); }
.side-riga { display:flex; align-items:center; } .side-riga .side-link { flex:1; min-width:0; flex-wrap:wrap; }
.side-riga .side-link small { display:block; width:100%; font-size:.75rem; margin:0; }
.side-vuoto { padding:.4rem .7rem; font-size:.9rem; }
.side-check { padding:0 .7rem; font-size:.85rem; }
.side-foot { border-top:1px solid var(--border); padding:.6rem; display:flex; flex-direction:column; gap:.2rem; }
.side-azioni { display:flex; justify-content:space-between; padding:0 .3rem; }
.side-close, .menu-btn, .scrim { display:none; }
.main-col { display:flex; flex-direction:column; min-width:0; min-height:0; }
.topbar { display:flex; align-items:center; gap:.7rem; padding:.55rem 1.2rem; border-bottom:1px solid var(--border); background:var(--surface); min-height:58px; }
.topbar-titolo { font-size:1.1rem; margin:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.topbar-extra { display:flex; align-items:center; gap:.6rem; }
.topbar-modello { font-size:.85rem; color:var(--muted); background:var(--surface-2); border:1px solid var(--border); padding:.1rem .6rem; border-radius:999px; }
.topbar-modello:empty { display:none; }
.contenuto { flex:1; overflow-y:auto; padding:1.4rem; min-height:0; }
.contenuto-chat { padding:0; display:flex; flex-direction:column; overflow:hidden; }
.pagina { max-width:1000px; margin:0 auto; } .pagina-stretta { max-width:760px; } .pagina-larga { max-width:1200px; }
.tabs { display:flex; gap:.3rem; border-bottom:1px solid var(--border); margin-bottom:1.2rem; overflow-x:auto; }
.tab { padding:.6rem 1rem; text-decoration:none; color:var(--muted); border-bottom:3px solid transparent; white-space:nowrap; font-weight:600; }
.tab.attivo { color:var(--text); border-color:var(--brand); }
.barra-azioni { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; flex-wrap:wrap; }
.vuoto-pagina { text-align:center; padding:3rem 1rem; color:var(--muted); border:1px dashed var(--border-strong); border-radius:var(--r-lg); }

/* ---------- Bot ---------- */
.griglia-bot { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:1rem; }
.bot-card { display:flex; flex-direction:column; margin:0; }
.bot-card-top { display:flex; justify-content:space-between; gap:.5rem; align-items:flex-start; }
.bot-nome { font-size:1.1rem; margin:0 0 .3rem; } .bot-nome a { display:flex; gap:.5rem; align-items:center; text-decoration:none; color:var(--text); }
.bot-nome .icona { color:var(--brand); }
.bot-spento { opacity:.7; }
.bot-azioni { display:flex; flex-wrap:wrap; gap:.4rem; margin-top:auto; padding-top:.7rem; align-items:center; }
.form-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); padding:1.3rem; margin-bottom:1rem; box-shadow:var(--sh); }
.form-azioni { display:flex; justify-content:flex-end; gap:.6rem; margin-top:1rem; }

/* ---------- Chat ---------- */
.chat { flex:1; display:flex; flex-direction:column; min-height:0; position:relative; }
.messaggi { flex:1; overflow-y:auto; padding:1.5rem 1.2rem; scroll-behavior:smooth; }
.vuoto { max-width:760px; margin:8vh auto 0; text-align:center; }
.vuoto-titolo { font-size:clamp(1.5rem,3vw,2.1rem); }
.bot-suggeriti { list-style:none; display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:.8rem; padding:0; margin:1.6rem 0 0; text-align:left; }
.bot-suggeriti .card { margin:0; padding:.9rem 1rem; }
.msg { max-width:820px; margin:0 auto 1.2rem; display:flex; flex-direction:column; position:relative; }
.msg-utente { align-items:flex-end; }
.msg-utente .msg-corpo { background:var(--brand-soft); border:1px solid var(--border); border-radius:var(--r-lg) var(--r-lg) 4px var(--r-lg); padding:.7rem 1rem; max-width:88%; }
.msg-testo { white-space:pre-wrap; overflow-wrap:anywhere; margin:0; }
.msg-assistente .msg-corpo { width:100%; overflow-wrap:anywhere; }
.msg-azioni { display:flex; gap:.2rem; margin-top:.2rem; opacity:.7; } .msg-assistente:hover .msg-azioni { opacity:1; }
.msg-file { display:flex; flex-wrap:wrap; gap:.3rem; margin-bottom:.4rem; }
.file-chip { display:inline-flex; align-items:center; gap:.3rem; font-size:.82rem; background:var(--surface); border:1px solid var(--border-strong); border-radius:999px; padding:.1rem .65rem; }
.file-x { border:0; background:none; cursor:pointer; color:var(--muted); font-size:1.1rem; line-height:1; padding:0 .1rem; }
.msg-errore { max-width:820px; margin:0 auto 1rem; padding:.7rem 1rem; border:1px solid var(--err); background:var(--err-soft); color:var(--err); border-radius:var(--r); }
.attesa { display:inline-flex; gap:5px; padding:.4rem 0; }
.attesa span { width:8px; height:8px; border-radius:50%; background:var(--brand); animation:pulsa 1.2s infinite ease-in-out; }
.attesa span:nth-child(2) { animation-delay:.15s; } .attesa span:nth-child(3) { animation-delay:.3s; }
@keyframes pulsa { 0%,80%,100% { opacity:.25; transform:scale(.8);} 40% { opacity:1; transform:scale(1);} }
.banner-conv { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.6rem 1.2rem; background:var(--info-soft); color:var(--info); border-bottom:1px solid var(--border); }

.compositore { margin:0 auto 1rem; width:calc(100% - 2.4rem); max-width:820px; background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--r-lg); padding:.7rem .8rem .5rem; box-shadow:var(--sh); }
.compositore:focus-within { border-color:var(--brand); }
.compositore.trascina { outline:2px dashed var(--brand); outline-offset:3px; }
.compositore textarea { border:0 !important; padding:.3rem .2rem !important; min-height:48px !important; max-height:240px; resize:none; background:transparent !important; box-shadow:none; outline:none; }
.allegati { display:flex; flex-wrap:wrap; gap:.4rem; padding-bottom:.4rem; }
.comp-barra { display:flex; justify-content:space-between; align-items:center; gap:.6rem; flex-wrap:wrap; }
.comp-sx,.comp-dx { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.chip { display:inline-flex; align-items:center; gap:.35rem; border:1px solid var(--border-strong); background:transparent; color:var(--text); border-radius:999px; padding:.2rem .75rem; font:inherit; font-size:.9rem; cursor:pointer; min-height:34px; }
.chip[aria-pressed="true"] { background:var(--brand-soft); border-color:var(--brand); color:var(--brand); }
.btn-invia { width:42px; padding:0; border-radius:50%; min-height:42px; }
.btn-stop { background:var(--text); color:var(--surface); }
.quota { font-size:.82rem; color:var(--muted); } .quota-alta { color:var(--err); font-weight:600; }
.aiuto-tasti { font-size:.78rem; margin:.3rem .2rem 0; }

/* Ragionamento del modello (riquadro comprimibile) */
.ragionamento { margin:0 0 .7rem; border-left:3px solid var(--border-strong); padding-left:.8rem; color:var(--muted); font-size:.9rem; }
.ragionamento > summary { cursor:pointer; list-style:none; display:flex; align-items:center; gap:.45rem; min-height:28px; user-select:none; }
.ragionamento > summary::-webkit-details-marker { display:none; }
.ragionamento > summary::before { content:""; width:6px; height:6px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg); transition:transform .15s; }
.ragionamento[open] > summary::before { transform:rotate(45deg); }
.ragionamento.ragionando > summary { color:var(--brand); }
.ragionamento.ragionando > summary::after { content:""; width:8px; height:8px; border-radius:50%; background:var(--brand); animation:pulsa 1.2s infinite ease-in-out; }
.ragionamento-testo { white-space:pre-wrap; overflow-wrap:anywhere; max-height:260px; overflow-y:auto; padding:.4rem 0 .2rem; font-style:italic; }

/* Markdown */
.md > :first-child { margin-top:0; } .md > :last-child { margin-bottom:0; }
.md h1,.md h2,.md h3 { margin:1.2em 0 .5em; } .md ul,.md ol { padding-left:1.4rem; }
.md blockquote { margin:.8em 0; padding:.2em 1em; border-left:3px solid var(--border-strong); color:var(--muted); }
.md table { border-collapse:collapse; display:block; overflow-x:auto; max-width:100%; margin:.8em 0; }
.md th,.md td { border:1px solid var(--border); padding:.4rem .7rem; } .md th { background:var(--surface-2); }
.md :not(pre) > code { font-family:var(--mono); font-size:.88em; background:var(--code-bg); padding:.1em .4em; border-radius:4px; }
.md img { max-width:100%; height:auto; border-radius:var(--r); }
.codice { margin:.9em 0; border:1px solid var(--border); border-radius:var(--r); overflow:hidden; background:var(--code-bg); }
.codice-head { display:flex; justify-content:space-between; align-items:center; background:var(--code-head); padding:.25rem .5rem .25rem .9rem; font-size:.8rem; color:var(--muted); font-family:var(--mono); }
.codice-copia { border:1px solid var(--border-strong); background:var(--surface); color:var(--text); border-radius:var(--r-sm); font:inherit; font-size:.8rem; padding:.15rem .7rem; cursor:pointer; min-height:28px; }
.codice pre { margin:0; padding:.9rem 1rem; overflow-x:auto; font-family:var(--mono); font-size:.88rem; line-height:1.5; tab-size:2; }
.codice pre code { font-family:inherit; background:none; padding:0; white-space:pre; }
.hljs-keyword,.hljs-selector-tag,.hljs-built_in,.hljs-literal,.hljs-doctag { color:var(--hl-kw); }
.hljs-string,.hljs-regexp,.hljs-addition,.hljs-template-variable { color:var(--hl-str); }
.hljs-number,.hljs-symbol,.hljs-bullet,.hljs-meta { color:var(--hl-num); }
.hljs-comment,.hljs-quote,.hljs-deletion { color:var(--hl-com); font-style:italic; }
.hljs-title,.hljs-function,.hljs-section,.hljs-class .hljs-title { color:var(--hl-fn); }
.hljs-attr,.hljs-attribute,.hljs-name,.hljs-variable,.hljs-type,.hljs-params { color:var(--hl-attr); }

/* ---------- Tabelle, KPI, grafici ---------- */
.tabella-scroll { overflow-x:auto; }
.tabella { width:100%; border-collapse:collapse; font-size:.93rem; }
.tabella th,.tabella td { padding:.55rem .7rem; border-bottom:1px solid var(--border); text-align:left; vertical-align:middle; }
.tabella thead th { font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); white-space:nowrap; }
.tabella tbody th { font-weight:600; } .tabella .num { text-align:right; font-variant-numeric:tabular-nums; }
.azioni-riga { white-space:nowrap; text-align:right !important; }
.input-quota { max-width:150px; }
.filtri { display:flex; gap:.8rem; align-items:flex-end; flex-wrap:wrap; margin-bottom:1rem; } .filtri .field { margin:0; flex:none; }
.kpi { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:.8rem; margin-bottom:1rem; }
.kpi-item { margin:0; display:flex; flex-direction:column; } .kpi-item strong { font-size:1.5rem; font-variant-numeric:tabular-nums; }
.barre { display:flex; align-items:flex-end; gap:4px; height:150px; overflow-x:auto; padding-top:.5rem; }
.barra { flex:1 0 22px; max-width:56px; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:2px; }
.barra span { width:100%; background:var(--brand); border-radius:4px 4px 0 0; min-height:2px; } .barra small { font-size:.65rem; color:var(--muted); margin:0; }
.meter { height:10px; background:var(--surface-2); border:1px solid var(--border); border-radius:999px; overflow:hidden; margin:.5rem 0; }
.meter span { display:block; height:100%; background:var(--brand); } .meter span.alta { background:var(--err); }
.dettagli-modello > summary { cursor:pointer; padding:.2rem 0; } .dettagli-modello[open] > summary { margin-bottom:.8rem; }

/* ---------- Toast e dialog ---------- */
.toasts { position:fixed; top:14px; right:14px; display:flex; flex-direction:column; gap:.5rem; z-index:300; max-width:min(420px,calc(100vw - 28px)); }
.toast { display:flex; align-items:center; gap:.7rem; padding:.7rem .9rem; border-radius:var(--r); border:1px solid; box-shadow:var(--sh-lg); background:var(--surface); animation:entra .2s ease-out; }
.toast span { flex:1; } .toast-ok { border-color:var(--ok); color:var(--ok); } .toast-errore { border-color:var(--err); background:var(--err-soft); color:var(--err); } .toast-info { border-color:var(--info); color:var(--info); }
.toast-azione { background:none; border:1px solid currentColor; color:inherit; border-radius:var(--r-sm); padding:.15rem .6rem; font:inherit; cursor:pointer; }
.toast-x { background:none; border:0; color:inherit; font-size:1.3rem; cursor:pointer; line-height:1; }
@keyframes entra { from { opacity:0; transform:translateY(-8px);} to { opacity:1; transform:none;} }
.dialog { border:1px solid var(--border); border-radius:var(--r-lg); padding:1.4rem; width:min(480px,92vw); background:var(--surface); color:var(--text); box-shadow:var(--sh-lg); }
.dialog::backdrop { background:rgba(20,18,16,.5); }
.dialog-azioni { display:flex; justify-content:flex-end; gap:.6rem; margin-top:1rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .topbar-modello { display:none; }
  body.app { grid-template-columns:1fr; }
  .sidebar { position:fixed; inset:0 auto 0 0; width:min(320px,86vw); z-index:120; transform:translateX(-102%); transition:transform .2s; box-shadow:var(--sh-lg); }
  .sidebar.aperta { transform:none; }
  .menu-btn,.side-close { display:inline-flex; }
  .scrim { display:block; position:fixed; inset:0; background:rgba(20,18,16,.5); z-index:110; } .scrim[hidden] { display:none !important; }
  .topbar { padding:.4rem .7rem; } .contenuto { padding:1rem; }
  .compositore { width:calc(100% - 1.2rem); margin-bottom:.6rem; } .messaggi { padding:1rem .7rem; }
  .msg-utente .msg-corpo { max-width:96%; } .aiuto-tasti { display:none; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration:.01ms !important; transition-duration:.01ms !important; scroll-behavior:auto !important; } }
