/* FM·One — design system
   Tutto in variabili: un tenant cambia palette da pannello (Impostazioni → Branding). */

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;

  --bg: #f3f5f9;
  --bg-2: #e9edf4;
  --sup: #ffffff;
  --sup-2: #f8fafc;
  --bordo: #e4e8f0;
  --bordo-2: #d5dae5;
  --testo: #0f172a;
  --testo-2: #475569;
  --muto: #7c8aa0;

  --nav-bg: #0b1730;
  --nav-bg-2: #102446;
  --nav-testo: #c7d2e6;
  --nav-muto: #6f7fa3;
  --nav-attivo: #2f6bff;

  --primario: #2563eb;
  --primario-2: #1d4ed8;
  --primario-soft: #e8efff;
  --accento: #0d9488;
  --accento-soft: #d9f4ef;
  --ok: #16a34a;
  --ok-soft: #dcf5e4;
  --avviso: #d97706;
  --avviso-soft: #fdf0d5;
  --errore: #dc2626;
  --errore-soft: #fde4e4;
  --info: #6366f1;
  --info-soft: #e7e8fd;
  --viola: #7c3aed;
  --viola-soft: #ede4ff;
  --rosa: #db2777;
  --rosa-soft: #fce4ef;
  --ciano: #0891b2;
  --ciano-soft: #d8f2f8;

  --r-sm: 9px;
  --r-ctrl: 10px;
  --r: 14px;
  --r-lg: 18px;
  --ombra-0: 0 1px 1px rgba(15, 23, 42, .035);
  --ombra: 0 1px 2px rgba(15, 23, 42, .03), 0 2px 6px -1px rgba(15, 23, 42, .05), 0 0 0 1px rgba(15, 23, 42, .02);
  --ombra-2: 0 4px 10px -4px rgba(15, 23, 42, .08), 0 14px 32px -12px rgba(15, 23, 42, .16);
  --ombra-3: 0 24px 64px -16px rgba(15, 23, 42, .32), 0 8px 24px -8px rgba(15, 23, 42, .18);
  --anello: 0 0 0 4px var(--primario-soft);

  --sidebar: 252px;
  --topbar: 64px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --sup: #131c2e;
  --sup-2: #18233a;
  --bordo: #223049;
  --bordo-2: #2c3b57;
  --testo: #e6ebf5;
  --testo-2: #a7b3c9;
  --muto: #718096;
  --nav-bg: #070d1a;
  --nav-bg-2: #0b1428;
  --primario-soft: #1b2a4d;
  --accento-soft: #123a37;
  --ok-soft: #113523;
  --avviso-soft: #3d2a0c;
  --errore-soft: #421818;
  --info-soft: #24264d;
  --viola-soft: #2c1d4d;
  --rosa-soft: #41182b;
  --ciano-soft: #0e3340;
  --ombra: 0 1px 2px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.03);
  --ombra-2: 0 4px 10px -4px rgba(0,0,0,.4), 0 14px 32px -12px rgba(0,0,0,.5);
  --ombra-3: 0 24px 64px -16px rgba(0,0,0,.6), 0 8px 24px -8px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--testo);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
}
a { color: var(--primario); text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.012em; }
h1 { font-size: 24px; letter-spacing: -.025em; }
h2 { font-size: 17px; letter-spacing: -.012em; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
::selection { background: var(--primario-soft); color: var(--primario-2); }
.contenuto, .op-corpo, .cl-corpo { animation: entra .22s cubic-bezier(.2,.8,.2,1); }
@keyframes entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .contenuto, .op-corpo, .cl-corpo { animation: none; } }
svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 28px; height: 28px; }
svg.ic.ph { fill: currentColor; stroke: none; }
.ic-sm.ph { width: 16px; height: 16px; }
.ic-lg.ph { width: 24px; height: 24px; }
.ic-xl.ph { width: 30px; height: 30px; }
.nav a .ic.ph { width: 20px; height: 20px; opacity: 1; }
.op-tabbar a .ic.ph { width: 24px; height: 24px; }
.vuoto .ic.ph { width: 36px; height: 36px; }
.ic.ms { font-family: 'Material Symbols Rounded'; font-weight: 400; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; display: inline-block; width: 1em; height: 1em; vertical-align: -4px; flex: none; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.ic.ms.ic-sm { font-size: 16px; vertical-align: -3px; }
.ic.ms.ic-lg { font-size: 24px; }
.ic.ms.ic-xl { font-size: 30px; }
.vuoto .ic.ms { font-size: 36px; }
.op-tabbar a .ic.ms { font-size: 24px; }
.nav a .ic.ms { font-size: 21px; }
.muto { color: var(--muto); }
.testo-2 { color: var(--testo-2); }
.piccolo { font-size: 12px; }
.mini { font-size: 11px; }
.grassetto { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.tronca { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx { text-align: right; }
.centro { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-1 { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 4px; }
.gap-2 { gap: 4px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.sep { height: 1px; background: var(--bordo); margin: 12px 0; }
.spazio { flex: 1; }
.nascosto { display: none !important; }
.c-ok { color: var(--ok); } .c-err { color: var(--errore); } .c-avv { color: var(--avviso); } .c-pri { color: var(--primario); } .c-info { color: var(--info); } .c-acc { color: var(--accento); }

/* ---------- Layout shell ---------- */
#app { min-height: 100%; }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  color: var(--nav-testo);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.sidebar.viola { --nav-bg: #1a0b30; --nav-bg-2: #2a1352; --nav-attivo: #7c3aed; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-logo { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; box-shadow: 0 8px 18px -8px rgba(59,130,246,.9); }
.brand-logo svg { display: block; }
.brand-nome { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand-nome b { color: #5eead4; font-weight: 700; }
.brand-sotto { font-size: 11px; color: var(--nav-muto); margin-top: -2px; }
.nav { flex: 1; overflow: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: #2a3a5c transparent; }
.nav-gruppo { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--nav-muto); padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7.5px 10px; border-radius: var(--r-ctrl); color: var(--nav-testo); font-weight: 500; font-size: 13.5px; margin-bottom: 1px; transition: background .12s, color .12s; }
.nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav a.attivo { background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0) 60%), var(--nav-attivo); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -6px var(--nav-attivo); font-weight: 600; }
.nav a .ic { opacity: .8; }
.nav a.attivo .ic { opacity: 1; }
.nav a .cont { margin-left: auto; background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav a.attivo .cont { background: rgba(255,255,255,.25); }
.sidebar-piede { padding: 12px; }
.tenant-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px; }
.tenant-card b { color: #fff; display: block; font-size: 13px; }
.tenant-card span { font-size: 11.5px; color: var(--nav-muto); }
.nav-app-switch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 12px 6px; background: rgba(255,255,255,.05); padding: 4px; border-radius: 10px; }
.nav-app-switch a { display: grid; place-items: center; padding: 6px 0; border-radius: 7px; color: var(--nav-muto); }
.nav-app-switch a.attivo { background: rgba(255,255,255,.12); color: #fff; }
.nav-app-switch a:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--sup); border-bottom: 1px solid var(--bordo); box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 6px 16px -14px rgba(15,23,42,.3); position: sticky; top: 0; z-index: 30; }
.cerca { position: relative; width: min(420px, 100%); }
.cerca input { width: 100%; height: 38px; padding: 0 12px 0 38px; border-radius: var(--r-ctrl); border: 1px solid var(--bordo); background: var(--bg); outline: none; transition: border .15s, box-shadow .15s, background .15s; }
.cerca input:focus { border-color: var(--primario); box-shadow: var(--anello); background: var(--sup); }
.cerca > .ic { position: absolute; left: 12px; top: 10px; color: var(--muto); }
.cerca kbd { position: absolute; right: 10px; top: 9px; font-family: var(--mono); font-size: 11px; color: var(--muto); border: 1px solid var(--bordo-2); border-radius: 5px; padding: 1px 5px; background: var(--sup); }
.cerca-risultati { position: absolute; top: 44px; left: 0; right: 0; background: var(--sup); border: 1px solid var(--bordo); border-radius: var(--r); box-shadow: var(--ombra-3); overflow: hidden; z-index: 50; max-height: 420px; overflow-y: auto; }
.cerca-risultati .gruppo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muto); padding: 10px 14px 4px; font-weight: 600; }
.cerca-risultati a { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--testo); }
.cerca-risultati a:hover { background: var(--sup-2); }
.top-azioni { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn-icona { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--testo-2); display: grid; place-items: center; position: relative; }
.btn-icona:hover { background: var(--bg); color: var(--testo); }
.btn-icona .punto { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--errore); border: 2px solid var(--sup); }
.utente-top { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 10px; cursor: pointer; margin-left: 6px; }
.utente-top:hover { background: var(--bg); }
.utente-top .nome { font-weight: 600; font-size: 13px; line-height: 1.1; }
.utente-top .ruolo { font-size: 11.5px; color: var(--muto); }

.contenuto { padding: 24px 28px 48px; flex: 1; }
.pagina-testa { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagina-testa .sotto { color: var(--muto); margin-top: 3px; font-size: 13.5px; }
.pagina-testa .azioni { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.briciole { font-size: 12.5px; color: var(--muto); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--bordo); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--testo-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--testo); }
.tabs a.attivo { color: var(--primario); border-color: var(--primario); font-weight: 600; }
.tabs a .cont { background: var(--bg-2); color: var(--testo-2); font-size: 11px; padding: 0 6px; border-radius: 99px; font-weight: 600; }
.tabs a.attivo .cont { background: var(--primario-soft); color: var(--primario); }
.pill-tabs { display: inline-flex; gap: 2px; background: var(--bg-2); padding: 3px; border-radius: 9px; }
.pill-tabs a, .pill-tabs button { padding: 5px 11px; border-radius: 7px; color: var(--testo-2); font-weight: 500; font-size: 12.5px; border: 0; background: transparent; }
.pill-tabs .attivo { background: var(--sup); color: var(--testo); box-shadow: var(--ombra); font-weight: 600; }

/* ---------- Cards ---------- */
.griglia { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }
.scheda { background: var(--sup); border: 1px solid var(--bordo); border-radius: var(--r); box-shadow: var(--ombra); transition: box-shadow .18s, transform .18s, border-color .18s; }
.scheda-testa { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.scheda-testa h2 { font-size: 15px; }
.scheda-testa .azione { margin-left: auto; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.scheda-corpo { padding: 18px 20px; }
.scheda-corpo.p0 { padding: 0; }
.scheda-piede { padding: 11px 20px; border-top: 1px solid var(--bordo); font-size: 12.5px; color: var(--muto); display: flex; align-items: center; gap: 8px; }
.scheda.hover:hover { box-shadow: var(--ombra-2); border-color: var(--bordo-2); transform: translateY(-2px); cursor: pointer; }

.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 11px; position: relative; overflow: hidden; }
.kpi-testa { display: flex; align-items: center; justify-content: space-between; color: var(--testo-2); font-size: 13px; font-weight: 500; }
.kpi-icona { width: 36px; height: 36px; border-radius: var(--r-ctrl); display: grid; place-items: center; }
.kpi-valore { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.kpi-valore small { font-size: 15px; color: var(--muto); font-weight: 500; letter-spacing: 0; }
.kpi-nota { font-size: 12.5px; color: var(--muto); display: flex; align-items: center; gap: 6px; }
.kpi .spark { position: absolute; right: 12px; bottom: 10px; opacity: .9; }
.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.delta.su { color: var(--ok); } .delta.giu { color: var(--errore); } .delta.neutro { color: var(--muto); }

/* ---------- Tabelle ---------- */
.tabella-wrap { overflow-x: auto; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tab th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muto); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--bordo); white-space: nowrap; background: var(--sup-2); }
.tab td { padding: 11px 14px; border-bottom: 1px solid var(--bordo); vertical-align: middle; }
.tab tr:last-child td { border-bottom: 0; }
.tab tbody tr.cliccabile { cursor: pointer; }
.tab tbody tr.cliccabile:hover td { background: var(--sup-2); }
.tab td.dx, .tab th.dx { text-align: right; }
.tab .principale { font-weight: 600; }
.tab .sotto { display: block; font-size: 12px; color: var(--muto); margin-top: 1px; }
.barra-filtri { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--bordo); flex-wrap: wrap; }
.barra-filtri .cerca { width: 260px; }
.barra-filtri .cerca input { height: 34px; }
.barra-filtri .cerca .ic { top: 8px; }
.paginazione { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--muto); border-top: 1px solid var(--bordo); }

/* ---------- Badge / chip ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge .p { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-grigio { background: var(--bg-2); color: var(--testo-2); }
.b-blu { background: var(--primario-soft); color: var(--primario); }
.b-verde { background: var(--ok-soft); color: var(--ok); }
.b-giallo { background: var(--avviso-soft); color: var(--avviso); }
.b-rosso { background: var(--errore-soft); color: var(--errore); }
.b-viola { background: var(--viola-soft); color: var(--viola); }
.b-indaco { background: var(--info-soft); color: var(--info); }
.b-teal { background: var(--accento-soft); color: var(--accento); }
.b-rosa { background: var(--rosa-soft); color: var(--rosa); }
.b-ciano { background: var(--ciano-soft); color: var(--ciano); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 8px; font-size: 12px; background: var(--bg-2); color: var(--testo-2); border: 1px solid var(--bordo); }
.chip.attivo { background: var(--primario-soft); color: var(--primario); border-color: transparent; font-weight: 600; }
.tag-sensore { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; background: linear-gradient(90deg, #7c3aed, #2563eb); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }

/* ---------- Avatar ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; letter-spacing: -.02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar-gruppo { display: inline-flex; }
.avatar-gruppo .avatar { border: 2px solid var(--sup); margin-left: -8px; }
.avatar-gruppo .avatar:first-child { margin-left: 0; }

/* ---------- Bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-ctrl); border: 1px solid var(--bordo-2); background: var(--sup); color: var(--testo); font-weight: 600; font-size: 13px; letter-spacing: -.006em; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--sup-2); border-color: var(--muto); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--primario); border-color: var(--primario); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 3px 10px -4px rgba(37,99,235,.55); }
.btn.pri:hover { background: var(--primario-2); border-color: var(--primario-2); }
.btn.acc { background: var(--accento); border-color: var(--accento); color: #fff; }
.btn.err { background: var(--errore); border-color: var(--errore); color: #fff; }
.btn.fantasma { border-color: transparent; background: transparent; color: var(--testo-2); }
.btn.fantasma:hover { background: var(--bg-2); color: var(--testo); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.blocco { width: 100%; justify-content: center; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }

/* ---------- Progress ---------- */
.prog { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.prog > i { display: block; height: 100%; border-radius: 99px; background: var(--primario); }
.prog.sottile { height: 4px; }
.prog.grande { height: 10px; }

/* ---------- Form ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 12.5px; font-weight: 600; color: var(--testo-2); }
.campo input, .campo select, .campo textarea { height: 38px; padding: 0 12px; border-radius: var(--r-ctrl); border: 1px solid var(--bordo-2); background: var(--sup); outline: none; transition: border-color .12s, box-shadow .12s; }
.campo textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--primario); box-shadow: var(--anello); }
.form-griglia { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-griglia .intera { grid-column: 1 / -1; }
.interruttore { width: 38px; height: 22px; border-radius: 99px; background: var(--bordo-2); position: relative; display: inline-block; cursor: pointer; flex: none; transition: .15s; }
.interruttore::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.interruttore.on { background: var(--ok); }
.interruttore.on::after { left: 19px; }
select.sel { height: 34px; padding: 0 30px 0 10px; border-radius: 8px; border: 1px solid var(--bordo-2); background: var(--sup); outline: none; font-size: 13px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c8aa0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }

/* ---------- Liste ---------- */
.lista { display: flex; flex-direction: column; }
.lista-voce { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--bordo); align-items: flex-start; }
.lista-voce:last-child { border-bottom: 0; }
.lista-voce.cliccabile { cursor: pointer; }
.lista-voce.cliccabile:hover { background: var(--sup-2); }
.lista-voce .icona-tonda { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.lista-voce .titolo { font-weight: 600; font-size: 13.5px; }
.lista-voce .desc { color: var(--testo-2); font-size: 13px; margin-top: 1px; }
.lista-voce .meta { color: var(--muto); font-size: 11.5px; margin-top: 3px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--bordo); }
.timeline .ev { position: relative; padding-bottom: 16px; }
.timeline .ev::before { content: ''; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--sup); border: 2px solid var(--primario); }
.timeline .ev.ok::before { border-color: var(--ok); background: var(--ok); }
.timeline .ev.err::before { border-color: var(--errore); background: var(--errore); }
.timeline .ev.avv::before { border-color: var(--avviso); }
.timeline .ev .quando { font-size: 11.5px; color: var(--muto); }

/* ---------- Stepper (flussi) ---------- */
.stepper { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0; }
.stepper .passo { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muto); white-space: nowrap; }
.stepper .passo .n { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bordo-2); display: grid; place-items: center; font-size: 11px; background: var(--sup); }
.stepper .passo.fatto { color: var(--testo-2); }
.stepper .passo.fatto .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper .passo.corrente { color: var(--primario); }
.stepper .passo.corrente .n { border-color: var(--primario); color: var(--primario); box-shadow: 0 0 0 4px var(--primario-soft); }
.stepper .linea { width: 28px; height: 2px; background: var(--bordo-2); margin: 0 8px; flex: none; }
.stepper .linea.fatta { background: var(--ok); }

/* ---------- Drawer ---------- */
.velo { position: fixed; inset: 0; background: rgba(8, 15, 35, .45); z-index: 90; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.velo.aperto { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--sup); z-index: 100; box-shadow: var(--ombra-3); transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.drawer.aperto { transform: translateX(0); }
.drawer-testa { padding: 18px 22px; border-bottom: 1px solid var(--bordo); display: flex; align-items: flex-start; gap: 12px; }
.drawer-testa h2 { font-size: 17px; }
.drawer-corpo { padding: 20px 22px; overflow: auto; flex: 1; }
.drawer-piede { padding: 14px 22px; border-top: 1px solid var(--bordo); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 13.5px; }
.dl dt { color: var(--muto); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- Modale ---------- */
.modale { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 20px; }
.modale > .velo { z-index: 0; }
.modale-box { background: var(--sup); border-radius: var(--r-lg); width: min(680px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--ombra-3); animation: pop .18s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { transform: scale(.96) translateY(6px); opacity: 0; } }
.modale-testa { padding: 18px 22px; border-bottom: 1px solid var(--bordo); display: flex; align-items: center; gap: 10px; }
.modale-corpo { padding: 20px 22px; overflow: auto; }
.modale-piede { padding: 14px 22px; border-top: 1px solid var(--bordo); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--testo); color: var(--sup); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--ombra-3); display: flex; align-items: center; gap: 8px; animation: pop .2s; max-width: 380px; }
[data-theme="dark"] .toast { background: #e6ebf5; color: #0b1220; }

/* ---------- Grafici ---------- */
.grafico { width: 100%; height: auto; display: block; }
.grafico text { font-family: var(--font); fill: var(--muto); font-size: 11px; }
.grafico .griglia-linea { stroke: var(--bordo); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--testo-2); }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.heat { display: grid; gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 4px; display: block; }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.gauge-valore { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: -34px; }

/* ---------- Calendario ---------- */
.calendario { display: grid; grid-template-columns: 70px repeat(7, 1fr); border: 1px solid var(--bordo); border-radius: 12px; overflow: hidden; }
.calendario .h { background: var(--sup-2); padding: 10px 6px; font-size: 12px; text-align: center; border-bottom: 1px solid var(--bordo); border-left: 1px solid var(--bordo); font-weight: 600; }
.calendario .h b { display: block; font-size: 16px; font-weight: 700; }
.calendario .h.oggi b { color: var(--primario); }
.calendario .ora { font-size: 11px; color: var(--muto); padding: 6px; text-align: right; border-top: 1px solid var(--bordo); height: 56px; }
.calendario .cella { border-top: 1px solid var(--bordo); border-left: 1px solid var(--bordo); height: 56px; position: relative; padding: 2px; }
.calendario .ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: 11px; font-weight: 600; overflow: hidden; line-height: 1.2; border-left: 3px solid; cursor: pointer; }
.calendario .ev small { display: block; font-weight: 500; opacity: .8; font-size: 10.5px; }
.matrice { display: grid; border: 1px solid var(--bordo); border-radius: 12px; overflow: hidden; font-size: 12px; }
.matrice > div { padding: 8px 10px; border-bottom: 1px solid var(--bordo); border-left: 1px solid var(--bordo); min-height: 40px; display: flex; align-items: center; }
.matrice .h { background: var(--sup-2); font-weight: 600; color: var(--muto); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.matrice .nome { font-weight: 600; background: var(--sup); position: sticky; left: 0; }
.turno { width: 100%; text-align: center; padding: 4px; border-radius: 6px; font-weight: 700; font-size: 11.5px; }
.t-M { background: #fef3c7; color: #92400e; } .t-P { background: #dbeafe; color: #1e40af; } .t-N { background: #e0e7ff; color: #3730a3; } .t-R { background: var(--bg-2); color: var(--muto); font-weight: 500; } .t-F { background: #dcfce7; color: #166534; } .t-A { background: #fee2e2; color: #991b1b; } .t-S { background: #fce7f3; color: #9d174d; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kanban .colonna { background: var(--bg-2); border-radius: 12px; padding: 10px; }
.kanban .colonna h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--testo-2); padding: 4px 6px 10px; display: flex; align-items: center; gap: 6px; }
.kanban .carta { background: var(--sup); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--ombra); border: 1px solid var(--bordo); cursor: pointer; }
.kanban .carta:hover { box-shadow: var(--ombra-2); }
.kanban .carta .t { font-weight: 600; font-size: 13px; margin: 4px 0; }

/* ---------- Albero ---------- */
.albero { font-size: 13.5px; }
.albero .nodo { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.albero .nodo:hover { background: var(--sup-2); }
.albero .nodo.sel { background: var(--primario-soft); color: var(--primario); font-weight: 600; }
.albero .figli { margin-left: 22px; border-left: 1px dashed var(--bordo-2); padding-left: 6px; }

/* ---------- Planimetria ---------- */
.plan { background: var(--sup-2); border-radius: 12px; border: 1px solid var(--bordo); }
.plan .stanza { fill: var(--sup); stroke: var(--bordo-2); stroke-width: 1.5; }
.plan .stanza.ok { fill: #dcfce7; } .plan .stanza.avv { fill: #fef3c7; } .plan .stanza.err { fill: #fee2e2; } .plan .stanza.info { fill: #e0e7ff; }
.plan text { font-family: var(--font); font-size: 10px; fill: var(--testo-2); font-weight: 600; }
.plan .sens { fill: var(--primario); stroke: #fff; stroke-width: 2; }
.plan .sens.avv { fill: var(--avviso); } .plan .sens.err { fill: var(--errore); } .plan .sens.ok { fill: var(--ok); }
.plan .sens-pulse { fill: none; stroke: var(--errore); stroke-width: 1.5; animation: pulse 1.6s infinite; transform-origin: center; }
@keyframes pulse { 0% { r: 6; opacity: .9; } 100% { r: 16; opacity: 0; } }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 280px 1fr; min-height: 560px; }
.chat-lista { border-right: 1px solid var(--bordo); overflow: auto; }
.chat-voce { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--bordo); cursor: pointer; }
.chat-voce:hover, .chat-voce.attiva { background: var(--sup-2); }
.chat-voce .nome { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.chat-voce .ultimo { font-size: 12px; color: var(--muto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.chat-area { display: flex; flex-direction: column; }
.chat-msgs { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow: auto; background: var(--bg); }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; background: var(--sup); border: 1px solid var(--bordo); align-self: flex-start; }
.msg.mio { align-self: flex-end; background: var(--primario); color: #fff; border-color: var(--primario); }
.msg .quando { display: block; font-size: 10.5px; opacity: .65; margin-top: 3px; }
.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--bordo); }
.chat-input input { flex: 1; height: 38px; border-radius: 9px; border: 1px solid var(--bordo-2); padding: 0 12px; outline: none; }

/* ---------- Notifiche drawer ---------- */
.notifica { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--bordo); }
.notifica.nuova .t { font-weight: 700; }
.notifica .t { font-size: 13.5px; }
.notifica .d { font-size: 12.5px; color: var(--testo-2); }

/* ---------- Login / scelta ruolo ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-sx { background: radial-gradient(1200px 600px at -10% -10%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0f766e 0%, transparent 55%), var(--nav-bg); color: #fff; padding: 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-sx .brand-nome { font-size: 22px; }
.login-sx h1 { font-size: 40px; line-height: 1.1; margin-top: auto; letter-spacing: -.03em; max-width: 560px; }
.login-sx p.lead { color: #b7c4e2; font-size: 16px; margin-top: 16px; max-width: 520px; line-height: 1.55; }
.login-sx .pillole { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.login-sx .pillole span { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 6px 12px; border-radius: 99px; font-size: 12.5px; }
.login-sx .griglia-deco { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 40px 40px; pointer-events: none; }
.login-dx { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-box { width: min(520px, 100%); }
.login-box h2 { font-size: 22px; }
.ruoli { display: grid; gap: 10px; margin-top: 20px; }
.scelta-ruolo { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--bordo); border-radius: 14px; background: var(--sup); cursor: pointer; transition: .12s; text-align: left; width: 100%; }
.scelta-ruolo:hover { border-color: var(--primario); box-shadow: 0 0 0 3px var(--primario-soft); transform: translateY(-1px); }
.scelta-ruolo .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.scelta-ruolo b { display: block; font-size: 14.5px; }
.scelta-ruolo span { font-size: 12.5px; color: var(--muto); }
.scelta-ruolo .ic-freccia { margin-left: auto; color: var(--muto); }

/* ---------- App operatore (telefono) ---------- */
.op-sfondo { min-height: 100vh; background: radial-gradient(800px 500px at 20% 0%, #dbeafe 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #ccfbf1 0%, transparent 60%), var(--bg); display: flex; align-items: center; justify-content: center; gap: 48px; padding: 32px; flex-wrap: wrap; }
[data-theme="dark"] .op-sfondo { background: radial-gradient(800px 500px at 20% 0%, #1e3a8a55 0%, transparent 60%), var(--bg); }
.telefono { width: 390px; height: 800px; background: #000; border-radius: 48px; padding: 12px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6), inset 0 0 0 2px #333; position: relative; flex: none; }
.telefono::before { content: ''; position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 110px; height: 30px; background: #000; border-radius: 20px; z-index: 5; }
.schermo { background: var(--bg); border-radius: 38px; height: 100%; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.op-lato { max-width: 380px; }
.op-lato h2 { font-size: 26px; letter-spacing: -.02em; }
.op-lato p { color: var(--testo-2); margin-top: 8px; line-height: 1.6; }
.op-lato ul { padding-left: 18px; color: var(--testo-2); line-height: 1.8; margin: 12px 0; }
.op-stato { display: flex; justify-content: space-between; padding: 14px 24px 0; font-size: 12px; font-weight: 600; }
.op-testa { padding: 10px 18px 12px; }
.op-corpo { flex: 1; overflow: auto; padding: 0 16px 90px; scrollbar-width: none; }
.op-tabbar { position: absolute; bottom: 0; left: 0; right: 0; background: var(--sup); border-top: 1px solid var(--bordo); display: grid; grid-template-columns: repeat(6, 1fr); padding: 8px 4px 20px; }
.op-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; color: var(--muto); }
.op-tabbar a.attivo { color: var(--primario); }
.op-tabbar a .ic { width: 22px; height: 22px; }
.op-card { background: var(--sup); border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; box-shadow: var(--ombra); border: 1px solid var(--bordo); }
.op-att { display: flex; gap: 12px; align-items: center; }
.op-att .n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--bg-2); color: var(--testo-2); flex: none; }
.op-att.sensore .n { background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff; }
.op-att.fatta .n { background: var(--ok); color: #fff; }
.op-att.corso .n { background: var(--primario); color: #fff; }
.op-att .t { font-weight: 600; font-size: 14px; }
.op-att .s { font-size: 12px; color: var(--muto); }
.op-btn-grande { display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; border-radius: 16px; font-weight: 700; font-size: 15px; border: 0; width: 100%; }
.op-chk { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--bordo); font-size: 14px; }
.op-chk:last-child { border-bottom: 0; }
.op-chk .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--bordo-2); display: grid; place-items: center; flex: none; }
.op-chk.ok .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.op-chk.ok { color: var(--muto); text-decoration: line-through; }
.op-griglia-azioni { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.op-azione { background: var(--sup); border: 1px solid var(--bordo); border-radius: 16px; padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; text-align: center; }
.op-azione .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.op-foto { aspect-ratio: 4/3; border-radius: 12px; background: linear-gradient(135deg, #cbd5e1, #94a3b8); display: grid; place-items: center; color: #fff; }

/* ---------- Portale cliente ---------- */
.cl-shell { min-height: 100vh; background: var(--bg); }
.cl-testa { background: var(--sup); border-bottom: 1px solid var(--bordo); }
.cl-nav { max-width: 1240px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 22px; height: 68px; }
.cl-nav .brand-cl { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.cl-nav .brand-cl .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #b45309, #f59e0b); color: #fff; display: grid; place-items: center; font-weight: 800; }
.cl-nav .voci { display: flex; gap: 4px; margin-left: 12px; }
.cl-nav .voci a { padding: 8px 12px; border-radius: 8px; color: var(--testo-2); font-weight: 500; }
.cl-nav .voci a.attivo { background: var(--primario-soft); color: var(--primario); font-weight: 600; }
.cl-nav .voci a:hover { color: var(--testo); }
.cl-corpo { max-width: 1240px; margin: 0 auto; padding: 28px; }
.cl-hero { background: linear-gradient(120deg, #0b1730, #1e3a8a 60%, #0f766e); color: #fff; border-radius: 20px; padding: 28px 32px; display: flex; align-items: center; gap: 28px; margin-bottom: 20px; position: relative; overflow: hidden; }
.cl-hero h1 { font-size: 26px; }
.cl-hero p { color: #c7d2e6; margin-top: 6px; }
.cl-hero .iqs-grande { margin-left: auto; text-align: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 16px; padding: 14px 24px; }
.cl-hero .iqs-grande b { font-size: 40px; display: block; letter-spacing: -.03em; line-height: 1; }
.cl-hero .iqs-grande span { font-size: 12px; color: #b7c4e2; }
.stelle { color: #f59e0b; letter-spacing: 1px; }

/* ---------- Varie ---------- */
.stat-riga { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-riga > div { display: flex; flex-direction: column; }
.stat-riga b { font-size: 20px; letter-spacing: -.02em; }
.stat-riga span { font-size: 12px; color: var(--muto); }
.icona-tonda { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r); font-size: 13.5px; }
.banner.avv { background: var(--avviso-soft); color: #7c4a03; } .banner.err { background: var(--errore-soft); color: #7f1d1d; } .banner.info { background: var(--primario-soft); color: #1e3a8a; } .banner.ok { background: var(--ok-soft); color: #14532d; }
[data-theme="dark"] .banner.avv { color: #fcd34d; } [data-theme="dark"] .banner.err { color: #fca5a5; } [data-theme="dark"] .banner.info { color: #93c5fd; } [data-theme="dark"] .banner.ok { color: #86efac; }
.qr { display: inline-grid; grid-template-columns: repeat(9, 1fr); gap: 1px; width: 54px; height: 54px; padding: 4px; background: #fff; border-radius: 6px; border: 1px solid var(--bordo); }
.qr i { display: block; background: #0f172a; border-radius: 1px; }
.qr i.v { background: transparent; }
.vuoto { padding: 40px; text-align: center; color: var(--muto); }
.vuoto .ic { width: 36px; height: 36px; opacity: .5; margin-bottom: 8px; }
.punteggio { display: inline-flex; align-items: center; gap: 8px; }
.punteggio .cerchio { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.riga-servizio { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bordo); }
.riga-servizio:last-child { border-bottom: 0; }
.griglia-servizi { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.servizio-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.servizio-card .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.servizio-card h3 { font-size: 15px; }
.servizio-card .prest { font-size: 12.5px; color: var(--testo-2); line-height: 1.5; }
.doc-riga { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bordo); }
.doc-riga:last-child { border-bottom: 0; }
.doc-riga .ext { width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.ext.pdf { background: #dc2626; } .ext.xls { background: #16a34a; } .ext.doc { background: #2563eb; } .ext.img { background: #7c3aed; } .ext.zip { background: #64748b; }
.tooltip { position: relative; }
.stella { color: #f59e0b; }
.punto-stato { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.griglia-kpi-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi-mini { padding: 12px 14px; border-radius: 10px; background: var(--sup-2); border: 1px solid var(--bordo); }
.kpi-mini b { font-size: 20px; display: block; letter-spacing: -.02em; }
.kpi-mini span { font-size: 11.5px; color: var(--muto); }
.mappa-sensori { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sens-card { padding: 12px; border-radius: 12px; border: 1px solid var(--bordo); background: var(--sup); position: relative; }
.sens-card .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.sens-card .l { font-size: 11.5px; color: var(--muto); }
.sens-card .stato { position: absolute; top: 10px; right: 10px; }
.regola { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.regola .box { padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.regola .se { background: var(--avviso-soft); }
.regola .allora { background: var(--primario-soft); }
.griglia-ispezione td .voto { display: inline-flex; gap: 3px; }
.griglia-ispezione td .voto i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--bg-2); color: var(--muto); font-style: normal; }
.griglia-ispezione td .voto i.sel { background: var(--primario); color: #fff; }
.griglia-ispezione td .voto i.sel.nc { background: var(--errore); }
.fascicolo-testa { display: flex; gap: 18px; align-items: center; }
.stampa-etichetta { border: 1px dashed var(--bordo-2); border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center; background: var(--sup); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4, .g-5, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-12 > [class*="span-"] { grid-column: span 12; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 80; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.aperta { transform: translateX(0); }
  .sidebar-chiudi { display: grid !important; }
  .contenuto { padding: 16px; }
  .topbar { padding: 0 12px; }
  .cerca { width: 100%; }
  .utente-top .col { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-sx { padding: 28px; min-height: 300px; }
  .login-sx h1 { font-size: 28px; }
  .g-2, .g-3, .g-4, .g-5, .g-6 { grid-template-columns: 1fr; }
  .form-griglia { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; }
  .chat-lista { display: none; }
  .op-lato { display: none; }
  .op-sfondo { padding: 0; }
  .telefono { width: 100%; height: 100vh; border-radius: 0; padding: 0; box-shadow: none; }
  .telefono::before { display: none; }
  .schermo { border-radius: 0; }
  .cl-nav { height: auto; flex-wrap: wrap; padding: 10px 14px; }
  .cl-nav .voci { overflow-x: auto; width: 100%; margin-left: 0; }
  .cl-corpo { padding: 14px; }
  .cl-hero { flex-direction: column; align-items: flex-start; }
  .cl-hero .iqs-grande { margin-left: 0; }
  .dl { grid-template-columns: 1fr; }
  .menu-btn { display: grid !important; }
}
.menu-btn { display: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bordo-2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

/* ---------- Linee di servizio, flussi, matrice moduli, mappa ---------- */
.striscia-linee { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.linea-mini { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--bordo); border-radius: 10px; color: inherit; background: var(--sup); }
.linea-mini:hover { border-color: var(--primario); box-shadow: var(--ombra); }
.linea-mini .ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.linea-mini .n { font-size: 12.5px; font-weight: 600; }
.linea-mini .v { font-size: 11.5px; color: var(--muto); }
.linea-mini .prog { grid-column: 1 / -1; }
.flusso { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--bordo); border-radius: 12px; color: inherit; background: var(--sup-2); }
.flusso:hover { border-color: var(--primario); }
.flusso .titolo { font-weight: 600; font-size: 13.5px; }
.flusso .passi { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-top: 6px; font-size: 11.5px; color: var(--testo-2); }
.flusso .passi span { display: inline-flex; align-items: center; gap: 2px; }
.matrice-moduli th { vertical-align: bottom; }
.matrice-moduli .cel { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.matrice-moduli .cel.core { background: var(--primario); }
.matrice-moduli .cel.opz { border: 2.5px solid var(--accento); background: transparent; }
.matrice-moduli .cel.no { width: 10px; height: 2px; border-radius: 0; background: var(--bordo-2); vertical-align: middle; }
.tile-scuro { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.leaflet-container { font-family: var(--font); border-radius: 12px; }
.leaflet-popup-content { font-size: 12.5px; line-height: 1.5; }
.tappa-num { background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 800; font-size: 11px; padding: 0; }
.tappa-num::before { display: none; }
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip { background: var(--sup); color: var(--testo); }
[data-theme="dark"] .leaflet-bar a { background: var(--sup); color: var(--testo); border-color: var(--bordo); }

/* ---------- Pagina di accesso ----------
   Due colonne: a sinistra una vetrina reale del prodotto (non decorazione
   astratta), a destra il modulo di accesso. Header e piè di pagina sono fuori
   dal flusso (position:absolute) su entrambi i lati, così l'unico blocco che
   resta — la vetrina a sinistra, il modulo a destra — si centra allo stesso
   modo e i due lati restano sempre alla stessa altezza, a qualunque risoluzione. */
.au { min-height: 100vh; display: grid; grid-template-columns: minmax(460px, 54%) 1fr; background: var(--sup); }
.au-vetrina { position: relative; overflow: hidden; background: linear-gradient(175deg, #0a1226 0%, #0d1a33 100%); display: flex; align-items: center; justify-content: center; padding: 0 56px; }
.au-vetrina::before { content: ''; position: absolute; inset: 0; z-index: 0; background: radial-gradient(900px 500px at 12% -6%, rgba(59,130,246,.16), transparent 62%); }
.au-vetrina > * { position: relative; z-index: 1; }
.au-testa { position: absolute; top: 34px; left: 56px; display: flex; align-items: center; gap: 11px; }
.au-testa b { font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.au-testa b em { font-style: normal; color: #5eead4; }
.au-corpo { max-width: 540px; padding: 100px 0 92px; }
.au-corpo h1 { font-size: clamp(25px, 2.3vw, 32px); line-height: 1.22; letter-spacing: -.025em; font-weight: 700; color: #fff; }
.au-corpo p { color: #93a2c4; font-size: 14px; line-height: 1.55; margin-top: 12px; max-width: 460px; }
.au-piede { position: absolute; left: 56px; right: 56px; bottom: 28px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #7688ae; border-top: 1px solid rgba(255,255,255,.09); padding-top: 16px; flex-wrap: wrap; }

/* Vetrina prodotto: ricostruzione in CSS del gestionale reale, non uno screenshot */
.au-finestra { margin-top: 26px; background: #0e1730; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.65), 0 2px 0 rgba(255,255,255,.04) inset; overflow: hidden; }
.au-fbarra { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.07); }
.au-fbarra i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.16); display: block; }
.au-fbarra span { margin: 0 auto; font-size: 11px; color: #566486; font-family: var(--mono); }
.au-fcorpo { display: flex; height: 258px; }
.au-fside { width: 46px; flex: none; background: #0a1226; border-right: 1px solid rgba(255,255,255,.06); padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.au-fside .lg { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg,#3b82f6,#0ea5a4); margin-bottom: 6px; }
.au-fside i { width: 22px; height: 22px; border-radius: 6px; display: block; background: rgba(255,255,255,.06); }
.au-fside i.on { background: var(--primario); }
.au-fmain { flex: 1; min-width: 0; padding: 14px 16px; }
.au-fkpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.au-fkpi div { background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); border-radius: 7px; padding: 7px 9px; }
.au-fkpi b { display: block; font-size: 14px; color: #f1f4fb; letter-spacing: -.02em; font-weight: 700; }
.au-fkpi i { font-style: normal; font-size: 9px; color: #6d7ca3; }
.au-fgrafico { display: flex; align-items: flex-end; gap: 5px; height: 64px; margin-top: 12px; padding: 0 2px; }
.au-fgrafico b { flex: 1; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #3b82f6, rgba(59,130,246,.25)); }
.au-frighe { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.au-frighe span { height: 9px; border-radius: 3px; background: rgba(255,255,255,.06); display: block; }
.au-callout { position: absolute; background: #12172a; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 9px 12px; display: flex; align-items: center; gap: 9px; box-shadow: 0 16px 32px -12px rgba(0,0,0,.5); font-size: 12px; color: #dbe3f5; white-space: nowrap; }
.au-callout .ic { color: #5eead4; }
.au-callout-1 { top: -14px; right: -22px; }
.au-callout-2 { bottom: -16px; left: -26px; }
.au-stat-riga { display: flex; gap: 26px; margin-top: 28px; }
.au-stat-riga div b { display: block; font-size: 20px; color: #fff; font-weight: 700; letter-spacing: -.02em; }
.au-stat-riga div span { font-size: 11.5px; color: #7688ae; }

/* Colonna del modulo (chiara) */
.au-col { position: relative; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.au-col-testa { position: absolute; top: 34px; right: 40px; font-size: 12.5px; color: var(--muto); }
.au-scatola { width: min(392px, 100%); }
.au-scatola h2 { font-size: 21px; letter-spacing: -.02em; }
.au-scatola p.au-sotto { color: var(--muto); font-size: 13px; margin-top: 5px; }
.au-form { margin-top: 24px; display: flex; flex-direction: column; gap: 13px; }
.au-campo > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--testo-2); margin-bottom: 6px; }
.au-input { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 10px 0 13px; border: 1px solid var(--bordo-2); border-radius: var(--r-ctrl); background: var(--sup); color: var(--muto); transition: .15s; }
.au-input:focus-within { border-color: var(--primario); box-shadow: var(--anello); }
.au-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14.5px; color: var(--testo); }
.au-occhio { border: 0; background: transparent; color: var(--muto); display: grid; place-items: center; padding: 6px; border-radius: 6px; margin-right: -4px; }
.au-occhio:hover { background: var(--bg-2); color: var(--testo); }
.au-opzioni { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--testo-2); gap: 10px; flex-wrap: wrap; }
.au-opzioni label { display: flex; align-items: center; gap: 7px; }
.au-opzioni a { font-weight: 600; }
.au-btn { height: 44px; border-radius: var(--r-ctrl); font-size: 14.5px; margin-top: 3px; }
.au-oppure { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muto); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.au-oppure::before, .au-oppure::after { content: ''; flex: 1; height: 1px; background: var(--bordo); }
.au-sso { height: 42px; border-radius: var(--r-ctrl); justify-content: center; }
.au-nota { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--muto); }
.au-separatore { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.au-separatore span { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muto); white-space: nowrap; }
.au-separatore::before, .au-separatore::after { content: ''; flex: 1; height: 1px; background: var(--bordo); }
.au-demo { display: flex; flex-direction: column; gap: 7px; }
.au-profilo { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid var(--bordo); border-radius: var(--r-sm); background: var(--sup); color: var(--testo); transition: .13s; }
.au-profilo:hover { border-color: var(--primario); box-shadow: var(--ombra); }
.au-profilo .avatar { width: 28px; height: 28px; font-size: 11px; }
.au-profilo .ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.au-profilo .ico .ic { width: 15px; height: 15px; }
.au-profilo > div { flex: 1; min-width: 0; }
.au-profilo b { display: block; font-size: 12.5px; font-weight: 700; }
.au-profilo > div > span { font-size: 11px; color: var(--muto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.au-profilo > .ic { flex: none; color: var(--bordo-2); }
.au-profilo:hover > .ic { color: var(--primario); }
.au-piede2 { position: absolute; left: 0; right: 0; bottom: 20px; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muto); padding: 0 20px; }
.au-piede2 a { color: var(--testo-2); }
.au-marchio-mobile { display: none; align-items: center; gap: 10px; justify-content: center; margin-bottom: 26px; }
.au-marchio-mobile b { font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--testo); }
.au-marchio-mobile b em { font-style: normal; color: var(--accento); }
@media (max-width: 1080px) {
  .au { grid-template-columns: 1fr; display: block; }
  .au-vetrina { display: none; }
  .au-col { flex-direction: column; padding: 20px; min-height: 100vh; }
  .au-col-testa { display: none; }
  .au-marchio-mobile { display: flex; }
  .au-piede2 { position: static; margin-top: 24px; }
}
@media (max-width: 420px) {
  .au-scatola h2 { font-size: 19px; }
}
.nav-home { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border-radius: 9px; color: var(--nav-testo); font-size: 13px; font-weight: 500; }
.nav-home:hover { background: rgba(255,255,255,.06); color: #fff; }
.brand:hover .brand-nome { color: #5eead4; }

.sidebar-chiudi { display: none; position: absolute; top: 14px; right: 12px; z-index: 2; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; }
.sidebar-scrim { display: none; }
@media (max-width: 900px) { .sidebar-scrim.vis { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(5,10,25,.55); } }

/* selettore lingua IT | EN */
.lingua-switch { display: inline-flex; gap: 2px; background: var(--bg-2); padding: 3px; border-radius: 9px; flex: none; }
.lingua-switch button { padding: 4px 8px; border-radius: 7px; border: 0; background: transparent; color: var(--muto); font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; line-height: 1.2; cursor: pointer; }
.lingua-switch button:hover { color: var(--testo); }
.lingua-switch button.attivo { background: var(--sup); color: var(--testo); box-shadow: var(--ombra); cursor: default; }
.au-lingua { position: absolute; top: 28px; left: 32px; }
@media (max-width: 600px) { .au-lingua { top: 16px; left: auto; right: 16px; } }
