/* Estensioni v2 del design system MIRA (stessi token di mira.css). */

.proj-switch { margin: 4px 14px 14px; }
.proj-switch label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7fa7a5; font-weight: 700; margin-bottom: 5px; }
.proj-switch select { width: 100%; background: rgba(255,255,255,.06); color: #e6f4f2; border: 1px solid rgba(127,214,207,.25); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; }
.nav-soon { display: flex; align-items: center; gap: 10px; padding: 7px 14px; margin: 1px 8px; font-size: 13px; color: rgba(230,244,242,.38); }
.nav-soon svg { width: 16px; height: 16px; opacity: .45; }
.nav-soon i { margin-left: auto; font-style: normal; font-size: 10px; border: 1px solid rgba(127,214,207,.2); border-radius: 5px; padding: 1px 5px; }

.card-h { display: flex; align-items: center; gap: 10px; }
.hint { margin-left: auto; font-size: 11.5px; color: var(--faint); }

/* domini di evidenza */
.dom-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.dom-pill { display: inline-grid; place-items: center; min-width: 38px; height: 20px; padding: 0 5px; font-size: 10px; font-weight: 750; letter-spacing: .03em; border-radius: 6px; border: 1px solid transparent; }
.dom-pill.AVAILABLE { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.dom-pill.NOT_AVAILABLE { background: var(--surface-2); color: var(--faint); border-color: var(--border); border-style: dashed; }
.dom-pill.NO_SAMPLE { background: transparent; color: color-mix(in srgb, var(--faint) 50%, transparent); border-color: transparent; }
.dom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.dom-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.dom-tile .t { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; }
.dom-tile .n { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.dom-tile .s { font-size: 11.5px; color: var(--faint); }
.dom-tile.off { opacity: .62; border-style: dashed; box-shadow: none; }

/* timeline */
.tline { display: flex; align-items: flex-start; position: relative; padding: 6px 0 2px; }
.tline::before { content: ""; position: absolute; left: 0; right: 0; top: 19px; height: 3px; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); border-radius: 3px; }
.tl-node { flex: 1; text-align: center; position: relative; z-index: 1; }
.tl-node .dotc { width: 15px; height: 15px; border-radius: 50%; margin: 7px auto 10px; background: var(--surface); border: 3px solid var(--accent); }
.tl-node.event .dotc { border-radius: 4px; transform: rotate(45deg); border-color: var(--warn); background: var(--warn-soft); width: 13px; height: 13px; }
.tl-node .c { font-weight: 720; font-size: 15px; }
.tl-node.event .c { color: var(--warn); font-size: 12.5px; }
.tl-node .d { font-size: 11.5px; color: var(--muted); }
.tl-node .x { font-size: 11px; color: var(--faint); max-width: 170px; margin: 2px auto 0; line-height: 1.35; }

/* stati e tag */
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.err { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.tag.acc { background: var(--accent-soft); color: var(--accent-deep); border-color: transparent; }
.tag.ghost { background: transparent; border-style: dashed; color: var(--faint); }

.val-nr { color: var(--faint); font-style: italic; }
.val-flag { color: var(--blue); }
.cell-q { cursor: help; }
.muted-row td { opacity: .55; }

/* sezioni dominio nella scheda punto */
.dom-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.dom-head h2 { margin: 0; font-size: 17px; }
.dom-head .rule { flex: 1; height: 1px; background: var(--border); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 14px; margin-bottom: 14px; }
.chart-card h4 { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.chart-tip { position: absolute; opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 7px; font-size: 11.5px; box-shadow: var(--shadow-lg); transition: opacity .12s; white-space: nowrap; z-index: 5; }
.na-block { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 16px 18px; color: var(--muted); font-size: 13px; background: var(--surface-2); }
.point-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; }
.point-tabs a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); font-weight: 650; font-size: 13px; color: var(--muted); background: var(--surface); }
.point-tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* rete di trasformazione */
.net { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 8px 2px 4px; }
.net-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.net-node { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent-deep); border-radius: 10px; padding: 8px 12px; text-align: center; min-width: 96px; }
.net-node b { display: block; font-size: 14px; }
.net-node small { font-size: 10.5px; color: var(--muted); }
.net-node.PARENT_COMPOUND { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.net-node.TERMINAL_PRODUCT { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.net-node.minor { border-style: dashed; opacity: .85; }
.net-arrow { width: 36px; height: 2px; background: var(--border-strong); position: relative; flex: 0 0 36px; }
.net-arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border-left: 7px solid var(--border-strong); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

/* upload */
.upload { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 12px; align-items: end; }
@media (max-width: 900px) { .upload { grid-template-columns: 1fr; } }
.upload input[type=file], .upload select, .upload input[type=text] { width: 100%; }
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.notice.ok { background: var(--good-soft); color: var(--good); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.issue-list { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.issue-list li { display: grid; grid-template-columns: 64px 170px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.issue-list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.sec-anchor { scroll-margin-top: 70px; }
.toc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.toc a { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); }
.toc a:hover { color: var(--accent-deep); border-color: var(--accent); }

/* Rules Engine */
.att { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.att::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.att.FAVORABLE { background: var(--good-soft); color: var(--good); }
.att.INTERMEDIATE { background: var(--blue-soft); color: var(--blue); }
.att.TO_VERIFY { background: var(--warn-soft); color: var(--warn); }
.att.CRITICAL { background: var(--bad-soft); color: var(--bad); }
.att.INFO { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.att.NOT_EVALUABLE { background: transparent; color: var(--faint); border: 1px dashed var(--border-strong); }
.ev-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ev-cell .n { font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.ev-cell .n.FAVORABLE { background: var(--good-soft); color: var(--good); }
.ev-cell .n.INTERMEDIATE { background: var(--blue-soft); color: var(--blue); }
.ev-cell .n.TO_VERIFY { background: var(--warn-soft); color: var(--warn); }
.ev-cell .n.CRITICAL { background: var(--bad-soft); color: var(--bad); }
.ev-cell .hl { flex-basis: 100%; font-size: 11px; color: var(--warn); line-height: 1.35; margin-top: 3px; }
.ev-card { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 13px 15px; margin-bottom: 10px; box-shadow: var(--shadow); border-left: 4px solid var(--border-strong); }
.ev-card.FAVORABLE { border-left-color: var(--good); }
.ev-card.INTERMEDIATE { border-left-color: var(--blue); }
.ev-card.TO_VERIFY { border-left-color: var(--warn); }
.ev-card.CRITICAL { border-left-color: var(--bad); }
.ev-card .h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-card .h b { font-size: 14px; }
.ev-card .code { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ev-card .msg { margin: 7px 0 4px; font-size: 13.5px; line-height: 1.55; }
.ev-card .cli { font-size: 12.5px; color: var(--muted); }
.ev-card .lim { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.ev-card details { margin-top: 8px; }
.ev-card summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--accent-deep); }
.why { margin-top: 8px; font-size: 12.5px; }
.why ul { list-style: none; margin: 0; padding-left: 16px; border-left: 1px dashed var(--border-strong); }
.why > ul { padding-left: 0; border-left: 0; }
.why li { margin: 4px 0; }
.why .st { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; margin-right: 5px; }
.why .st.TRUE { background: var(--good-soft); color: var(--good); }
.why .st.FALSE { background: var(--bad-soft); color: var(--bad); }
.why .st.NOT_EVALUABLE { background: var(--surface-2); color: var(--faint); border: 1px dashed var(--border-strong); }
.why .obs { color: var(--muted); }
.why .rsn { color: var(--warn); font-style: italic; }
.camp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.camp-tabs a { padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border); font-weight: 650; font-size: 13px; color: var(--muted); background: var(--surface); }
.camp-tabs a.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.rule-row td { vertical-align: top; }
.cond-list { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted); white-space: normal; }

/* Evidenze & indici */
.evd { display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; border: 1px solid transparent; }
.evd.SUPPORTING, .evd.CONCORDANT, .evd.HIGH { background: var(--good-soft); color: var(--good); }
.evd.PARTIALLY_SUPPORTING, .evd.PARTIALLY_CONCORDANT, .evd.MODERATE { background: var(--blue-soft); color: var(--blue); }
.evd.CONTRADICTORY, .evd.DIVERGENT { background: var(--bad-soft); color: var(--bad); }
.evd.LOW { background: var(--warn-soft); color: var(--warn); }
.evd.NEUTRAL { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.evd.INSUFFICIENT, .evd.NOT_EVALUABLE { background: transparent; color: var(--faint); border: 1px dashed var(--border-strong); }
.evd.NOT_AVAILABLE { background: transparent; color: color-mix(in srgb, var(--faint) 70%, transparent); border: 1px dashed var(--border); }
.evd-panel { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 1000px) { .evd-panel { grid-template-columns: 1fr; } }
.dom-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.dom-row:last-child { border-bottom: 0; }
.dom-row .nm { flex: 1; display: flex; align-items: center; gap: 8px; }
.idx-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 10px; background: var(--surface); }
.idx-card .h { display: flex; align-items: center; gap: 8px; }
.idx-card .q { font-size: 11.5px; color: var(--faint); margin: 3px 0 6px; }
.comp { display: grid; grid-template-columns: 150px 92px 1fr; gap: 8px; font-size: 12px; padding: 4px 0; border-top: 1px dashed var(--border); align-items: start; }
.comp .lbl { color: var(--muted); }
.cross-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 12px; }
.cross-hero .big { font-size: 17px; font-weight: 750; }
.mini-doms { display: flex; gap: 3px; margin-top: 5px; flex-wrap: wrap; }
.mini-doms span { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.mini-doms .SUPPORTING { background: var(--good); }
.mini-doms .PARTIALLY_SUPPORTING { background: color-mix(in srgb, var(--blue) 70%, transparent); }
.mini-doms .CONTRADICTORY { background: var(--bad); }
.mini-doms .NEUTRAL { background: var(--border-strong); }
.mini-doms .INSUFFICIENT, .mini-doms .NOT_AVAILABLE { background: transparent; border: 1px dashed var(--border-strong); }

/* accesso e utente */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--bg), var(--accent-soft)); }
.login-card { width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.login-card .brand { display: flex; align-items: center; gap: 12px; }
.login-card label { font-size: 12px; font-weight: 650; color: var(--muted); margin: 10px 0 4px; }
.login-card input { padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 8px; margin-left: 14px; font-size: 12px; }
.user-chip span { color: var(--faint); }
.user-chip a { font-weight: 650; color: var(--accent-deep); }

/* revisione esperta */
.rv { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.rv-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.dec { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.dec.CONFIRMED { background: var(--good-soft); color: var(--good); }
.dec.MODIFIED { background: var(--blue-soft); color: var(--blue); }
.dec.REJECTED { background: var(--bad-soft); color: var(--bad); }
.dec.NEEDS_DATA { background: var(--warn-soft); color: var(--warn); }
.dec.NONE { background: var(--surface-2); color: var(--faint); border: 1px dashed var(--border-strong); }
.rv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.rv-form .full { grid-column: 1 / -1; }
.rv-form textarea, .rv-form select, .rv-form input[type=text], .interp textarea, .interp select, .interp input[type=text] { width: 100%; font: inherit; font-size: 12.5px; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.rv-form textarea, .interp textarea { min-height: 54px; resize: vertical; }
.rv-form label, .interp label { font-size: 11px; font-weight: 650; color: var(--muted); display: block; margin-bottom: 3px; }
.interp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.interp .full { grid-column: 1 / -1; }
.istate { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.istate.APPROVED_FOR_CLIENT { background: var(--good-soft); color: var(--good); }
.istate.VALIDATED { background: var(--blue-soft); color: var(--blue); }
.istate.REJECTED { background: var(--bad-soft); color: var(--bad); }

/* cliente */
.client-hero { background: linear-gradient(150deg, var(--accent-deep), #07393c); color: #eafffb; border-radius: var(--radius); padding: 24px 26px; margin-bottom: 18px; box-shadow: var(--shadow-lg); }
.client-hero h1 { margin: 0 0 4px; font-size: 24px; color: #fff; }
.client-hero .sub { color: #b9e8e3; font-size: 13.5px; }
.scope-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.scope-card h3 { margin: 0; font-size: 16px; }
.scope-card .sum { font-size: 14px; line-height: 1.6; margin: 8px 0; }

/* microbioma */
.hm { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
.hm th { font-size: 10.5px; font-weight: 650; color: var(--muted); padding: 3px 4px; white-space: nowrap; }
.hm th.rot { writing-mode: vertical-rl; transform: rotate(180deg); height: 70px; text-align: left; }
.hm td.g { white-space: nowrap; padding-right: 10px; font-weight: 600; }
.hm td.c { width: 46px; height: 26px; text-align: center; font-family: var(--mono); font-size: 10.5px; border-radius: 4px; color: var(--ink); }
.hm td.c a { color: inherit; display: block; }
.hm td.c.na { background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--border) 4px, var(--border) 5px); color: var(--faint); }
.hm tr.ne td.g { color: var(--faint); font-weight: 500; }
.macro { font-size: 10px; color: var(--faint); font-weight: 500; display: block; }
.cov-bar { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); width: 46px; }
.cov-bar i { display: block; height: 100%; background: var(--accent); }
.traj { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.traj.EMERGING, .traj.INCREASING { background: var(--good-soft); color: var(--good); }
.traj.DECLINING, .traj.LOST { background: var(--bad-soft); color: var(--bad); }
.traj.FLUCTUATING { background: var(--warn-soft); color: var(--warn); }
.login-card .brand h1 { color: var(--accent-deep); }
.login-card .btn { background: var(--accent); color: #fff; border: 0; }

/* ================= Analisi visiva ================= */
:root {
  /* catena: rampa ordinale (4 Cl → 1 Cl) + accento per il prodotto finale — validata (light) */
  --ch-c0: #0f4a48; --ch-c1: #1d6f6b; --ch-c2: #3a9590; --ch-c3: #79bdb6; --ch-end: #eb6834;
  /* biomarcatori: tre tinte categoriali in ordine fisso — validate */
  --bm-s1: #2a78d6; --bm-s2: #1baf7a; --bm-s3: #4a3aa7;
  /* redox divergente: blu riducente ↔ rosso ossidante, grigio al centro */
  --orp-n3: #1f5fb0; --orp-n2: #4f8fdc; --orp-n1: #a9c8ef; --orp-z: #f0efec; --orp-p1: #f2b0aa; --orp-p2: #e06a64; --orp-p3: #b8302f;
  /* indici: rampa ordinale monotinta */
  --ix-h: #1d6f6b; --ix-m: #79bdb6; --ix-l: #d5ece9;
  /* stato (riservato) */
  --st-good: #0ca30c; --st-warn: #fab219; --st-crit: #d03b3b;
  --vz-grid: #e6ecee; --vz-axis: #c3cdd1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ch-c0: #9ad6cf; --ch-c1: #55b2ab; --ch-c2: #2f8f8a; --ch-c3: #1f6f6b; --ch-end: #f07a49;
    --bm-s1: #3987e5; --bm-s2: #199e70; --bm-s3: #9085e9;
    --orp-n3: #6fa5f0; --orp-n2: #3f78c8; --orp-n1: #2a4c78; --orp-z: #383835; --orp-p1: #6e3433; --orp-p2: #b04947; --orp-p3: #e66767;
    --ix-h: #55b2ab; --ix-m: #2f7d79; --ix-l: #1c3d3d;
    --vz-grid: #1d3136; --vz-axis: #31474d;
  }
}

.vz-hero { padding: 26px 28px 18px; margin-bottom: 18px; position: relative; overflow: hidden; }
.vz-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--ch-c0), var(--ch-c1) 30%, var(--ch-c2) 55%, var(--ch-c3) 80%, var(--ch-end)); }
.vz-hero-h { display: flex; gap: 28px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }
.vz-hero-h h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.02em; font-weight: 720; }
.vz-hero-h p { margin: 0; color: var(--muted); max-width: 62ch; font-size: 13.5px; }

.vz-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; font-weight: 650; color: var(--ink); }
.vz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.vz-legend small { color: var(--faint); font-weight: 500; font-size: 11px; }
.vz-legend.sm { font-size: 12px; gap: 12px; margin-left: auto; }
.vz-legend .sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.vz-legend .ln { width: 16px; height: 2px; border-radius: 2px; display: inline-block; position: relative; }
.vz-legend .ln::after { content: ""; position: absolute; left: 4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: inherit; }
.sw.c0, .vz-bar i.c0 { background: var(--ch-c0); } .sw.c1, .vz-bar i.c1 { background: var(--ch-c1); }
.sw.c2, .vz-bar i.c2 { background: var(--ch-c2); } .sw.c3, .vz-bar i.c3 { background: var(--ch-c3); }
.sw.end, .vz-bar i.end { background: var(--ch-end); }
.ln.s1 { background: var(--bm-s1); } .ln.s2 { background: var(--bm-s2); } .ln.s3 { background: var(--bm-s3); }

.vz-scroll { overflow-x: auto; }
.vz-atlas { display: grid; gap: 0; min-width: 640px; }
.vz-row { display: grid; grid-template-columns: 88px repeat(var(--n), auto 1fr); align-items: stretch; }
.vz-atlas .vz-row + .vz-row { border-top: 1px solid var(--border); }
.vz-pt { font-weight: 700; font-size: 13.5px; align-self: center; padding-right: 10px; }
.vz-camp { padding: 0 10px 10px; display: flex; align-items: baseline; gap: 8px; }
.vz-camp b { font-size: 14px; } .vz-camp span { font-size: 11.5px; color: var(--faint); }
.vz-cell { padding: 14px 10px 12px; min-width: 0; }
.vz-ev-gap { width: 0; }
.vz-ev-h, .vz-ev-line { width: 26px; position: relative; }
.vz-ev-line::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; border-left: 2px dashed var(--warn); opacity: .7; }
.vz-ev-h { align-self: stretch; }
.vz-atlas .vz-head { padding-top: 26px; }
.vz-ev-h::before { content: ""; position: absolute; left: 12px; top: -8px; bottom: 0; border-left: 2px dashed var(--warn); opacity: .7; }
.vz-ev-h span { position: absolute; left: 7px; top: -28px; white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--warn); }
.vz-ev-h span b { font-size: 9px; }
.vz-ev-h small { font-weight: 500; color: var(--faint); margin-left: 3px; }

.vz-bar { display: flex; gap: 2px; height: 22px; border-radius: 5px; overflow: hidden; background: var(--surface); outline-offset: 3px; cursor: default; }
.vz-bar i { min-width: 3px; height: 100%; display: block; }
.vz-bar i:first-child { border-radius: 4px 0 0 4px; } .vz-bar i:last-child { border-radius: 0 4px 4px 0; } .vz-bar i:only-child { border-radius: 4px; }
.vz-bar:hover i, .vz-bar:focus i { filter: saturate(1.15) brightness(1.04); }
.vz-bar.none { border: 1px dashed var(--border-strong); background: var(--surface-2); align-items: center; padding: 0 8px; }
.vz-bar.none span { font-size: 11px; color: var(--faint); }
.vz-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 6px; }
.vz-tot { font-family: var(--mono); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vz-tot small { font-family: var(--sans); color: var(--faint); font-weight: 500; font-size: 10.5px; }
.vz-end { font-size: 11px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.vz-end::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--ch-end); }

.vz-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.vz-foot > span { font-size: 11.5px; color: var(--faint); max-width: 90ch; }
.vz-table summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--accent); }
.vz-table[open] { flex-basis: 100%; }
.vz-table[open] summary { margin-bottom: 8px; }

.vz-lede { margin: 0 0 14px; color: var(--muted); font-size: 13px; max-width: 80ch; }
.vz-sec { margin-bottom: 18px; }
.vz-sec .card-h { flex-wrap: wrap; }
.vz-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
@media (max-width: 1150px) { .vz-two { grid-template-columns: 1fr; } }

/* small multiples */
.vz-multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px 18px; margin-bottom: 10px; }
.vz-mini { margin: 0; }
.vz-mini figcaption { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.vz-plot { width: 100%; height: auto; display: block; overflow: visible; border-radius: 6px; }
.vz-plot:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.vz-plot .grid { stroke: var(--vz-grid); stroke-width: 1; }
.vz-plot .ax { stroke: var(--vz-axis); stroke-width: 1; }
.vz-plot .tk { fill: var(--faint); font-size: 9.5px; font-family: var(--sans); }
.vz-plot .ev { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .8; }
.vz-plot .xh { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.vz-plot .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.vz-plot .dt { stroke: var(--surface); stroke-width: 2; }
.vz-plot .s1 { stroke: var(--bm-s1); } .vz-plot .dt.s1 { fill: var(--bm-s1); stroke: var(--surface); }
.vz-plot .s2 { stroke: var(--bm-s2); } .vz-plot .dt.s2 { fill: var(--bm-s2); stroke: var(--surface); }
.vz-plot .s3 { stroke: var(--bm-s3); } .vz-plot .dt.s3 { fill: var(--bm-s3); stroke: var(--surface); }
.vz-plot .dl { fill: var(--muted); font-size: 10px; font-weight: 650; font-family: var(--sans); }

/* redox */
.vz-heat { display: grid; gap: 4px; max-width: 760px; }
.vz-heat .vz-row { grid-template-columns: 64px repeat(var(--n), 1fr); gap: 4px; }
.vz-heat .vz-camp { padding: 0 0 2px; justify-content: center; }
.orp { height: 34px; border-radius: 6px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 650; color: var(--ink); }
.orp.n3, .orp.n2, .orp.p2, .orp.p3 { color: #fff; }
.orp.n3 { background: var(--orp-n3); } .orp.n2 { background: var(--orp-n2); } .orp.n1 { background: var(--orp-n1); }
.orp.z { background: var(--orp-z); } .orp.p1 { background: var(--orp-p1); } .orp.p2 { background: var(--orp-p2); } .orp.p3 { background: var(--orp-p3); }
.orp.na { background: transparent; border: 1px dashed var(--border); color: var(--faint); }
.vz-scale { display: flex; align-items: center; gap: 2px; margin-top: 12px; font-size: 10.5px; color: var(--faint); }
.vz-scale i { width: 26px; height: 8px; display: inline-block; }
.vz-scale i:nth-of-type(1) { border-radius: 4px 0 0 4px; } .vz-scale i:nth-of-type(7) { border-radius: 0 4px 4px 0; }
.vz-scale span { margin: 0 6px; }
.vz-scale .n3 { background: var(--orp-n3); } .vz-scale .n2 { background: var(--orp-n2); } .vz-scale .n1 { background: var(--orp-n1); }
.vz-scale .z { background: var(--orp-z); } .vz-scale .p1 { background: var(--orp-p1); } .vz-scale .p2 { background: var(--orp-p2); } .vz-scale .p3 { background: var(--orp-p3); }
@media (prefers-color-scheme: dark) { .orp.n1, .orp.z, .orp.p1 { color: var(--ink); } .orp.n2 { color: #fff; } }

/* indici */
table.vz-ix { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 12px; min-width: 620px; table-layout: fixed; }
.vz-ix col.c-pt { width: 72px; } .vz-ix col.c-code { width: 96px; }
.vz-ix thead th { font-size: 12.5px; font-weight: 700; text-align: center; padding-bottom: 4px; }
.vz-ix tbody + tbody tr:first-child > * { border-top: 10px solid transparent; }
.vz-ix th.pt { text-align: left; vertical-align: top; font-size: 13.5px; padding: 4px 10px 0 0; width: 64px; }
.vz-ix th.pt a:hover { color: var(--accent); }
.vz-ix th.code { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding-right: 8px; white-space: nowrap; width: 84px; }
.vz-ix td { padding: 0; }
.ix { display: grid; place-items: center; height: 22px; border-radius: 5px; font-size: 11px; font-weight: 650; }
.ix.HIGH { background: var(--ix-h); color: #fff; }
.ix.MODERATE { background: var(--ix-m); color: var(--ink); }
.ix.LOW { background: var(--ix-l); color: var(--ink); }
.ix.NOT_EVALUABLE { border: 1px dashed var(--border-strong); color: var(--faint); font-weight: 500; }
.ix.NONE { color: var(--faint); }
@media (prefers-color-scheme: dark) { .ix.HIGH { color: #0b1416; } .ix.MODERATE { color: var(--ink); } }
.ixsw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.ixsw.HIGH { background: var(--ix-h); } .ixsw.MODERATE { background: var(--ix-m); } .ixsw.LOW { background: var(--ix-l); }
.ixsw.NOT_EVALUABLE { border: 1px dashed var(--border-strong); }
.vz-ix tr.cross td { padding-top: 3px; }
.xc-wrap { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; color: inherit; }
.xc { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; color: var(--ink); padding: 2px 7px 2px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.xc b { width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; color: #fff; }
.xc.CONCORDANT b { background: var(--st-good); }
.xc.PARTIALLY_CONCORDANT b { background: var(--st-warn); color: #3a2a00; }
.xc.DIVERGENT b { background: var(--st-crit); }
.xc.INSUFFICIENT b { background: var(--faint); }
.flag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border-strong); }

.vz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 11px; border-radius: 8px; font-size: 12px; line-height: 1.45; box-shadow: var(--shadow-lg); max-width: 340px; }
.vz-tip b { display: block; margin-bottom: 3px; font-size: 12.5px; }
[data-tip]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.vz-lead { display: flex; gap: 10px; flex-wrap: wrap; margin: -4px 0 18px; }
.vz-lead p { margin: 0; font-size: 13.5px; padding: 8px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 700px) { .vz-hero { padding: 18px 16px 14px; } .vz-legend.sm { margin-left: 0; } }
@media (prefers-reduced-motion: reduce) { .vz-bar i { transition: none; } }

/* account e utenti */
.form-card { max-width: 520px; }
.stack-form { display: flex; flex-direction: column; }
.stack-form label { font-size: 12px; font-weight: 650; color: var(--muted); margin: 12px 0 4px; }
.stack-form label:first-child { margin-top: 0; }
.stack-form input, .stack-form select, .inline-form select { padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 13.5px; background: var(--surface); color: var(--ink); }
.stack-form .btn { margin-top: 16px; align-self: flex-start; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { padding: 4px 8px; font-size: 12.5px; }
.issued { border-color: var(--accent); margin-bottom: 16px; }
.pw-box { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 10px 14px; border-radius: 9px; background: var(--accent-soft); }
.pw-box .mono { font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.user-chip .acct { color: var(--accent); font-weight: 600; }

.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; padding-right: 76px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; padding: 4px 6px; }

/* ================= Menu laterale: scorrevole, richiudibile, responsive ================= */
.sidebar { overflow: hidden; }
.sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-right: -8px; padding-right: 8px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent; }
.sidebar .nav::-webkit-scrollbar { width: 6px; }
.sidebar .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 6px; }
.sidebar .nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.42); }
.sidebar .foot { flex: 0 0 auto; }

.sb-toggle { display: grid; place-items: center; width: 34px; height: 34px; margin: -4px 0 -4px -10px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.sb-toggle:hover { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.sb-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sb-toggle .sb-chev { transition: transform .2s; transform-origin: 14.5px 12px; }
.sb-overlay { display: none; }

/* desktop: il menu rientra a sinistra */
@media (min-width: 901px) {
  .sb-ready .sidebar { transition: margin-left .22s ease, visibility .22s; }
  .sb-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); visibility: hidden; }
  .sb-collapsed .sb-toggle .sb-chev { transform: scaleX(-1); }
}

/* tablet e telefono: menu a scomparsa sopra il contenuto */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; height: 100dvh; z-index: 60; transform: translateX(-100%);
    visibility: hidden; box-shadow: 0 0 40px rgba(0,0,0,.35); width: min(var(--sidebar-w), 86vw); }
  .sb-ready .sidebar { transition: transform .22s ease, visibility .22s; }
  .sb-open .sidebar { transform: none; visibility: visible; }
  .sb-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5,25,28,.45); }
  .sb-overlay[hidden] { display: none; }
  .sb-open body { overflow: hidden; }
  .sb-toggle .sb-chev { display: none; }

  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .sb-toggle { margin-left: -6px; }
  .topbar .crumb { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .spacer { display: none; }
  .topbar .badge { display: none; }
  .user-chip { margin-left: 0; gap: 10px; }
  .user-chip span { display: none; }
  .user-chip b { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 20px 16px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13.5px; margin-bottom: 18px; }
  .card .card-h { padding: 13px 16px; flex-wrap: wrap; }
  .card .card-b { padding: 16px; }
  .card .card-h .hint, .card-h .hint { margin-left: 0; width: 100%; }
  .app-footer { padding: 16px; gap: 12px; }
  .app-footer .ft-links { margin-left: 0; flex-wrap: wrap; }
  .app-footer .ft-note { text-align: left; }
  .tline { overflow-x: auto; padding-bottom: 6px; }
  .tl-node { min-width: 110px; }
  .stack-form .btn { align-self: stretch; }
  .form-card { max-width: none; }
}
@media (max-width: 560px) {
  .user-chip b { display: none; }
  .stat .k, .kpi .k { font-size: 22px; }
  .vz-legend { gap: 10px; }
  table.data th, table.data td { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { .sb-ready .sidebar { transition: none; } }
@media (max-width: 900px) {
  .rgrid { grid-template-columns: 1fr !important; }
  .grid > *, .rgrid > *, .card, .card-b, .card-h { min-width: 0; }
  .card-h h3 { min-width: 0; overflow-wrap: anywhere; }
  .card .card-h .hint, .card-h .hint { white-space: normal; }
  .camp-grid { grid-template-columns: repeat(var(--n, 4), minmax(150px, 1fr)) !important; overflow-x: auto; }
  .filters .field { flex: 1 1 150px; min-width: 0; }
  .field select, .field input { min-width: 0; width: 100%; max-width: 100%; }
  .kv { overflow-wrap: anywhere; }
}
@media (max-width: 900px) { .content [style*="white-space:nowrap"] { white-space: normal !important; } }

/* pulsante «nascondi» dentro il menu e pulsante in barra più visibile */
.sidebar .brand { position: relative; }
.sb-close { margin-left: auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #cfe9e6; cursor: pointer; }
.sb-close:hover { background: rgba(255,255,255,.14); color: #fff; }
.sb-close:focus-visible { outline: 2px solid #7fd6cf; outline-offset: 2px; }
.sb-toggle { border-color: var(--border); background: var(--surface); color: var(--ink); }
.sb-toggle:hover { border-color: var(--border-strong); }
@media (min-width: 901px) {
  /* a menu aperto il comando è nel menu; in barra resta per riaprirlo */
  html:not(.sb-collapsed) .sb-toggle { display: none; }
  html:not(.sb-collapsed) .topbar .crumb { margin-left: 0; }
}
/* mobile: menu in tinta unita, più leggibile sopra la pagina */
@media (max-width: 900px) {
  .sidebar { background: #0b4f50; }
  .nav a { color: #e3f3f1; }
  .nav-sec { color: #a9d8d3; opacity: 1; }
  .sidebar .foot { color: #a9d8d3; }
  .brand small { color: #b5e0dc; }
}
.sidebar .brand { gap: 10px; padding-right: 0; }
.sidebar .brand > div { min-width: 0; }
.sidebar .brand small { white-space: nowrap; letter-spacing: .02em; }
.sb-close { width: 28px; height: 28px; }

/* ================= iPhone: niente scorrimento orizzontale ================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: clip; overscroll-behavior-x: none; }
@supports not (overflow-x: clip) { body { overflow-x: hidden; } }
.layout, .main, .content { max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }
@media (max-width: 900px) {
  body { touch-action: manipulation; }
  /* Safari ingrandisce la pagina se un campo ha testo sotto i 16px: è la causa più comune dello «scivolamento» */
  input, select, textarea { font-size: 16px !important; }
  pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .mono { overflow-wrap: anywhere; }
}

/* ================= Web app installata: notch e barra di stato ================= */
.topbar { padding-top: max(16px, env(safe-area-inset-top)); }
.sidebar { padding-top: max(22px, calc(env(safe-area-inset-top) + 10px)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.app-footer { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
@media (max-width: 900px) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}
.login-body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }

/* banner «installa l'app» */
.pwa-hint { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); max-width: 520px; margin: 0 auto; }
.pwa-hint[hidden] { display: none; }
.pwa-hint img { border-radius: 10px; flex: 0 0 40px; }
.pwa-txt { display: flex; flex-direction: column; font-size: 13px; line-height: 1.4; min-width: 0; }
.pwa-txt span { color: var(--muted); }
.pwa-txt svg { vertical-align: -2px; color: var(--blue); }
.pwa-hint .btn { flex: 0 0 auto; }
.pwa-x { margin-left: auto; flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.pwa-x:hover { background: var(--surface-2); }
@media (display-mode: standalone) { .pwa-hint { display: none !important; } }
