/* LORNA Compliance Suite – identità visiva
   Nero, bianco e il viola del logo (#603FFE).

   Il nero è la base della marca: menu a sinistra, pagine di accesso e il blocco «Adesso», cioè cosa fare ora.
   Il viola è l'accento forte: voce attiva del menu, azioni principali, numeri.
   Il bianco è il lavoro: l'area accanto al menu ha un fondo chiarissimo e schede bianche.
   I link restano neutri e sottolineati: si riconoscono senza bisogno del colore.

   I colori stanno nelle variabili: :root descrive il nero, .canvas ridefinisce le stesse variabili
   per l'area chiara. I componenti non sanno su quale fondo si trovano.

   Tre livelli di superficie:
   - principale (--surface): dove si lavora;
   - aiuti (--surface-aid): spiegazioni e strumenti accanto al lavoro, con testo più piccolo;
   - secondarie (.card-quiet): informazioni di contorno, solo una linea.

   Scala delle pagine pubbliche: titoli 34 px, domande 30 px, sezioni 20 px, testo 16 px, contenitore 1200 px.
   Con il menu si lavora più fitto e a tutta larghezza: vedi «Densità», in fondo. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #121215;        /* superficie principale */
  --surface-aid: #0b0b0d;    /* aiuti: più scuri della superficie principale */
  --surface-2: #19191d;      /* pannelli che si aprono sopra le altre superfici */
  --field: #1b1b1f;
  --field-hover: #222228;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #ffffff;
  --text-2: #d4d4da;
  --muted: #9b9ba5;
  --brand: #603ffe;          /* viola LORNA: pulsanti principali, punti di stato, selezioni */
  --brand-hover: #7458ff;
  --brand-text: #ab9dff;     /* viola chiaro: solo testo di stato o al passaggio del mouse */
  --brand-tint: rgba(96, 63, 254, 0.10);  /* fondo di una scelta fatta */
  --warn: #dcb872;           /* informazioni da completare */
  --danger: #ff9a9a;
  --radius: 10px;
  --radius-sm: 6px;
  --page-max: 1200px;
  --gutter: clamp(16px, 3vw, 32px);
  --s-1: 8px;
  --s-2: 12px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --fs-title: 34px;          /* titolo della pagina */
  --fs-question: 30px;       /* testo della domanda */
  --fs-section: 20px;        /* titolo di sezione */
  --fs-sub: 17px;            /* titolo interno a una sezione */
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-micro: 12px;
  --header-h: 64px;
  --side-w: 236px;
  --focus: 0 0 0 3px rgba(171, 157, 255, 0.45);
  --link-line: rgba(255, 255, 255, 0.35);
  --hover-line: #55555e;
  --placeholder: #7d7d87;
  --missing-line: rgba(220, 184, 114, 0.6);
  --font: "Avenir Next", Avenir, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }

body {
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0 0 var(--s-2); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-title); }
h2 { font-size: var(--fs-section); line-height: 1.3; }
h3, .h3 { font-size: var(--fs-sub); line-height: 1.35; }
h4 { font-size: var(--fs-body); }
p { margin: 0 0 var(--s-2); }

/* I link restano neutri e sottolineati. */
a { color: var(--text); text-decoration-color: var(--link-line); text-underline-offset: 3px; }
a:hover { color: var(--brand-text); text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm);
}

code { background: var(--surface-2); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.9em; font-family: ui-monospace, Menlo, Consolas, monospace; }

.container { width: 100%; max-width: calc(var(--page-max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
main.container { flex: 1; padding-top: var(--s-5); padding-bottom: 48px; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }

.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }
/* Codici e date restano su una riga: «MQ-07» non va a capo dopo il trattino. */
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

/* ---- Intestazione ---- */
.site-header { background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header-inner {
  max-width: calc(var(--page-max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); min-height: var(--header-h);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-5);
}
/* --logo è l'altezza del PNG con i margini: 56 px danno un logo visibile largo circa 130 px. */
.brand { display: block; overflow: hidden; text-decoration: none; color: var(--text); --logo: 56px; }
/* Il PNG ufficiale ha margini trasparenti: i margini negativi li escludono dall'ingombro. */
.brand img {
  display: block; height: var(--logo); width: auto;
  margin: calc(var(--logo) * -0.205) calc(var(--logo) * -0.233) calc(var(--logo) * -0.207);
}


.userbox { display: flex; align-items: center; gap: var(--s-3); margin-left: auto; }
.user-name { color: var(--muted); font-size: var(--fs-small); }

.context-label { color: var(--muted); }
.context-name { font-weight: 500; }
.context-note { color: var(--muted); }
.demo-note summary { display: inline-flex; align-items: center; padding: 2px 0; }
.demo-note .menu-panel { left: 0; right: auto; width: min(420px, calc(100vw - 2 * var(--gutter))); padding: var(--s-2) var(--s-3); }
.demo-note .menu-panel p { margin: 0; color: var(--text-2); font-size: var(--fs-small); line-height: 1.5; }

.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding: var(--s-3) 0; }

/* ---- Superfici ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-4); margin-bottom: var(--s-3);
}
.card > :last-child { margin-bottom: 0; }
.card-quiet { background: transparent; }
/* Aiuti: accanto al lavoro, più scuri e con testo più piccolo. */
.card-aid { background: var(--surface-aid); padding: 20px; font-size: 15px; }
.card-aid .h3, .card-aid h2 { font-size: 16px; margin-bottom: var(--s-1); }
.card-highlight { border-top: 2px solid var(--brand); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-1); }
.card-head h2 { margin-bottom: var(--s-1); }
/* Stato vuoto: una riga, senza riquadro alto. */
.empty { color: var(--muted); font-size: 15px; margin: 0; }
.card-empty { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-3); padding-top: var(--s-3); padding-bottom: var(--s-3); }
.card-empty h2 { font-size: var(--fs-sub); margin: 0; }
.card-link { font-weight: 500; font-size: 1.05rem; text-decoration: none; color: var(--text); }
.card-link:hover { color: var(--brand-text); }
.cards { list-style: none; padding: 0; margin: 0; }

.grid-2 { display: grid; gap: var(--s-3); grid-template-columns: 1fr; margin-bottom: var(--s-3); align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.card .grid-2 { margin-bottom: 0; gap: var(--s-4) var(--s-5); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.hero { padding: 0 0 var(--s-5); }
.hero h1 { font-size: var(--fs-title); margin-bottom: var(--s-2); }
.hero-compact { padding-bottom: var(--s-4); }
.eyebrow { color: var(--muted); font-size: var(--fs-micro); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: var(--s-1); }
.lead { color: var(--text-2); font-size: var(--fs-body); max-width: 68ch; }
.muted { color: var(--muted); }
.text { color: var(--text); }
.small { font-size: var(--fs-small); }
.pre { white-space: pre-wrap; margin: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: var(--text-2); }
.breadcrumb { font-size: var(--fs-small); color: var(--muted); margin-bottom: var(--s-3); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.actions, .form-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin: var(--s-4) 0 var(--s-3); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-4); }
.page-head h1 { margin-bottom: 0; max-width: 28ch; }
.page-head-side { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---- Pulsanti ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 500; font-size: 15px; letter-spacing: 0.01em; text-decoration: none; cursor: pointer; line-height: 1.2;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: var(--fs-small); }
.btn-block { width: 100%; }

/* ---- Stati: il punto del logo ---- */
.badge {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 500;
  color: var(--text-2); white-space: nowrap; line-height: 1.4; letter-spacing: 0;
}
.badge::before {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px var(--muted);
}
.badge-ok { color: var(--text); }
.badge-ok::before { background: var(--brand); box-shadow: none; }
.badge-warn { color: var(--warn); }
.badge-warn::before { background: var(--warn); box-shadow: none; }
.badge-draft::before { box-shadow: inset 0 0 0 1.5px var(--brand-text); }
.badge-neutral { color: var(--muted); }
.badge-demo {
  color: var(--text-2); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
  border: 1px solid var(--border-strong); border-radius: 3px; padding: 0.1rem 0.45rem;
}
.badge-demo::before { display: none; }

.step-num { color: var(--muted); font-weight: 500; font-size: 0.85em; font-variant-numeric: tabular-nums; margin-right: 0.6rem; }

/* ---- Messaggi ---- */
.flash {
  border-left: 2px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--s-2) var(--s-3); margin-bottom: var(--s-3); color: var(--text-2); font-size: 15px;
}
.flash strong { color: var(--text); font-weight: 500; }
.flash ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.flash-ok { border-left-color: var(--brand); }
.flash-info { border-left-color: var(--warn); }
.flash-errore { border-left-color: var(--danger); }

/* ---- Elenchi ---- */
.plain { list-style: none; padding: 0; margin: 0 0 0.9rem; }
.plain li { margin-bottom: 0.5rem; }

.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--border); }
.status-list li:first-child { border-top: 0; }
.status-list a { color: var(--text); text-decoration: none; font-weight: 500; margin-right: auto; }
.status-list a:hover { color: var(--brand-text); }
.status-list a.btn { margin-right: 0; flex-shrink: 0; }
/* Testo a sinistra e pulsante a destra, sempre sulla stessa riga. */
.status-list li:has(> a.btn) { flex-wrap: nowrap; }
.status-list li:has(> a.btn) .person { flex: 1 1 0; }
.status-list a.btn:hover { color: var(--text); }
.status-list .person { margin-right: auto; min-width: 0; overflow-wrap: anywhere; }

.activity-list { list-style: none; padding: 0; margin: 0; counter-reset: act; }
.activity-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1.5rem; padding: 0.9rem 0; border-top: 1px solid var(--border); counter-increment: act; }
.activity-list li:first-child { border-top: 0; }
.activity-link { text-decoration: none; display: flex; flex-direction: column; flex: 1 1 16rem; }
.activity-title { font-weight: 500; color: var(--text); }
.activity-title::before { content: counter(act, decimal-leading-zero); color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; margin-right: 0.6rem; }
.activity-link:hover .activity-title { color: var(--brand-text); }
.activity-summary { color: var(--muted); font-size: 0.9rem; }
.activity-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; }

.missing-list { list-style: none; padding: 0; margin: 0; }
.missing-list li { margin-bottom: 0.55rem; color: var(--muted); font-size: 0.93rem; }
.missing-list a { color: var(--text); text-decoration: none; font-weight: 500; }
.missing-list a:hover { color: var(--brand-text); }

.unavailable { list-style: none; padding: 0; margin: 0; }
.unavailable li { padding: 0.55rem 0; border-top: 1px solid var(--border); color: var(--muted); }
.unavailable li:first-child { border-top: 0; }

.history { list-style: none; padding: 0; margin: 0 0 0.9rem; }
.history li { position: relative; display: flex; flex-direction: column; padding: 0 0 0.9rem 1.1rem; border-left: 1px solid var(--border-strong); margin-left: 0.2rem; }
.history li:last-child { border-left-color: transparent; padding-bottom: 0; }
.history li::before { content: ""; position: absolute; left: -0.25rem; top: 0.5rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--border-strong); }
.history li:first-child::before { background: var(--brand); }
.history strong { font-weight: 500; }

.instructions { padding-left: 1.2rem; margin: 0 0 1.25rem; color: var(--text-2); }
.instructions li { margin-bottom: 0.4rem; padding-left: 0.2rem; }
.instructions li::marker { color: var(--muted); }

/* ---- Moduli ---- */
.stack > * + * { margin-top: var(--s-3); }
/* Solo il margine inferiore: quello superiore lo decide .stack, che prima veniva annullato. */
.field { margin-bottom: 0; }
.field label, .field legend { display: block; font-weight: 500; margin-bottom: 6px; color: var(--text); padding: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.help { color: var(--muted); font-size: var(--fs-small); margin: 0 0 var(--s-1); }
.opt { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }

input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.45;
  transition: border-color 120ms ease;
}
textarea { resize: vertical; min-height: 6.5rem; }
input:hover, textarea:hover { border-color: var(--hover-line); }
input:focus, textarea:focus { border-color: var(--brand); }
::placeholder { color: var(--placeholder); }

.is-missing > input, .is-missing > textarea, .cell.is-missing input { border-color: var(--missing-line); }
.field .badge-warn, .cell .badge-warn { margin-left: 0.5rem; font-size: 0.78rem; }

.row-card { border-top: 1px solid var(--border); padding: 0.9rem 0 1rem; }
.row-title { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 0.5rem; }
.row-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .row-grid { grid-template-columns: 1fr 1fr 1.4fr; } }
.cell label { font-size: 0.87rem; font-weight: 500; color: var(--text-2); display: block; margin-bottom: 0.25rem; }

.checkbox { display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; font-weight: 400; color: var(--text-2); }
.checkbox input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; accent-color: var(--brand); flex-shrink: 0; }
.confirm-box { border-top: 1px solid var(--border); padding-top: 1.4rem; }
.confirm-box .btn { margin-top: 1rem; }
.confirm-box p { margin: 0.7rem 0 0; }

.share-list { list-style: none; padding: 0; margin: 0; }
.share-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.share-list li.is-disabled .checkbox { cursor: not-allowed; color: var(--muted); }
/* Una casella dentro un campo resta una riga: .field label la renderebbe un blocco in grassetto. */
.field .checkbox { display: flex; font-weight: 400; margin-bottom: 0; }
.share-list .checkbox { flex: 1 1 22rem; min-width: 0; }
.share-list .checkbox > span { display: flex; flex-direction: column; color: var(--text); }
.share-list li.is-disabled .checkbox > span { color: var(--muted); }
.share-what { color: var(--muted); font-size: var(--fs-small); }
.share-what + .share-what { color: var(--warn); }
/* Le tabelle da leggere (riepiloghi condivisi) diventano schede su smartphone, come quelle del portafoglio. */
@media (max-width: 700px) {
  .readable .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .readable .table-wrap table, .readable .table-wrap tbody, .readable .table-wrap tr, .readable .table-wrap td { display: block; width: 100%; }
  .readable .table-wrap tr { padding: var(--s-1) 0; border-bottom: 1px solid var(--border); }
  .readable .table-wrap td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: var(--s-3); text-align: right; }
  .readable .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex-shrink: 0; text-align: left; }
}
.share-list .small-title, .field .small-title { margin-top: var(--s-4); }
.share-waiting { margin-top: var(--s-2); }
/* Il testo condiviso di un documento: chiuso nel riepilogo, si apre su richiesta. */
.shared-doc { margin-top: var(--s-2); border-top: 0; padding-top: 0; }
.shared-doc .paper { margin: var(--s-2) 0 0; }

.inline-form { margin-bottom: 1rem; }

/* ---- Lettura dati ---- */
.readable { margin: 0 0 1rem; }
.readable dt { color: var(--muted); font-size: 0.82rem; margin-top: 0.9rem; }
.readable dt:first-child { margin-top: 0; }
.readable dd { margin: 0.1rem 0 0; color: var(--text); }
.readable ul { margin: 0; padding-left: 1.2rem; }
.shared-activity { border-top: 1px solid var(--border); padding-top: 1.1rem; margin-top: 1.1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.82rem; }

details.example { border-top: 1px solid var(--border); padding-top: 0.9rem; }
details.example summary { cursor: pointer; font-weight: 500; color: var(--text); list-style: none; }
details.example summary::-webkit-details-marker { display: none; }
details.example summary::before { content: "+"; color: var(--muted); display: inline-block; width: 1.1rem; }
details.example[open] summary::before { content: "–"; }
details.example[open] summary { margin-bottom: 0.6rem; }

/* ---- Configurazione: passaggi a sinistra, modulo a destra ---- */
.layout-config { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
.config-form { min-width: 0; max-width: 960px; }
.config-form .card { margin-bottom: 0; }
.config-help { margin-bottom: 0; }
.stepper ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.stepper li.is-current { border-bottom-color: var(--brand); }
.stepper a { display: flex; align-items: baseline; justify-content: center; width: 100%; padding: 0.3rem 0; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 0.95rem; }
.stepper li.is-current a, .stepper li.is-current .step-num { color: var(--text); }
.stepper a:hover { color: var(--text); }
.stepper .step-num { margin-right: 0; }
/* Su schermi stretti restano numero e punto di stato; i testi restano per i lettori di schermo. */
.stepper .step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stepper .badge { font-size: 0; gap: 0; }
@media (min-width: 1000px) {
  .layout-config { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 1.5rem 3rem; align-items: start; }
  .config-form { grid-column: 2; grid-row: 1 / span 2; }
  .stepper ol { display: flex; flex-direction: column; gap: 0; }
  .stepper li { align-items: flex-start; padding: 0.8rem 0 0.8rem 1rem; border-bottom: 0; border-left: 2px solid var(--border); }
  .stepper li.is-current { border-left-color: var(--brand); }
  .stepper a { justify-content: flex-start; padding: 0; }
  .stepper .step-num { margin-right: 0.6rem; }
  .stepper .step-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .stepper .badge { font-size: 0.78rem; gap: 0.45rem; }
}

/* ---- Attività: guida a sinistra, lavoro a destra ---- */
.layout-activity { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
.layout-activity .card { margin-bottom: 0; }
.work .card { margin-bottom: 1.25rem; }
.work .card > .h3 { margin-bottom: 1.25rem; }
@media (min-width: 1100px) {
  .layout-activity {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto 1fr; align-items: start;
    grid-template-areas: "guide work" "history work";
  }
  .guide { grid-area: guide; }
  .work { grid-area: work; }
  .history-card { grid-area: history; }
}
.side-stack { display: grid; gap: 1.25rem; min-width: 0; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; }
.pager a { color: var(--muted); text-decoration: none; }
.pager a:hover { color: var(--text); }

/* ---- Accesso ---- */
.auth { display: grid; gap: 2.5rem; max-width: 1200px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); align-items: center; min-height: 72vh; }
.brand.auth-logo { --logo: clamp(120px, 14vw, 190px); width: fit-content; max-width: 100%; margin-bottom: 1.75rem; }
.auth-claim { color: var(--text-2); font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem); line-height: 1.45; max-width: 26em; margin: 0; }
.auth-card { margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.auth-note { margin: 1rem 0 0; }
.demo-box { padding: 0 0.25rem; }
.demo-box h2 { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.7rem; }
/* ---- Percorso ---- */
.now { padding: 0 0 var(--s-5); }
.now h1 { font-size: var(--fs-title); margin-bottom: var(--s-2); }
.now h2 { font-size: 24px; }
.now .actions { margin: var(--s-3) 0 0; }
.now .progress { margin-top: var(--s-4); }
.card .now { padding: 0; }
.client-facts.journey-facts { margin: 1rem 0 1.75rem; gap: 0.3rem 3rem; }
.stages { list-style: none; padding: 0; margin: 0; }
.stage { position: relative; padding: 0 0 1.5rem 1.5rem; border-left: 1px solid var(--border-strong); margin-left: 0.3rem; }
.stage:last-child { border-left-color: transparent; padding-bottom: 0; }
.stage::before {
  content: ""; position: absolute; left: -0.35rem; top: 0.35rem; width: 0.65rem; height: 0.65rem; border-radius: 50%;
  background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--muted);
}
.stage-completata::before, .stage-in_corso::before { background: var(--brand); box-shadow: none; }
.stage-in_corso::before { box-shadow: 0 0 0 4px rgba(96, 63, 254, 0.25); }
.stage h3 { margin-bottom: 0.15rem; font-size: 1.08rem; }
.stage-da_iniziare h3 { color: var(--muted); }
.stage p { margin-bottom: 0.3rem; }
.step-locked { color: var(--muted); margin-right: auto; }
.checks { list-style: none; padding: 0; margin: 1rem 0; }
.checks li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem; padding: 0.65rem 0; border-top: 1px solid var(--border); }
.checks li:first-child { border-top: 0; }

/* ---- Documenti: la pagina resta bianca, come sulla carta ---- */
/* Il foglio del documento: la stessa impaginazione di PDF e Word. */
.paper { --paper-ink: #15151b; --paper-muted: #6c6c79; --paper-accent: #603ffe; --paper-tint: #f1eefe; --paper-hair: #e4e1f0; --paper-zebra: #fbfaff;
  background: #ffffff; color: var(--paper-ink); border-radius: 4px; padding: clamp(1.25rem, 0.5rem + 3vw, 3rem); margin-bottom: 1.25rem; font-size: 0.95rem; line-height: 1.55; }
.paper-id { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding-bottom: 0.6rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--paper-hair); }
.paper-id::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 3.5rem; height: 2px; background: var(--paper-accent); }
.paper-logo { font-size: 0.95rem; color: var(--paper-ink); }
.paper-logo strong { font-weight: 600; }
.paper-logo img { display: block; max-width: 11rem; max-height: 2.6rem; }
.paper-meta { font-size: 0.72rem; color: var(--paper-muted); text-align: right; white-space: nowrap; }
.paper .paper-doc-title { margin: 0 0 0.15rem; color: var(--paper-ink); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; white-space: normal; }
.paper .paper-company { margin: 0 0 0.9rem; color: var(--paper-muted); font-size: 0.85rem; }
.paper-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0 0 1.2rem; padding: 0.55rem 0; border-top: 1px solid var(--paper-hair); border-bottom: 1px solid var(--paper-hair); }
.paper-strip dt { color: var(--paper-muted); font-size: 0.68rem; }
.paper-strip dd { margin: 0; color: var(--paper-ink); font-size: 0.82rem; }
.paper-sign { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1.6rem 0 0; }
body .paper h2, body:has(> .side) .canvas .paper h2 { margin: 1.4rem 0 0.35rem; color: var(--paper-ink); font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.paper-n { margin-right: 0.55em; color: var(--paper-accent); }
.paper p { margin: 0 0 0.6rem; white-space: pre-line; text-align: justify; hyphens: auto; }
.paper li { text-align: justify; hyphens: auto; }
.paper .paper-brand { margin: 1.2rem 0 0; color: var(--paper-muted); font-size: 0.68rem; text-align: right; hyphens: none; }
.paper .paper-doc-title, .paper .paper-company { text-align: left; hyphens: none; }
.paper-tema-blu { --paper-accent: #1f4e8c; --paper-tint: #e8eff8; --paper-hair: #dce4ef; --paper-zebra: #f7fafd; }
.paper-tema-verde { --paper-accent: #1f6f5c; --paper-tint: #e6f2ee; --paper-hair: #dce8e4; --paper-zebra: #f6fbf9; }
.paper-tema-bordeaux { --paper-accent: #8c1f3f; --paper-tint: #f7e9ee; --paper-hair: #eddde3; --paper-zebra: #fdf8fa; }
.paper-tema-grafite { --paper-accent: #3a3f47; --paper-tint: #eceef1; --paper-hair: #e1e3e7; --paper-zebra: #f8f9fa; }
.paper ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.paper li::marker { color: var(--paper-accent); }
.paper table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
/* Le parole lunghe vanno a capo con il trattino; una tabella ancora troppo larga scorre dentro il foglio. */
.paper th, .paper td { padding: 0.42rem 0.55rem; color: var(--paper-ink); font-weight: 400; text-align: left; vertical-align: top; overflow-wrap: break-word; hyphens: auto; border-bottom: 1px solid var(--paper-hair); }
.paper thead th { background: var(--paper-tint); font-size: 0.76rem; font-weight: 600; border-bottom: 1.5px solid var(--paper-accent); }
.paper tbody tr:nth-child(even) td { background: var(--paper-zebra); }
.paper-card th { width: 32%; background: var(--paper-tint); font-size: 0.76rem; font-weight: 600; }
.paper-card tbody tr:first-child th, .paper-card tbody tr:first-child td { border-top: 1px solid var(--paper-hair); }
.paper-scroll { overflow-x: auto; margin-bottom: 0.9rem; }
.paper-scroll .paper-table { margin-bottom: 0; }
.paper mark { background: #fbe9b7; color: #6b4e00; padding: 0 0.2rem; }
@media (max-width: 560px) {
  .paper-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper .paper-doc-title { font-size: 1.4rem; }
  .paper table { font-size: 0.75rem; }
  .paper th, .paper td { padding: 0.28rem 0.32rem; }
}

.downloads { display: inline-flex; gap: 0.4rem; }
.logo-preview { background: #ffffff; border-radius: 4px; padding: 1rem; margin-bottom: 1.25rem; width: fit-content; }
.logo-preview img { display: block; max-width: 280px; max-height: 120px; }
input[type="file"] { color: var(--text-2); font: inherit; max-width: 100%; }

/* ---- Requisiti ---- */
.filters { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 1.5rem 0 1.25rem; }
.filters a { color: var(--muted); text-decoration: none; font-size: 0.92rem; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.filters a span { font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.filters a:hover { color: var(--text); }
.filters a[aria-current="true"] { color: var(--text); border-bottom-color: var(--brand); }
.theme-title { color: var(--muted); font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; margin: 1.5rem 0 0.25rem; }
.count-row { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 2.5rem; color: var(--muted); font-size: 0.93rem; }
.count-row strong { color: var(--text); font-weight: 500; font-size: 1.15rem; margin-right: 0.3rem; font-variant-numeric: tabular-nums; }
.task-preview { margin: var(--s-2) 0 0; border-top: 1px solid var(--border); }
.task-preview li:first-child { border-top: 0; }
.card-foot { margin: var(--s-2) 0 0; }
.guide .unavailable { margin-top: 1rem; font-size: 0.88rem; }

/* ---- Scelta dell'accesso ---- */
.access { max-width: 1000px; margin: 0 auto; min-height: 72vh; display: flex; flex-direction: column; justify-content: center; }
.access h1 { margin-bottom: 1.75rem; }
.portal-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .portal-grid { grid-template-columns: 1fr 1fr; } }
.portal-card {
  display: flex; flex-direction: column; gap: 0.6rem; padding: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); transition: border-color 120ms ease;
}
.portal-card:hover { border-color: var(--brand); color: var(--text); }
.portal-title { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.01em; }
.portal-text { color: var(--muted); flex: 1; }
.portal-go { color: var(--brand-text); font-size: 0.93rem; font-weight: 500; margin-top: 0.6rem; }

/* ---- Elenco clienti ---- */
.client-list { list-style: none; padding: 0; margin: 0; }
.client-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 1rem 0; border-top: 1px solid var(--border); }
.client-list li:first-child { border-top: 0; padding-top: 0; }
.client-list li:last-child { padding-bottom: 0; }
.client-name { color: var(--text); text-decoration: none; font-weight: 500; font-size: 1.05rem; }
.client-name:hover { color: var(--brand-text); }
.client-facts { display: flex; flex-wrap: wrap; gap: 0.3rem 2.5rem; margin: 0 0 0 auto; }
.client-facts dt { color: var(--muted); font-size: 0.78rem; }
.client-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .client-facts { margin-left: 0; width: 100%; gap: 0.3rem 1.5rem; } }

@media (min-width: 900px) { .auth { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 5rem; } }

@media (min-width: 861px) { .site-header-inner { flex-wrap: nowrap; } }
@media (max-width: 1200px) {
  .user-name { display: none; }
  .site-header-inner { gap: 0 var(--s-4); }
}

@media (max-width: 860px) {
  .site-header-inner { min-height: 0; padding-top: var(--s-1); gap: 0 var(--s-3); justify-content: space-between; }
  .site-header-inner > .brand, .site-header-inner > .userbox { min-height: 48px; display: flex; align-items: center; }
}

@media (max-width: 560px) {
  :root { --fs-title: 28px; --fs-question: 24px; --fs-section: 18px; }
  .brand { --logo: 48px; }
  .user-name { display: none; }
  main.container { padding-top: var(--s-4); }
  .card { padding: var(--s-3); }
  .card-empty { padding-top: var(--s-2); padding-bottom: var(--s-2); }
  .form-actions .btn, .actions .btn { width: 100%; }
  .page-head-side { width: 100%; justify-content: space-between; }
  /* Sulla domanda la barra in basso resta su una riga, per non coprire le risposte. */
  .question-main .form-actions.is-sticky { flex-wrap: nowrap; gap: var(--s-1); }
  .question-main .form-actions.is-sticky .btn { width: auto; flex: 1 1 auto; padding-left: var(--s-2); padding-right: var(--s-2); }
  .question-main .form-actions.is-sticky .save-state { flex: 0 0 auto; font-size: 13px; }
}

/* ---- Due ambienti ---- */
/* Il logo non si comprime mai: se manca spazio cede il menu, che scorre. */
.site-header-inner .brand, .env-tag, .userbox { flex-shrink: 0; }
.env-tag {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2);
  border-left: 1px solid var(--border-strong); padding-left: var(--s-2); margin-left: calc(-1 * var(--s-3)); white-space: nowrap;
}
body[data-env="consulente"] .env-tag { color: var(--brand-text); }
body[data-env="consulente"] main.container { padding-top: var(--s-4); }
body[data-env="consulente"] .card { padding: 20px; }
.userbox form { margin: 0; }

.menu { position: relative; }
.menu summary { cursor: pointer; list-style: none; color: var(--text-2); font-size: 0.88rem; padding: 0.4rem 0.2rem; white-space: nowrap; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: "▾"; color: var(--muted); margin-left: 6px; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 20; min-width: 260px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.35rem;
}
.menu-panel button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 0.92rem;
  padding: 0.5rem 0.6rem; border-radius: 4px; cursor: pointer;
}
.menu-panel button:hover { background: var(--field); }
.menu-panel button[aria-current="true"] { box-shadow: inset 2px 0 0 var(--brand); }
.menu-env { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ---- Menu a tendina ---- */
select {
  width: 100%; appearance: none; -webkit-appearance: none; background-color: var(--field); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; font-size: 16px; line-height: 1.45;
  padding: 10px 40px 10px 12px; cursor: pointer; transition: border-color 120ms ease;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 50%, calc(100% - 0.8rem) 50%; background-size: 0.35rem 0.35rem; background-repeat: no-repeat;
}
select:hover { border-color: var(--hover-line); }
select:focus, select:focus-visible { border-color: var(--brand); outline: none; box-shadow: var(--focus); }
select:disabled, input:disabled { opacity: 0.6; cursor: not-allowed; }
select option { background: var(--surface-2); color: var(--text); }
input[type="number"], input[type="date"], input[type="search"] {
  width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.45;
}
.label { display: block; font-weight: 500; margin-bottom: 0.3rem; color: var(--text); }

.multi { position: relative; }
.multi summary {
  list-style: none; cursor: pointer; background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 40px 10px 12px; line-height: 1.45; color: var(--text); position: relative;
}
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after { content: "▾"; color: var(--muted); position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.multi[open] summary { border-color: var(--border-strong); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
/* L'elenco spinge in basso il resto della pagina: non copre mai il pulsante per continuare. */
.multi-panel {
  background: var(--surface); border: 1px solid var(--border-strong); border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 4px;
}
/* .field label renderebbe le opzioni blocchi in grassetto: qui restano righe flessibili, a peso normale. */
.multi-panel .checkbox {
  display: flex; align-items: center; gap: var(--s-2); min-height: 48px; margin: 0; padding: 10px var(--s-2); border-radius: 4px;
  color: var(--text); font-weight: 400; line-height: 1.4; transition: background-color 120ms ease;
}
.multi-panel .checkbox + .checkbox { margin-top: 2px; }
.multi-panel .checkbox:hover { background: var(--field-hover); }
.multi-panel .checkbox input { width: 20px; height: 20px; margin: 0; }
.multi-panel .checkbox:has(input:checked) { background: var(--brand-tint); box-shadow: inset 2px 0 0 var(--brand); }
.multi-panel .checkbox:has(input:focus-visible) { box-shadow: var(--focus); }
.multi-panel .checkbox:has(input:disabled) { cursor: not-allowed; }
/* Le risposte speciali («non lo so», «non esiste») stanno sotto una linea, separate dalle altre. */
.multi-panel .is-special { color: var(--text-2); }
.multi-panel .checkbox:not(.is-special) + .is-special { margin-top: 6px; border-top: 1px solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.detail { margin-top: 1rem; }
.detail[hidden] { display: none; }

/* ---- Domanda ---- */
.layout-question { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
.question-main { max-width: 720px; }
.question-main h1 { font-size: var(--fs-question); line-height: 1.25; margin-bottom: var(--s-4); }
.question-main .lead { margin-top: calc(-1 * var(--s-2)); }
.question-main .pager { margin-top: var(--s-4); }
.question-main .form-actions { margin: var(--s-4) 0 var(--s-1); }
/* Il pulsante per continuare resta raggiungibile anche con elenchi lunghi. */
.question-main .form-actions.is-sticky {
  position: sticky; bottom: 0; z-index: 4; margin-bottom: 0; padding: var(--s-2) 0;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.layout-question .side-stack { gap: var(--s-3); }
.layout-question .side-stack .card { margin-bottom: 0; }
@media (min-width: 1200px) {
  .layout-question { grid-template-columns: minmax(0, 720px) 300px; justify-content: space-between; column-gap: var(--s-5); }
}
.save-state { color: var(--muted); font-size: var(--fs-small); }
.save-state.is-error { color: var(--danger); }
.small-title { font-size: var(--fs-micro); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin: var(--s-3) 0 4px; }

/* ---- Indicatori e allerte ---- */
.metrics { margin: 0 0 0.6rem; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.metrics + .muted { margin-bottom: 1.5rem; }
.metrics + .card, .metrics + .grid-2 { margin-top: 1.25rem; }
.card-alert { border-left: 2px solid var(--warn); }
.areas { list-style: none; padding: 0; margin: 0; }
.areas li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.2rem 0.6rem; padding: 0.8rem 0; border-top: 1px solid var(--border); align-items: start; }
.areas li:first-child { border-top: 0; }
.areas p { margin: 0; }
.areas .is-off .card-link, .areas li.is-off .card-link { color: var(--muted); }
@media (min-width: 900px) { .grid-wide { grid-template-columns: 3fr 2fr; } }
.complexity { margin: 0.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem 1.5rem; }
.link-box { margin-top: 0.5rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem !important; }

/* ---- Lavoro del consulente ---- */
table.dense td, table.dense th { padding: 0.55rem 1rem 0.55rem 0; }
.search { display: flex; gap: 0.6rem; max-width: 460px; margin-bottom: 0.25rem; }
.quick { padding-top: 1rem; padding-bottom: 1rem; margin-bottom: 0.75rem; }
.quick-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.quick-head h2 { margin-bottom: 0.2rem; }
.quick-head a { color: var(--text); text-decoration: none; }
.quick-head a:hover { color: var(--brand-text); }
.quick p { margin-bottom: 0.6rem; }
.quick-grid { display: grid; gap: 0.75rem 1rem; grid-template-columns: minmax(0, 1fr); align-items: end; }
.quick-grid label { font-size: 0.82rem; color: var(--text-2); font-weight: 500; }
@media (min-width: 900px) { .quick-grid { grid-template-columns: minmax(0, 2fr) repeat(auto-fit, minmax(170px, 1fr)); } }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 0.75rem 0; margin: 0; border-top: 1px solid var(--border); z-index: 5; }
.perimeter-row { padding: 0.7rem 0; border-top: 1px solid var(--border); align-items: end; }
.perimeter-row:first-of-type { border-top: 0; }
.task-row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); justify-content: space-between; padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.task-main { display: flex; flex-direction: column; gap: 0.15rem; flex: 1 1 22rem; min-width: 0; }
.task-main strong { font-weight: 500; }
.task-side { display: grid; gap: var(--s-1) var(--s-2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; flex: 1 1 30rem; }
@media (min-width: 1100px) {
  .task-side { grid-template-columns: minmax(170px, 1.2fr) minmax(160px, 1fr) minmax(130px, 1fr) auto; flex-basis: 40rem; }
}

@media (max-width: 1200px) {
  .env-tag { margin-left: calc(-1 * var(--s-3)); }
}
@media (max-width: 860px) {
  .env-tag { margin-left: 0; margin-right: auto; }
  .userbox { margin-left: 0; }
}
@media (max-width: 700px) {
  table.dense thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.dense, table.dense tbody, table.dense tr, table.dense td { display: block; width: 100%; }
  table.dense tr { padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
  table.dense td { border: 0; padding: 0.1rem 0; display: flex; justify-content: space-between; gap: 1rem; }
  table.dense td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
  table.dense td > a, table.dense td > span { text-align: right; }
}

/* ---- Orientarsi: dove sei, quanto manca ---- */
progress {
  appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 3px;
  background: var(--border); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 3px; }
.progress { display: grid; gap: 6px; max-width: 34rem; color: var(--muted); font-size: var(--fs-small); margin-top: var(--s-3); }
.progress-top { max-width: none; margin: 0 0 var(--s-5); grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px var(--s-3); }
.progress-top progress { grid-column: 1 / -1; grid-row: 2; }
.progress-top span:last-child { grid-row: 1; grid-column: 2; }
.progress-title { color: var(--text); font-weight: 500; font-size: 15px; }
.progress-block { margin: 0 0 1.5rem; }
.trail { list-style: none; display: flex; gap: 0.4rem; padding: 0; margin: 0.4rem 0 0.8rem; }
.trail li { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.trail li.is-now { background: var(--brand); }
.named-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.named-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.named-list li:first-child { border-top: 0; }
.add-row { display: flex; gap: 0.6rem; }
.add-row input[type="text"] { flex: 1; min-width: 0; }


/* ---- Obiettivo e fasi ---- */
.context-path { color: var(--text-2); font-weight: 500; }
.goal-form { display: flex; gap: var(--s-2); max-width: 34rem; margin-top: var(--s-4); }
.goal-form select { flex: 1; min-width: 0; }
.phases { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); padding: 0; margin: var(--s-1) 0 var(--s-2); }
.phases li { border-top: 3px solid var(--border); padding-top: var(--s-1); }
.phases li.is-now { border-top-color: var(--brand); }
.phases strong { display: block; font-weight: 500; }
.phases li:not(.is-now) strong { color: var(--text-2); }
.phases span { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 1.4; }
.phases-open li { border-top-color: var(--brand); }
.phases-open li:not(.is-now) strong { color: var(--text); }
@media (max-width: 760px) {
  .phases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .goal-form { flex-direction: column; }
}

/* ---- Lavoro del consulente: chi ha bisogno di te ---- */
.next-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem; }
.next-card h2 { margin: 0; font-size: 1.15rem; }
.next-card .eyebrow { margin-bottom: 0.2rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; }
.menu-clients summary { font-size: var(--fs-small); color: var(--text-2); padding: 0; }
.menu-clients .menu-panel { left: 0; right: auto; }
.menu-panel a { display: block; padding: 0.5rem 0.6rem; color: var(--text); text-decoration: none; font-size: 0.92rem; border-radius: 4px; }
.menu-panel a:hover { background: var(--field); }
.menu-panel a[aria-current="true"] { box-shadow: inset 2px 0 0 var(--brand); }
.menu-panel a .menu-env { text-transform: none; letter-spacing: 0; }
.portfolio-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 0.75rem; }
.portfolio-tools .filters { margin: 0; }
td progress { max-width: 9rem; margin-bottom: 0.25rem; }
.ask-row { display: grid; gap: 0.6rem 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; }
.ask-row label { font-size: 0.85rem; color: var(--text-2); display: block; margin-bottom: 0.25rem; }
.source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin-bottom: 1rem; }
.source-row label { font-weight: 500; }
.source-row select { width: auto; min-width: 16rem; }
.row-actions { display: inline-flex; gap: 0.4rem; }
.area-list { list-style: none; padding: 0; margin: 0.2rem 0 0.9rem; }
.area-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; color: var(--muted); font-size: 0.93rem; }
.area-phase { color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; margin: 1rem 0 0.1rem; }
@media (max-width: 700px) { .ask-row { grid-template-columns: minmax(0, 1fr); } .source-row select { width: 100%; } }

@media (max-width: 560px) {
  .env-tag { font-size: 0.6rem; letter-spacing: 0.08em; padding-left: 0.6rem; }
  .site-header-inner { gap: 0 0.6rem; }
}

@media (max-width: 700px) {
  table.dense td[data-label="Cliente"], table.dense td[data-label="Avanzamento"] { display: block; }
  table.dense td[data-label="Cliente"]::before { display: none; }
  table.dense td[data-label="Cliente"] > a, table.dense td[data-label="Cliente"] > span,
  table.dense td[data-label="Avanzamento"] > span { text-align: left; }
  table.dense td[data-label="Avanzamento"]::before { display: block; margin-bottom: 0.2rem; }
  td progress { max-width: none; }
}

/* ---- Piano ---- */
.plan-task .quick-head h2 { margin-bottom: 0.3rem; }
.plan-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0.4rem 0 0.8rem; }
.plan-facts dt { margin: 0 !important; }
.plan-facts dd { margin: 0; color: var(--text-2); }
.plan-fields { margin-top: 0.4rem; }
.plan-task .form-actions { margin: 0.8rem 0 0; }
.plan-task .checkbox.small { font-size: 0.87rem; }
@media (max-width: 700px) { .plan-facts { grid-template-columns: 1fr; } }

.path-steps { list-style: none; padding: 0; margin: 0.5rem 0 0.6rem; }
.path-steps li { padding: 0.25rem 0; font-size: 0.93rem; color: var(--text-2); }
.path-steps strong { color: var(--text); font-weight: 500; }

/* ---- Tappa 4 ---- */
.step-tabs { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; margin: -0.5rem 0 1.5rem; }
.step-tabs a { color: var(--muted); text-decoration: none; font-size: 0.9rem; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.step-tabs a:hover { color: var(--text); }
.step-tabs a[aria-current="true"] { color: var(--text); border-bottom-color: var(--brand); }
.decision-card h2 { margin-bottom: 0.8rem; }
.decision-grid { display: grid; gap: 0.9rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.decision-grid .field label { font-size: 0.9rem; }
.decision-grid .field[hidden] { display: none; }
.decision-grid .grouped { grid-column: 1 / -1; max-width: 640px; }
.decision-grid .area-phase { margin-top: 0.4rem; }
.practice-select { margin-top: 0.4rem; font-size: 0.9rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.is-missing > select, .is-missing > input, .is-missing > details > summary { border-color: var(--missing-line); }
.diff li.added { color: var(--text); }
.diff li.removed { color: var(--muted); text-decoration: line-through; }

.phases .pdca { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin: 2px 0 4px; }
.phases li.is-now .pdca { color: var(--brand-text); }

/* ---- Menu a sinistra: tutta la navigazione sta qui (lorna/menu.py) ---- */
.side { background: #000000; color: var(--text); font-size: 13.5px; line-height: 1.3; }
/* Come in SOPHIA la fascia del logo è più alta della barra di ricerca: il colore del menu comincia sotto la curva dell'area di lavoro. */
.side-top { flex-shrink: 0; display: flex; align-items: center; min-height: 78px; padding: 0 20px; background: #ffffff; }
.side .brand { --logo: 62px; flex-shrink: 0; }
.side-marchio { display: block; text-decoration: none; }
.side-simbolo { display: none; border-radius: 9px; }
.side-toggle {
  margin-left: auto; padding: 8px var(--s-2); border: 1px solid #cfc9e8; border-radius: var(--radius-sm);
  font-size: var(--fs-small); cursor: pointer; color: #15151b;
}
.side-toggle .when-open { display: none; }
.side-check:checked ~ .side-top .when-open { display: inline; }
.side-check:checked ~ .side-top .when-closed { display: none; }
.side-check:focus-visible ~ .side-top .side-toggle { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.side-body { display: flex; flex-direction: column; padding: 0 0 10px; }

/* L'azienda: un riquadro tenue sotto il logo, come in SOPHIA. */
.side-context { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 38px; margin: 12px 12px 10px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.11); font-size: 12.5px; line-height: 1.3; }
.side-context .context-name { color: #ffffff; font-weight: 600; }
.side-context .context-label { color: rgba(255, 255, 255, 0.62); font-size: 10.5px; }
.side-context .context-path { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.side-context .menu summary { padding: 1px 0; white-space: normal; font-size: 11.5px; color: var(--muted); }
.side-context .menu summary::after { margin-left: 4px; font-size: 9px; }
.side .badge-demo { border: 0; padding: 0; font-size: 11.5px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--brand-text); }

.side-nav { flex: 1; display: flex; flex-direction: column; padding: 0 12px; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.side-group { font-size: 10.5px; font-weight: 600; color: var(--brand-text); text-transform: uppercase; letter-spacing: 0.09em; margin: 16px 0 5px; padding: 0 10px; }
.side-section-foot { margin-top: auto; padding-top: 16px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 8px; border-radius: 10px;
  color: #ffffff; font-weight: 500; letter-spacing: -0.005em; text-decoration: none; line-height: 1.3; transition: background-color 120ms ease;
}
.side-link:hover { background: rgba(96, 63, 254, 0.3); color: #ffffff; }
.side-link[aria-current="page"], .side-link[aria-current="page"]:hover { background: #ffffff; color: #15151b; font-weight: 600; box-shadow: 0 2px 10px rgba(96, 63, 254, 0.45); }
.side-link[aria-current="page"] .side-icon { color: #ffffff; }
.side-link[aria-current="page"] .side-done { color: var(--brand); }
.side-link.is-waiting { color: var(--muted); }
.side-add { color: var(--brand-text); }
.side-tile { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(171, 157, 255, 0.2); }
.side-link[aria-current="page"] .side-tile { background: var(--brand); }
.side-icon { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--brand-text); }
.side-step {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: 1px solid rgba(171, 157, 255, 0.6); border-radius: 50%; font-size: 10.5px; line-height: 1; color: var(--brand-text);
}
.side-link.is-waiting .side-step { border-color: var(--border-strong); color: var(--muted); }
.side-link[aria-current="page"] .side-step { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.side-label { min-width: 0; }
.side-done { margin-left: auto; display: inline-flex; color: var(--brand-text); }
.side-done-icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.side-count {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: rgba(96, 63, 254, 0.55); color: #ffffff;
  font-size: 11px; font-weight: 600; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums;
}
.side-link[aria-current="page"] .side-count { background: var(--brand); }

/* Un modulo acceso: si apre una alla volta, con le sue tappe sotto. */
.side-module > summary {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 8px; border-radius: 10px; list-style: none; cursor: pointer; color: #ffffff; font-weight: 600;
  transition: background-color 120ms ease;
}
.side-module > summary::-webkit-details-marker { display: none; }
.side-module > summary:hover { background: rgba(96, 63, 254, 0.3); }
.side-module > summary:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.side-module-icon { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--brand); }
.side-module-icon .side-icon { width: 15px; height: 15px; color: #ffffff; }
.side-module-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.side-module-text .side-label { font-weight: 500; }
.side-module-iso { font-size: 11px; color: var(--muted); }
.side-chevron { flex: none; width: 13px; height: 13px; margin-left: auto; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 140ms ease; }
.side-module[open] > summary .side-chevron { transform: rotate(90deg); }
.side-module ul { margin: 2px 0 6px 18px; padding-left: 6px; border-left: 1px solid rgba(171, 157, 255, 0.24); }
.side-module .side-link { min-height: 40px; padding: 5px 8px; font-size: 13px; }
.side-note { margin: -2px 0 6px 25px; padding: 0 8px; font-size: 11.5px; line-height: 1.3; color: var(--muted); }

.side-foot { display: flex; flex-direction: column; gap: 4px; margin: 10px 12px 0; padding: 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.11); }
.side-envs summary { padding: 2px 10px; font-size: 12px; color: var(--muted); }
.side-user { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 10px; background: #ffffff; }
.side-user form { margin: 0; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #ffffff; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.side-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.side-user-name { color: #15151b; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-env { color: #6c6c79; font-size: 11.5px; }
.side-exit { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: #f1eefe; color: #15151b; cursor: pointer; }
.side-exit .side-icon { color: currentColor; }
.side-exit:hover { background: #e2dcfb; color: #15151b; }
/* Dentro il menu i pannelli si aprono al loro posto: una tendina sovrapposta verrebbe tagliata. */
.side .menu-panel, .side .demo-note .menu-panel, .side .menu-clients .menu-panel { position: static; width: auto; min-width: 0; margin-top: 4px; }

/* La luce viola che sale dal fondo del menu. */
.side-check:checked ~ .side-body {
  background-image: radial-gradient(130% 34% at 15% 100%, rgba(96, 63, 254, 0.55), transparent 72%),
                    radial-gradient(90% 20% at 100% 0%, rgba(96, 63, 254, 0.22), transparent 70%);
}
@media (min-width: 1024px) {
  body:has(> .side) { padding-left: var(--side-w); }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; display: flex; flex-direction: column; width: var(--side-w); overflow: hidden;
    background-image: radial-gradient(130% 34% at 15% 100%, rgba(96, 63, 254, 0.55), transparent 72%);
  }
  .side-check, .side-toggle { display: none; }
  /* Scorrono solo le voci: azienda in alto e «Riduci menu» con l'utente in basso restano sempre a portata. */
  .side-body { flex: 1; min-height: 0; overflow: hidden; }
  .side-nav { min-height: 0; overflow-y: auto; scrollbar-width: none; }
  .side-foot { flex: none; margin-top: 10px; }
}
@media (max-width: 1023px) {
  .side { position: sticky; top: 0; z-index: 40; }
  .side-top { min-height: 56px; padding: 0 var(--gutter); }
  .side-body { display: none; }
  .side-check:checked ~ .side-body { display: flex; position: fixed; top: 56px; right: 0; bottom: 0; left: 0; overflow-y: auto; padding: 8px 6px 14px; background-color: #000000; }
  html:has(.side-check:checked) { overflow: hidden; }
  .side-link { min-height: 44px; font-size: 15px; }
  .side-module .side-link { min-height: 42px; font-size: 14.5px; }
  .side-module > summary { min-height: 48px; font-size: 15px; }
}

/* ---- Fascia in alto: bianca da un bordo all'altro, con il logo in positivo ---- */
.topbar {
  color-scheme: light;
  --surface-2: #ffffff;
  --field: #ffffff;
  --field-hover: #f1eefe;
  --border: #e9e5f6;
  --border-strong: #cfc9e8;
  --text: #15151b;
  --text-2: #41414d;
  --muted: #6c6c79;
  --brand-text: #4d2de8;
  --brand-tint: rgba(96, 63, 254, 0.09);
  --focus: 0 0 0 3px rgba(96, 63, 254, 0.25);
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px var(--gutter); background: #ffffff; color: var(--text); border-bottom: 1px solid var(--border);
}
.topbar-search { position: relative; flex: 0 1 600px; min-width: 0; margin: 0; }
.topbar-search-icon { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
body .topbar-search input[type="search"], body:has(> .side) .topbar-search input[type="search"] { height: 38px; padding: 0 12px 0 35px; border: 1px solid var(--border); border-radius: 10px; background: #f6f4fd; color: var(--text); font-size: 13.5px; }
body .topbar-search input[type="search"]:hover { border-color: var(--border-strong); }
body .topbar-search input[type="search"]:focus { border-color: var(--brand); background: #ffffff; outline: none; box-shadow: var(--focus); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.topbar-icon:hover { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-text); }
.topbar-icon-svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar .topbar-action { min-height: 38px; padding: 6px 16px; border-radius: 10px; font-size: 13px; white-space: nowrap; }
.topbar .topbar-action:hover { background: var(--brand-hover); }
.topbar .badge-demo { border: 0; padding: 0; font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--brand-text); }
.topbar .demo-note summary { padding: 0; }
.topbar .demo-note .menu-panel { left: auto; right: 0; top: calc(100% + 10px); z-index: 50; }
@media (min-width: 1024px) {
  .topbar { position: sticky; top: 0; z-index: 25; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; min-height: 0; }
  .topbar-search { flex: 1 1 100%; order: 2; }
  .topbar-actions { width: 100%; }
  .topbar .demo-note .menu-panel { left: 0; right: auto; }
  .topbar-actions > .demo-note { margin-right: auto; }
}

/* ---- Area di lavoro: il bianco accanto al menu nero ---- */
.canvas { display: flex; flex-direction: column; flex: 1; min-width: 0; }
body:has(> .side) .canvas, body.pagina-chiara {
  color-scheme: light;
  --bg: #f6f4fd;
  --surface: #ffffff;
  --surface-aid: #fbfaff;
  --surface-2: #ffffff;
  --field: #ffffff;
  --field-hover: #f1eefe;
  --border: #e9e5f6;
  --border-strong: #cfc9e8;
  --text: #15151b;
  --text-2: #41414d;
  --muted: #6c6c79;
  --brand-hover: #4f2ff0;
  --brand-text: #4d2de8;
  --brand-tint: rgba(96, 63, 254, 0.09);
  --warn: #8a5a00;
  --danger: #c0272d;
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 0 0 0 3px rgba(96, 63, 254, 0.25);
  --link-line: rgba(21, 21, 27, 0.3);
  --hover-line: #9a9aa8;
  --placeholder: #8a8a96;
  --missing-line: rgba(138, 90, 0, 0.55);
  background: var(--bg); color: var(--text);
}
body:has(> .side) .canvas h1, body:has(> .side) .canvas h2, body:has(> .side) .canvas h3 { font-weight: 600; letter-spacing: -0.012em; }
/* Il foglio del documento si stacca dal fondo con una linea e un'ombra leggera. */
body:has(> .side) .canvas .paper, body:has(> .side) .canvas .logo-preview { border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(21, 21, 27, 0.05); }
/* Il blocco nero «Adesso»: è il nero della marca, e il pulsante viola spicca. */
body:has(> .side) .home-top > .now, body:has(> .side) main > .now {
  color-scheme: dark;
  --bg: #000000;
  --surface: #121215;
  --field: #1b1b1f;
  --field-hover: #222228;
  --border: #2a2a30;
  --border-strong: #3a3a41;
  --text: #ffffff;
  --text-2: #d4d4da;
  --muted: #a6a6b0;
  --brand-hover: #7458ff;
  --brand-text: #ab9dff;
  --focus: 0 0 0 3px rgba(171, 157, 255, 0.45);
  --link-line: rgba(255, 255, 255, 0.35);
  --hover-line: #55555e;
  --placeholder: #7d7d87;
  background: #000000; color: var(--text); border-radius: var(--radius); padding: 18px 22px; margin-bottom: var(--s-3);
}
body:has(> .side) .home-top > .now > :last-child, body:has(> .side) main > .now > :last-child { margin-bottom: 0; }
body:has(> .side) .canvas .eyebrow, body:has(> .side) .canvas .small-title, body:has(> .side) .canvas .area-phase,
body:has(> .side) .canvas .theme-title, body:has(> .side) .canvas .row-title { color: var(--brand-text); }
body:has(> .side) .canvas .count-row strong { color: var(--brand); font-weight: 600; }
body:has(> .side) .canvas .btn-secondary, body:has(> .side) .canvas .btn-ghost { background: var(--surface); }
body:has(> .side) .canvas .btn-secondary:hover, body:has(> .side) .canvas .btn-ghost:hover { border-color: var(--brand); color: var(--brand-text); }
body:has(> .side) .now .btn-secondary, body:has(> .side) .now .btn-ghost { background: transparent; }
body:has(> .side) .now .btn-secondary:hover, body:has(> .side) .now .btn-ghost:hover { border-color: var(--text); color: var(--text); }
@media (max-width: 1023px) {
  body:has(> .side) .canvas { border-radius: 0; }
}
@media (max-width: 560px) {
  body:has(> .side) .home-top > .now, body:has(> .side) main > .now { padding: var(--s-3); }
}

/* ---- Densità: con il menu si lavora fitto e a tutta larghezza, come in SOPHIA ---- */
@media (min-width: 1024px) {
  html:has(> body > .side) { font-size: 14.5px; }
  body:has(> .side) {
    --side-w: 230px; --gutter: 24px;
    --s-1: 6px; --s-2: 10px; --s-3: 14px; --s-4: 18px; --s-5: 22px;
    --fs-title: 23px; --fs-question: 21px; --fs-section: 15.5px; --fs-sub: 14px; --fs-body: 14px; --fs-small: 12.5px; --fs-micro: 11px;
    line-height: 1.5;
  }
  body:has(> .side) .canvas .container { max-width: none; margin: 0; }
  body:has(> .side) main.container { padding-top: 20px; padding-bottom: 28px; }
  body:has(> .side) .footer { font-size: 11.5px; padding: 10px 0; }
  body:has(> .side) .btn { min-height: 36px; padding: 6px 14px; font-size: 13px; border-radius: 8px; }
  body:has(> .side) .btn-small { min-height: 28px; padding: 3px 10px; font-size: 12px; }
  body:has(> .side) input[type="text"], body:has(> .side) input[type="email"], body:has(> .side) input[type="password"],
  body:has(> .side) input[type="number"], body:has(> .side) input[type="date"], body:has(> .side) input[type="search"],
  body:has(> .side) textarea { padding: 7px 10px; font-size: 14px; }
  body:has(> .side) select { padding: 7px 32px 7px 10px; font-size: 14px; }
  body:has(> .side) .multi summary { padding: 7px 32px 7px 10px; }
  body:has(> .side) .multi-panel .checkbox { min-height: 36px; padding: 6px 10px; }
  body:has(> .side) .multi-panel .checkbox input { width: 16px; height: 16px; }
  body:has(> .side) .flash { font-size: 13px; padding: 8px 12px; }
  body:has(> .side) .empty { font-size: 13px; }
  body:has(> .side) .now h2 { font-size: 18px; margin-bottom: 4px; }
  body:has(> .side) .now .lead { margin-bottom: 0; }
  body:has(> .side) .card-head { margin-bottom: 4px; }
  body:has(> .side) .card-aid { padding: 14px; font-size: 13px; }
  body:has(> .side) .card-aid .h3, body:has(> .side) .card-aid h2 { font-size: 13.5px; }
  body:has(> .side) .question-main { max-width: none; }
  body:has(> .side) .layout-question { grid-template-columns: minmax(0, 1fr) 320px; justify-content: stretch; column-gap: var(--s-4); }
}
@media (max-width: 1199px) and (min-width: 1024px) {
  body:has(> .side) .layout-question { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Home: banner di benvenuto, numeri, moduli, orologio e calendario ---- */
.banner {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-2) var(--s-4); padding: 16px 20px; margin-bottom: var(--s-3); border: 1px solid #e0d9ff; border-radius: var(--radius);
  background: linear-gradient(100deg, #ffffff 0%, #f9f7ff 50%, #efeaff 100%); color: var(--text);
}
.banner-deco { position: absolute; right: -60px; top: -70px; pointer-events: none; }
/* Il punto del logo, grande e tenue. */
.banner-dot { fill: var(--brand); opacity: 0.12; }
.banner-text, .banner-actions { position: relative; }
.banner-text { display: flex; flex-direction: column; gap: 1px; max-width: 640px; }
.banner-date { font-size: var(--fs-small); font-weight: 600; color: var(--brand-text); }
.banner h1 { margin: 0; font-size: 20px; color: var(--text); }
.banner p { margin: 0; color: var(--text-2); font-size: var(--fs-small); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.banner-letter { display: inline-block; white-space: pre; opacity: 0; transform: translateY(0.18em); animation: banner-letter 320ms ease-out forwards; }
@keyframes banner-letter { to { opacity: 1; transform: none; } }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); align-items: start; }
.home-col { min-width: 0; }
.home-col > :last-child { margin-bottom: 0; }
.page-title { font-size: 21px; margin: 0 0 var(--s-2); }

/* La prima riga della home: chi sei e cosa fare adesso, della stessa altezza. */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); margin-bottom: var(--s-3); }
.home-top > .banner, body:has(> .side) .home-top > .now { margin-bottom: 0; }
@media (min-width: 900px) { .home-top { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }

/* «Da risolvere oggi»: i numeri in fila, a tutta larghezza. Ogni riquadro porta all'elenco. */
.tiles { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s-3); margin: 0 0 var(--s-3); padding: 0; }
.tiles > li { display: flex; min-width: 0; }
.tile { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color 120ms ease; }
.tile:hover { border-color: var(--brand); color: var(--text); }
.tile-value { flex: none; min-width: 34px; font-size: 24px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; text-align: center; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile.is-zero .tile-value { color: var(--muted); }
.tile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile-label { font-size: 13px; font-weight: 600; line-height: 1.25; }
.tile-hint { font-size: 11.5px; line-height: 1.3; color: var(--muted); }

/* «Adesso»: il testo a sinistra e l'azione a destra. */
@media (min-width: 761px) {
  .home-top > .now { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-4); align-items: center; align-content: center; }
  .home-top > .now > * { grid-column: 1; }
  .home-top > .now > .actions { grid-column: 2; grid-row: 1 / span 4; margin: 0; }
  .home-top > .now > .goal-form { grid-column: 1 / -1; max-width: none; margin-top: var(--s-2); }
}

/* I moduli accesi e le loro otto tappe. */
.mod-rows { list-style: none; margin: 0; padding: 0; }
.mod-row { display: grid; grid-template-columns: auto minmax(160px, 1fr) minmax(0, 2fr) auto; align-items: center; gap: var(--s-2) var(--s-3); padding: 10px 0; border-top: 1px solid var(--border); }
.mod-row:first-child { border-top: 0; padding-top: 4px; }
.mod-row:last-child { padding-bottom: 0; }
.mod-row-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.mod-row-title strong { font-weight: 600; }
.mod-row-title span { color: var(--muted); font-size: var(--fs-small); }
.mod-icon { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-tint); }
.mod-icon-svg { width: 18px; height: 18px; fill: none; stroke: var(--brand); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.is-on .mod-icon, .mod-row .mod-icon { background: var(--brand); }
.is-on .mod-icon-svg, .mod-row .mod-icon-svg { stroke: #ffffff; }
.mod-track { display: flex; gap: 8px; min-width: 0; }
.mod-phase { min-width: 0; }
.mod-phase-4 { flex: 3.4 1 0; }
.mod-phase-2 { flex: 2.3 1 0; }
.mod-phase-1 { flex: 1.9 1 0; }
.mod-phase-name { display: block; margin-bottom: 4px; font-size: 11px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-steps { display: flex; gap: 3px; }
.mod-step { flex: 1; height: 5px; border-radius: 3px; background: var(--border); }
.mod-step.is-done { background: var(--brand); }
.mod-step.is-now { background: #b9abff; }
.mod-off { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: var(--s-2) 0 0; padding-top: var(--s-2); border-top: 1px solid var(--border); font-size: var(--fs-small); color: var(--muted); }
.mod-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: 12px; }
.mod-chip:hover { border-color: var(--brand); color: var(--brand-text); }

.home-aside { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.home-aside > .card { margin-bottom: 0; }

/* La pagina Moduli. */
.eco { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-5); padding: 12px 16px; margin-bottom: var(--s-3); border-radius: var(--radius); background: var(--brand-tint); }
.eco-text { flex: 1 1 340px; min-width: 0; }
.eco-text h2 { font-size: 14px; margin-bottom: 1px; }
.eco-text .lead { margin: 0; font-size: var(--fs-small); }
.eco-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: var(--fs-small); color: var(--text-2); }
.eco-list li { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.eco-icon { width: 13px; height: 13px; fill: none; stroke: var(--brand-text); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.mod-card { display: flex; flex-direction: column; gap: var(--s-2); padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.mod-card.is-on { border-color: rgba(96, 63, 254, 0.55); }
.mod-card-head { display: flex; align-items: center; gap: 11px; }
.mod-card-head form { margin: 0 0 0 auto; }
.mod-card-head > .switch, .mod-card-head > .badge { margin-left: auto; }
.mod-card-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mod-card-title h2 { margin: 0; font-size: 15px; }
.mod-card-text { flex: 1; margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.mod-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 28px; }
.switch { position: relative; display: block; flex: none; width: 38px; height: 22px; padding: 0; border: 0; border-radius: 11px; background: #d4cfe9; cursor: pointer; transition: background-color 140ms ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(21, 21, 27, 0.25); transition: transform 140ms ease; }
.switch:hover { background: #bdb5e0; }
.switch.is-on, .switch.is-on:hover { background: var(--brand); }
.switch.is-on::after { transform: translateX(16px); }
.switch:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 11px; }

.home-side { display: flex; flex-direction: column; align-items: center; margin-bottom: 0; padding: 16px; }
.clock-face { flex: none; width: 88px; aspect-ratio: 1; border-radius: 50%; background: var(--surface); border: 1px solid rgba(96, 63, 254, 0.3); }
.clock { display: block; width: 100%; height: 100%; }
.clock-tick { stroke: var(--border); stroke-width: 1.4; stroke-linecap: round; }
.clock-tick-hour { stroke: var(--muted); stroke-width: 3; }
.clock-tick-twelve { stroke: var(--brand); stroke-width: 5; }
.clock-hand { stroke: var(--text); stroke-linecap: round; }
.clock-hand-hours { stroke-width: 7; }
.clock-hand-minutes { stroke-width: 4.5; }
.clock-hand-seconds { stroke: var(--brand); stroke-width: 2.2; }
.clock-weight { fill: var(--brand); }
.clock-pin { fill: var(--brand); stroke: var(--text); stroke-width: 2; }

.cal { width: 100%; margin-top: var(--s-2); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); margin-bottom: 4px; }
.cal-month { font-size: 13.5px; font-weight: 600; text-transform: capitalize; }
.cal-arrow { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer; }
.cal-arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cal-arrow:hover { background: var(--field-hover); color: var(--brand-text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.cal-weekday { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--muted); padding-bottom: 3px; }
.cal-day { position: relative; justify-self: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.cal-day:hover { background: var(--field-hover); }
.cal-day.is-today, .cal-day.is-today:hover { background: var(--brand); color: #ffffff; font-weight: 600; }
.cal-day.is-chosen { box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-dot { position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand); }
.cal-day.is-today .cal-dot { background: #ffffff; }
.cal-detail { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--border); font-size: 12.5px; }
.cal-detail:empty { display: none; }
.cal-detail p { margin: 0; color: var(--muted); }
.cal-detail .cal-detail-title { margin-bottom: 4px; color: var(--text); font-weight: 600; }
.cal-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-item { display: flex; flex-direction: column; padding: 5px 6px; border-radius: var(--radius-sm); text-decoration: none; line-height: 1.3; }
.cal-item:hover { background: var(--field-hover); color: var(--text); }
.cal-item-kind { font-size: 11px; font-weight: 600; color: var(--brand-text); }
.cal-item-title { font-weight: 500; }
.cal-item-detail { font-size: 12px; color: var(--muted); }

/* Accanto al lavoro solo se c'è spazio; altrimenti orologio e calendario stanno in fondo, affiancati. */
@media (min-width: 1240px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (min-width: 640px) and (max-width: 1239px) {
  .home-side { flex-direction: row; align-items: flex-start; justify-content: center; gap: var(--s-5); }
  .home-side .cal { margin-top: 0; max-width: 340px; }
}
@media (max-width: 760px) {
  .banner { padding: var(--s-3) 18px; }
  .banner-actions { margin-right: 0; width: 100%; }
  .banner-deco { right: -130px; top: -80px; }
  .banner-actions .btn { flex: 1 1 auto; }
  .mod-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .mod-row .mod-track { grid-column: 1 / -1; grid-row: 2; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.search-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--s-3); align-items: start; }
.search-groups .card { margin-bottom: 0; }

/* ---- Tappe 5-8 ---- */
.audit-point { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-1) var(--s-4); padding: var(--s-2) 0; border-top: 1px solid var(--border); }
.card h2 + .audit-point { border-top: 0; }
.audit-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.audit-what strong { font-weight: 500; }
.audit-answer { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (min-width: 900px) { .audit-point { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.decision-row { padding: 6px 0; flex-basis: auto; }
.visit { padding: var(--s-2) 0; border-top: 1px solid var(--border); }
.card h2 + .visit { border-top: 0; }
.visit h3 { margin: 0; }
.visit-forms { margin-top: var(--s-2); }
.inline-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2); }
.inline-row .cell { flex: 1 1 160px; min-width: 0; }
.visit-new { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--border); }
.doc-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 4px var(--s-3); }
tr.is-voided td { color: var(--muted); text-decoration: line-through; }
tr.is-voided td:last-child { text-decoration: none; }

/* ---- Ordine: ogni pagina comincia e si compone allo stesso modo ----
   Una sola testata, un solo modo di aprire una scheda, una sola altezza per campi e pulsanti, due soli raggi.
   Il nero resta per il menu e per «Adesso»: chi lo vede sa che lì c'è la cosa da fare. */

/* La testata: titolo e spiegazione a sinistra, l'azione a destra, una linea sotto. */
body:has(> .side) main > .hero, body:has(> .side) main .page-head { padding: 0 0 12px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
body:has(> .side) main .page-head { align-items: center; }
body:has(> .side) main > .hero h1, body:has(> .side) main .page-head h1 { max-width: none; margin: 0; }
body:has(> .side) main > .hero .eyebrow, body:has(> .side) main .page-head .eyebrow { margin-bottom: 2px; }
body:has(> .side) main > .hero .lead, body:has(> .side) main .page-head .lead { max-width: none; margin: 2px 0 0; color: var(--muted); font-size: var(--fs-small); }
body:has(> .side) .breadcrumb { margin-bottom: 8px; }
/* Una spiegazione messa subito dopo il titolo fa parte della testata: la linea scende sotto di lei. */
body:has(> .side) main .page-head:has(+ .lead) { padding-bottom: 0; margin-bottom: 2px; border-bottom: 0; }
body:has(> .side) main .page-head + .lead { max-width: none; padding-bottom: 12px; margin: 0 0 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: var(--fs-small); }

/* La scheda: titolo e stato sulla stessa linea, sempre alla stessa distanza dal contenuto. */
.card-head { align-items: center; min-height: 28px; }
.card-head h2 { margin-bottom: 0; }
body:has(> .side) .card > h2:first-child { margin-bottom: 8px; }
body:has(> .side) .card-head { margin-bottom: 8px; }
body:has(> .side) .card-head + .muted { margin-top: -4px; }

/* I link di servizio sono parole viola, senza sottolineatura: la sottolineatura resta ai link dentro le frasi. */
body:has(> .side) .canvas .card-head a:not(.btn), body:has(> .side) .canvas .card-foot a { color: var(--brand-text); font-size: var(--fs-small); font-weight: 500; text-decoration: none; }
body:has(> .side) .canvas .card-head a:not(.btn):hover, body:has(> .side) .canvas .card-foot a:hover { text-decoration: underline; }

/* Le tabelle: righe pulite, nome da aprire in evidenza e l'azione in fondo come parola, non come pulsante ripetuto. */
body:has(> .side) .canvas table.dense td { vertical-align: middle; }
body:has(> .side) .canvas table.dense td a:not(.btn) { font-weight: 500; text-decoration: none; }
body:has(> .side) .canvas table.dense td a:not(.btn):hover { color: var(--brand-text); }
body:has(> .side) .canvas table.dense tbody tr:last-child td { border-bottom: 0; }
body:has(> .side) .canvas table.dense td:last-child:has(.btn-small), body:has(> .side) .canvas table.dense th:last-child { padding-right: 0; }
body:has(> .side) .canvas table.dense td:last-child:has(.btn-small) { text-align: right; white-space: nowrap; }
body:has(> .side) .canvas table.dense td:last-child .btn-small { min-height: 0; padding: 0; border: 0; background: none; color: var(--brand-text); font-weight: 500; }
body:has(> .side) .canvas table.dense td:last-child .btn-small:hover { color: var(--brand-text); text-decoration: underline; }
body:has(> .side) .canvas table.dense .row-actions { gap: 12px; }

/* I numeri di una pagina stanno liberi, senza altre linee oltre a quella della testata. */
body:has(> .side) .canvas .metrics { padding: 0; margin: 0 0 var(--s-3); border: 0; }

/* I messaggi: stessa scheda bianca, con la linea di stato a sinistra. */
body:has(> .side) .canvas .flash { background: var(--surface); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm); }

/* I moduli sulla stessa linea: il pulsante sta accanto ai campi, alla loro altezza. */
.visit-forms { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.inline-row .cell { flex: 1 1 200px; max-width: 460px; }
body:has(> .side) .inline-row .btn, body:has(> .side) .task-side .btn { flex: none; min-height: 36px; }
@media (min-width: 900px) { .inline-row { flex-wrap: nowrap; } }
body:has(> .side) .card .form-actions { margin: 14px 0 0; }
body:has(> .side) .card .form-actions + p { margin: 10px 0 0; }

/* Nelle colonne laterali lo spazio tra le schede lo decide la colonna. */
body:has(> .side) .side-stack { gap: var(--s-3); }
body:has(> .side) .side-stack > .card { margin-bottom: 0; }

/* Il pulsante per allegare un file è uguale agli altri. */
body:has(> .side) .canvas input[type="file"] { font-size: 13px; }
body:has(> .side) .canvas input[type="file"]::file-selector-button { height: 30px; margin-right: 10px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
body:has(> .side) .canvas input[type="file"]::file-selector-button:hover { border-color: var(--brand); color: var(--brand-text); }

/* Il menu: un solo bordo a sinistra, una riga per voce. */
.side-module ul { margin: 1px 0 6px; padding-left: 0; border-left: 0; }
.side-step { width: 20px; height: 20px; margin: 0 4px; font-size: 11px; }
.side-link.has-step .side-done { display: none; }
.side-link.is-done:not([aria-current="page"]) .side-step { background: rgba(96, 63, 254, 0.7); border-color: transparent; color: #ffffff; }
.side-note { margin: 0 0 6px; padding: 0 10px 0 48px; }

@media (min-width: 1024px) {
  body:has(> .side) .card { padding: 16px 18px; }
  body:has(> .side) .card-aid { padding: 14px; }
  body:has(> .side) .topbar-search input[type="search"], body .topbar-icon, body .topbar .topbar-action { min-height: 36px; border-radius: 8px; }
  body .topbar-icon { width: 36px; height: 36px; }
  body:has(> .side) .topbar-search input[type="search"] { height: 36px; }
  /* Campi e pulsanti hanno tutti la stessa altezza. */
  body:has(> .side) input[type="text"], body:has(> .side) input[type="email"], body:has(> .side) input[type="password"],
  body:has(> .side) input[type="number"], body:has(> .side) input[type="date"], body:has(> .side) select { height: 36px; padding-top: 0; padding-bottom: 0; }
  body:has(> .side) .multi summary { min-height: 36px; line-height: 20px; }
  body:has(> .side) .field label:not(.checkbox), body:has(> .side) .field legend, body:has(> .side) .cell label, body:has(> .side) .label { margin-bottom: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
  body:has(> .side) .decision-grid { gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  body:has(> .side) .status-list li { padding: 8px 0; }
  body:has(> .side) table.dense td, body:has(> .side) table.dense th { padding-top: 8px; padding-bottom: 8px; }
  .side-link { min-height: 34px; padding: 4px 10px; }
  .side-module > summary { min-height: 38px; }
  .side-module .side-link { min-height: 30px; padding: 3px 10px 3px 10px; font-size: 12.5px; white-space: nowrap; }
  .side-group { margin: 14px 0 4px; }
}

/* ---- Rifinitura: stati leggibili a colpo d'occhio, righe che rispondono, il percorso come segno di LORNA ---- */

/* Stati: una pillola tenue. Viola è fatto, ambra chiede attenzione, rosso è scaduto, grigio è più avanti. */
body:has(> .side) .canvas .badge:not(.badge-demo) { gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; background: #f1f0f7; font-size: 12px; line-height: 18px; }
body:has(> .side) .canvas .badge:not(.badge-demo)::before { width: 6px; height: 6px; }
body:has(> .side) .canvas .badge-ok { background: rgba(96, 63, 254, 0.1); color: #3f22d6; }
body:has(> .side) .canvas .badge-warn { background: #fdf1d8; color: #7a4f00; }
body:has(> .side) .canvas .badge-late { background: #fde8e8; color: #a8181e; }
body:has(> .side) .canvas .badge-late::before { background: #c0272d; box-shadow: none; }
body:has(> .side) .canvas .badge-draft { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
body:has(> .side) .canvas .badge-neutral { color: #5e5e6b; }
body:has(> .side) .canvas .now .badge:not(.badge-demo) { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: none; }

/* Le superfici si staccano appena dal fondo; i pulsanti principali hanno un filo di luce. */
body:has(> .side) .canvas .card:not(.card-quiet), body:has(> .side) .canvas .tile, body:has(> .side) .canvas .mod-card, body:has(> .side) .canvas .rail { box-shadow: 0 1px 2px rgba(34, 22, 92, 0.05); }
body:has(> .side) .canvas .btn-primary { box-shadow: 0 1px 2px rgba(58, 30, 190, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
body:has(> .side) .canvas .btn:active { transform: translateY(1px); }
.tile { transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease; }
body:has(> .side) td, body:has(> .side) .count-row strong, body:has(> .side) .step-num, body:has(> .side) .cal-day { font-variant-numeric: tabular-nums; }

/* «Adesso» prende lo stesso bagliore viola del menu. */
body:has(> .side) .home-top > .now, body:has(> .side) main > .now { background: radial-gradient(380px 200px at 100% 130%, rgba(96, 63, 254, 0.5), rgba(96, 63, 254, 0) 72%), #000000; }

/* Le righe rispondono al mouse e si aprono cliccando ovunque, non solo sul titolo. */
body:has(> .side) .status-list li { position: relative; transition: background-color 100ms ease, box-shadow 100ms ease; }
body:has(> .side) .status-list li > a:first-child:not(.btn)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
body:has(> .side) .status-list li > :not(a:first-child) { position: relative; z-index: 1; }
@media (hover: hover) {
  /* Il fondo sborda con un'ombra: le linee tra le righe restano allineate al resto della scheda. */
  body:has(> .side) .status-list li:has(> a:first-child:not(.btn)):hover { background: #faf9ff; box-shadow: -8px 0 0 #faf9ff, 8px 0 0 #faf9ff; }
  body:has(> .side) table.dense tbody tr:hover td { background: #faf9ff; }
  body:has(> .side) .tile:hover { box-shadow: 0 8px 20px -12px rgba(96, 63, 254, 0.55); transform: translateY(-1px); }
}

/* Attività in Panoramica: chi la segue è un cerchio con le iniziali, la data sta in colonna. */
.task-line .avatar { width: 24px; height: 24px; background: var(--brand-tint); color: var(--brand-text); font-size: 9.5px; }
.due { color: var(--muted); font-size: var(--fs-small); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.is-late { color: var(--danger); font-weight: 500; }
@media (min-width: 700px) {
  .task-line { flex-wrap: nowrap; }
  .due { min-width: 116px; text-align: right; }
}

/* Da fare: una tabella con una sola intestazione, i campi si vedono quando servono. */
.task-head { display: none; }
.task-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.task-title strong { font-weight: 600; }
.js .task-row:not(.is-dirty) .task-save { display: none; }
body:has(> .side) .canvas .task-row.is-dirty .task-save { background: var(--brand); border-color: transparent; color: #ffffff; }
select:has(option[value=""]:checked) { color: var(--muted); }
.task-row.is-late input[type="date"] { color: var(--danger); }
@media (min-width: 1280px) {
  body:has(> .side) .task-head { display: flex; align-items: center; gap: 24px; position: sticky; top: 64px; z-index: 5; margin-top: 8px; padding: 6px 0; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; }
  body:has(> .side) .task-head > :first-child { flex: 1; }
  body:has(> .side) .task-head-side, body:has(> .side) .task-side { display: grid; grid-template-columns: 232px 140px 104px 64px; gap: 8px; flex: none; }
  body:has(> .side) .task-side { align-items: center; }
  body:has(> .side) .task-row { flex-wrap: nowrap; align-items: center; gap: 24px; padding: 9px 0; transition: background-color 100ms ease, box-shadow 100ms ease; }
  body:has(> .side) .task-row:first-of-type, body:has(> .side) .task-head + .task-row { border-top: 0; }
  body:has(> .side) .task-main { flex: 1 1 0; }
  body:has(> .side) .task-side .cell { min-width: 0; }
  body:has(> .side) .task-side .cell label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
  body:has(> .side) .task-row:not(:hover):not(:focus-within) select,
  body:has(> .side) .task-row:not(:hover):not(:focus-within) input[type="date"] { border-color: transparent; background-color: transparent; background-image: none; }
  body:has(> .side) .task-row:not(:hover):not(:focus-within) input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; }
  body:has(> .side) .task-side select, body:has(> .side) .task-side input[type="date"] { padding-left: 8px; }
  body:has(> .side) .task-row:hover { background: #faf9ff; box-shadow: -8px 0 0 #faf9ff, 8px 0 0 #faf9ff; }
  body:has(> .side) .task-head-side > span { padding-left: 9px; }
  body:has(> .side) .task-side select { padding-right: 8px; text-overflow: ellipsis; }
}

/* Il percorso: tutte le tappe in un colpo d'occhio, poi i dettagli di una alla volta. */
.stage-dot { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.is-completata > * > .stage-dot, .is-completata .stage-dot { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.is-in_corso .stage-dot { border-color: var(--brand); color: var(--brand-text); box-shadow: 0 0 0 4px var(--brand-tint); }
.stage-dot-icon { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.rail { display: none; }
@media (min-width: 700px) {
  .rail { display: grid; grid-template-columns: 4fr 2fr 1fr 1fr; list-style: none; margin: 0 0 var(--s-3); padding: 14px 18px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
  .rail-phase { min-width: 0; }
  .rail-name { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
  .rail-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); list-style: none; margin: 0; padding: 0; }
  .rail-step { position: relative; min-width: 0; padding-right: 12px; }
  .rail-step::before { content: ""; position: absolute; left: 14px; right: 0; top: 13px; height: 2px; background: var(--border-strong); }
  .rail-step.is-completata::before { background: var(--brand); }
  .rail-phase:last-child .rail-step:last-child::before { display: none; }
  .rail-link { position: relative; display: block; color: var(--text); font-size: 12.5px; line-height: 1.3; text-decoration: none; }
  a.rail-link:hover { color: var(--brand-text); }
  .rail-label { display: block; margin-top: 6px; }
  .rail-step.is-da_iniziare .rail-label { color: var(--muted); }
  .rail-step.is-in_corso .rail-label { font-weight: 600; }
}
@media (max-width: 1023px) and (min-width: 700px) { .rail-label { display: none; } }

.path-phase { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; }
.path-phase-head > :last-child { margin-bottom: 0; }
.path-phase-head h2 { margin-bottom: 2px; }
.path-stages { list-style: none; margin: 0; padding: 0; }
.path-stage { position: relative; }
.path-stage::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--border-strong); }
.path-stage.is-completata::before { background: var(--brand); }
.path-stage:first-child::before { top: 24px; }
.path-stage:last-child::before { bottom: calc(100% - 24px); }
.path-stage:only-child::before { display: none; }
.path-stage summary { display: flex; align-items: flex-start; gap: 12px; padding: 10px 28px 10px 0; list-style: none; cursor: pointer; }
.path-stage summary::-webkit-details-marker { display: none; }
.path-stage summary:hover h3 { color: var(--brand-text); }
.path-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding-top: 3px; }
.path-title h3 { margin: 0; font-size: var(--fs-body); }
.path-stage.is-da_iniziare .path-title h3 { color: var(--muted); }
.path-more { position: absolute; right: 0; top: 15px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 120ms ease; }
.path-stage details[open] .path-more { transform: rotate(90deg); }
.path-action { padding: 0 0 10px 40px; }
.path-body { padding: 0 0 12px 40px; }
.path-gate { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-small); }
.path-table { list-style: none; margin: 0; padding: 0; }
.path-table li { padding: 6px 0; border-top: 1px solid var(--border); font-size: var(--fs-small); color: var(--text-2); }
.path-table li > * { display: block; }
.path-table strong { color: var(--text); font-weight: 600; }
.path-result { color: var(--muted); }
.path-table-head { display: none; }
@media (min-width: 900px) {
  .path-stage summary { padding-right: 200px; }
  .path-action { position: absolute; right: 28px; top: 8px; padding: 0; }
  .path-table li { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 0.7fr); gap: 16px; }
  .path-table li.path-table-head { display: grid; border-top: 0; color: var(--muted); font-size: 11.5px; font-weight: 500; }
}
@media (min-width: 1200px) { .path-phase { grid-template-columns: 220px minmax(0, 1fr); } }

/* Barra in alto: la scorciatoia per cercare. */
.topbar-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 5px; background: #ffffff; color: var(--muted); font: 500 11px/16px var(--font); pointer-events: none; }
.topbar-search input:focus ~ .topbar-kbd { display: none; }

/* L'ingresso: la prima cosa che si vede di LORNA. */
body:has(.access), body:has(.auth) { background-color: #000000; background-image: radial-gradient(1100px 620px at 8% 108%, rgba(96, 63, 254, 0.42), rgba(96, 63, 254, 0) 70%), radial-gradient(700px 420px at 100% -10%, rgba(96, 63, 254, 0.14), rgba(96, 63, 254, 0) 70%); background-repeat: no-repeat; }
.access { max-width: 880px; }
.access .brand.auth-logo { --logo: 104px; margin-bottom: 28px; }
.auth .brand.auth-logo { --logo: clamp(96px, 9vw, 130px); }
.access h1 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: -0.02em; }
.access-lead { margin: 0 0 28px; color: var(--text-2); max-width: 56ch; }
.portal-card { background: rgba(22, 22, 27, 0.72); border-color: #2a2a31; border-radius: 14px; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; }
.portal-card:hover { border-color: var(--brand); box-shadow: 0 24px 60px -28px rgba(96, 63, 254, 0.85); transform: translateY(-2px); }
.portal-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; background: rgba(96, 63, 254, 0.18); color: #c9bfff; }
.portal-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal-title { font-weight: 600; }
.portal-go { display: inline-flex; align-items: center; gap: 6px; color: #ffffff; }
.portal-go-arrow { transition: transform 140ms ease; }
.portal-card:hover .portal-go-arrow { transform: translateX(3px); }

/* Sui telefoni la scorciatoia non serve e l'attività va a capo sempre allo stesso modo: titolo, poi chi e quando. */
@media (max-width: 1023px) { .topbar-kbd { display: none; } }
@media (max-width: 699px) { .task-line > a:first-child, .task-line > .person { flex: 1 1 100%; } }

/* Moduli divisi per famiglia, quando ce n'è più d'una. */
.family-title { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-sub); color: var(--muted); }

/* Documenti che hai già, libreria, assistente. */
.upload-row { display: grid; gap: var(--s-2); align-items: start; grid-template-columns: minmax(0, 1fr); margin-bottom: var(--s-2); }
.upload-row > .btn { align-self: end; }
.card .decision-grid + .field { margin-top: var(--s-2); }
@media (min-width: 900px) { .upload-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.7fr) auto; } }
.link-grid { display: grid; gap: 2px var(--s-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: var(--s-3); }
.link-grid .checkbox { min-height: 30px; font-size: var(--fs-small); }
.inline-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-2); margin: var(--s-2) 0; }
.danger-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-2); margin-top: var(--s-3); }
.ai-answer { margin: var(--s-2) 0; padding: 10px 12px; border-left: 2px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-aid); font-size: var(--fs-small); }
.ai-answer[hidden] { display: none; }

/* Moduli acquistabili: richieste, collegamenti e abilitazioni. */
.mod-card-actions { display: inline-flex; align-items: center; gap: var(--s-2); }
.link-button { padding: 0; border: 0; background: none; color: var(--brand-text); font: inherit; font-size: var(--fs-small); cursor: pointer; text-decoration: none; }
.link-button:hover { text-decoration: underline; }
.link-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: 10px 0; border-top: 1px solid var(--border); }
.link-row:first-of-type { border-top: 0; }
.link-row p { margin: 2px 0 0; }
.cell-form { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
table.entitlements th { white-space: nowrap; }
.mod-card-actions .link-button { white-space: nowrap; }
fieldset.norm-choice { border: 0; padding: 0; margin: 0 0 var(--s-2); display: flex; flex-wrap: wrap; gap: 4px var(--s-3); } fieldset.norm-choice legend { padding: 0; font-size: 12.5px; font-weight: 500; }

/* Percorsi con molte tappe: i nomi stanno nel menu, qui bastano i segni. */
.mod-track-long .mod-phase-name { display: none; }

/* Da schermo largo le parole nelle tabelle dei documenti restano intere. */
@media (min-width: 561px) {
  .paper th, .paper td { hyphens: manual; overflow-wrap: normal; }
}

/* Aspetto dei documenti: colorazione, logo, esempio */
.look-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1.25rem; align-items: start; }
.look-side { display: grid; gap: 1.25rem; }
.look-side h2 { margin-top: 0; }
.palette-list { display: grid; gap: 0.5rem; border: 0; margin: 0 0 1rem; padding: 0; }
.palette-choice { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.palette-choice:has(input:checked) { border-color: var(--brand, #603ffe); box-shadow: inset 0 0 0 1px var(--brand, #603ffe); }
.palette-choice:has(input:focus-visible) { outline: 2px solid var(--brand, #603ffe); outline-offset: 2px; }
.palette-choice input { margin: 0; }
.palette-name { flex: 1; font-weight: 500; }
.swatch { display: inline-flex; gap: 2px; }
.swatch i { display: block; width: 1.05rem; height: 1.05rem; border-radius: 3px; }
.swatch-lorna i:nth-child(1) { background: #603ffe; } .swatch-lorna i:nth-child(2) { background: #f1eefe; }
.swatch-blu i:nth-child(1) { background: #1f4e8c; } .swatch-blu i:nth-child(2) { background: #e8eff8; }
.swatch-verde i:nth-child(1) { background: #1f6f5c; } .swatch-verde i:nth-child(2) { background: #e6f2ee; }
.swatch-bordeaux i:nth-child(1) { background: #8c1f3f; } .swatch-bordeaux i:nth-child(2) { background: #f7e9ee; }
.swatch-grafite i:nth-child(1) { background: #3a3f47; } .swatch-grafite i:nth-child(2) { background: #eceef1; }
@media (max-width: 900px) { .look-grid { grid-template-columns: minmax(0, 1fr); } }

/* Tabella di marcia */
.road { list-style: none; margin: 0; padding: 0; }
.road-step { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; gap: 0.25rem 1rem; align-items: start; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.road-step:first-child { border-top: 0; }
.road-date { font-variant-numeric: tabular-nums; color: var(--muted, inherit); font-size: 0.86rem; }
.road-body { display: grid; gap: 0.1rem; }
.road-step.is-fatta strong { font-weight: 500; opacity: 0.7; }
.road-step.is-adesso .road-date, .road-step.is-in_ritardo .road-date { font-weight: 600; }
@media (max-width: 560px) { .road-step { grid-template-columns: minmax(0, 1fr) auto; } .road-date { grid-column: 1 / -1; } }

/* Clienti per fase */
.phase-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.phase-col { background: var(--surface-aid); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem; display: grid; gap: 0.5rem; align-content: start; min-height: 8rem; }
.phase-col h3 { margin: 0; font-size: 0.9rem; }
.phase-card { display: grid; gap: 0.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.55rem 0.65rem; justify-items: start; }
@media (max-width: 1024px) { .phase-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .phase-board { grid-template-columns: minmax(0, 1fr); } }
/* Marchio dello studio nel menu del cliente */
.side-studio { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.35rem; color: var(--muted); font-size: 0.74rem; }
.side-studio img { max-height: 1.35rem; max-width: 4.5rem; border-radius: 3px; background: #ffffff; padding: 1px; }

/* Avvisi, matrici, resoconto */
.topbar-icon { position: relative; }
.topbar-count { position: absolute; top: -4px; right: -6px; min-width: 1.05rem; height: 1.05rem; padding: 0 0.22rem; border-radius: 999px; background: #d92d20; color: #ffffff; font-size: 0.64rem; font-weight: 600; line-height: 1.05rem; text-align: center; }
.read-matrix th[scope="row"], .resp-matrix th[scope="row"] { font-weight: 500; text-align: left; }
.resp-area th { background: var(--surface-aid); font-size: 0.78rem; text-align: left; }
.resp-matrix td { text-align: center; }
.resp-dot { color: var(--brand, #603ffe); }

/* Registro dei rischi */
.risk-layout { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 0.78rem; }
.heat th { font-weight: 500; text-align: center; }
.heat tbody th { text-align: left; }
.heat td { height: 2.6rem; text-align: center; font-weight: 600; border-radius: 4px; }
.heat-basso { background: #e3f4e8; color: #17603a; }
.heat-medio { background: #fdf0cf; color: #6b4e00; }
.heat-alto { background: #fbe0dc; color: #8f1d12; }
.plain-fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.plain-fieldset h2 { margin: 0.5rem 0 0; }
@media (max-width: 900px) { .risk-layout { grid-template-columns: minmax(0, 1fr); } }

/* Segnalazioni */
.wb-code { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; overflow-wrap: anywhere; }
.wb-msg { border-left: 2px solid var(--border-strong); padding: 0.2rem 0 0.2rem 0.75rem; margin: 0.6rem 0; }
.wb-msg p { margin: 0.15rem 0 0; white-space: pre-line; }
.wb-gestore { border-left-color: var(--brand, #603ffe); }
.pre-line { white-space: pre-line; }

/* Righe fitte con piccole azioni */
.row-form { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.row-form input[type="date"] { width: 9.2rem; }
.row-form input[type="text"] { width: 8.5rem; }
.row-form select { width: 9.5rem; }
.row-more summary { cursor: pointer; color: var(--muted); font-size: var(--fs-small, 0.85rem); }
.row-more[open] summary { margin-bottom: 0.35rem; }

body.pagina-chiara { min-height: 100vh; }
body.pagina-chiara .site-header { background: #ffffff; }
body.pagina-chiara .card { box-shadow: 0 1px 3px rgba(21, 21, 27, 0.05); }
body.pagina-chiara .eyebrow { color: var(--brand-text); }

/* Canale di segnalazione: modi, logo, codice QR */
.wb-solo-vocale, .wb-solo-incontro, .wb-non-scritta { display: none; }
.wb-form:has(input[name="modo"][value="vocale"]:checked) .wb-solo-vocale,
.wb-form:has(input[name="modo"][value="incontro"]:checked) .wb-solo-incontro { display: block; }
.wb-form:has(input[name="modo"][value="vocale"]:checked) .wb-solo-scritta,
.wb-form:has(input[name="modo"][value="incontro"]:checked) .wb-solo-scritta { display: none; }
.wb-form:has(input[name="modo"][value="vocale"]:checked) .wb-non-scritta,
.wb-form:has(input[name="modo"][value="incontro"]:checked) .wb-non-scritta { display: inline; }
.wb-logo { display: block; max-height: 3rem; max-width: 12rem; margin-bottom: 0.75rem; }
.wb-qr { display: block; margin: 0.5rem 0; background: #ffffff; }
.wb-info li { margin-bottom: 0.4rem; }
.inline-form { display: inline; }

/* Controlli del canale */
.check-list li { padding: 0.45rem 0; border-top: 1px solid var(--border); }
.check-list li:first-child { border-top: 0; }
.check-list p { margin: 0.1rem 0 0 1.6rem; }

/* ---- Intestazione e menu come in SOPHIA: logo sul bianco, area di lavoro con l'angolo arrotondato ---- */
.side-riduci { display: none; }
@media (min-width: 1024px) {
  body:has(> .side) { background: #ffffff; }
  body:has(> .side) .canvas { border-top-left-radius: 24px; box-shadow: inset 1px 1px 0 var(--border); }
  .topbar { border-bottom: 0; }
  .side-riduci {
    display: flex; align-items: center; gap: 9px; width: 100%; min-height: 30px; padding: 0 9px; border: 0; border-radius: 9px; background: transparent;
    font: inherit; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, 0.72); cursor: pointer;
  }
  .side-riduci:hover { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
  .side-riduci .side-icon { color: currentColor; }

  /* Menu ridotto a sole icone: una scelta di chi lavora, mai automatica. */
  html.menu-ridotto body:has(> .side) { --side-w: 64px; }
  html.menu-ridotto .side-top { justify-content: center; padding: 0; }
  html.menu-ridotto .side-marchio .brand, html.menu-ridotto .side-context, html.menu-ridotto .side-note,
  html.menu-ridotto .side-chevron, html.menu-ridotto .side-done, html.menu-ridotto .side-envs { display: none; }
  html.menu-ridotto .side-simbolo { display: block; }
  html.menu-ridotto .side-body { padding-top: 12px; }
  html.menu-ridotto .side-nav { padding: 0 10px; }
  html.menu-ridotto .side-group { height: 1px; margin: 8px 4px; padding: 0; overflow: hidden; color: transparent; background: rgba(255, 255, 255, 0.16); }
  html.menu-ridotto .side-label, html.menu-ridotto .side-riduci-testo, html.menu-ridotto .side-user-text, html.menu-ridotto .side-module-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  html.menu-ridotto .side-link, html.menu-ridotto .side-module > summary { justify-content: center; min-height: 44px; padding: 0; }
  html.menu-ridotto .side-step { margin: 0; }
  html.menu-ridotto .side-count { position: absolute; top: 1px; right: 0; margin: 0; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; background: var(--brand); }
  html.menu-ridotto .side-module ul { margin: 2px 0 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); }
  html.menu-ridotto .side-section-foot { padding-top: 8px; }
  html.menu-ridotto .side-foot { margin: 10px 8px 0; padding: 4px; }
  html.menu-ridotto .side-riduci { justify-content: center; padding: 0; }
  html.menu-ridotto .side-riduci .side-icon { transform: scaleX(-1); }
  html.menu-ridotto .side-user { flex-direction: column; gap: 4px; padding: 4px; }
}
.side-tip {
  position: fixed; z-index: 60; transform: translateY(-50%); padding: 4px 9px; border-radius: 7px; background: #15151b; color: #ffffff;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 10px rgba(21, 21, 27, 0.25);
}
.side-tip[hidden] { display: none; }

/* ---- Caricamento intelligente ---- */
.zona-carica { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.zona-carica [hidden] { display: none; }
.zona-area {
  width: 100%; min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-aid); cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.zona-area:hover, .zona-area.is-active { border-color: var(--brand); background: var(--brand-tint); }
#file-arrivo:focus-visible + .zona-area { outline: 2px solid var(--brand); outline-offset: 2px; }
.zona-icona { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-text); }
.zona-icona-svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lettura-stato { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-small); color: var(--muted); }
.lettura-stato li { display: inline-flex; align-items: center; gap: 6px; }
.lettura-stato li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.lettura-stato li.is-on::before { background: var(--brand); box-shadow: none; }
.zona-esiti { width: 100%; margin: 0; padding: 0; list-style: none; }
.zona-esiti li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 7px 0; border-top: 1px solid var(--border); font-size: var(--fs-small); }
.zona-esiti li:first-child { border-top: 0; }
.zona-nome { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.zona-esiti li.is-error .zona-esito { color: var(--danger); }
.zona-esiti li.is-done .zona-esito { color: var(--brand-text); }
.zona-nota { margin: 8px 0 0; }
.zona-coda { align-items: center; margin-top: 18px; }
.zona-coda h3 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.zona-conta { margin-left: 0; background: var(--brand); }

/* La conferma: il documento accanto alla proposta, come in SOPHIA. */
.revisione { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.revisione .card { margin-bottom: 0; }
.revisione > div > * + * { margin-top: 14px; }
.revisione-anteprima { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 76px; }
.anteprima-pagine { display: flex; flex-direction: column; gap: 8px; max-height: 74vh; overflow-y: auto; padding: 8px; border-radius: 10px; background: var(--bg); }
.anteprima-pagine img { display: block; width: 100%; height: auto; border-radius: 7px; background: #ffffff; box-shadow: 0 1px 4px rgba(21, 21, 27, 0.14); }
.anteprima-testo { margin: 0; padding: 12px 14px; border-radius: 7px; background: #ffffff; color: var(--text); font: inherit; font-size: var(--fs-small); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.revisione-proposta { display: flex; flex-direction: column; gap: 12px; }
.revisione-proposta .card-head { align-items: center; margin-bottom: 0; }
.revisione-proposta .card-head form { margin: 0; }
.revisione-proposta .flash { margin: 0; }
.revisione-proposta .flash ul { margin: 0; }
.revisione-proposta .field { margin-bottom: 0; }
.revisione-proposta .stack { display: flex; flex-direction: column; gap: 12px; }
.revisione-proposta .decision-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.badge-row { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.revisione-motivi { font-size: var(--fs-small); color: var(--text-2); }
.revisione-motivi summary { cursor: pointer; font-weight: 600; color: var(--text); }
.revisione-motivi ul { margin: 6px 0 0; padding-left: 18px; }
.revisione-collegamenti { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; }
.revisione-collegamenti legend { padding: 0; margin-bottom: 6px; font-weight: 500; }
.revisione-collegamenti h3 { margin: 10px 0 6px; font-size: var(--fs-small); }
.revisione-azioni { justify-content: space-between; margin: 4px 0 0; }
@media (max-width: 1023px) {
  .revisione { grid-template-columns: minmax(0, 1fr); }
  .revisione-anteprima { position: static; }
  .anteprima-pagine { max-height: 60vh; }
}

/* ---- Tutta la larghezza, come in SOPHIA: più spazio, più contenuto. Una pagina non resta mai a metà. ---- */
body:has(> .side) .narrow { max-width: none; margin-left: 0; margin-right: 0; }
body:has(> .side) .canvas .lead { max-width: none; }
@media (min-width: 1024px) {
  body:has(> .side) .config-form { max-width: none; }
}
/* Il lavoro a sinistra, gli aiuti a destra. Sul telefono gli aiuti vengono prima, come nell'ordine di lettura. */
.due-colonne { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.due-colonne > aside { order: -1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.due-colonne .card, .due-colonne > aside .card { margin-bottom: 0; }
.due-colonne > div, .due-colonne > form { min-width: 0; }
.due-colonne > div > * + * { margin-top: 14px; }
.tre-fatti { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0 0 14px; padding: 0; list-style: none; }
.tre-fatti li { margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-aid); font-size: var(--fs-small); }
/* Il documento come un foglio, centrato; revisioni e approvazione accanto. */
.layout-documento { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.layout-documento > div { min-width: 0; }
.layout-documento > aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.layout-documento > aside .card { margin-bottom: 0; }
@media (min-width: 1200px) {
  .due-colonne { grid-template-columns: minmax(0, 1fr) 360px; }
  .due-colonne > aside { order: 2; }
  .layout-documento { grid-template-columns: minmax(0, 1fr) 380px; }
  .layout-documento .paper { max-width: 980px; margin-left: auto; margin-right: auto; }
  body:has(> .side) .check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 2px 28px; }
}
.due-colonne > aside.dopo { order: 0; }

/* I moduli riempiono la riga: un campo lungo sotto non deve bloccare gli altri a sinistra. */
body:has(> .side) .decision-grid:has(> .grouped) { display: flex; flex-wrap: wrap; }
body:has(> .side) .decision-grid:has(> .grouped) > .field { flex: 1 1 220px; min-width: 0; }
body:has(> .side) .decision-grid:has(> .grouped) > .grouped { flex: 1 1 100%; max-width: none; }
body:has(> .side) .inline-row .cell { max-width: none; }
@media (min-width: 1200px) {
  .plan-facts.a-colonne { grid-template-columns: repeat(3, auto minmax(0, 1fr)); }
}

/* Se accanto al foglio non c'è niente, il foglio resta al centro della pagina. */
.layout-documento > aside:not(:has(*)) { display: none; }
@media (min-width: 1200px) {
  .layout-documento:not(:has(> aside *)) { grid-template-columns: minmax(0, 1fr); }
}
/* Tante colonne quante sono le schede: nessuna resta da sola con mezza riga vuota. */
.griglia-adatta { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.griglia-adatta > .card { margin-bottom: 0; }

/* Quadro dei rischi 231 */
.catalogo-nota { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 18px; font-size: var(--fs-small); color: var(--muted); }
.proposte { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.proposta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.proposta-testo p { margin: 6px 0 0; }
.proposta-testo .badge { margin-left: 6px; }
.proposta-azioni { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: flex-end; max-width: 380px; }
.proposta-escludi > summary { list-style: none; }
.proposta-escludi > summary::-webkit-details-marker { display: none; }
.proposta-escludi[open] { flex-basis: 100%; }
.proposta-escludi[open] > summary { margin-bottom: 8px; }
.riga-area { display: block; }
.riga-area + .riga-area { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.matrice-clienti th, .matrice-clienti td { text-align: center; vertical-align: middle; }
.matrice-clienti th[scope="row"], .matrice-clienti td:first-child { text-align: left; }
.matrice-clienti thead th { font-size: 12px; font-weight: 600; line-height: 1.25; min-width: 6.4rem; }
.matrice-clienti thead th span { display: block; font-weight: 400; color: var(--muted); }
.matrice-clienti tbody th[scope="row"] { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 12rem; }
@media (max-width: 720px) { .proposta { grid-template-columns: minmax(0, 1fr); } .proposta-azioni { justify-content: flex-start; } }
.filters-tight { margin: 0; }
.lista-clienti { list-style: none; margin: 10px 0 0; padding: 0; }
.lista-clienti li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); }
.paper-figure { margin: 0.4rem 0 1rem; overflow-x: auto; }
.paper-figure .grafico-svg { margin: 0 auto; }

/* Sicurezza e dati */
.sicurezza-lista { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 4px 32px; }
.sicurezza-lista li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.sicurezza-lista p { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-small); }
.sicurezza-segno { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-aid); color: var(--muted); font-weight: 600; font-size: 13px; }
.sicurezza-ok { background: var(--brand-tint); color: var(--brand-text); }
.footer a { color: inherit; }


/* ==== Grafici, matrici e indicatori (lorna/grafici.py, templates/_grafici.html) ====
   Rischio: corallo, albicocca, lavanda (controllati per chi distingue male i colori). Avanzamento: la scala del viola.
   La parola accompagna sempre il colore; le larghezze sono classi q-0 … q-100, mai stili in linea. */
:root {
  --c-alto: #da3546; --c-alto-tenue: #fbe3e5; --c-alto-testo: #a11f2e;
  --c-medio: #f2925f; --c-medio-tenue: #fdebdd; --c-medio-testo: #8a4512;
  --c-basso: #cdc8e6; --c-basso-tenue: #f1eff8; --c-basso-testo: #4a4568;
  --c-fatto: #603ffe; --c-in-corso: #a08fff; --c-da-fare: #e4dff7;
  --g-traccia: #f3f1fa; --g-griglia: #eeebf7; --g-ombra: 0 1px 2px rgba(21, 21, 27, 0.04), 0 6px 18px rgba(64, 40, 160, 0.05);
}
.q-0 { --q: 0%; }
.q-1 { --q: 1%; }
.q-2 { --q: 2%; }
.q-3 { --q: 3%; }
.q-4 { --q: 4%; }
.q-5 { --q: 5%; }
.q-6 { --q: 6%; }
.q-7 { --q: 7%; }
.q-8 { --q: 8%; }
.q-9 { --q: 9%; }
.q-10 { --q: 10%; }
.q-11 { --q: 11%; }
.q-12 { --q: 12%; }
.q-13 { --q: 13%; }
.q-14 { --q: 14%; }
.q-15 { --q: 15%; }
.q-16 { --q: 16%; }
.q-17 { --q: 17%; }
.q-18 { --q: 18%; }
.q-19 { --q: 19%; }
.q-20 { --q: 20%; }
.q-21 { --q: 21%; }
.q-22 { --q: 22%; }
.q-23 { --q: 23%; }
.q-24 { --q: 24%; }
.q-25 { --q: 25%; }
.q-26 { --q: 26%; }
.q-27 { --q: 27%; }
.q-28 { --q: 28%; }
.q-29 { --q: 29%; }
.q-30 { --q: 30%; }
.q-31 { --q: 31%; }
.q-32 { --q: 32%; }
.q-33 { --q: 33%; }
.q-34 { --q: 34%; }
.q-35 { --q: 35%; }
.q-36 { --q: 36%; }
.q-37 { --q: 37%; }
.q-38 { --q: 38%; }
.q-39 { --q: 39%; }
.q-40 { --q: 40%; }
.q-41 { --q: 41%; }
.q-42 { --q: 42%; }
.q-43 { --q: 43%; }
.q-44 { --q: 44%; }
.q-45 { --q: 45%; }
.q-46 { --q: 46%; }
.q-47 { --q: 47%; }
.q-48 { --q: 48%; }
.q-49 { --q: 49%; }
.q-50 { --q: 50%; }
.q-51 { --q: 51%; }
.q-52 { --q: 52%; }
.q-53 { --q: 53%; }
.q-54 { --q: 54%; }
.q-55 { --q: 55%; }
.q-56 { --q: 56%; }
.q-57 { --q: 57%; }
.q-58 { --q: 58%; }
.q-59 { --q: 59%; }
.q-60 { --q: 60%; }
.q-61 { --q: 61%; }
.q-62 { --q: 62%; }
.q-63 { --q: 63%; }
.q-64 { --q: 64%; }
.q-65 { --q: 65%; }
.q-66 { --q: 66%; }
.q-67 { --q: 67%; }
.q-68 { --q: 68%; }
.q-69 { --q: 69%; }
.q-70 { --q: 70%; }
.q-71 { --q: 71%; }
.q-72 { --q: 72%; }
.q-73 { --q: 73%; }
.q-74 { --q: 74%; }
.q-75 { --q: 75%; }
.q-76 { --q: 76%; }
.q-77 { --q: 77%; }
.q-78 { --q: 78%; }
.q-79 { --q: 79%; }
.q-80 { --q: 80%; }
.q-81 { --q: 81%; }
.q-82 { --q: 82%; }
.q-83 { --q: 83%; }
.q-84 { --q: 84%; }
.q-85 { --q: 85%; }
.q-86 { --q: 86%; }
.q-87 { --q: 87%; }
.q-88 { --q: 88%; }
.q-89 { --q: 89%; }
.q-90 { --q: 90%; }
.q-91 { --q: 91%; }
.q-92 { --q: 92%; }
.q-93 { --q: 93%; }
.q-94 { --q: 94%; }
.q-95 { --q: 95%; }
.q-96 { --q: 96%; }
.q-97 { --q: 97%; }
.q-98 { --q: 98%; }
.q-99 { --q: 99%; }
.q-100 { --q: 100%; }
.c-alto { background: var(--c-alto); } .c-medio { background: var(--c-medio); } .c-basso { background: var(--c-basso); }
.c-fatto { background: var(--c-fatto); } .c-in-corso { background: var(--c-in-corso); } .c-da-fare { background: var(--c-da-fare); }
.s-alto { stroke: var(--c-alto); } .s-medio { stroke: var(--c-medio); } .s-basso { stroke: var(--c-basso); }
.s-fatto { stroke: var(--c-fatto); } .s-in-corso { stroke: var(--c-in-corso); } .s-da-fare { stroke: var(--c-da-fare); }

.grafico { margin: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grafico-titolo { display: flex; flex-direction: column; gap: 4px; }
.grafico-titolo strong { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.grafico-titolo span { font-size: 13px; line-height: 1.45; color: var(--muted); }
.grafico-legenda { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.grafico-legenda li { display: inline-flex; align-items: center; gap: 8px; }
.grafico-legenda i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.grafico-legenda b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.grafico-legenda .is-vuota { opacity: 0.5; }
.grafico-nota { margin: 0; font-size: 13px; color: var(--muted); }
.grafico-dati { margin-top: -4px; }
.grafico-dati summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--muted); width: max-content; list-style: none; }
.grafico-dati summary::-webkit-details-marker { display: none; }
.grafico-dati summary::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform 0.15s ease; }
.grafico-dati[open] summary::before { transform: rotate(90deg); }
.grafico-dati summary:hover { color: var(--brand-text); }
.grafico-dati[open] summary { margin-bottom: 8px; }
.grafico-area { min-width: 0; }
.grafico-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.grafico-tip {
  position: fixed; z-index: 60; transform: translate(-50%, calc(-100% - 12px)); max-width: 320px; padding: 7px 11px; border-radius: 9px;
  background: #15151b; color: #ffffff; font-size: 12.5px; font-weight: 500; line-height: 1.35; pointer-events: none; box-shadow: 0 8px 24px rgba(21, 21, 27, 0.25);
}
.grafico-tip[hidden] { display: none; }
.grafici-due { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; align-items: stretch; }
.grafici-due > .grafico, .pannello { padding: 22px 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--g-ombra); }
.grafici-due > section.card { margin: 0; }

/* Barre orizzontali, anche divise in parti */
.g-barre { display: flex; flex-direction: column; gap: 4px; }
.g-riga { display: grid; grid-template-columns: minmax(92px, 36%) minmax(0, 1fr) 2.4rem; gap: 14px; align-items: center; padding: 6px 8px; margin: 0 -8px;
  border-radius: 10px; color: inherit; text-decoration: none; outline: none; transition: background-color 0.15s ease; }
.g-riga:hover, .g-riga:focus-visible { background: #f8f7fd; }
.g-riga:focus-visible { box-shadow: var(--focus); }
.g-nome { font-size: 13.5px; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-traccia { position: relative; height: 12px; border-radius: 6px; background: var(--g-traccia); overflow: hidden; }
.g-barra, .g-pila { position: absolute; top: 0; bottom: 0; left: 0; width: var(--q); border-radius: 6px; transform-origin: left center; animation: g-cresci 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.g-pila { display: flex; overflow: hidden; }
.g-pila > span { flex: 0 0 var(--q); height: 100%; box-sizing: border-box; }
.g-pila > span + span { border-left: 2px solid var(--surface); }
.g-valore { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
@keyframes g-cresci { from { transform: scaleX(0); } }

/* Anello: le parti di un intero, con il totale al centro */
.g-anello { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; align-items: center; }
.g-anello svg { width: 150px; height: 150px; display: block; overflow: visible; }
.g-anello__fondo { fill: none; stroke: var(--g-traccia); stroke-width: 16; }
.g-anello__fetta { fill: none; stroke-width: 16; outline: none; transition: stroke-width 0.15s ease, opacity 0.15s ease; animation: g-anello 0.9s ease both; }
.g-anello svg:hover .g-anello__fetta { opacity: 0.45; }
.g-anello svg .g-anello__fetta:hover, .g-anello__fetta:focus-visible { opacity: 1; stroke-width: 21; }
.g-anello__totale { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; fill: var(--text); }
.g-anello__unita { font-size: 11.5px; fill: var(--muted); }
.g-anello__legenda { flex-direction: column; gap: 4px; font-size: 14px; }
.g-anello__legenda li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--g-griglia); }
.g-anello__legenda li:last-child { border-bottom: 0; }
.g-anello__legenda b { font-size: 16px; }
@keyframes g-anello { from { opacity: 0; } }

/* Colonne nel tempo */
.g-colonne { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); grid-template-rows: 190px auto; column-gap: 10px; }
.g-colonne__asse { position: relative; }
.g-colonne__asse span { position: absolute; right: 0; bottom: var(--q); transform: translateY(50%); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-colonne__area { position: relative; display: flex; align-items: stretch; gap: 8px; border-bottom: 1px solid var(--border-strong); }
.g-colonne__linea { position: absolute; left: 0; right: 0; bottom: var(--q); border-top: 1px solid var(--g-griglia); }
.g-col { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; outline: none; border-radius: 8px 8px 0 0; }
.g-col:hover, .g-col:focus-visible { background: rgba(96, 63, 254, 0.05); }
.g-col__barra { width: min(30px, 62%); height: var(--q); border-radius: 8px 8px 3px 3px; transform-origin: bottom center; animation: g-sali 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.g-col__valore { margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.g-colonne__etichette { display: flex; gap: 8px; padding-top: 8px; }
.g-colonne__etichette span { flex: 1; min-width: 0; text-align: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes g-sali { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .g-barra, .g-pila, .g-col__barra, .g-anello__fetta { animation: none; } }

/* Matrice probabilità per gravità */
.g-matrice { display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: auto auto; gap: 6px 8px; }
.g-matrice__asse-y { writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; justify-self: center; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.g-matrice__asse-x { justify-self: center; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-left: 60px; }
.g-mat { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; margin: -6px; width: calc(100% + 12px); }
.g-mat th { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.g-mat tbody th { width: 60px; text-align: right; padding-right: 4px; }
.g-mat tfoot th { text-align: center; padding-top: 2px; }
.g-mat td { height: 64px; border-radius: 12px; text-align: center; vertical-align: middle; outline: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.g-mat td b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.g-mat td:focus-visible { box-shadow: var(--focus); }
.g-mat td.piena:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(21, 21, 27, 0.12); }
.g-mat .lv-alto { background: var(--c-alto-tenue); } .g-mat .lv-alto.piena { background: var(--c-alto); color: #ffffff; }
.g-mat .lv-medio { background: var(--c-medio-tenue); } .g-mat .lv-medio.piena { background: var(--c-medio); color: #2a1406; }
.g-mat .lv-basso { background: var(--c-basso-tenue); } .g-mat .lv-basso.piena { background: var(--c-basso); color: #23203a; }
.g-mat tfoot td { height: auto; background: none; }

/* Livelli: pallino colorato e parola */
.livello { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; line-height: 1.3; }
.livello::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.livello-alto { background: var(--c-alto-tenue); color: var(--c-alto-testo); }
.livello-medio { background: var(--c-medio-tenue); color: var(--c-medio-testo); }
.livello-basso { background: var(--c-basso-tenue); color: var(--c-basso-testo); }
.livello.pieno::before { display: none; }
.livello-alto.pieno { background: var(--c-alto); color: #ffffff; }
.livello-medio.pieno { background: var(--c-medio); color: #2a1406; }
.livello-basso.pieno { background: var(--c-basso); color: #23203a; }
.livello-nessuno { color: #b6b3c4; padding: 4px; font-weight: 500; }
.livello-nessuno::before, .livello-da-valutare::before { display: none; }
.livello-da-valutare { background: var(--surface); color: var(--muted); border: 1px dashed var(--border-strong); font-weight: 500; }

/* Indicatori: etichetta sopra, numero grande sotto, filo viola a sinistra */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 18px 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--g-ombra); overflow: hidden; }
.stat-tile::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.stat-tile a { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; }
.stat-tile span { order: -1; font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.stat-tile strong { font-size: 32px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; color: var(--text); }
.stat-tile a:hover strong { color: var(--brand-text); text-decoration: none; }
.stat-tile.is-alto::before { background: var(--c-alto); }
.stat-tile.is-attesa::before { background: var(--c-medio); }
.stat-tile.is-quieto::before { background: var(--border-strong); }

/* Matrice live nelle valutazioni */
.quadro-vivo-griglia { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 18px 28px; align-items: center; }
.quadro-livelli { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.quadro-livelli li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-aid); }
.quadro-livelli strong { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

@media (max-width: 720px) {
  .g-anello { grid-template-columns: 1fr; justify-items: center; }
  .g-anello__legenda { width: 100%; }
  .g-riga { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) 2rem; gap: 10px; }
  .quadro-vivo-griglia { grid-template-columns: minmax(0, 1fr); }
  .quadro-livelli { flex-direction: row; flex-wrap: wrap; }
  .g-mat td { height: 52px; }
}
@media (max-width: 600px) {
  .grafico-area, .paper-figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grafico-area .grafico-svg { min-width: 440px; }
  .paper-figure .grafico-svg { min-width: 600px; }
}
.sezione-grafici { margin: 0 0 20px; }
.sezione-titolo { margin: 4px 0 12px; font-size: var(--fs-section); font-weight: 600; letter-spacing: -0.01em; }
.grafici-due > .largo { grid-column: 1 / -1; display: flex; }
.grafici-due > .largo > .grafico { flex: 1; padding: 22px 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--g-ombra); }
@media (min-width: 1100px) { .grafici-largo-stretto { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.matrice-clienti td { padding: 5px 4px; }
.matrice-clienti .livello { width: 100%; min-width: 4.6rem; padding: 8px 6px; border-radius: 9px; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.matrice-clienti a.livello:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(21, 21, 27, 0.14); }
.matrice-clienti .livello-da-valutare { padding: 7px 6px; }
.g-mat th, .g-mat td { border: 0; padding: 0; background-clip: padding-box; }
.g-mat tbody th { padding-right: 8px; }
.g-mat tfoot th { padding-top: 4px; }
.g-col { justify-content: flex-start; }
.g-col__barra { position: absolute; bottom: 0; left: 50%; margin-left: max(-15px, -31%); }
.g-col__valore { position: absolute; left: 0; right: 0; bottom: calc(var(--q) + 6px); margin: 0; text-align: center; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-tile { padding: 14px 14px 14px 16px; gap: 6px; }
  .stat-tile::before { top: 14px; bottom: 14px; }
  .stat-tile span { font-size: 12.5px; }
  .stat-tile strong { font-size: 26px; }
  .grafici-due > .grafico, .grafici-due > .largo > .grafico, .pannello { padding: 18px 16px; }
}

/* ==== Spazi dei moduli, come in SOPHIA: il nome del modulo sotto il logo ==== */
.side-marchio { display: flex; flex-direction: column; align-items: flex-start; }
.side-modulo { display: block; margin: 3px 0 0 1px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--brand); white-space: nowrap; }
html.menu-ridotto .side-modulo { display: none; }
.modulo-testa { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; margin: 4px 0 20px; }
.modulo-icona { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: 16px; background: var(--brand-tint); color: var(--brand); }
.modulo-icona-svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.modulo-testi h1 { margin: 2px 0 4px; }
.modulo-testi .lead { margin: 0; max-width: 72ch; }
.btn-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 4px; }
.modulo-adesso { margin-bottom: 20px; }
.modulo-adesso .now, section.now.modulo-adesso { margin-bottom: 20px; }
@media (min-width: 1100px) { .grafici-stretto-largo { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); } }
.tappe-modulo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tappa { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--g-griglia); }
.tappa:last-child { border-bottom: 0; }
.tappa-numero { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-aid); color: var(--muted); font-size: 13px; font-weight: 700; }
.tappa-completata .tappa-numero { background: var(--brand); color: #ffffff; }
.tappa-in_corso .tappa-numero { background: var(--brand-tint); color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand) inset; }
.tappa-ok { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tappa-testo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tappa-testo a { font-weight: 600; color: var(--text); text-decoration: none; }
.tappa-testo a:hover { color: var(--brand-text); }
.tappa-da_iniziare .tappa-testo strong { font-weight: 500; color: var(--muted); }
.modulo-traccia { margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.strumenti { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.strumento { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; box-shadow: var(--g-ombra); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.strumento:hover { transform: translateY(-1px); border-color: var(--brand); box-shadow: 0 8px 22px rgba(64, 40, 160, 0.12); }
.strumento-icona { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--brand-tint); color: var(--brand); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; box-sizing: border-box; }
.strumento .side-count { margin-left: auto; }
.stat-tile strong small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
@media (max-width: 720px) { .modulo-testa { grid-template-columns: auto minmax(0, 1fr); } .modulo-testa > .btn { grid-column: 1 / -1; justify-self: start; } }
.sezione-testa { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.moduli-schede { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.modulo-scheda { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--g-ombra); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.modulo-scheda:hover, .modulo-scheda:focus-visible { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 12px 28px rgba(64, 40, 160, 0.14); outline: none; }
.modulo-scheda-testa { display: flex; align-items: center; gap: 14px; }
.modulo-scheda .modulo-icona { width: 48px; height: 48px; border-radius: 14px; }
.modulo-scheda .modulo-icona-svg { width: 25px; height: 25px; }
.modulo-scheda-nome { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modulo-scheda-nome strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.modulo-scheda-nome span { font-size: 13px; color: var(--muted); }
.modulo-scheda-nota { font-size: 14px; color: var(--text-2); line-height: 1.45; }
.modulo-scheda-entra { margin-top: auto; padding-top: 4px; font-size: 14px; font-weight: 600; color: var(--brand-text); }
.modulo-scheda-aggiungi { border-style: dashed; background: var(--surface-aid); box-shadow: none; justify-content: center; }
.modulo-scheda-aggiungi strong { font-size: 16px; }
.now-modulo { display: inline-flex; align-items: center; margin-bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #ffffff; font-size: 12px; font-weight: 600; text-decoration: none; }
.now-modulo:hover { background: rgba(255, 255, 255, 0.2); }

/* ==== Grafica estesa a tutta LORNA (12/11/2026): le stesse schede, pillole e numeri dei grafici ==== */
body:has(> .side) .canvas .card:not(.card-quiet) { border-radius: 16px; border-color: var(--border); box-shadow: var(--g-ombra); padding: 20px 22px; }
body:has(> .side) .canvas .card-highlight { border-top: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--brand), var(--g-ombra); }
body:has(> .side) .canvas .card-alert { box-shadow: inset 0 3px 0 var(--c-alto), var(--g-ombra); }
body:has(> .side) .canvas .card-aid { border-radius: 16px; box-shadow: none; }
body:has(> .side) .canvas .card-quiet { box-shadow: none; }

/* Stati a pillola: pallino e parola su fondo tenue */
body:has(> .side) .canvas .badge:not(.badge-demo) { padding: 3px 10px 3px 8px; border-radius: 999px; background: #f1eff8; color: #4a4568; font-size: 12px; font-weight: 600; gap: 6px; }
body:has(> .side) .canvas .badge:not(.badge-demo)::before { width: 7px; height: 7px; box-shadow: none; background: #a8a3c4; }
body:has(> .side) .canvas .badge-ok { background: var(--brand-tint); color: var(--brand-text); }
body:has(> .side) .canvas .badge-ok::before { background: var(--brand); }
body:has(> .side) .canvas .badge-warn { background: var(--c-medio-tenue); color: var(--c-medio-testo); }
body:has(> .side) .canvas .badge-warn::before { background: var(--c-medio); }
body:has(> .side) .canvas .badge-late { background: var(--c-alto-tenue); color: var(--c-alto-testo); }
body:has(> .side) .canvas .badge-late::before { background: var(--c-alto); }
body:has(> .side) .canvas .badge-draft { background: #f4f3f9; color: #5b5873; }
body:has(> .side) .canvas .badge-draft::before { background: transparent; box-shadow: inset 0 0 0 1.5px #8d88a8; }
body:has(> .side) .canvas .badge-neutral { background: #f4f3f9; color: var(--muted); }
body:has(> .side) .canvas .badge-demo { padding: 3px 10px; }
body:has(> .side) .canvas .now .badge { background: rgba(255, 255, 255, 0.12); color: #ffffff; }

/* Avanzamento: la stessa traccia delle barre dei grafici */
body:has(> .side) progress { height: 8px; border-radius: 4px; background: var(--g-traccia); }
body:has(> .side) progress::-webkit-progress-bar { background: var(--g-traccia); border-radius: 4px; }
body:has(> .side) progress::-webkit-progress-value { background: var(--brand); border-radius: 4px; }
body:has(> .side) progress::-moz-progress-bar { background: var(--brand); border-radius: 4px; }

/* Tabelle: intestazioni leggere, righe che si accendono al passaggio */
body:has(> .side) table.dense thead th { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--border); }
body:has(> .side) table.dense tbody tr { transition: background-color 0.12s ease; }
body:has(> .side) table.dense tbody tr:hover { background: #faf9fe; }
body:has(> .side) table.dense td, body:has(> .side) table.dense th { border-bottom-color: var(--g-griglia); }

/* I numeri della Panoramica: come gli indicatori, con il filo a sinistra */
body:has(> .side) .canvas .tile { position: relative; padding: 14px 16px 14px 18px; border-radius: 16px; box-shadow: var(--g-ombra); overflow: hidden; }
body:has(> .side) .canvas .tile::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
body:has(> .side) .canvas .tile.is-zero::before { background: var(--border-strong); }
body:has(> .side) .canvas .tile-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
body:has(> .side) .canvas .tile:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(64, 40, 160, 0.12); }

/* Numeri in riga (portafoglio): piccole schede invece del testo sciolto */
body:has(> .side) .canvas .count-row.metrics { gap: 10px; margin: 6px 0 16px; }
body:has(> .side) .canvas .count-row.metrics li { display: inline-flex; align-items: baseline; gap: 6px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--g-ombra); }
body:has(> .side) .canvas .count-row.metrics strong { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.registro-anello { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--g-griglia); }
.risk-layout { grid-template-columns: minmax(22rem, 30rem) minmax(0, 1fr); }
@media (max-width: 900px) { .risk-layout { grid-template-columns: minmax(0, 1fr); } }
.g-mat tbody th { width: 76px; }
.g-matrice__asse-x { padding-left: 76px; }
.stat-tile strong.stat-data { font-size: 24px; }
