/* Ritrovo. Stile "framed sheet": una cornice tinta (barra in alto + lato) e il lavoro su un foglio bianco.
   Colore solo sui dati, sullo stato e sull'unica azione principale. Volto: cornice tinta di petrolio, petrolio sul "live". */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/font/plex/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/font/plex/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/font/plex/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --ground: #f2f6f6;  --surface: #ffffff;  --raised: #f4f6f8;  --active: #e6ecec;  --hover: #f4f7f7;
  --border: #e3e8e9;  --rule: #eef1f2;     --control: #cdd3d5;
  --text: #131416;    --muted: #5a5f61;    --faint: #6b6f71;
  --primary: #1d1f20; --on-primary: #ffffff;
  --accent: #1b6c80;  --accent-pale: #e3f1f3; --accent-ink: #0f4552;
  --negative: #c4242a; --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --mio: #eef6f7;
  --stage: #0d0f10;   --stage-tile: #1a1d1f; --stage-text: #f2f4f5; --stage-muted: #a7adb0;
  --radius-sheet: 16px; --radius-card: 8px; --radius-control: 6px;
  --sheet-inset: 8px;  --sidebar: 240px; --elenco: 340px; --dettagli: 300px;
  --font: "IBM Plex Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --veloce: 140ms cubic-bezier(.2, .7, .2, 1);
}
/* chiaro o scuro lo decide inizio.js (scelta dell'utente o impostazione del sistema) con data-modo su <html> */
:root[data-modo="scuro"] {
  color-scheme: dark;
  --ground: #0b0d0d;  --surface: #131617;  --raised: #1b1f20;  --active: #242a2b;  --hover: #1a1e1f;
  --border: #232829;  --rule: #1d2223;     --control: #3d4547;
  --text: #f2f4f5;    --muted: #b1b8ba;    --faint: #949b9d;
  --primary: #f2f4f5; --on-primary: #0b0d0d;
  --accent: #5fb8c9;  --accent-pale: #15292e; --accent-ink: #9fdbe6;
  --negative: #e5566f; --pill-negative-bg: #2c1a20; --pill-negative-ink: #f08a9c;
  --mio: #172326;
  --stage: #000000;   --stage-tile: #15181a;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: var(--accent); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; }
.nascosto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- schermata di caricamento ---------- */
.caricamento { display: none; }
.js .caricamento { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--ground); transition: opacity 400ms ease, visibility 400ms; }
.js.pronto .caricamento { opacity: 0; visibility: hidden; }
.caricamento img { animation: respiro 1.6s ease-in-out infinite alternate; }
.caricamento p { font-size: 16px; color: var(--muted); }
@keyframes respiro { from { transform: scale(.95); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .js .caricamento { display: none; } }

/* ---------- controlli ---------- */
.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background var(--veloce), transform var(--veloce); }
.bottone:hover { background: var(--hover); }
.bottone:active { transform: translateY(1px); }
.bottone.primario { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bottone.primario:hover { opacity: .9; }
.bottone.testo { border-color: transparent; background: none; color: var(--muted); }
.bottone.testo:hover { color: var(--text); background: var(--active); }
.bottone.pericolo { color: var(--negative); border-color: transparent; background: none; padding: 0; height: auto; }
.bottone.largo { width: 100%; height: 40px; }
.icona { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted); transition: background var(--veloce), color var(--veloce); }
.icona:hover { background: var(--active); color: var(--text); }
.icona.piccola { width: 24px; height: 24px; }
.icona svg { width: 18px; height: 18px; }
.solo-telefono { display: none; }
kbd { font: 500 11px/1 var(--font); color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--tinta, var(--active)); color: var(--inchiostro, var(--text)); font-weight: 600; font-size: 13px; position: relative; }
.avatar.grande { width: 40px; height: 40px; font-size: 15px; }
.avatar.gruppo { border-radius: 10px; }
.avatar[data-online="true"]::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #2f9e6a; border: 2px solid var(--surface); }

/* ---------- accesso ---------- */
.accesso { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.accesso-modulo { width: min(100%, 380px); display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); padding: 32px; }
.accesso-modulo h1 { font-size: 22px; line-height: 28px; font-weight: 600; margin-top: 8px; }
.accesso-sotto { color: var(--muted); margin-bottom: 16px; }
.accesso-modulo label { font-weight: 500; margin-top: 8px; }
.accesso-modulo input { height: 40px; border: 1px solid var(--control); border-radius: var(--radius-control); padding: 0 12px; background: var(--surface); }
.accesso-modulo .solo-nuovo { display: none; }
.accesso-modulo.nuovo .solo-nuovo { display: grid; gap: 8px; }
.accesso-modulo .primario { margin-top: 16px; }
.errore { color: var(--negative); min-height: 20px; }

/* ---------- guscio: cornice a L e foglio ---------- */
.app { height: 100dvh; display: grid; grid-template: 48px 1fr / var(--sidebar) 1fr; }
.barra { grid-column: 1 / -1; display: grid; grid-template-columns: var(--sidebar) 1fr auto; align-items: center; gap: 16px; padding: 0 16px 0 0; }
.marchio { display: flex; align-items: center; gap: 10px; padding-left: 16px; color: var(--text); text-decoration: none; font-size: 15px; }
.marchio b { font-weight: 600; }
.cerca { justify-self: center; width: min(548px, 100%); height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--faint); }
.cerca input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); }
.cerca input::placeholder { color: var(--faint); }
.cerca:focus-within { border-color: var(--accent); }
.barra-destra { display: flex; align-items: center; gap: 4px; }

.lato { display: flex; flex-direction: column; gap: 24px; padding: 12px 12px 12px 16px; overflow: auto; }
.lato-blocco h2 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); padding: 0 8px 8px; }
.lista-lato li { margin-bottom: 2px; }
.lista-lato button { width: 100%; display: grid; grid-template-columns: 28px 1fr; gap: 2px 10px; align-items: center; padding: 6px 8px; border: 0; border-radius: var(--radius-card); background: none; text-align: left; }
.lista-lato button:hover { background: var(--active); }
.lista-lato .avatar { width: 28px; height: 28px; font-size: 12px; grid-row: span 2; }
.lista-lato b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-lato small { color: var(--muted); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-lato .live small { color: var(--accent); }
.lista-lato .nota { color: var(--muted); padding: 0 8px; font-size: 13px; }
.io { margin-top: auto; display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border); }
.io-testo { min-width: 0; display: grid; }
.io-testo b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.io-testo input { border: 0; padding: 0; background: none; color: var(--muted); font-size: 12px; line-height: 16px; outline: 0; text-overflow: ellipsis; }
.io-testo input:focus { color: var(--text); }

.foglio { grid-column: 2; margin: 0 var(--sheet-inset) var(--sheet-inset) 0; min-height: 0; display: grid; grid-template-columns: var(--elenco) 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); overflow: hidden; }
.foglio.con-dettagli { grid-template-columns: var(--elenco) 1fr var(--dettagli); }

/* ---------- elenco delle chat ---------- */
.elenco { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.elenco-testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; }
.elenco-testa h1 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.schede { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.schede button { position: relative; height: 36px; padding: 0; border: 0; background: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
.schede button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.schede button[aria-selected="true"]::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: -1px; height: 2px; background: var(--text); }
.stanze { flex: 1; overflow: auto; padding: 8px; }
.stanza { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: 20px 20px; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px; border: 0; border-radius: var(--radius-card); background: none; text-align: left; transition: background var(--veloce); }
.stanza:hover { background: var(--hover); }
.stanza[aria-current="true"] { background: var(--active); }
.stanza .avatar { grid-row: span 2; width: 40px; height: 40px; font-size: 15px; }
.stanza-nome { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stanza.da-leggere .stanza-nome { font-weight: 600; }
.stanza time { color: var(--faint); font-size: 12px; justify-self: end; }
.stanza-anteprima { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stanza.da-leggere .stanza-anteprima { color: var(--text); }
.conteggio { justify-self: end; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.pill-live { justify-self: end; display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--accent-pale); color: var(--accent-ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.elenco-vuoto { padding: 16px 12px; color: var(--muted); }

/* ---------- conversazione ---------- */
.conversazione { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.vuoto { margin: auto; max-width: 380px; padding: 24px; display: grid; gap: 8px; text-align: center; }
.vuoto h2 { font-size: 16px; font-weight: 600; }
.vuoto p { color: var(--muted); }
.vuoto-azioni { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-testa { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px 0 20px; flex: none; }
.chat-titolo { flex: 1; min-width: 0; }
.chat-titolo h2 { font-size: 16px; line-height: 22px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-titolo p { color: var(--muted); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-azioni { display: flex; align-items: center; gap: 4px; }
.chat-azioni .bottone { margin-left: 8px; }
.chat-azioni .bottone.in-chiamata { background: var(--surface); color: var(--negative); border-color: var(--control); }

.canali { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex: none; }
.canali button { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0; border: 0; background: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
.canali button svg { width: 14px; height: 14px; }
.canali button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.canali button[aria-selected="true"]::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: -1px; height: 2px; background: var(--accent); }
.canali .conta { color: var(--accent); font-weight: 600; }
.canali .nuovo-canale { color: var(--faint); }
.chat:not(:has(.canali:not([hidden]))) .chat-testa { border-bottom: 1px solid var(--border); }

/* la striscia "live": chi è nella stanza vocale di questa chat, chi condivide, un clic per entrare */
.diretta { display: flex; align-items: center; gap: 12px; margin: 12px 20px 0; padding: 8px 8px 8px 12px; border-radius: var(--radius-card); background: var(--accent-pale); color: var(--accent-ink); flex: none; }
.diretta .facce { display: flex; }
.diretta .facce .avatar { width: 24px; height: 24px; font-size: 11px; border: 2px solid var(--accent-pale); margin-left: -6px; }
.diretta .facce .avatar:first-child { margin-left: 0; }
.diretta p { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diretta b { font-weight: 600; }

/* ---------- palco della chiamata ---------- */
.palco-area { flex: none; height: min(58vh, 560px); margin: 12px 12px 0; border-radius: 12px; background: var(--stage); color: var(--stage-text); display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
.palco { min-height: 0; padding: 12px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.tile { position: relative; margin: 0; min-height: 0; border-radius: 10px; background: var(--stage-tile); overflow: hidden; display: grid; place-items: center; cursor: zoom-in; outline-offset: -2px; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.schermo video { object-fit: contain; background: #000; }
.tile.senza-video video { display: none; }
.tile .iniziale { display: none; width: 64px; height: 64px; border-radius: 50%; place-items: center; font-size: 24px; font-weight: 600; background: var(--tinta); color: var(--inchiostro); }
.tile.senza-video .iniziale { display: grid; }
.tile.schermo .iniziale, .palco.focus .tile.schermo:not(.su) .iniziale { width: auto; height: auto; max-width: calc(100% - 16px); border-radius: 0; background: none; color: var(--stage-muted); font-size: 12px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile figcaption { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px); padding: 3px 8px; border-radius: 6px; background: rgb(0 0 0 / .6); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile figcaption svg { width: 12px; height: 12px; }
.tile.parla { box-shadow: inset 0 0 0 2px var(--accent); }
.tile .ingrandisci { position: absolute; right: 8px; top: 8px; opacity: 0; color: var(--stage-text); background: rgb(0 0 0 / .6); }
.tile:hover .ingrandisci, .tile:focus-within .ingrandisci { opacity: 1; }
/* in primo piano: una tessera grande sopra, le altre in una fila di colonne uguali (--n la imposta app.js) */
.palco.focus { grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); grid-template-rows: 1fr 96px; }
.palco.focus .tile.su { grid-column: 1 / -1; grid-row: 1; cursor: zoom-out; }
.palco.focus .tile:not(.su) { grid-row: 2; }
.palco.focus .tile:not(.su) .iniziale { width: 40px; height: 40px; font-size: 16px; }
.tile:fullscreen { border-radius: 0; }
.comandi { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 10px 12px 12px; flex-wrap: wrap; }
.tondo { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 22px; background: #262b2d; color: var(--stage-text); font-weight: 500; transition: background var(--veloce), transform var(--veloce); }
.tondo:hover { background: #313739; }
.tondo:active { transform: scale(.96); }
.tondo svg { width: 20px; height: 20px; }
.tondo.spento { background: #f2f4f5; color: #0d0f10; }
.tondo.rosso { background: #c4242a; }
.tondo.rosso:hover { background: #a91e23; }
.tondo.attivo { background: var(--accent); color: #fff; }
.schermo-gruppo { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 26px; background: #1a1e20; }
.schermo-gruppo select { height: 36px; border: 0; border-radius: 18px; padding: 0 12px; background: #262b2d; color: var(--stage-text); }

/* ---------- messaggi ---------- */
.messaggi { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 8px; }
.altri-messaggi { display: block; margin: 0 auto 16px; }
.giorno { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; color: var(--faint); font-size: 12px; }
.giorno::before, .giorno::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.giorno.cifrato { color: var(--accent-ink); text-align: center; }
.msg { position: relative; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-card); }
.msg:hover, .msg.scelto { background: var(--hover); }
.msg .avatar { grid-row: span 4; align-self: start; margin-top: 2px; }
.msg.unito .avatar { visibility: hidden; height: 0; }
.msg header { display: flex; align-items: baseline; gap: 8px; }
.msg header b { font-weight: 600; }
.msg time { color: var(--faint); font-size: 12px; }
.msg .testo { grid-column: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mio .testo, .msg.mio .file-card { background: var(--mio); }
.msg .testo { justify-self: start; max-width: 100%; padding: 2px 0; }
.msg.mio .testo { padding: 6px 10px; border-radius: 10px; }
.msg small { color: var(--faint); font-size: 12px; }
.msg code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; padding: 1px 4px; border-radius: 4px; background: var(--active); }
.msg .eliminato { grid-column: 2; color: var(--faint); font-style: italic; }
.cit { grid-column: 2; justify-self: start; margin: 2px 0 4px; padding: 2px 10px; border-left: 2px solid var(--control); color: var(--muted); font-size: 13px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .immagine { grid-column: 2; justify-self: start; display: block; margin-top: 6px; border-radius: 10px; overflow: hidden; max-width: min(420px, 100%); }
.msg .immagine img { display: block; max-width: 100%; max-height: 320px; object-fit: cover; }
.msg video, .msg audio { grid-column: 2; margin-top: 6px; max-width: min(420px, 100%); border-radius: 10px; }
.file-card { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; max-width: 100%; }
.file-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { white-space: nowrap; }
.reazioni { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.reazioni button { height: 24px; padding: 0 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 13px; font-variant-numeric: tabular-nums; }
.reazioni button.mia { border-color: var(--accent); background: var(--accent-pale); color: var(--accent-ink); }
.barra-msg { position: absolute; right: 8px; top: -14px; display: none; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 12px rgb(0 0 0 / .08); z-index: 2; }
.msg:hover .barra-msg, .msg.scelto .barra-msg, .msg:focus-within .barra-msg { display: flex; }
.barra-msg button { height: 28px; min-width: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); display: inline-grid; place-items: center; }
.barra-msg button:hover { background: var(--active); color: var(--text); }
.barra-msg .reaz { font-size: 15px; }
.scrive { min-height: 20px; padding: 0 20px; color: var(--muted); font-size: 12px; }
.scrivi { margin: 0 16px 16px; border: 1px solid var(--control); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 10px rgb(0 0 0 / .05); }
.scrivi:focus-within { border-color: var(--accent); }
.scrivi-riga { display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.scrivi textarea { flex: 1; min-height: 32px; max-height: 180px; padding: 6px 4px; border: 0; outline: 0; resize: none; background: none; line-height: 20px; }
.scrivi .invia { color: var(--on-primary); background: var(--primary); }
.scrivi .invia:hover { background: var(--primary); opacity: .9; color: var(--on-primary); }
.scrivi.trascina { border-style: dashed; border-color: var(--accent); }
.risposta-a { display: flex; align-items: center; gap: 8px; padding: 8px 8px 0 12px; color: var(--muted); font-size: 13px; }
.risposta-a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- dettagli ---------- */
.dettagli { border-left: 1px solid var(--border); overflow: auto; padding: 20px; display: grid; align-content: start; gap: 24px; }
.dettagli h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; }
.dettagli h3 small { color: var(--faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.persona { display: grid; grid-template-columns: 32px 1fr; gap: 0 10px; align-items: center; padding: 6px 0; }
.persona .avatar { grid-row: span 2; }
.persona b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona small { color: var(--muted); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invito { display: flex; }
.invito input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--control); border-right: 0; border-radius: var(--radius-control) 0 0 var(--radius-control); background: var(--raised); color: var(--muted); font-size: 12px; }
.invito .bottone { border-radius: 0 var(--radius-control) var(--radius-control) 0; }
.file-lista a { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--text); text-decoration: none; }
.file-lista a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-lista small, .dettagli .nota { color: var(--muted); font-size: 12px; }

/* ---------- dialoghi, menu, avvisi ---------- */
.dialogo { width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgb(0 0 0 / .18); }
.dialogo::backdrop { background: rgb(10 14 15 / .4); }
.dialogo form { display: grid; gap: 8px; }
.dialogo h2 { font-size: 16px; font-weight: 600; }
.dialogo p { color: var(--muted); }
.dialogo label { font-weight: 500; margin-top: 8px; }
.dialogo input { height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.dialogo-azioni { display: flex; flex-direction: row-reverse; gap: 8px; margin-top: 16px; }
.menu-nuovo { position: fixed; z-index: 30; display: grid; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 32px rgb(0 0 0 / .14); }
.menu-nuovo button { height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu-nuovo button:hover, .menu-nuovo button:focus-visible { background: var(--active); }
.avvisi { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.avviso { padding: 10px 16px; border-radius: 10px; background: var(--primary); color: var(--on-primary); box-shadow: 0 12px 32px rgb(0 0 0 / .2); animation: entra 180ms ease-out; max-width: calc(100vw - 32px); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
.scossa { animation: scossa 520ms cubic-bezier(.36, .07, .19, .97); }
@keyframes scossa { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .scossa, .avviso { animation: none; } }

/* ---------- larghezze ---------- */
@media (max-width: 1279px) {
  .foglio.con-dettagli { grid-template-columns: var(--elenco) 1fr; }
  .foglio.con-dettagli .dettagli { position: absolute; right: var(--sheet-inset); top: 48px; bottom: var(--sheet-inset); width: var(--dettagli); background: var(--surface); border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; box-shadow: -12px 0 32px rgb(0 0 0 / .08); z-index: 5; }
}
@media (max-width: 1023px) {
  :root { --sidebar: 0px; --elenco: 300px; }
  .lato { position: fixed; z-index: 40; inset: 48px auto 0 0; width: 280px; background: var(--ground); transform: translateX(-100%); visibility: hidden; transition: transform 200ms ease, visibility 200ms; }
  .app.menu-aperto .lato { transform: none; visibility: visible; box-shadow: 12px 0 32px rgb(0 0 0 / .12); }
  .solo-telefono { display: inline-grid; }
  #indietro { display: none; }
  .barra { grid-template-columns: auto auto 1fr auto; padding-left: 8px; }
  .marchio { padding-left: 0; }
  .foglio { margin-left: var(--sheet-inset); }
  #usa-invito { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template: 48px 1fr / 1fr; }
  .foglio { grid-column: 1; margin: 0; border-radius: 0; border-width: 1px 0 0; grid-template-columns: 1fr; }
  .cerca kbd, .marchio b { display: none; }
  .elenco { border-right: 0; }
  #indietro { display: inline-grid; }
  .conversazione { display: none; }
  .app.in-chat .elenco { display: none; }
  .app.in-chat .conversazione { display: flex; }
  .stanza { padding: 12px 8px; }
  .chat-testa { padding: 0 8px; gap: 8px; }
  .chat-azioni .bottone span { display: none; }
  .chat-azioni .bottone { margin-left: 4px; width: 40px; padding: 0; }
  #b-dettagli { display: none; }
  .palco-area { height: 46vh; margin: 8px 8px 0; }
  .palco { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 8px; }
  .schermo-gruppo select { max-width: 120px; }
  .tondo.largo-tondo span { display: none; }
  .messaggi { padding: 12px 12px 8px; }
  .scrivi { margin: 0 8px 8px; }
  .barra-msg { right: 4px; }
}

/* ---------- thread laterale ---------- */
.filo { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); background: var(--surface); }
.filo-testa { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--border); flex: none; }
.filo-testa h3 { font-size: 16px; font-weight: 600; }
.foglio.con-filo { grid-template-columns: var(--elenco) 1fr 360px; }
.foglio.con-filo .dettagli { display: none; }
.apri-thread { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--accent-ink); }
.apri-thread:hover { background: var(--hover); }
.apri-thread .facce { display: flex; }
.apri-thread .avatar { width: 22px; height: 22px; font-size: 10px; margin-left: -6px; border: 2px solid var(--surface); }
.apri-thread .avatar:first-child { margin-left: 0; }
.apri-thread small { color: var(--faint); }
.msg.mio .apri-thread { justify-self: end; }

/* ---------- sondaggi ---------- */
.sondaggio { grid-column: 2; justify-self: start; display: grid; gap: 6px; width: min(420px, 100%); margin-top: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); }
.msg.mio .sondaggio { justify-self: end; }
.sondaggio-domanda { font-size: 15px; }
.opzione { position: relative; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--control); border-radius: 10px; background: var(--surface); text-align: left; overflow: hidden; }
.opzione:hover { border-color: var(--accent); }
.barra-voto { position: absolute; inset: 0 auto 0 0; background: var(--accent-pale); transition: width 300ms ease; }
.opzione > :not(.barra-voto) { position: relative; }
.spunta { width: 18px; height: 18px; border: 2px solid var(--control); border-radius: 50%; }
.opzione.scelta .spunta { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }
.opzione.scelta { border-color: var(--accent); }
.opzione .num { font-weight: 600; }

/* ---------- messaggi vocali ---------- */
.vocale { grid-column: 2; justify-self: start; display: flex; align-items: center; gap: 10px; width: min(320px, 100%); margin-top: 6px; padding: 8px 12px 8px 8px; border-radius: 22px; background: var(--raised); }
.msg.mio .vocale { justify-self: end; background: var(--bolla-mia, var(--mio)); color: var(--testo-bolla-mia, var(--text)); }
.vocale .play { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.msg.mio .vocale .play { background: var(--text); color: var(--surface); }
.onda { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.onda i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .35; }
.onda i.sentita { opacity: 1; }
.vocale small { font-size: 12px; min-width: 34px; text-align: right; }
.registra { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; }
.registra-punto { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: pulsa 1s infinite; }
@keyframes pulsa { 50% { opacity: .3; } }
.onda.dal-vivo { color: var(--accent); }
.onda.dal-vivo i { opacity: .9; max-width: 4px; }

/* ---------- ricerca, codice di sicurezza, avvisi ---------- */
.risultati-titolo { padding: 16px 12px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.risultato .stanza-anteprima mark { background: var(--accent-pale); color: var(--accent-ink); border-radius: 3px; padding: 0 2px; }
.msg.evidenziato { animation: evidenzia 2s ease-out; }
@keyframes evidenzia { 0%, 40% { background: var(--accent-pale); } }
.giorno.sistema { color: var(--muted); text-align: center; font-size: 12px; }
.codice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 10px; margin: 4px 0 10px; padding: 12px; border-radius: 10px; background: var(--raised); font: 500 14px/20px ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .04em; }
.verificato { color: var(--online, #2f9e6a); font-weight: 500; font-size: 13px; }
.avviso-codice { color: var(--negative); font-size: 13px; margin-bottom: 8px; }
.sezione-codice .bottone { margin-top: 8px; }
.s-opzioni { display: grid; gap: 8px; }
.dialogo .s-opzioni input { height: 38px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.s-spunta { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; }
@media (prefers-reduced-motion: reduce) { .registra-punto, .msg.evidenziato { animation: none; } }
@media (max-width: 1279px) {
  .foglio.con-filo { grid-template-columns: var(--elenco) 1fr; }
  .foglio.con-filo .filo { position: absolute; right: var(--sheet-inset); top: 48px; bottom: var(--sheet-inset); width: 380px; z-index: 6; box-shadow: -12px 0 32px rgb(0 0 0 / .12); border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; }
}
@media (max-width: 760px) {
  .foglio.con-filo .filo { position: fixed; inset: 48px 0 0 0; width: auto; border-radius: 0; }
}

/* ---------- spunte, fissati, scadenze, menzioni, inoltrati ---------- */
.io { grid-template-columns: 32px 1fr 32px 32px; gap: 6px; }
.spunta-msg { font-size: 11px; letter-spacing: -2px; color: var(--faint); margin-left: 2px; }
.spunta-msg.letta { color: var(--online, #2f9e6a); font-weight: 700; }
.segno-fissato svg, .segno-scade svg, .segno-silenzio svg { width: 12px; height: 12px; color: var(--faint); vertical-align: -1px; }
.stanza-nome .segno-silenzio, .stanza-nome .segno-scade { margin-left: 6px; }
.fissati { display: flex; align-items: center; gap: 10px; margin: 8px 20px 0; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-card); background: var(--surface); text-align: left; flex: none; min-width: 0; }
.fissati span { min-width: 0; }
.fissati b { font-size: 12px; color: var(--accent-ink); }
.fissati small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inoltrato { grid-column: 2; display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-style: italic; font-size: 12px; }
.inoltrato svg { width: 12px; height: 12px; }
.msg.mio .inoltrato { justify-self: end; }
.menzione { color: var(--accent-ink); font-weight: 600; }
.menzione.me { background: var(--accent-pale); border-radius: 4px; padding: 0 3px; }
.msg.mi-cita { box-shadow: inset 3px 0 0 var(--accent); }
.messaggi.bolle .msg.mi-cita { box-shadow: none; }
.messaggi.bolle .msg.mi-cita .testo { box-shadow: 0 0 0 1.5px var(--accent); }
.scrivi { position: relative; }
.menzioni { position: absolute; left: 8px; bottom: calc(100% + 6px); z-index: 20; display: grid; min-width: 240px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgb(0 0 0 / .16); }
.menzioni button { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.menzioni button:hover { background: var(--active); }
.menzioni .avatar { width: 28px; height: 28px; font-size: 12px; }
.pannello-emoji { position: fixed; z-index: 40; width: 312px; max-height: 320px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 40px rgb(0 0 0 / .2); }
.pannello-emoji h3 { font-size: 11px; font-weight: 600; color: var(--muted); margin: 8px 2px 4px; }
.griglia-emoji { display: grid; grid-template-columns: repeat(8, 1fr); }
.griglia-emoji button { height: 34px; border: 0; border-radius: 8px; background: none; font-size: 20px; }
.griglia-emoji button:hover { background: var(--active); transform: scale(1.15); }
.dl-testa { display: flex; align-items: center; justify-content: space-between; }
.dl-elenco { display: grid; gap: 4px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.riga-lista { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--rule); }
.riga-lista .bottone.pericolo { height: 32px; padding: 0 10px; }
.scelta-chat { grid-template-rows: 40px; }
.impostazioni-chat select { height: 36px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.interruttore { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 13px; color: var(--muted); }
.interruttore input { margin-top: 2px; accent-color: var(--accent); }
/* il pannello dei dettagli non si allarga mai oltre la sua colonna (niente barra orizzontale) */
.dettagli { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }

/* ---------- foto profilo, stella, bozze, copia di sicurezza ---------- */
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
button.avatar { border: 0; padding: 0; cursor: pointer; font-family: inherit; }
button.avatar:hover { box-shadow: 0 0 0 2px var(--accent); }
.segno-importante svg { width: 12px; height: 12px; color: #e0a800; fill: currentColor; vertical-align: -1px; }
.barra-msg button.acceso { color: #e0a800; }
.barra-msg button.acceso svg { fill: currentColor; }
.stanza-anteprima .bozza { color: var(--danger, #c8364f); font-style: normal; font-weight: 600; }
.importanti .riga-importante { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 0; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.importanti .riga-importante svg { width: 14px; height: 14px; flex: none; color: #e0a800; fill: currentColor; }
.importanti .riga-importante span { min-width: 0; display: grid; }
.importanti .riga-importante small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.importanti .riga-importante:hover b { text-decoration: underline; }
.azioni-gruppo { display: flex; flex-wrap: wrap; gap: 8px; }
.copia-sicurezza { align-items: flex-start; }
.azioni-copia { display: flex; gap: 6px; flex: none; }
.azioni-copia .bottone { height: 32px; padding: 0 10px; }

/* ---------- gruppi, menu, chat fissate, non letti, blocchi, formattazione ---------- */
.testa-gruppo { display: grid; justify-items: center; gap: 6px; text-align: center; }
.testa-gruppo h2 { margin: 4px 0 0; font-size: 18px; overflow-wrap: anywhere; }
.testa-gruppo .descrizione { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.testa-gruppo .azioni-gruppo { justify-content: center; margin-top: 4px; }
.testa-gruppo .azioni-gruppo .bottone { height: 32px; padding: 0 10px; }
.avatar.enorme { width: 88px; height: 88px; font-size: 32px; border-radius: 24px; }
.persona { position: relative; padding-right: 36px; }
.azioni-persona { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.menu-azioni button.pericolo { color: var(--danger, #c8364f); }
.segno-fissata svg { width: 12px; height: 12px; color: var(--faint); vertical-align: -1px; margin-left: 6px; }
.giorno.non-letti { color: var(--accent-ink); font-weight: 600; }
.giorno.non-letti::before, .giorno.non-letti::after { background: var(--accent) !important; opacity: .55; }
.vai-in-fondo { position: absolute; right: 24px; bottom: 112px; z-index: 5; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 6px 18px rgb(0 0 0 / .16); cursor: pointer; }
.vai-in-fondo svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.vai-in-fondo .conteggio { position: absolute; top: -6px; right: -6px; }
.nota-blocco { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 14px 20px; border-top: 1px solid var(--rule); color: var(--muted); text-align: center; }
.testo s { opacity: .75; }
.testo .citazione { display: block; margin: 2px 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--accent); color: var(--muted); }
.testo code.blocco { display: block; margin: 4px 0; padding: 8px 10px; border-radius: 8px; background: var(--active); white-space: pre; overflow-x: auto; font-size: 13px; line-height: 1.45; }
.testo .spoiler { border-radius: 4px; background: var(--text); color: transparent; cursor: pointer; transition: background .2s, color .2s; }
.testo .spoiler.visto { background: var(--active); color: inherit; cursor: auto; }
@media (prefers-reduced-motion: reduce) { .testo .spoiler { transition: none; } }
@media (max-width: 760px) { .vai-in-fondo { right: 14px; bottom: 96px; } }

/* ---------- accesso con Google ---------- */
.accesso-google { display: grid; gap: 8px; }
.accesso-google .oppure { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; color: var(--faint); font-size: 12px; }
.accesso-google .oppure::before, .accesso-google .oppure::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.google-pulsante { display: flex; justify-content: center; min-height: 0; }
.google-pulsante:empty { display: none; }
.accesso-google .nota { font-size: 12px; }

/* ---------- profilo e impostazioni ---------- */
.dialogo.impostazioni { width: min(920px, calc(100vw - 32px)); max-width: none; height: min(720px, calc(100dvh - 32px)); max-height: none; padding: 0; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.dialogo.impostazioni[open] { display: grid; }
.imp-testa { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--rule); }
.imp-testa h2 { margin: 0; font-size: 18px; }
.imp-schede { display: grid; align-content: start; gap: 2px; padding: 12px; border-right: 1px solid var(--rule); }
.imp-schede button { height: 38px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.imp-schede button:hover { background: var(--active); }
.imp-schede button[aria-selected="true"] { background: var(--active); font-weight: 600; }
.imp-corpo { overflow-y: auto; padding: 4px 28px 28px; }
.imp-voce { display: grid; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.imp-voce h3 { margin: 0; font-size: 15px; font-weight: 600; }
.imp-voce .nota { margin: 0; }
.imp-scelte { display: grid; gap: 6px; max-width: 460px; }
.imp-scelta { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; }
.imp-scelta:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); }
.imp-scelta input { margin-top: 3px; accent-color: var(--accent); }
.imp-scelta span { display: grid; }
.imp-modulo { display: grid; gap: 6px; max-width: 460px; padding: 18px 0; }
.imp-modulo label { font-weight: 500; margin-top: 6px; }
.imp-modulo input, .imp-modulo textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.imp-modulo .bottone { justify-self: start; margin-top: 10px; }
.imp-chiocciola { display: flex; align-items: center; gap: 6px; }
.imp-chiocciola span { color: var(--muted); font-weight: 600; }
.imp-anteprima { display: grid; justify-items: start; gap: 4px; max-width: 460px; padding: 18px; border-radius: 16px; background: var(--active); }
.imp-anteprima b { font-size: 18px; margin-top: 6px; }
.imp-anteprima small { color: var(--muted); }
.imp-anteprima p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.imp-anteprima .imp-stato { padding: 2px 10px; border-radius: 999px; background: var(--surface); font-size: 13px; }
.imp-esito { min-height: 1.4em; margin: 0; color: var(--muted); }
.imp-elenco { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.imp-elenco li { display: flex; align-items: center; gap: 10px; }
.imp-elenco li b { flex: 1; }
.menu-tema.imp-tema { position: static; display: grid; gap: 6px; width: auto; max-width: 460px; padding: 18px 0; box-shadow: none; border: 0; border-radius: 0; background: none; }
.menu-tema.imp-tema button { height: auto; min-height: 38px; padding: 6px 8px; }
.imp-pericolo h3 { color: var(--danger, #c8364f); }
.dettagli .bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .dialogo.impostazioni { width: 100vw; height: 100dvh; border-radius: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .imp-schede { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .imp-schede button { flex: none; }
  .imp-corpo { padding: 4px 16px 24px; }
}
.imp-voce > .bottone { justify-self: start; }

/* ---------- ondata A: menu dei messaggi, selezione, programmati, promemoria, sondaggi, vocali ---------- */
.avviso.cliccabile { pointer-events: auto; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.segno-promemoria svg { width: 12px; height: 12px; color: var(--accent-ink); vertical-align: -1px; }
.chat.selezionando .scrivi { display: none; }
.msg.selezionabile { cursor: pointer; border-radius: 10px; }
.msg.selezionabile .barra-msg { display: none; }
.msg.selezionato { background: var(--accent-pale); box-shadow: inset 3px 0 0 var(--accent); }
.barra-selezione { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule); }
.barra-selezione b { margin-right: auto; }
.programmati { display: grid; gap: 4px; padding: 8px 20px 0; }
.programmato { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--active); font-size: 13px; }
.programmato svg { width: 16px; height: 16px; flex: none; color: var(--accent-ink); }
.programmato span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.programmato .bottone { height: 28px; padding: 0 8px; }
.sondaggio.chiuso .opzione { cursor: default; opacity: .8; }
.vocale .velocita { min-width: 38px; height: 26px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 999px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
#s-durata { height: 38px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }

/* ---------- ondata B: visore delle foto, finestre a schede, liste, sfondi ---------- */
.visore { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(8 10 12 / .94); color: #fff; }
.visore[open] { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; grid-template-rows: auto minmax(0, 1fr); align-items: center; }
.visore-barra { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.visore-barra span { flex: 1; font-size: 14px; opacity: .85; }
.visore-barra .icona, .visore-barra .bottone { color: #fff; border-color: rgb(255 255 255 / .3); background: none; }
.visore img { justify-self: center; max-width: 100%; max-height: calc(100dvh - 80px); object-fit: contain; }
.visore-freccia { justify-self: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .12); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.visore-freccia:disabled { opacity: .25; cursor: default; }
.dialogo.dialogo-schede { width: min(640px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px)); padding: 0; grid-template-rows: auto auto minmax(0, 1fr); }
.dialogo.dialogo-schede[open] { display: grid; }
.dialogo-schede .dl-testa { padding: 14px 16px 0 20px; }
.schede-orizzontali { display: flex; gap: 4px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.schede-orizzontali button { flex: none; }
.ds-corpo { overflow-y: auto; padding: 12px 16px 20px; }
.griglia-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.miniatura { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border: 0; border-radius: 8px; background: var(--active); color: var(--muted); cursor: pointer; }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.elenco-schede { display: grid; gap: 2px; }
.riga-messaggio { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; }
button.riga-messaggio { cursor: pointer; }
.riga-messaggio:hover { background: var(--active); }
.riga-messaggio > svg { width: 18px; height: 18px; color: var(--muted); }
.riga-messaggio span { display: grid; min-width: 0; }
.riga-messaggio span > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riga-messaggio small { color: var(--muted); }
.vuoto-schede { padding: 24px 4px; }
.schede { overflow-x: auto; scrollbar-width: none; }
.schede-liste { display: contents; }
.nuova-lista { flex: none; width: 28px; height: 28px; border: 1px dashed var(--rule); border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.dl-elenco label.scelta-chat { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.messaggi[data-sfondo="puntini"] { background-image: radial-gradient(var(--rule) 1.2px, transparent 1.6px); background-size: 18px 18px; }
.messaggi[data-sfondo="righe"] { background-image: repeating-linear-gradient(135deg, transparent 0 14px, var(--rule) 14px 15px); }
.messaggi[data-sfondo="quadretti"] { background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px); background-size: 22px 22px; }

/* ---------- canali: categorie, tipi, privati, forum, spoiler, moduli ---------- */
.canali .categoria-canali { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; margin-left: 6px; padding: 0 8px; border: 0; border-left: 1px solid var(--rule); background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.canali .categoria-canali .freccia { font-size: 13px; }
.canali .lucchetto svg { width: 12px; height: 12px; opacity: .7; }
.scheda-post { display: grid; gap: 4px; width: 100%; margin: 6px 0; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.scheda-post:hover, .scheda-post:focus-visible { border-color: var(--accent); }
.scheda-post .post-titolo { font-size: 15px; }
.scheda-post .post-anteprima { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.titolo-msg { grid-column: 2; margin: 0 0 2px; font-size: 15px; }
.messaggi[data-spoiler="si"] .immagine:not(.visto) { position: relative; display: inline-block; overflow: hidden; border-radius: 10px; }
.messaggi[data-spoiler="si"] .immagine:not(.visto) img { filter: blur(28px); }
.messaggi[data-spoiler="si"] .immagine:not(.visto)::after { content: "Spoiler · tocca per vedere"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
.nota-blocco svg { width: 18px; height: 18px; }
.dialogo.dialogo-modulo { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.mod-corpo { display: grid; gap: 6px; }
.mod-corpo select, .mod-corpo textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.mod-corpo .imp-scelte { max-width: none; }
.mod-corpo #mc-elimina { justify-self: start; margin-top: 10px; }
.mc-persone { display: grid; gap: 2px; padding-left: 26px; }

/* ---------- ondata D: gruppi (invito, richieste, regole, registro), eventi, etichette ---------- */
.regole-gruppo { display: grid; gap: 6px; }
.regole-gruppo > label:not(.interruttore) { font-weight: 500; font-size: 13px; margin-top: 6px; }
.regole-gruppo .imp-scelta { padding: 6px 10px; }
.regole-gruppo .bottone { justify-self: start; margin-top: 6px; }
.richieste .persona { padding-right: 0; }
.azioni-richiesta { grid-column: 2; display: flex; gap: 6px; margin-top: 6px; }
.azioni-richiesta .bottone { height: 30px; padding: 0 10px; }
.etichetta-membro { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent-pale); color: var(--accent-ink); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.persona .bottone.piccolo { height: 24px; margin-left: 6px; padding: 0 6px; font-size: 12px; }
.evento { display: grid; gap: 6px; grid-column: 2; max-width: 420px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
.evento.finito { opacity: .7; }
.evento-testa { display: flex; align-items: center; gap: 8px; }
.evento-testa svg { width: 20px; height: 20px; color: var(--accent-ink); }
.evento-titolo { font-size: 15px; }
.evento-quando { margin: 0; font-weight: 500; }
.evento-descrizione { margin: 0; white-space: pre-wrap; }
.evento .nota { margin: 0; }
.evento-risposte { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.evento-risposte .bottone { height: 32px; padding: 0 10px; }
.evento-risposte .bottone.scelta { border-color: var(--accent); background: var(--accent-pale); color: var(--accent-ink); }

/* ---------- ondata C: stato, pronomi, colore del profilo ---------- */
.avatar[data-modo="assente"]::after { background: #e0a526; }
.avatar[data-modo="nondisturbare"]::after { background: linear-gradient(#fff, #fff) center / 5px 2px no-repeat, #e5484d; }
.avatar[data-modo="invisibile"]::after { background: radial-gradient(circle, var(--surface) 2px, #8a8f98 2.5px); }
#mio-avatar { cursor: pointer; }
.banner-profilo { height: 64px; border-radius: 12px; background: var(--colore, linear-gradient(120deg, var(--tinta), var(--tinta2))); }
.imp-anteprima .banner-profilo { justify-self: stretch; margin: -6px -6px -38px; }
.imp-anteprima .avatar.enorme, .scheda-persona .avatar.enorme { border: 4px solid var(--active); }
.scheda-persona { display: grid; justify-items: center; gap: 4px; text-align: center; }
.scheda-persona .banner-profilo { justify-self: stretch; margin-bottom: -40px; }
.scheda-persona .avatar.enorme { border-color: var(--surface); }
.scheda-persona h2 { margin: 4px 0 0; font-size: 18px; overflow-wrap: anywhere; }
.scheda-persona small { color: var(--muted); }
.scheda-persona .imp-stato { padding: 2px 10px; border-radius: 999px; background: var(--active); font-size: 13px; }
.imp-colori { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.imp-colori input { appearance: none; width: 28px; height: 28px; margin: 0; border-radius: 50%; cursor: pointer; background: var(--colore, var(--active)); border: 2px solid var(--border); }
.imp-colori input[value=""] { background: linear-gradient(135deg, transparent 45%, var(--muted) 46% 54%, transparent 55%), var(--active); }
.imp-colori input:checked { outline: 2px solid var(--text); outline-offset: 2px; }
.imp-colori input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- ondata C: note sulle persone, blocco dell'app, verifica in due passaggi ---------- */
.scheda-persona .nota-persona { justify-self: stretch; margin-top: 10px; text-align: left; font-weight: 600; font-size: 13px; }
.scheda-persona .nota-persona small { font-weight: 400; }
.scheda-persona #nota-persona { justify-self: stretch; resize: vertical; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); color: var(--text); font: inherit; font-size: 14px; }
.blocco-app { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--ground); }
.blocco-app::backdrop { background: var(--ground); }
.blocco-app form { display: grid; justify-items: center; gap: 12px; width: min(340px, calc(100vw - 32px)); margin: 18vh auto 0; text-align: center; }
.blocco-app h2 { margin: 4px 0 8px; }
.blocco-app input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--control); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 18px; letter-spacing: .2em; text-align: center; }
.blocco-app .errore, .dialogo-modulo .errore { min-height: 1.2em; margin: 0; color: var(--negative); }
.imp-riga { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.chiave-2f { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chiave-2f code, .codici-riserva code { padding: 6px 10px; border-radius: 8px; background: var(--raised); font-size: 16px; letter-spacing: .06em; user-select: all; }
.codici-riserva { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 28px; margin: 8px 0 12px; padding-left: 22px; }

/* ---------- ondata E: chiamate ---------- */
.tondo.attivo#b-mano { background: #e0a526; color: #1d1f20; }
.tondo.ptt { box-shadow: inset 0 0 0 2px #e0a526; }
.mano-alzata { margin-right: 4px; }
.tile { position: relative; overflow: hidden; }
.reazione-volante { position: absolute; bottom: 12px; font-size: 34px; pointer-events: none; animation: reazione-su 2.6s ease-out forwards; }
@keyframes reazione-su { 0% { transform: translateY(0) scale(.6); opacity: 0; } 12% { transform: translateY(-10px) scale(1.1); opacity: 1; } 100% { transform: translateY(-140px) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .reazione-volante { animation: reazione-ferma 2.6s linear forwards; } @keyframes reazione-ferma { 0%, 80% { opacity: 1; } 100% { opacity: 0; } } }
.menu-azioni.menu-emoji { display: flex; gap: 2px; padding: 6px; }
.menu-azioni.menu-emoji button { width: 44px; height: 44px; padding: 0; font-size: 24px; justify-content: center; }
.squillo { position: fixed; top: 16px; right: 16px; z-index: 50; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 14px 16px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .22); border: 1px solid var(--border); }
.squillo .avatar { animation: squilla 1.2s ease-in-out infinite; }
@keyframes squilla { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 106, .5); } 50% { box-shadow: 0 0 0 8px rgba(47, 158, 106, 0); } }
@media (prefers-reduced-motion: reduce) { .squillo .avatar { animation: none; } }
.squillo-testo { display: grid; margin-right: 6px; }
.squillo-testo small { color: var(--muted); }
.squillo .bottone.rifiuta { background: var(--negative); color: #fff; border-color: transparent; }
.riga-chiamata.persa b, .riga-chiamata.persa svg { color: var(--negative); }
.imp-due { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.imp-due select, .imp-voce > select { width: 100%; }
.misura-mic { flex: 1; min-width: 120px; height: 10px; border-radius: 5px; background: var(--active); overflow: hidden; }
.misura-mic span { display: block; width: 0; height: 100%; background: #2f9e6a; transition: width .1s linear; }
.anteprima-cam { width: 100%; max-width: 360px; aspect-ratio: 16 / 9; margin-top: 8px; border-radius: 12px; background: #0d0f10; object-fit: cover; }
kbd { padding: 2px 8px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--raised); font: inherit; font-size: 13px; }
/* le caselle di spunta nei dialoghi non prendono l'altezza dei campi di testo */
.dialogo input[type="checkbox"] { height: auto; padding: 0; }
.imp-corpo select { height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); }
.imp-voce h4 { margin: 8px 0 0; font-size: 14px; font-weight: 600; }

/* ---------- ondata F: una volta, contatti, fotocamera, videomessaggi, sticker ---------- */
.una-volta { display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 14px 8px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.una-volta .uno { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px dashed var(--accent); color: var(--accent); font-weight: 700; font-size: 13px; }
.una-volta.spenta { cursor: default; color: var(--muted); }
.una-volta.spenta .uno { border-color: var(--muted); color: var(--muted); }
.visore-una-volta { max-width: min(96vw, 900px); padding: 16px; border: 0; border-radius: 16px; background: #0d0f10; color: #f2f4f5; text-align: center; user-select: none; }
.visore-una-volta::backdrop { background: rgba(0, 0, 0, .85); }
.visore-una-volta img, .visore-una-volta video { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto 10px; border-radius: 10px; -webkit-user-drag: none; }
.contatto-msg { display: flex; align-items: center; gap: 12px; max-width: 360px; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.contatto-msg > span { display: grid; flex: 1; min-width: 0; }
.contatto-msg small { color: var(--muted); }
.ct-elenco { display: grid; max-height: 280px; overflow-y: auto; }
.scatto { width: 100%; max-height: 50vh; border-radius: 12px; background: #0d0f10; object-fit: contain; }
.video-tondo { display: block; width: 220px; height: 220px; border-radius: 50%; object-fit: cover; background: #0d0f10; cursor: pointer; }
.video-tondo.anteprima { width: 260px; height: 260px; margin: 0 auto; cursor: default; transform: scaleX(-1); }
.tondo-msg { position: relative; width: 220px; margin-top: 4px; }
.tondo-durata { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.sticker-msg { display: block; margin-top: 4px; padding: 0; border: 0; background: none; cursor: pointer; }
.sticker-msg img { display: block; width: 160px; height: 160px; object-fit: contain; }
.griglia-sticker { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; }
.sticker-scelta { padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--raised); cursor: pointer; }
.sticker-scelta img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }

/* ---------- ondata F: canali da seguire, stati di 24 ore ---------- */
#messaggi[data-muto="si"] .barra-msg { display: none; }
.riga-stato { width: 100%; text-align: left; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.riga-stato .avatar.anello-nuovo { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.riga-stato .avatar.anello-visto { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--control); }
.titolo-stati { margin: 14px 0 4px; font-size: 14px; }
.stato-testo { display: grid; place-items: center; min-height: 220px; padding: 28px; border-radius: 14px; color: #fff; font-size: 26px; font-weight: 600; line-height: 1.3; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; }
.stato-testo.piccolo { min-height: 120px; font-size: 18px; }
.visore-stati { width: min(520px, 96vw); max-width: none; padding: 12px; border: 0; border-radius: 18px; background: #0d0f10; color: #f2f4f5; }
.visore-stati::backdrop { background: rgba(0, 0, 0, .85); }
.stato-barre { display: flex; gap: 4px; margin-bottom: 10px; }
.stato-barre span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.stato-barre span.fatta, .stato-barre span.ora { background: #fff; }
.visore-stati header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.visore-stati header small { flex: 1; color: #a7adb0; }
.visore-stati header .icona { color: #f2f4f5; }
.stato-palco { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 6px; }
.stato-palco img, .stato-palco video { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; }
.stato-freccia { height: 48px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 26px; cursor: pointer; }
.stato-freccia:disabled { opacity: .3; cursor: default; }
.stato-didascalia { margin: 10px 0 0; text-align: center; }
.visore-stati footer, .stato-risposta { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.visore-stati footer span { flex: 1; color: #c9ced0; font-size: 14px; }
.stato-risposta input { flex: 1; height: 40px; padding: 0 14px; border: 1px solid #3a4043; border-radius: 20px; background: #1a1d1f; color: #f2f4f5; font: inherit; }

/* ---------- volume per persona, chiamata programmata, segnalazioni ---------- */
.volume-tessera { position: absolute; top: 8px; right: 44px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; opacity: 0; transition: opacity var(--veloce); }
.tile:hover .volume-tessera, .tile:focus-within .volume-tessera { opacity: 1; }
.volume-tessera svg { width: 16px; height: 16px; }
.menu-volume { position: fixed; z-index: 60; display: grid; gap: 8px; width: 260px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.menu-volume input { flex: 1; accent-color: var(--accent); }
.menu-volume small { color: var(--muted); }
.entra-chiamata { margin-top: 8px; }
.elenco-segnalazioni { display: grid; gap: 12px; padding-top: 12px; }
.segnalazione { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.segnalazione.chiusa { opacity: .6; }
.segnalazione header { display: grid; gap: 2px; margin-bottom: 6px; }
.segnalazione header small { color: var(--muted); }
.segnalati { margin: 6px 0 10px; padding-left: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- ruoli su misura ---------- */
.chip-ruolo { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--colore, var(--border)); color: var(--text); font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: middle; background: color-mix(in srgb, var(--colore, transparent) 16%, transparent); }
.riga-ruolo { display: grid; gap: 2px; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--rule); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.riga-ruolo .chip-ruolo { margin-left: 0; justify-self: start; font-size: 13px; line-height: 22px; }
.riga-ruolo small { color: var(--muted); }
.assegna-ruolo .chip-ruolo { margin-left: 0; }
.persona b:has(.chip-ruolo) { white-space: normal; overflow: visible; }

/* ---------- informativa privacy, termini e collegamenti dalla schermata di accesso ---------- */
a.bottone { color: var(--text); text-decoration: none; }
.accesso { align-content: center; gap: 16px; }
.accesso-legale { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 18px; text-align: center; }
.accesso-titolare { max-width: 380px; margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; text-align: center; }
.accesso-legale a, .accesso-titolare a, .legale a { color: var(--accent); }
.da-inserire { padding: 0 4px; border-radius: 4px; background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.legale { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; font-size: 16px; line-height: 26px; }
.legale header a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; font-weight: 600; text-decoration: none; }
.legale h1 { margin: 32px 0 4px; font-size: 32px; line-height: 40px; font-weight: 600; }
.legale h2 { margin: 36px 0 8px; font-size: 20px; line-height: 28px; font-weight: 600; }
.legale p, .legale ul { margin: 0 0 12px; }
.legale li { margin-bottom: 6px; }
.aggiornata { color: var(--muted); }
.tabella { overflow-x: auto; margin: 12px 0 16px; border: 1px solid var(--border); border-radius: var(--radius-card); }
.legale table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; line-height: 21px; }
.legale th, .legale td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.legale th { background: var(--raised); font-weight: 600; }
.legale tr:last-child td { border-bottom: 0; }
