/* Stile della piattaforma.
   Tema scuro: sidebar in vetro (rif. «Glassy side bar») e schede antracite con accento arancio (rif. «Dashboard V32»).
   Tema chiaro: schede bianche su grigio con sidebar arancio piena (rif. «Dashboard V28»).
   Login a due pannelli con card fluttuanti e verifica a codice (rif. «Login and OTP»). */

:root {
  color-scheme: light;
  --sfondo: #eef0f3;
  --sfondo-alone-1: rgba(240, 122, 42, .10);
  --sfondo-alone-2: rgba(99, 102, 241, .07);
  --superficie: #ffffff;
  --superficie-2: #f5f6f8;
  --superficie-3: #eceef2;
  --bordo: #e3e6ea;
  --bordo-forte: #d3d7dd;
  --testo: #0f1115;
  --testo-2: #4b5260;
  --testo-3: #8a919e;
  --accento: #e8682a;
  --accento-2: #f59a4f;
  --accento-testo: #ffffff;
  --accento-scritta: #c2510f;
  --accento-tenue: #fdeee4;
  --sfumatura: linear-gradient(135deg, #f59a4f 0%, #e8682a 55%, #cf4f14 100%);
  --barra-sfondo: linear-gradient(180deg, #f08a45 0%, #e4631f 100%);
  --barra-testo: rgba(255, 255, 255, .86);
  --barra-testo-2: rgba(255, 255, 255, .62);
  --barra-attiva: #ffffff;
  --barra-attiva-testo: #d9591c;
  --barra-bordo: rgba(255, 255, 255, .18);
  --barra-hover: rgba(255, 255, 255, .14);
  --griglia: #edf0f3;
  --ok: #0f9d58; --ok-tenue: #e3f6ec;
  --attenzione: #b46a00; --attenzione-tenue: #fff3dc;
  --errore: #d92d20; --errore-tenue: #fdecea;
  --info: #2563eb; --info-tenue: #e8f0fe;
  --c-arancio: #f97316; --c-blu: #3b82f6; --c-verde: #10b981; --c-viola: #a855f7; --c-rosso: #ef4444;
  --c-giallo: #eab308; --c-ciano: #06b6d4; --c-grigio: #8b8b95;
  --serie-1: #e8682a; --serie-2: #3b82f6; --serie-3: #10b981; --serie-4: #a855f7; --serie-5: #eab308;
  --ombra: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
  --ombra-alta: 0 20px 50px rgba(16, 24, 40, .16);
  --raggio: 18px;
  --raggio-p: 12px;
  --barra: 252px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sfondo: #0a0a0c; --sfondo-alone-1: rgba(240, 122, 42, .10); --sfondo-alone-2: rgba(91, 76, 255, .16);
    --superficie: #151518; --superficie-2: #1c1c21; --superficie-3: #25252b; --bordo: rgba(255, 255, 255, .07);
    --bordo-forte: rgba(255, 255, 255, .13); --testo: #f4f4f5; --testo-2: #b5b5be; --testo-3: #7d7d88;
    --accento: #f07a2a; --accento-2: #ff9d52; --accento-scritta: #ff9d52; --accento-tenue: rgba(240, 122, 42, .14);
    --barra-sfondo: linear-gradient(180deg, rgba(28, 28, 34, .72), rgba(16, 16, 20, .66));
    --barra-testo: #e7e7ea; --barra-testo-2: #8d8d98; --barra-attiva: rgba(255, 255, 255, .09);
    --barra-attiva-testo: #ffffff; --barra-bordo: rgba(255, 255, 255, .08); --barra-hover: rgba(255, 255, 255, .05);
    --griglia: rgba(255, 255, 255, .06);
    --ok: #34d399; --ok-tenue: rgba(52, 211, 153, .12); --attenzione: #fbbf24; --attenzione-tenue: rgba(251, 191, 36, .12);
    --errore: #f87171; --errore-tenue: rgba(248, 113, 113, .12); --info: #60a5fa; --info-tenue: rgba(96, 165, 250, .12);
    --serie-1: #f07a2a; --serie-2: #60a5fa; --serie-3: #34d399; --serie-4: #c084fc; --serie-5: #facc15;
    --ombra: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
    --ombra-alta: 0 24px 60px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sfondo: #0a0a0c; --sfondo-alone-1: rgba(240, 122, 42, .10); --sfondo-alone-2: rgba(91, 76, 255, .16);
  --superficie: #151518; --superficie-2: #1c1c21; --superficie-3: #25252b; --bordo: rgba(255, 255, 255, .07);
  --bordo-forte: rgba(255, 255, 255, .13); --testo: #f4f4f5; --testo-2: #b5b5be; --testo-3: #7d7d88;
  --accento: #f07a2a; --accento-2: #ff9d52; --accento-scritta: #ff9d52; --accento-tenue: rgba(240, 122, 42, .14);
  --barra-sfondo: linear-gradient(180deg, rgba(28, 28, 34, .72), rgba(16, 16, 20, .66));
  --barra-testo: #e7e7ea; --barra-testo-2: #8d8d98; --barra-attiva: rgba(255, 255, 255, .09);
  --barra-attiva-testo: #ffffff; --barra-bordo: rgba(255, 255, 255, .08); --barra-hover: rgba(255, 255, 255, .05);
  --griglia: rgba(255, 255, 255, .06);
  --ok: #34d399; --ok-tenue: rgba(52, 211, 153, .12); --attenzione: #fbbf24; --attenzione-tenue: rgba(251, 191, 36, .12);
  --errore: #f87171; --errore-tenue: rgba(248, 113, 113, .12); --info: #60a5fa; --info-tenue: rgba(96, 165, 250, .12);
  --serie-1: #f07a2a; --serie-2: #60a5fa; --serie-3: #34d399; --serie-4: #c084fc; --serie-5: #facc15;
  --ombra: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --ombra-alta: 0 24px 60px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sfondo); color: var(--testo); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(900px 500px at 100% -10%, var(--sfondo-alone-2), transparent 60%),
                    radial-gradient(700px 500px at -10% 110%, var(--sfondo-alone-1), transparent 60%);
  background-attachment: fixed; min-height: 100vh;
}
a { color: var(--accento-scritta); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 4px; letter-spacing: -.025em; font-weight: 750; }
h2 { font-size: 1rem; margin: 0 0 12px; letter-spacing: -.01em; font-weight: 650; }
h3 { font-size: .92rem; margin: 0 0 8px; }
.sotto { color: var(--testo-2); margin: 0 0 20px; }
.muto { color: var(--testo-3); font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nascosto { display: none !important; }
::selection { background: var(--accento-tenue); }

/* ===== Struttura ===== */
.guscio { display: grid; grid-template-columns: var(--barra) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s ease; }
html.compatta .guscio { grid-template-columns: 84px minmax(0, 1fr); }
.laterale {
  position: sticky; top: 12px; margin: 12px 0 12px 12px; height: calc(100vh - 24px); border-radius: 22px;
  background: var(--barra-sfondo); border: 1px solid var(--barra-bordo); color: var(--barra-testo);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--ombra-alta); display: flex; flex-direction: column; overflow: hidden; z-index: 30;
}
.laterale .testa-barra { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px 16px; }
.marchio { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; font-weight: 750; letter-spacing: .04em; font-size: .92rem; }
.marchio:hover { text-decoration: none; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff;
  background: var(--sfumatura); box-shadow: 0 6px 16px rgba(232, 104, 42, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.logo svg { width: 20px; height: 20px; }
.marchio small { display: block; font-weight: 500; letter-spacing: .02em; color: var(--barra-testo-2); font-size: .7rem; }
.chiudi-barra { margin-left: auto; background: none; border: 0; color: var(--barra-testo-2); cursor: pointer; padding: 6px; border-radius: 8px; }
.chiudi-barra:hover { background: var(--barra-hover); color: var(--barra-testo); }
.chiudi-barra svg { width: 16px; height: 16px; transition: transform .25s; }
html.compatta .chiudi-barra svg { transform: rotate(180deg); }
.conto {
  margin: 4px 12px 8px; padding: 10px; border-radius: 14px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--barra-bordo); background: rgba(255, 255, 255, .04); color: inherit;
}
.conto:hover { text-decoration: none; background: var(--barra-hover); }
.conto .avatar { width: 34px; height: 34px; border-radius: 10px; }
.conto b { display: block; font-size: .86rem; color: var(--barra-testo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conto span { font-size: .72rem; color: var(--barra-testo-2); }
.nav { flex: 1; overflow-y: auto; padding: 2px 10px 10px; scrollbar-width: thin; }
.nav .titoletto { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--barra-testo-2); padding: 14px 10px 6px; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; color: var(--barra-testo);
  font-weight: 520; font-size: .885rem; position: relative; white-space: nowrap; border: 1px solid transparent; margin-bottom: 2px;
}
.nav a:hover { background: var(--barra-hover); text-decoration: none; }
.nav a.attivo { background: var(--barra-attiva); color: var(--barra-attiva-testo); font-weight: 650; border-color: var(--barra-bordo);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .08); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .conteggio { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: .7rem; font-weight: 700;
  display: inline-grid; place-items: center; background: #6366f1; color: #fff; }
.nav .conteggio.caldo { background: var(--c-rosso); }
.orologio {
  margin: 0 12px 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--barra-bordo);
  background: rgba(0, 0, 0, .14); font-family: var(--mono); color: #fff; white-space: nowrap; overflow: hidden;
}
:root[data-theme="dark"] .orologio { color: var(--accento-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .orologio { color: var(--accento-2); } }
.orologio .ore { font-size: 1.5rem; letter-spacing: .08em; font-weight: 600; }
.orologio .ore small { font-size: .8rem; opacity: .7; margin-left: 4px; }
.orologio .riga-bassa { display: flex; justify-content: space-between; font-size: .62rem; letter-spacing: .12em; color: var(--barra-testo-2); text-transform: uppercase; }
.orologio .online::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #34d399; margin-right: 5px; vertical-align: middle; }
.laterale .piede { border-top: 1px solid var(--barra-bordo); padding: 8px 10px 12px; }
.laterale .piede button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; border: 0; background: none; color: var(--barra-testo); font: inherit; font-size: .885rem; cursor: pointer; }
.laterale .piede button:hover { background: var(--barra-hover); }
.laterale .piede svg { width: 18px; height: 18px; }
html.compatta .laterale .etichetta-nav, html.compatta .marchio .nome-marchio, html.compatta .conto > div,
html.compatta .nav .titoletto, html.compatta .nav .conteggio, html.compatta .orologio, html.compatta .conto svg { display: none; }
html.compatta .nav a, html.compatta .laterale .piede button { justify-content: center; padding: 10px; }
html.compatta .nav .titoletto + a { margin-top: 10px; }
html.compatta .conto { justify-content: center; padding: 8px; }
html.compatta .laterale .testa-barra { flex-direction: column; padding: 14px 8px 8px; }
html.compatta .chiudi-barra { margin: 0; }
html.compatta .nav a .pallino-conteggio { display: block; }
.nav a .pallino-conteggio { display: none; position: absolute; top: 6px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-rosso); }

.principale { min-width: 0; display: flex; flex-direction: column; }
.testata { display: flex; align-items: center; gap: 14px; padding: 18px 26px 6px; min-height: 70px; }
.testata .saluto { min-width: 0; }
.testata .saluto strong { font-size: 1.05rem; letter-spacing: -.01em; display: block; }
.testata .saluto span { font-size: .8rem; color: var(--testo-3); }
.testata .azioni { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cerca-rapida {
  display: flex; align-items: center; gap: 8px; background: var(--superficie); border: 1px solid var(--bordo); border-radius: 12px;
  padding: 0 10px; height: 40px; width: min(340px, 32vw); color: var(--testo-3); box-shadow: var(--ombra);
}
.cerca-rapida input { border: 0 !important; background: none !important; padding: 0 !important; height: 100%; box-shadow: none !important; outline: none !important; color: var(--testo); }
.cerca-rapida kbd, kbd { font-family: var(--mono); font-size: .7rem; border: 1px solid var(--bordo-forte); border-radius: 6px; padding: 1px 6px; color: var(--testo-3); background: var(--superficie-2); }
.tondo {
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--superficie);
  border: 1px solid var(--bordo); color: var(--testo-2); cursor: pointer; box-shadow: var(--ombra); position: relative;
}
.tondo:hover { color: var(--testo); border-color: var(--bordo-forte); }
.tondo svg { width: 18px; height: 18px; }
.tondo.ai { background: var(--sfumatura); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(232, 104, 42, .35); }
.presenza { display: flex; align-items: center; gap: 6px; color: var(--testo-3); font-size: .8rem; padding: 0 6px; }
.presenza .pallino { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-tenue); }
.presenza .avatar { width: 28px; height: 28px; font-size: .66rem; margin-left: -8px; border: 2px solid var(--sfondo); }
.presenza .gruppo { display: inline-flex; margin-left: 10px; }
.contenuto { padding: 10px 26px 40px; width: 100%; max-width: 1500px; }
.btn.menu-mobile { display: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accento-tenue); color: var(--accento-scritta);
  display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 750; flex: none;
}
.avatar.pieno { color: #fff; }

/* ===== Elementi ===== */
.scheda { background: var(--superficie); border: 1px solid var(--bordo); border-radius: var(--raggio); box-shadow: var(--ombra); padding: 20px; }
.scheda + .scheda { margin-top: 16px; }
.scheda .testa-scheda { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.scheda .testa-scheda h2 { margin: 0; }
.scheda .testa-scheda .muto { margin-left: 2px; }
.scheda .testa-scheda .destra { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.griglia { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.riga { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.riga.spazio { justify-content: space-between; }
.pila > * + * { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--bordo-forte); background: var(--superficie);
  color: var(--testo); padding: 8px 14px; border-radius: 11px; font: inherit; font-size: .88rem; font-weight: 560;
  cursor: pointer; white-space: nowrap; line-height: 1.3; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--superficie-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primario { background: var(--sfumatura); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(232, 104, 42, .28), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primario:hover { filter: brightness(1.05); }
.btn.scuro { background: #111214; color: #fff; border-color: #111214; box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.btn.scuro:hover { background: #202226; }
:root[data-theme="dark"] .btn.scuro { background: #f4f4f5; color: #111214; border-color: #f4f4f5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.scuro { background: #f4f4f5; color: #111214; border-color: #f4f4f5; } }
:root[data-theme="dark"] .btn.scuro .rotella { border-color: rgba(0,0,0,.2); border-top-color: #111; }
.btn.pericolo { color: var(--errore); }
.btn.piccolo { padding: 5px 10px; font-size: .8rem; border-radius: 9px; }
.btn.link { border: 0; background: none; color: var(--accento-scritta); padding: 4px 6px; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .55; cursor: default; }

label { display: block; font-size: .8rem; font-weight: 620; color: var(--testo-2); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], input[type=search],
input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--testo); background: var(--superficie); border: 1px solid var(--bordo-forte);
  border-radius: 11px; padding: 9px 12px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accento); box-shadow: 0 0 0 4px var(--accento-tenue); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
textarea { min-height: 80px; resize: vertical; }
.campo { margin-bottom: 14px; }
.campi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.campi .campo { margin: 0; }
.spunte { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.spunte label { display: inline-flex; gap: 6px; align-items: center; font-weight: 450; color: var(--testo); margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-weight: 650; color: var(--testo-3); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
  padding: 8px 10px; border-bottom: 1px solid var(--bordo); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--bordo); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--superficie-2); }
.tabella-scorre { overflow-x: auto; }

.etichetta { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 650;
  background: var(--superficie-3); color: var(--testo-2); white-space: nowrap; line-height: 1.6; }
.etichetta.ok { background: var(--ok-tenue); color: var(--ok); }
.etichetta.attenzione { background: var(--attenzione-tenue); color: var(--attenzione); }
.etichetta.errore { background: var(--errore-tenue); color: var(--errore); }
.etichetta.info { background: var(--info-tenue); color: var(--info); }
.etichetta.accento { background: var(--accento-tenue); color: var(--accento-scritta); }
.chip { --c: var(--c-grigio); display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 82%, var(--testo)); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.c-arancio { --c: var(--c-arancio); } .c-blu { --c: var(--c-blu); } .c-verde { --c: var(--c-verde); } .c-viola { --c: var(--c-viola); }
.c-rosso { --c: var(--c-rosso); } .c-giallo { --c: var(--c-giallo); } .c-ciano { --c: var(--c-ciano); } .c-grigio { --c: var(--c-grigio); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.delta.su { color: var(--ok); background: var(--ok-tenue); }
.delta.giu { color: var(--errore); background: var(--errore-tenue); }
.delta.pari { color: var(--testo-3); background: var(--superficie-3); }

.avviso { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: .9rem; border: 1px solid transparent; display: flex; gap: 8px; align-items: flex-start; }
.avviso.ok { background: var(--ok-tenue); color: var(--ok); }
.avviso.errore { background: var(--errore-tenue); color: var(--errore); }
.avviso.attenzione { background: var(--attenzione-tenue); color: var(--attenzione); }
.avviso.info { background: var(--info-tenue); color: var(--info); }

.segmenti { display: inline-flex; background: var(--superficie-2); border: 1px solid var(--bordo); border-radius: 11px; padding: 3px; gap: 2px; }
.segmenti a, .segmenti button { padding: 5px 12px; border-radius: 8px; font-size: .8rem; font-weight: 650; color: var(--testo-2); border: 0; background: none; cursor: pointer; font-family: inherit; }
.segmenti a:hover, .segmenti button:hover { color: var(--testo); text-decoration: none; }
.segmenti .attivo { background: var(--superficie); color: var(--testo); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Menu a tendina (senza JS) */
details.tendina { position: relative; display: inline-block; }
details.tendina > summary { list-style: none; cursor: pointer; }
details.tendina > summary::-webkit-details-marker { display: none; }
details.tendina .pannello { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 260px; background: var(--superficie);
  border: 1px solid var(--bordo); border-radius: 14px; box-shadow: var(--ombra-alta); padding: 10px; }
details.tendina .pannello.sinistra { left: 0; right: auto; }
details.tendina .pannello form + form, details.tendina .pannello .voce + .voce { margin-top: 6px; }
details.tendina .pannello .voce { display: block; padding: 7px 9px; border-radius: 8px; color: var(--testo); }
details.tendina .pannello .voce:hover { background: var(--superficie-2); text-decoration: none; }
details.tendina .pannello hr { border: 0; border-top: 1px solid var(--bordo); margin: 8px 0; }

/* ===== Documenti ===== */
.percorso { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; color: var(--testo-3); margin-bottom: 4px; }
.percorso a { color: var(--testo-2); }
.nome-file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nome-file a { color: var(--testo); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.icona-file { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 800; flex: none; color: #fff; }
.icona-file.word { background: #2b579a; } .icona-file.excel { background: #217346; } .icona-file.slide { background: #c4472b; }
.icona-file.pdf { background: #b42318; } .icona-file.cartella { background: var(--accento-tenue); color: var(--accento-scritta); }
.icona-file.altro, .icona-file.testo { background: var(--testo-3); }
.in-modifica { font-size: .74rem; color: var(--ok); font-weight: 650; }
.in-modifica::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; animation: pulsa 1.6s infinite; }
@keyframes pulsa { 50% { opacity: .3; } }
.zona-caricamento { border: 2px dashed var(--bordo-forte); border-radius: var(--raggio); padding: 20px; text-align: center; color: var(--testo-3); transition: .15s; }
.zona-caricamento.sopra { border-color: var(--accento); background: var(--accento-tenue); color: var(--accento-scritta); }
.vuoto { text-align: center; padding: 40px 20px; color: var(--testo-3); }
.editor-pagina .contenuto { max-width: none; padding: 0; height: calc(100vh - 76px); }
#editor-contenitore { height: 100%; }

/* ===== Dashboard ===== */
.tessera { background: var(--superficie); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 16px 18px 14px; box-shadow: var(--ombra);
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 132px; }
.tessera .titolo { font-size: .82rem; color: var(--testo-2); font-weight: 620; display: flex; align-items: center; gap: 8px; padding-right: 44px; }
.tessera .valore { font-size: 1.9rem; font-weight: 760; letter-spacing: -.03em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tessera .valore small { font-size: .95rem; font-weight: 600; color: var(--testo-3); margin-left: 4px; letter-spacing: 0; }
.tessera .nota { font-size: .76rem; color: var(--testo-3); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tessera .icona-tessera { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.tessera .icona-tessera svg { width: 18px; height: 18px; }
.tessera .vai { margin-top: auto; padding-top: 10px; font-size: .76rem; color: var(--testo-2); font-weight: 600; }
.tessera .vai:hover { color: var(--accento-scritta); }
.tessera .scintilla { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; opacity: .9; pointer-events: none; }
.grafico { position: relative; height: 280px; }
.grafico.basso { height: 220px; }
.grafico.alto { height: 330px; }
.barra-progresso { height: 8px; background: var(--superficie-3); border-radius: 999px; overflow: hidden; min-width: 80px; }
.barra-progresso > span { display: block; height: 100%; background: var(--sfumatura); border-radius: 999px; }
.barra-progresso.ok > span { background: var(--ok); }
.barre-elenco .voce { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin-bottom: 12px; font-size: .84rem; }
.barre-elenco .voce .barra-progresso { grid-column: 1 / -1; height: 7px; }
.barre-elenco .voce .barra-progresso > span { background: var(--c, var(--accento)); }
.funnel .passo { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .86rem; }
.funnel .passo .barra { height: 24px; background: var(--superficie-2); border-radius: 7px; overflow: hidden; }
.funnel .passo .barra span { display: block; height: 100%; background: var(--sfumatura); border-radius: 7px; }
.allarmi { margin: 0; padding: 0; list-style: none; }
.allarmi li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--bordo); font-size: .86rem; }
.allarmi li:last-child { border-bottom: 0; }
.allarmi li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--attenzione); box-shadow: 0 0 0 4px var(--attenzione-tenue); }
.filtri { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.filtri .campo { margin: 0; }
.elenco-semplice { list-style: none; margin: 0; padding: 0; }
.elenco-semplice li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--bordo); font-size: .86rem; }
.elenco-semplice li:last-child { border-bottom: 0; }
.elenco-semplice .data-blocco { width: 44px; height: 44px; border-radius: 12px; background: var(--superficie-2); border: 1px solid var(--bordo); display: grid; place-items: center; text-align: center; line-height: 1.05; flex: none; }
.elenco-semplice .data-blocco b { font-size: 1rem; }
.elenco-semplice .data-blocco small { font-size: .6rem; text-transform: uppercase; color: var(--testo-3); letter-spacing: .06em; }
.elenco-semplice .testo { min-width: 0; flex: 1; }
.elenco-semplice .testo div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.misuratore { position: relative; display: grid; place-items: center; }
.misuratore .centro { position: absolute; inset: auto 0 18% 0; text-align: center; }
.misuratore .centro b { font-size: 1.8rem; letter-spacing: -.03em; display: block; }
.misuratore .centro span { font-size: .76rem; color: var(--testo-3); }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--testo-2); }
.legenda span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.titolo-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.titolo-pagina p { margin: 2px 0 0; color: var(--testo-3); font-size: .86rem; }

/* ===== Accesso (login + verifica) ===== */
.accesso-pagina { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: var(--sfondo); }
.accesso-carta { width: min(1080px, 100%); min-height: 640px; display: grid; grid-template-columns: 1.02fr 1fr; background: var(--superficie);
  border-radius: 28px; box-shadow: var(--ombra-alta); overflow: hidden; border: 1px solid var(--bordo); }
.accesso-arte { position: relative; margin: 10px; border-radius: 22px; overflow: hidden; padding: 30px; color: #3b2416;
  background: radial-gradient(120% 90% at 70% 100%, #f2793a 0%, #f5a36e 38%, #fbd9c3 70%, #fdeee4 100%); display: flex; flex-direction: column; }
.accesso-arte .logo { box-shadow: 0 10px 24px rgba(201, 77, 18, .35); }
.accesso-arte .frase { margin-top: auto; position: relative; z-index: 2; }
.accesso-arte .frase small { font-size: .82rem; color: #6b3a1f; }
.accesso-arte .frase h2 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.03em; margin: 6px 0 0; color: #2a160b; font-weight: 750; }
.vetrino { position: absolute; background: rgba(255, 255, 255, .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .7); border-radius: 16px; box-shadow: 0 18px 40px rgba(156, 62, 15, .18); padding: 12px 14px; color: #2a160b;
  font-size: .78rem; animation: galleggia 6s ease-in-out infinite; }
.vetrino b { font-size: .86rem; }
.vetrino .mini { color: #8a5a3b; font-size: .7rem; }
.vetrino.uno { top: 104px; left: 10%; width: 60%; animation-delay: -1s; }
.vetrino.due { top: 62px; right: 6%; display: flex; gap: 10px; align-items: center; animation-delay: -3s; z-index: 2; }
.vetrino.tre { top: 232px; left: 6%; display: flex; gap: 10px; align-items: center; animation-delay: -2s; }
.vetrino.quattro { top: 300px; right: 7%; display: flex; gap: 8px; align-items: center; border-radius: 999px; padding: 8px 14px 8px 8px; animation-delay: -4s; z-index: 2; }
.vetrino .cerchio { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .7rem; flex: none; }
.vetrino .anello { width: 38px; height: 38px; border-radius: 50%; border: 5px solid #22c55e; border-right-color: rgba(34, 197, 94, .25); flex: none; }
.vetrino svg.linea { width: 100%; height: 54px; display: block; margin-top: 6px; }
@keyframes galleggia { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.mascotte { position: absolute; width: 78px; height: 78px; border-radius: 50%; left: 44%; top: 380px; z-index: 3;
  background: radial-gradient(circle at 32% 28%, #c7d2fe 0%, #818cf8 34%, #4f46e5 72%, #3730a3 100%);
  box-shadow: 0 18px 40px rgba(79, 70, 229, .45), inset -6px -8px 18px rgba(30, 27, 75, .35), inset 6px 6px 14px rgba(255, 255, 255, .35);
  transition: left .7s cubic-bezier(.5, 1.6, .4, 1), top .7s cubic-bezier(.5, 1.6, .4, 1), transform .3s; }
.mascotte .occhio { position: absolute; top: 31px; width: 9px; height: 13px; border-radius: 6px; background: #fff; transition: transform .2s, height .2s, top .2s; }
.mascotte .occhio.s { left: 23px; } .mascotte .occhio.d { right: 23px; }
.mascotte .bocca { position: absolute; left: 50%; top: 50px; width: 18px; height: 8px; margin-left: -9px; border: 3px solid #fff; border-top: 0; border-radius: 0 0 12px 12px; transition: .3s; }
.mascotte.timida .occhio { height: 3px; top: 37px; }
.mascotte.felice .occhio { height: 6px; border-radius: 6px 6px 0 0; top: 33px; }
.mascotte.felice .bocca { width: 24px; height: 12px; margin-left: -12px; }
.mascotte.triste .bocca { border-radius: 12px 12px 0 0; border: 3px solid #fff; border-bottom: 0; top: 54px; }
.mascotte.scuoti { animation: scuoti .45s; }
@keyframes scuoti { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.nuvoletta { position: absolute; transform: translate(-50%, -100%); left: 50%; top: -10px; background: #4f46e5; color: #fff; font-size: .7rem; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 8px 18px rgba(79, 70, 229, .35); opacity: 0; transition: .3s; }
.mascotte.parla .nuvoletta { opacity: 1; }
.accesso-modulo { padding: 64px 70px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.accesso-modulo .asterisco { color: var(--accento); width: 30px; height: 30px; margin-bottom: 14px; }
.accesso-modulo h1 { font-size: 2rem; margin-bottom: 8px; }
.accesso-modulo .sotto { font-size: .88rem; max-width: 380px; color: var(--testo-3); }
.accesso-modulo .campo label { color: var(--testo); font-weight: 600; }
.accesso-modulo input[type=text], .accesso-modulo input[type=password] { height: 46px; border-radius: 12px; }
.campo-password { position: relative; }
.campo-password button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--testo-3); cursor: pointer; padding: 6px; }
.campo-password svg { width: 18px; height: 18px; }
.accesso-modulo .btn.scuro { width: 100%; height: 48px; border-radius: 12px; margin-top: 8px; font-size: .95rem; }
.accesso-modulo .piede-accesso { margin-top: 22px; font-size: .78rem; color: var(--testo-3); display: flex; gap: 8px; align-items: center; }
.accesso-modulo .piede-accesso svg { width: 15px; height: 15px; }
.rotella { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: gira .7s linear infinite; display: inline-block; }
@keyframes gira { to { transform: rotate(360deg); } }
.otp { display: flex; gap: 10px; margin: 18px 0 8px; }
.otp input { width: 54px; height: 60px; text-align: center; font-size: 1.45rem; font-weight: 650; border-radius: 13px; padding: 0; font-family: var(--font); font-variant-numeric: tabular-nums; }
.otp input.piena { border-color: var(--testo); }
.otp.errore input { border-color: var(--errore); animation: scuoti .4s; }
.otp.ok input { border-color: var(--ok); color: var(--ok); }
.riga-otp { display: flex; justify-content: space-between; font-size: .76rem; color: var(--testo-3); margin-bottom: 16px; }
.btn.verificato { background: #16a34a !important; border-color: #16a34a !important; }
.errore-accesso { color: var(--errore); font-size: .84rem; min-height: 1.3em; margin: 4px 0 0; }
.qr { background: #fff; padding: 8px; border-radius: 12px; display: inline-block; border: 1px solid var(--bordo); flex: none; }
.qr svg { width: 150px; height: 150px; display: block; }
.passi-2fa { margin: 0 0 4px; padding-left: 20px; font-size: .88rem; color: var(--testo-2); }
.passi-2fa li { margin-bottom: 10px; }
.passi-2fa .riga-qr { display: flex; gap: 16px; align-items: flex-start; margin-top: 10px; flex-wrap: wrap; }
.passi-2fa details { max-width: 220px; font-size: .8rem; }
.passi-2fa summary { cursor: pointer; color: var(--accento-scritta); }
.codice-segreto { font-family: var(--mono); background: var(--superficie-2); padding: 6px 10px; border-radius: 8px; word-break: break-all; font-size: .86rem; }
input.codice { font-size: 1.4rem; letter-spacing: .4em; text-align: center; font-family: var(--mono); }
/* vecchio layout delle pagine di accesso (cambio password, 2FA) */
.accesso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.accesso .scheda { width: 100%; max-width: 440px; padding: 32px; border-radius: 24px; }
.accesso h1 { font-size: 1.4rem; }
.accesso .btn.primario { width: 100%; padding: 11px; }

/* ===== Notifiche ===== */
#notifiche { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.notifica { background: #111214; color: #f4f4f5; padding: 11px 14px; border-radius: 12px; font-size: .86rem; box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
  max-width: 380px; animation: entra .2s ease-out; display: flex; gap: 10px; align-items: center; border: 1px solid rgba(255, 255, 255, .08); }
.notifica .avatar { width: 24px; height: 24px; font-size: .6rem; }
.notifica.errore { background: #7f1d1d; }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }
.aggiornamenti { display: none; }
.aggiornamenti.visibile { display: flex; }

/* ===== Assistente AI (pannello laterale) ===== */
.cassetto { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px)); z-index: 120; display: flex; flex-direction: column;
  background: var(--superficie); border: 1px solid var(--bordo); border-radius: 22px; box-shadow: var(--ombra-alta); transform: translateX(110%); transition: transform .3s cubic-bezier(.2, .9, .3, 1); }
.cassetto.aperto { transform: none; }
.cassetto .testa { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--bordo); }
.cassetto .testa .logo { width: 32px; height: 32px; }
.cassetto .testa b { display: block; font-size: .95rem; }
.cassetto .testa span { font-size: .74rem; color: var(--testo-3); }
.cassetto .testa .btn { margin-left: auto; }
.chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat .msg { max-width: 92%; padding: 10px 13px; border-radius: 16px; font-size: .88rem; line-height: 1.5; }
.chat .msg.io { align-self: flex-end; background: var(--sfumatura); color: #fff; border-bottom-right-radius: 5px; }
.chat .msg.ai { align-self: flex-start; background: var(--superficie-2); border: 1px solid var(--bordo); border-bottom-left-radius: 5px; }
.chat .msg.ai.errore { background: var(--errore-tenue); color: var(--errore); }
.chat .msg p { margin: 0 0 8px; } .chat .msg p:last-child { margin: 0; }
.chat .msg table { margin: 6px 0; font-size: .8rem; }
.chat .msg th, .chat .msg td { padding: 4px 6px; }
.chat .msg ul { margin: 4px 0; padding-left: 18px; }
.chat .passi { font-size: .72rem; color: var(--testo-3); margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.chat .passi span::before { content: "✓ "; color: var(--ok); }
.chat .pensa { display: inline-flex; gap: 4px; }
.chat .pensa i { width: 6px; height: 6px; border-radius: 50%; background: var(--testo-3); animation: rimbalza 1s infinite; }
.chat .pensa i:nth-child(2) { animation-delay: .15s; } .chat .pensa i:nth-child(3) { animation-delay: .3s; }
@keyframes rimbalza { 50% { transform: translateY(-4px); opacity: .5; } }
.suggerimenti { display: flex; flex-wrap: wrap; gap: 6px; }
.suggerimenti button { border: 1px solid var(--bordo-forte); background: var(--superficie); color: var(--testo-2); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .78rem; cursor: pointer; text-align: left; }
.suggerimenti button:hover { border-color: var(--accento); color: var(--accento-scritta); }
.chat-invio { padding: 12px; border-top: 1px solid var(--bordo); display: flex; gap: 8px; align-items: flex-end; }
.chat-invio textarea { min-height: 44px; max-height: 140px; resize: none; border-radius: 14px; }
.chat-invio .btn { height: 44px; width: 44px; padding: 0; border-radius: 14px; flex: none; }
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .2s; }
.velo.visibile { opacity: 1; pointer-events: auto; }

/* ===== Palette comandi (ricerca rapida) ===== */
.palette { position: fixed; inset: 0; z-index: 150; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(0, 0, 0, .3); }
.palette.aperta { display: flex; }
.palette .riquadro { width: min(560px, calc(100vw - 32px)); background: var(--superficie); border: 1px solid var(--bordo); border-radius: 18px; box-shadow: var(--ombra-alta); overflow: hidden; }
.palette input { border: 0 !important; border-bottom: 1px solid var(--bordo) !important; border-radius: 0 !important; padding: 16px 18px !important; font-size: 1rem; box-shadow: none !important; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--testo); }
.palette li a:hover, .palette li a.scelto { background: var(--superficie-2); text-decoration: none; }
.palette li small { margin-left: auto; color: var(--testo-3); }

@media (max-width: 1150px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g-2-1 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .accesso-carta { grid-template-columns: 1fr; min-height: 0; }
  .accesso-arte { display: none; }
  .accesso-modulo { padding: 40px 28px; }
}
@media (max-width: 760px) {
  .guscio, html.compatta .guscio { grid-template-columns: 1fr; }
  .laterale { position: fixed; left: 0; top: 0; margin: 10px; width: 260px; transform: translateX(-120%); transition: transform .25s; }
  .laterale.aperta { transform: none; }
  html.compatta .laterale .etichetta-nav, html.compatta .nav .titoletto { display: initial; }
  .btn.menu-mobile { display: inline-flex; }
  .testata { padding: 12px 16px 4px; flex-wrap: wrap; }
  .cerca-rapida { display: none; }
  .contenuto { padding: 10px 16px 32px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .funnel .passo { grid-template-columns: 110px 1fr 50px; }
  .nascondi-mobile, .presenza .testo-presenza { display: none; }
  details.tendina .pannello { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; min-width: 0; }
  .otp input { width: 44px; height: 54px; }
}
