/* PLEASE — design system */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #16203a;
  --text-2: #475467;
  --muted: #667085;
  --faint: #98a2b3;
  --brand: #1f2a44;
  --brand-2: #2b3a5e;
  --accent: #2f5bea;
  --accent-soft: #eaf0fe;
  --accent-text: #2447c4;
  --green: #12805c;  --green-bg: #e7f5ee;
  --amber: #a15c07;  --amber-bg: #fdf3dc;
  --red: #c0362c;    --red-bg: #fdeceb;
  --grey: #667085;   --grey-bg: #eef0f3;
  --violet: #6941c6; --violet-bg: #f1ecfd;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px rgba(16, 24, 40, .16);
  --sidebar-w: 256px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 13.5px; line-height: 1.45;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 20px; height: 20px; }

/* ── layout ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: calc(100vh / var(--zm, 1)); }
.sidebar {
  background: var(--brand); color: #cbd3e6; display: flex; flex-direction: column;
  min-height: 0; border-right: 1px solid #0f1628;
}
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #4f7cff, #2f5bea);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: -.02em;
}
/* logo PLEASE su piastrella bianca (sul blu scuro i tratti scuri del logo sparirebbero) */
.brand-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 3px; object-fit: contain;
              flex: none; box-shadow: 0 1px 2px rgba(15, 22, 40, .25); }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; letter-spacing: .04em; }
.brand-sub { font-size: 11px; color: #8d99b8; }
.side-section { padding: 10px 12px; }
.side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7f8bab;
              padding: 6px 8px; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px;
  border: 0; background: transparent; color: #cbd3e6; cursor: pointer; text-align: left;
}
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
.project-pill {
  margin: 4px 0 2px; padding: 10px; border-radius: 8px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08); cursor: pointer; width: 100%; text-align: left; color: #fff;
}
.project-pill:hover { background: rgba(255, 255, 255, .1); }
.project-pill .pp-label { font-size: 10.5px; color: #8d99b8; text-transform: uppercase; letter-spacing: .06em; }
.project-pill .pp-name { font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { display: flex; flex-direction: column; gap: 2px; }
.step-link { position: relative; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px;
  font-weight: 600; border: 1.5px solid #52607f; color: #aeb8d0; flex: none;
}
.step-link.active .step-num { border-color: #6f93ff; background: #2f5bea; color: #fff; }
.step-link.done .step-num { border-color: #2fb383; background: #2fb383; color: #fff; }
.step-link.disabled { opacity: .45; cursor: default; }
.step-link.disabled:hover { background: transparent; color: #cbd3e6; }
.step-meta { display: flex; flex-direction: column; min-width: 0; }
.step-meta b { font-weight: 500; font-size: 13px; }
.step-meta span { font-size: 11px; color: #8d99b8; }
.step-tag { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 10px;
            background: rgba(255, 255, 255, .08); color: #aab4cc; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--faint); }
.content { flex: 1; overflow: auto; min-height: 0; }
/* «L'AI sta lavorando» (utente 06/10): avviso in basso in tutte le pagine; velo sullo step dove lavora l'AI */
.main { position: relative; }
.ai-busy { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 950; display: flex; align-items: center;
  gap: 10px; padding: 8px 10px 8px 14px; border-radius: 999px; background: #1e1b4b; color: #fff; box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: min(720px, 92vw); }
.ai-busy .ab-msg { color: #c7d2fe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ai-busy .spinner { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; width: 14px; height: 14px; flex: none; }
.ai-busy .btn { flex: none; }
.ai-velo { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(246, 247, 251, .72); }
.ai-velo-card { width: min(480px, 90%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 20px 22px; }
.page { padding: 24px 28px 48px; max-width: 1480px; margin: 0 auto; }
.page.full { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 21px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }

/* ── controls ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0cc; }
.btn:focus-visible, .input:focus, .select:focus, textarea:focus { outline: 2px solid rgba(47, 91, 234, .35); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2448c9; }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: #eef0f4; }
.btn.danger { color: var(--red); }
/* step concluso (output generato e aggiornato) / output da rigenerare dopo modifiche */
.btn.done { background: #14532d; border-color: #14532d; color: #fff; }
.btn.done:hover { background: #0f3f22; }
.btn.stale { background: #b42318; border-color: #b42318; color: #fff; }
.btn.stale:hover { background: #912018; }
.badge.step-ok { background: #14532d; color: #fff; border-color: #14532d; margin-left: auto; }
.step-stale .badge.red { margin-left: auto; }
.card.step-done { border-color: #86c9a3; }
.card.step-stale { border-color: #f1a9a2; }
.step-warn { color: #b42318; margin: -6px 0 12px; font-weight: 600; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.xs { height: 24px; padding: 0 7px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); min-width: 0; box-shadow: var(--shadow-sm);
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input.sm, .select.sm { height: 28px; font-size: 12.5px; padding: 0 8px; }
.select { padding-right: 26px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 32px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.seg { display: inline-flex; background: #eef0f4; border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--text-2);
  font-weight: 500; font-size: 12.5px;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.sm { flex-wrap: nowrap; }
.seg.sm button { padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ── surfaces ───────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-body { padding: 18px; }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.c1 { grid-template-columns: minmax(0, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius);
          border: 1px solid; font-size: 13px; }
.banner.info { background: var(--accent-soft); border-color: #cfdcfd; color: #1d3a9e; }
.banner.warn { background: var(--amber-bg); border-color: #f6dca4; color: #7a4506; }
.banner.danger { background: var(--red-bg); border-color: #f5c6c2; color: #8f261d; }
.banner.ok { background: var(--green-bg); border-color: #bfe5d1; color: #0c5c42; }
.banner .grow b { font-weight: 600; }

/* ── KPI ────────────────────────────────────────────────── */
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kpi .k-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.clickable { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.kpi.clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ── badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px;
         font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--grey-bg); color: var(--grey); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--accent-soft); color: var(--accent-text); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; display: inline-block; }
.dot.green { background: #17a673; } .dot.amber { background: #e0a100; } .dot.red { background: #d9453b; } .dot.grey { background: #c0c6d0; }
.conf { display: inline-flex; gap: 2px; }
.conf i { width: 4px; height: 12px; border-radius: 1px; background: #dde1e8; }
.conf.c3 i:nth-child(-n+3), .conf.c2 i:nth-child(-n+2), .conf.c1 i:nth-child(1) { background: currentColor; }
.conf.c3 { color: #17a673; } .conf.c2 { color: #e0a100; } .conf.c1 { color: #d9453b; }

/* ── tables ─────────────────────────────────────────────── */
/* intestazione sempre visibile, come "blocca riga superiore" di Excel: la riga dei titoli è sticky e resta ferma
   solo se è la tabella a scorrere, quindi ogni tabella scorre nel suo riquadro, alto al massimo quanto lo schermo */
.table-wrap { overflow: auto; max-height: calc(100vh / var(--zm, 1) - 170px); }
.modal-body .table-wrap { max-height: calc(70vh - 36px); }
.list-card .table-wrap { max-height: none; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); text-align: left; font-weight: 500;
             font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
             padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover td { background: #f7f9fc; }
table.t tbody tr.sel td { background: var(--accent-soft); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.zero { color: #c6ccd6; }
table.t tr.group td { background: #f3f5f8; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 7px 12px; }
.var-name { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── sub-stepper ────────────────────────────────────────── */
.substeps { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
            padding: 4px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.substep { flex: 1; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 8px; border: 0;
           background: transparent; cursor: pointer; text-align: left; color: var(--text-2); min-width: 0; }
.substep:hover { background: var(--surface-2); }
.substep.on { background: var(--accent-soft); color: var(--accent-text); }
.substep .ss-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
                 font-weight: 600; background: #eef0f4; color: var(--muted); flex: none; }
.substep.on .ss-n { background: var(--accent); color: #fff; }
.substep.done .ss-n { background: var(--green-bg); color: var(--green); }
.substep .ss-t { display: flex; flex-direction: column; min-width: 0; }
.substep .ss-t b { font-weight: 600; font-size: 13px; }
.substep .ss-t span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.substep.on .ss-t span { color: #4f69c9; }

/* ── upload ─────────────────────────────────────────────── */
.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 26px; text-align: center;
        background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .d-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
                display: grid; place-items: center; margin: 0 auto 10px; color: var(--accent); }
.file-ok { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
/* finestra stretta (utente 06/10): il nome del file va a capo invece di finire sotto i pulsanti, che restano interi */
.file-ok > .grow { min-width: 0; }
.file-ok > .grow .mono { overflow-wrap: anywhere; }
.file-ok > .btn, .file-ok > a.btn { flex-shrink: 0; }
.row.azioni { flex-wrap: wrap; }
.row.azioni > .btn.done { margin-left: auto; }
.file-ok .f-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.formats { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

/* ── rules editor ───────────────────────────────────────── */
.split-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(480px, 1fr); gap: 16px; align-items: start; }
.list-card { display: flex; flex-direction: column; height: calc(100vh / var(--zm, 1) - 250px); min-height: 420px; }
.list-card .table-wrap { flex: 1; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .select { flex: none; width: auto; }
.toolbar .search.grow { min-width: 150px; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--brand); color: #fff; }
.bulkbar .btn { height: 28px; font-size: 12.5px; }
.editor { position: sticky; top: 0; max-height: calc(100vh / var(--zm, 1) - 250px); min-height: 420px; display: flex; flex-direction: column; }
.editor .card-body { overflow: auto; flex: 1; }
.editor-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; background: var(--surface-2);
               border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.evidence { border-left: 3px solid #c8d4f8; background: #f7f9fe; padding: 8px 12px; border-radius: 0 6px 6px 0;
            color: var(--text-2); font-size: 12.5px; font-style: italic; }
.note-ai { border-left: 3px solid #f0c865; background: #fffaf0; padding: 8px 12px; border-radius: 0 6px 6px 0; color: #7a4f06; font-size: 12.5px; }
.sec-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.s0-pul { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.cond-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.cond-group .cond-group { background: var(--surface); margin-top: 4px; }
.cond-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.cond { display: grid; grid-template-columns: 62px minmax(0, 1fr) minmax(0, 150px) minmax(0, 1.5fr) 26px; gap: 6px; align-items: start; margin-bottom: 6px; }
.cond > * { min-width: 0; }
.cond .select { width: 100%; }
.cond .joiner { font-size: 11px; font-weight: 700; color: var(--accent-text); padding-top: 6px; text-align: center; }
.cond-values { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 8px;
               background: var(--surface); min-height: 28px; }   /* si allarga: tutti i codici sempre visibili */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; cursor: pointer;
        border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); user-select: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip b { font-family: var(--mono); font-weight: 600; }
.sentence { padding: 10px 12px; border-radius: 8px; background: #f3f6fd; border: 1px solid #dfe6fb; font-size: 13px; color: #1d3a9e; }
.preview-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eef0f3; }
.preview-bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.codes-table { width: 100%; border-collapse: collapse; }
.codes-table td { padding: 3px 4px 3px 0; }

/* ── drawer / modal ─────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .38); z-index: 50; display: flex; animation: fade .12s; }
.modal { margin: auto; width: min(520px, 92vw); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal.lg { width: min(860px, 94vw); }
.modal-head { padding: 18px 22px 6px; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 12px 22px 18px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer { margin-left: auto; width: min(720px, 96vw); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg);
          display: flex; flex-direction: column; animation: slide .16s ease-out; }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-body { padding: 18px 22px; overflow: auto; flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }

/* avvisi in alto al centro, sulla barra del titolo (utente 05/10: in basso a destra coprivano «Conferma e vai alla
   successiva»); trasparenti ai clic: non serve aspettare che spariscano */
.toasts { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column;
          align-items: center; gap: 8px; z-index: 100; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px;
         display: flex; gap: 8px; align-items: center; max-width: 520px; animation: fade .15s; }
.toast.error { background: #9b2a22; }
.toast.ok { background: #0e6b4c; }

.progress { height: 6px; background: #e6e9ef; border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(47, 91, 234, .25); border-top-color: var(--accent);
           animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .e-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
                 display: grid; place-items: center; margin: 0 auto 12px; color: var(--faint); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ── home ───────────────────────────────────────────────── */
.proj-row .p-steps { display: flex; gap: 4px; }
.p-step { width: 26px; height: 6px; border-radius: 3px; background: #e4e7ec; }
.p-step.done { background: #17a673; } .p-step.part { background: #e0a100; } .p-step.stale { background: #b42318; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pipe { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); position: relative; }
.pipe .p-n { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pipe h4 { font-size: 14px; margin-top: 4px; }
.pipe p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.pipe.active { border-color: #b8c8fa; box-shadow: 0 0 0 3px var(--accent-soft); }
.pipe.muted { background: var(--surface-2); }

.stack-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #eef0f3; min-width: 90px; }
.stack-bar span { height: 100%; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
       border-radius: 4px; background: var(--surface); color: var(--text-2); }

@media (max-width: 1250px) {
  .split-pane { grid-template-columns: 1fr; }
  .editor { position: static; max-height: none; }
  .grid.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── accesso ────────────────────────────────────────────── */
body.login-mode .app { display: none; }
.login-wrap { min-height: calc(100vh / var(--zm, 1)); display: grid; place-items: center; padding: 24px;
              background: radial-gradient(1200px 600px at 20% 0%, #2b3a5e 0%, var(--brand) 55%, #0f1628 100%); }
.login-card { width: min(400px, 100%); background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg);
              display: flex; flex-direction: column; }
.login-err { color: var(--red); min-height: 18px; margin-top: 10px; }
.user-box { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-top: 6px; border-radius: 8px; background: rgba(255, 255, 255, .05); }
/* profilo (utente 06/10): nome e informazioni sopra a tutta larghezza, sotto «Password» ed «Esci» con il testo */
.user-box .ub-top { display: flex; align-items: center; gap: 10px; }
.user-box .ub-act { display: flex; gap: 6px; }
.user-box .ub-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 26px;
  border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #c9d1e3; border-radius: 6px; cursor: pointer; font-size: 12px; }
.user-box .ub-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.user-box .u-name { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.user-box .u-role { color: #8d99b8; font-size: 11px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3b4b72; color: #fff; display: grid; place-items: center;
          font-size: 11px; font-weight: 700; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; background: var(--accent-soft); color: var(--accent-text); }
.pp-label svg { vertical-align: -2px; }
.cond .joiner-sel { height: 28px; font-size: 12px; font-weight: 700; color: var(--accent-text); padding: 0 20px 0 6px; }
.cond .joiner { padding-top: 6px; }
table.t tr.xtot td { border-top: 2px solid var(--border-strong); background: var(--surface-2); }

.card-head.sub-head { border-top: 1px solid var(--border); background: var(--surface-2); padding: 10px 18px; }

.code-exp { color: var(--muted); }
.code-exp.code-no { color: var(--red); background: var(--red-bg); border-color: transparent; }

.done-group > summary { list-style: none; cursor: pointer; user-select: none; }
.done-group > summary::-webkit-details-marker { display: none; }
.done-group > summary:hover { background: var(--surface-3, var(--border)); }
.done-chev { display: inline-flex; color: var(--muted); transition: transform .15s; }
.done-group[open] > summary .done-chev { transform: rotate(90deg); }   /* solo la propria freccia: le tendine si annidano */
.done-group.colleghi > summary { border-radius: inherit; }

/* ── STEP 1 · Piano PLS ─────────────────────────────────────────── */
.select.xs, .input.xs { height: 26px; padding: 2px 6px; font-size: 12px; }
.input.num { text-align: right; }
.input.xs.num { width: 70px; }
.t.compact td, .t.compact th { padding: 5px 8px; font-size: 12.5px; }
.s1-var { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 16px; }
.s1-vars .select.sm { width: 100%; }
.s1-vars .input.sm { width: 100%; min-width: 40px; padding: 0 6px; }
.s1-vars .select.sm { min-width: 108px; padding: 0 4px; }
.s1-vars td, .s1-vars th { padding-left: 8px; padding-right: 8px; }
.s1-vars select.tipo-LATENTE { color: var(--accent-text); font-weight: 600; }
.s1-vars select.tipo-SOCIODEMO { color: var(--violet); font-weight: 600; }
.s1-lat { position: sticky; top: 12px; }
.s1-lat .card-body { max-height: calc(100vh / var(--zm, 1) - 290px); overflow: auto; }
.s1-stratum { border-left: 3px solid var(--accent-soft); padding-left: 10px; margin-bottom: 14px; }
.s1-stratum-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
/* TARGET (🎯): quello che si vuole predire, la direzione del modello */
.s1-tg { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; width: 24px; height: 22px; padding: 0; cursor: pointer;
  font-size: 13px; line-height: 20px; filter: grayscale(1); opacity: .45; flex: none; }
.s1-tg:hover { opacity: .85; filter: none; }
.s1-tg.on { filter: none; opacity: 1; border-color: var(--red); background: var(--red-bg); }
span.s1-tg { display: inline-block; text-align: center; cursor: default; }
.s1-latcard.tgt { border-color: #efb3ad; box-shadow: inset 3px 0 0 var(--red); }
.s1-tgsec { border: 1px dashed #efb3ad; border-radius: var(--radius); padding: 8px 8px 0; margin-bottom: 12px; background: #fffafa; }
.s1-tgsec .s1-stratum { border-left-color: #efb3ad; }
.s1-tgsec-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--red); margin-bottom: 8px; }
.badge.s1-tgbadge { background: var(--red-bg); color: var(--red); border-color: #efb3ad; }
.s1-tgtxt { color: var(--red); font-weight: 600; }
.s1-tgsel.on { color: var(--red); font-weight: 600; border-color: #efb3ad; background: var(--red-bg); }
.s1-tgcheck { padding: 8px 10px; border: 1px solid #efb3ad; border-radius: var(--radius); background: #fffafa; align-items: flex-start; }
.s1-notg { margin-bottom: 12px; }
.s1-svg .node.tgt ellipse { stroke: var(--red); stroke-width: 3; }
.s1-svg .node .tgmark { font-size: 12px; }
.s1-latcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
.chip.good { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip.warn { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip.bad { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip .x { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 0 0 4px; font-size: 14px; line-height: 1; }
.chip small { opacity: .75; margin-left: 4px; font-size: 10.5px; }
.s1-sd th.s1-net { min-width: 120px; }
.s1-sd th.s1-net .input { width: 92px; }
.s1-mtabs { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; }
.s1-mtab { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 170px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px 12px; cursor: pointer; }
.s1-mtab.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.s1-tray { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.s1-trayitem { cursor: grab; }
.s1-why { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.s1-why li { margin-bottom: 4px; }
/* STEP 1 · editor dei modelli (disegno PLS) */
.s1-model { grid-template-columns: minmax(0, 1fr) 370px; align-items: start; gap: 16px; }
.s1-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.s1-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; display: inline-block; }
.s1-stage { position: relative; height: calc(100vh / var(--zm, 1) - 360px); min-height: 460px; background: #fbfcfe; }
.s1-stage.over { box-shadow: inset 0 0 0 3px var(--accent-soft); }
.s1-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.s1-stage.panning .s1-svg { cursor: grabbing; }
.s1-help { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--text-2); background: rgba(255,255,255,.92);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; pointer-events: none; max-width: calc(100% - 24px); }
.s1-svg .gdot { fill: #e3e7ee; }
.s1-svg .node { cursor: move; }
.s1-svg .node ellipse { stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(16,24,40,.18)); transition: stroke .1s; }
.s1-svg .node text { text-anchor: middle; pointer-events: none; font-family: var(--font); }
.s1-svg .node .nm { font-size: 13px; font-weight: 700; fill: #fff; letter-spacing: .02em; }
.s1-svg .node .sub { font-size: 10.5px; fill: rgba(255,255,255,.88); font-weight: 600; }
.s1-svg .node.exo ellipse { fill: #43307a; stroke: #2d1f57; }
.s1-svg .node.med ellipse { fill: #2f5bea; stroke: #1f45c4; }
.s1-svg .node.out ellipse { fill: #0f7b6c; stroke: #0a5c50; }
.s1-svg .node.iso ellipse { fill: #fff; stroke: var(--faint); stroke-dasharray: 5 4; }
.s1-svg .node.iso .nm { fill: var(--text); }
.s1-svg .node.iso .sub { fill: var(--muted); }
.s1-svg .node.hint ellipse { stroke: var(--violet); stroke-dasharray: 3 3; stroke-width: 2.5; }
.s1-svg .node .flag { fill: #fff; font-size: 12px; }
.s1-svg .node.iso .flag { fill: var(--violet); }
.s1-svg .node.sel ellipse { stroke: #f5b400; stroke-width: 4; }
.s1-svg .node.target ellipse { stroke: #22c55e; stroke-width: 5; }
.s1-svg .node.target.bad ellipse { stroke: var(--red); }
.s1-svg .handle { opacity: 0; cursor: crosshair; transition: opacity .12s; }
.s1-svg .node:hover .handle, .s1-svg .node.sel .handle { opacity: 1; }
.s1-svg .handle circle { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.s1-svg .handle path { stroke: var(--accent); stroke-width: 2; }
.s1-svg .edge { cursor: pointer; }
.s1-svg .edge .hit { stroke: transparent; stroke-width: 16; }
.s1-svg .edge .vis { stroke: #98a2b3; fill: none; }
.s1-svg .edge.sig .vis { stroke: #1f2a44; }
.s1-svg .edge.ns .vis { stroke: #d08a17; stroke-dasharray: 6 5; }
.s1-svg .edge.zero .vis { stroke: var(--red); stroke-dasharray: 2 5; }
.s1-svg .edge.sel .vis { stroke: #f5b400; }
.s1-svg .edge:hover .vis { filter: drop-shadow(0 0 3px rgba(47,91,234,.45)); }
/* percorso evidenziato (cursore sulla riga dei risultati o sulla freccia): giallo, gli altri sbiaditi */
.s1-svg #gEdges .edge { transition: opacity .12s; }
.s1-svg #gEdges.dim .edge:not(.hl) { opacity: .18; }
.s1-svg .edge.hl .vis { stroke: #f5b400; filter: drop-shadow(0 0 4px rgba(245,180,0,.55)); }
.s1-svg .edge.hl .lab rect { stroke: #f5b400; stroke-width: 2; }
.s1-svg .node.hl ellipse { stroke: #f5b400; stroke-width: 3; }
#side tr.edge-hl > td, #side .edge-hl { background: #fff6d6; }
.s1-svg .mk-none { fill: #98a2b3; } .s1-svg .mk-sig { fill: #1f2a44; } .s1-svg .mk-ns { fill: #d08a17; }
.s1-svg .mk-zero { fill: var(--red); } .s1-svg .mk-sel { fill: #f5b400; }
.s1-svg .lab rect { fill: #fff; stroke: var(--border-strong); }
.s1-svg .edge.sig .lab rect { stroke: #1f2a44; }
.s1-svg .lab text { font-size: 11px; font-weight: 700; text-anchor: middle; fill: var(--text); font-family: var(--font); pointer-events: none; }
.s1-svg .edge-tmp { stroke: #f5b400; stroke-width: 2.5; stroke-dasharray: 7 5; fill: none; pointer-events: none; }
.s1-svg .ind { stroke: #c9ced8; stroke-width: 1; }
.s1-svg .indbox rect { fill: #fff6cc; stroke: #d9b84a; }
.s1-svg .indbox.warn rect { fill: var(--amber-bg); stroke: var(--amber); }
.s1-svg .indbox text { font-size: 10.5px; text-anchor: middle; font-family: var(--mono); fill: var(--text); pointer-events: none; }
.s1-svg .indbox .ld { font-size: 9.5px; fill: var(--muted); font-family: var(--font); }
.s1-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 12px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }
.s1-legend span { display: inline-flex; align-items: center; gap: 6px; }
i.lg { display: inline-block; width: 20px; height: 12px; border-radius: 50%; border: 2px solid transparent; flex: 0 0 auto; }
i.lg.exo { background: #43307a; } i.lg.med { background: #2f5bea; } i.lg.out { background: #0f7b6c; }
i.lg.iso { background: #fff; border: 2px dashed var(--faint); }
i.ll { display: inline-block; width: 22px; height: 0; border-top: 2.5px solid #1f2a44; }
i.ll.ns { border-top: 2.5px dashed #d08a17; } i.ll.zero { border-top: 2.5px dotted var(--red); }
.s1-tray { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
/* reset di Variabili e latenti (utente 06/10): pulsante rosso */
/* barra della scheda Variabili: con la finestra stretta i pulsanti vanno a capo invece di uscire */
.card-head.s1-var-head { flex-wrap: wrap; row-gap: 8px; }
.s1-var-head .s1-var-n { white-space: nowrap; }
.btn.s1-reset { background: var(--red); border-color: var(--red); color: #fff; }
.btn.s1-reset:hover { filter: brightness(.92); }
.s1-side { position: sticky; top: 12px; max-height: calc(100vh / var(--zm, 1) - 110px); overflow: auto; }
.s1-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; margin-bottom: 6px; }
.s1-kpis div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
.s1-kpis span { display: block; font-size: 11px; color: var(--muted); }
.s1-kpis b { font-size: 16px; }
.s1-irow { display: grid; grid-template-columns: 18px auto minmax(0, 1fr) auto auto auto; gap: 6px; align-items: center; padding: 5px 4px;
  border-bottom: 1px solid var(--border); font-size: 12.5px; cursor: pointer; }
.s1-irow.off { opacity: .55; }
.s1-irow:hover { background: var(--surface-2); }
.s1-ilab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.s1-load { position: relative; width: 62px; height: 16px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; }
.s1-load i { position: absolute; left: 0; top: 0; bottom: 0; background: #b8c7f5; }
.s1-load.low i { background: #f3c77a; }
.s1-load b { position: relative; font-size: 10.5px; padding-left: 5px; line-height: 16px; }
.s1-prow { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.s1-pick { max-height: 320px; overflow: auto; margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; }
.s1-pick .check { display: flex; gap: 6px; padding: 2px 0; }
.c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-violet { color: var(--violet); }
.clickable { cursor: pointer; }

.s1-free { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; background: var(--surface-2); }
.s1-latcard.over, .s1-free.over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.s1-ichip { cursor: grab; }
.s1-ichip.dragging { opacity: .4; }

/* interruttore sì/no (STEP 0: codice previsto) */
.tgl { position: relative; width: 38px; height: 22px; border-radius: 11px; border: none; padding: 0; cursor: pointer;
       background: #c9cfdb; transition: background .15s; vertical-align: middle; }
.tgl span { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
            box-shadow: 0 1px 2px rgba(15, 22, 40, .3); transition: left .15s; }
.tgl.on { background: var(--green); }
.tgl.on span { left: 18px; }
.tgl:disabled { opacity: .55; cursor: default; }
.tgl:focus-visible { outline: 2px solid var(--accent, #2f5bea); outline-offset: 2px; }
.tgl-lab { display: inline-block; width: 16px; margin-left: 6px; font-size: 11px; color: var(--muted); vertical-align: middle; }
.cb-line { margin: 0 0 6px; }
.modal.xl { width: min(1200px, 96vw); }

/* STEP 1 · codici della variabile (menu aperto di default): dentro MIN-MAX, fuori scala, MISSING PLS */
.s1-codes { margin-top: 4px; }
.s1-codes summary { cursor: pointer; font-size: 11px; color: var(--muted); user-select: none; }
.s1-codes-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.s1-code { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 1px 6px;
           font-size: 11.5px; line-height: 18px; cursor: pointer; color: var(--text); max-width: 220px;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s1-code b { font-family: var(--mono); font-weight: 600; }
.s1-code:hover:not(:disabled) { border-color: var(--accent, #2f5bea); }
.s1-code.out { border-color: var(--amber); color: var(--amber); }
.s1-code.miss { background: var(--grey-bg); color: var(--muted); text-decoration: line-through; }
.s1-code:disabled { cursor: default; }
.s1-code.np { border-style: dashed; color: var(--faint); background: transparent; }
.s1-rowdrag { cursor: grab; color: var(--faint); font-size: 14px; line-height: 1; padding: 0 2px; user-select: none; }
.s1-rowdrag:hover { color: var(--accent-text, #2f5bea); }
.s1-lgrp { cursor: pointer; } .s1-caret { display: inline-block; width: 14px; color: var(--muted); }
.s1-pk { align-items: baseline; }
.s1-lgrp td { background: var(--surface-2); padding: 7px 12px; border-top: 1px solid var(--border); }
.s1-sdsum { color: var(--muted); line-height: 1.5; } .s1-sdsum b { color: var(--text); font-weight: 600; }
.s1-pct { font-size: 10.5px; color: var(--accent-text, #2f5bea); font-variant-numeric: tabular-nums; }
.s1-np-tag { font-size: 10.5px; color: var(--faint); font-style: italic; }
.s1-s0 { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.s1-s0 b { font-weight: 600; color: var(--text); }
.s1-s0 b.c-amber { color: var(--amber); } .s1-s0 b.c-red { color: var(--red); }
.s1-code-more { border: none; background: none; color: var(--accent-text, #2f5bea); font-size: 11.5px; cursor: pointer; padding: 1px 4px; }
.s1-codes-sum { margin-top: 4px; font-size: 11px; color: var(--muted); }
.s1-rev { color: var(--violet); font-weight: 600; }
.s1-inv { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px;
          width: 30px; height: 26px; font-size: 14px; line-height: 1; cursor: pointer; }
.s1-inv:hover:not(:disabled) { border-color: var(--violet); color: var(--violet); }
.s1-inv.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.s1-inv:disabled { cursor: default; opacity: .45; }
.sd-multi { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--violet); background: var(--grey-bg); border-radius: 0 6px 6px 0; color: var(--muted); }
.md-ex { font-size: 11px; font-weight: 500; color: var(--amber); white-space: nowrap; }
/* barra laterale nascondibile (Ctrl+B) */
.nav-hide { color: #8d99b8; }
.nav-hide:hover { color: #fff; }
.nav-show { display: none; margin-left: -8px; }
body.nav-hidden .nav-show { display: inline-flex; }
body.nav-hidden .app { grid-template-columns: 0 1fr; }
body.nav-hidden .sidebar { overflow: hidden; border-right: 0; }
/* pagina Utenti: ultima attività con menu degli ultimi progetti */
.u-act summary { cursor: pointer; list-style-position: outside; }
.u-act summary > div, .u-act-list .muted { display: block; }
.u-act-list { margin: 6px 0 2px 14px; display: flex; flex-direction: column; gap: 6px; }

/* spaccati suggeriti (STEP 1, scheda Campione e spaccati del modello) */
.md-sug { margin: 12px 16px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2, #fafbfc); }
.md-sug-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--border); }
.md-sug-row:first-child { border-top: 0; }

/* "$" sui pulsanti che chiamano l'AI (costo) */
.ai-cost { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; font-size: 10px; font-weight: 800; line-height: 1; background: #fff3cd; color: #8a5a00;
  border: 1px solid #f0c36d; margin-left: 3px; vertical-align: middle; font-family: inherit; }

/* barra laterale: "La tua spesa AI" (oggi · 7 giorni · 30 giorni), clic = pagina Spesa AI */
.side-spend { display: block; width: 100%; text-align: left; margin: 6px 0 0; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); color: #c9d2e6; font: inherit; }
.side-spend:hover { background: rgba(255, 255, 255, .1); }
/* riquadri della barra laterale come «La tua spesa AI» (utente 06/10): Zoom e Impostazioni AI */
.side-box { display: flex; align-items: center; width: 100%; margin: 6px 0 0; padding: 7px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); color: #c9d2e6; font: inherit; }
.side-ai { gap: 8px; cursor: pointer; text-align: left; font-size: 13px; margin-bottom: 8px; }
.side-ai:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-ai svg { color: #8f9ab3; }
/* zoom della finestra nella barra laterale (utente 06/10) */
.side-zoom { gap: 4px; }
.side-zoom .sz-l { flex: 1; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #8f9ab3; }
.side-zoom button { border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #dfe4ef; border-radius: 6px;
  height: 24px; cursor: pointer; font-size: 13px; line-height: 1; }
.side-zoom .sz-b { width: 26px; font-size: 15px; }
.side-zoom .sz-v { min-width: 50px; font-variant-numeric: tabular-nums; }
.side-zoom button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-spend .ss-h { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #8f9ab3; }
.side-spend .ss-row { display: flex; gap: 6px; margin-top: 6px; }
.side-spend .ss-c { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.side-spend .ss-l { font-size: 11px; color: #8f9ab3; }
.side-spend .ss-c b { font-size: 13px; color: #fff; white-space: nowrap; }
/* STEP 2 — Run PLS e report: riepiloghi compatti degli step precedenti */
.s2-kpis { gap: 10px; }
.s2-kpis .kpi { padding: 10px 12px; }
.s2-kpis .k-value { font-size: 19px; }
.mt-4 { margin-top: 4px; }

/* STEP 0: consiglio in cima alla scheda Carica (utente 05/10: «box arancione che salti subito all'occhio») */
.banner.s0-consiglio { margin-bottom: 14px; border: 1px solid #f59e0b; border-left: 6px solid #ea580c; background: #fff4e5; color: #7c2d12; }
.banner.s0-consiglio .s0-consiglio-tit { font-size: 14px; color: #9a3412; }
.banner.s0-consiglio svg { color: #ea580c; }
/* spiegazioni degli Excel da scaricare e ricaricare (utente 05/10: «alert di spiegazione sempre in sfondo arancione») */
.banner.spiega { border: 1px solid #f59e0b; border-left: 6px solid #ea580c; background: #fff4e5; color: #7c2d12; }
.banner.spiega b { color: #9a3412; }
.banner.spiega svg { color: #ea580c; }
.banner.spiega ol { margin: 4px 0 0; padding-left: 18px; }
.banner.spiega li { margin: 2px 0; }
/* sempre visibili (utente 06/10): «Riduci» li porta a una riga, «Espandi» li riapre */
.banner.spiega .spiega-tg { flex: none; align-self: flex-start; color: #9a3412; white-space: nowrap; }
.banner.spiega .spiega-tg svg { transition: transform .15s; transform: rotate(180deg); color: #9a3412; }
.banner.spiega.ridotto .spiega-tg svg { transform: none; }
.banner.spiega.ridotto > div { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; min-width: 0; }
.banner.spiega.ridotto ol, .banner.spiega.ridotto ul { display: none; }
.s1-elenco-info { margin: 10px 16px 0; }
.sd-spiega { margin: 0 0 14px; }
.sd-pesa[hidden] { display: none; }
/* scheda Variabili: le colonne di una multipla sotto la multipla intera (05/10) */
.s1-mrkids td { padding: 4px 12px 8px 34px; background: var(--surface-2, #f7f8fa); border-top: 0; }
.s1-mrkid td { background: #fbfbfd; }
.s1-mrkid td:first-child { padding-left: 34px; border-left: 3px solid #d9ccf5; }
.sd-item.sd-sub { margin-left: 16px; width: calc(100% - 16px); padding-top: 6px; padding-bottom: 6px; border-left: 3px solid #d9ccf5; }
.sd-item.sd-sub .sd-item-meta { font-size: 11px; }            /* multipla unita: non entra nella pesatura (05/10) */
/* STEP 0: scelta del codice per i REAL MISSING, un codice per riga */
.s0-scelta { display: flex; align-items: flex-start; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.s0-scelta:hover { background: var(--surface-2, #f5f6f8); }
.s0-scelta input { margin-top: 3px; }
.s0-scelta > b { min-width: 36px; }
.s0-scelte2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }

/* modalità manutenzione (utente 09/10) */
.avviso-manut { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--red-bg);
  color: var(--red); border: 1px solid #efb3ad; border-top: 0; border-radius: 0 0 8px 8px; padding: 4px 12px; font-size: 12px;
  display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-sm); }
.avviso-manut a { color: var(--red); text-decoration: underline; }
.card.manut-on { border-color: #efb3ad; }
.login-manut { margin-bottom: 16px; }
.mb-16 { margin-bottom: 16px; }

/* versione server: niente «Apri» e «Apri cartella» (aprivano Excel ed Esplora file sul PC), niente PLS Mapper precedente;
   resta «Scarica» */
#btnFolder, #folder, #openLegacy, [data-act="cartella"], .btn-apri { display: none !important; }
