/* ileviaSupport — tema del sito pubblico. Personalizza le variabili per il brand. */
:root {
  --brand: #c00d0d; /* rosso Ilevia (logo 2024) */
  --brand-dark: #9e0a0a;
  --brand-ink: #ffffff;
  --ink: #1b2430;
  --muted: #5d6b7c;
  --line: #e2e7ee;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --radius: 10px;
  --wrap: 1240px;
  --sidebar: 280px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --info: #0b5cad; --info-bg: #eaf3fc;
  --tip: #1f7a4a; --tip-bg: #e9f6ee;
  --warning: #9a6200; --warning-bg: #fff6e0;
  --danger: #b42318; --danger-bg: #fdecea;
  --pagefind-ui-scale: .8;
  --pagefind-ui-primary: var(--brand);
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-font: var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.65 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
body > .layout { flex: 1 0 auto; width: 100%; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { background: var(--brand); color: var(--brand-ink); }
.site-header a { color: inherit; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.site-header .logo, .site-footer .logo { display: inline-flex; flex: none; line-height: 0; }
.site-header .logo img { height: 35px; width: auto; display: block; }
.header-content { font-size: .95rem; opacity: .92; border-left: 1px solid rgba(255,255,255,.35); padding-left: 16px; }
.header-content { flex: 1; min-width: 0; }
.header-content p { margin: 0; }
.header-content img { max-height: 40px; width: auto; vertical-align: middle; }
.header-content > * { display: inline-block; margin: 0 12px 0 0; vertical-align: middle; }
.header-content h2, .header-content h3 { font-size: 1.15rem; }
.lang-switch { display: flex; gap: 4px; margin-left: auto; }
.lang-switch a { text-decoration: none; font-size: .8rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; opacity: .8; }
.lang-switch a.current, .lang-switch a:hover { background: rgba(255,255,255,.18); opacity: 1; }
.nav-toggle { display: none; background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; }

/* newsletter */
.nl { position: relative; margin-left: auto; }
.nl + .lang-switch { margin-left: 0; }
.nl-toggle { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 6px 12px; font: 600 .85rem/1 var(--font); cursor: pointer; }
.nl-toggle:hover, .nl-toggle[aria-expanded="true"] { background: rgba(255,255,255,.26); }
.nl-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 320px; background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 18px; z-index: 50; display: grid; gap: 10px; }
.nl-panel[hidden] { display: none; }
.nl-panel::before { content: ''; position: absolute; top: -6px; right: 24px; width: 12px; height: 12px; background: #fff; transform: rotate(45deg); }
.nl-title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.nl-text { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.nl-panel input[type=email] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .95rem; }
.nl-panel input[type=email]:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.nl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nl-consent { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; line-height: 1.4; color: var(--muted); }
.nl-consent input { margin-top: 2px; accent-color: var(--brand); flex: none; }
.site-header .nl-consent a { color: var(--brand); }
.nl-submit { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px; font: 600 .95rem var(--font); cursor: pointer; }
.nl-submit:hover { background: var(--brand-dark); }
.nl-submit:disabled { opacity: .6; cursor: default; }
.nl-msg { margin: 0; font-size: .85rem; }
.nl-msg:empty { display: none; }
.nl-msg.ok { color: var(--tip); }
.nl-msg.err { color: var(--danger); }

/* layout */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 40px; padding-top: 28px; padding-bottom: 48px; }
.sidebar { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; font-size: .92rem; }
#search { margin-bottom: 16px; min-height: 51px; }
/* prima che la ricerca sia pronta: stesso riquadro, così il menu sotto non si sposta */
#search:empty { box-sizing: border-box; height: 51px; border: 2px solid var(--line); border-radius: 8px; background: #fff; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 12px; }
.tree > ul { padding-left: 0; }
.tree li ul { display: none; border-left: 1px solid var(--line); margin-left: 4px; }
.tree li.open > ul { display: block; }
.tree a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.tree a:hover { background: var(--bg-soft); }
.tree li.active > a, .tree li.active > .tree-row > a { background: #fdecec; color: var(--brand); font-weight: 600; }
.tree-row { display: flex; align-items: center; gap: 2px; }
.tree-row > a { flex: 1; min-width: 0; font-weight: 600; }
.tree-toggle { flex: none; width: 26px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tree-toggle::before { content: '▸'; font-size: .8em; transition: transform .15s; }
.tree li.open > .tree-row > .tree-toggle::before { transform: rotate(90deg); }
.tree-toggle:hover { background: var(--bg-soft); color: var(--ink); }
.tree-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.tree-head .tree-home { margin-bottom: 0; flex: 1; }
.tree-tools { display: inline-flex; gap: 2px; }
.tree-tools button { width: 26px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0; }
.tree-tools button:hover { background: var(--bg-soft); color: var(--ink); }
.tree-home { font-weight: 600; margin-bottom: 4px; }
.tree-group { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; border: 0; background: none; border-radius: 6px; font: inherit; color: var(--ink); font-weight: 600; cursor: pointer; text-align: left; }
.tree-group::after { content: '▸'; font-size: .75em; color: var(--muted); transition: transform .15s; }
.tree li.group.open > .tree-group::after { transform: rotate(90deg); }
.tree-group:hover { background: var(--bg-soft); }
.tree li.group.open > ul { display: block; }
.tree .ext { font-size: .75em; color: var(--muted); }
.card time { display: block; margin-top: 6px; font-size: .78rem; color: var(--muted); }

/* content */
.content { min-width: 0; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb span { margin: 0 4px; }
h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.45rem; margin: 2em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
.lead { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
/* immagini: larghezza in % della colonna, allineamento e testo intorno */
.doc { display: flow-root; }
.doc h2, .doc h3, .doc h4 { clear: both; }
.doc figure.img { margin: 1.2em 0; max-width: 100%; }
.doc figure.img:not([style]) { width: fit-content; }
.doc figure.img img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.doc figure.img:not([style]) img { width: auto; max-width: 100%; }
.doc figure.img.img-center { margin-left: auto; margin-right: auto; }
.doc figure.img.img-right { margin-left: auto; }
.doc figure.img.img-float-left { float: left; margin: .3em 1.6em 1em 0; }
.doc figure.img.img-float-right { float: right; margin: .3em 0 1em 1.6em; }
.doc figure.img.img-float-left:not([style]), .doc figure.img.img-float-right:not([style]) { max-width: 50%; }
.doc figcaption { font-size: .86rem; color: var(--muted); text-align: center; margin-top: .45em; }
.doc div[data-youtube-video] { margin: 1.2em 0; }
.doc div[data-youtube-video] iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); }
.doc mark { border-radius: 3px; padding: 0 .15em; }
@media (max-width: 640px) {
  .doc figure.img.img-float-left, .doc figure.img.img-float-right { float: none; width: 100% !important; max-width: 100%; margin: 1em 0; }
}
.doc code { font-family: var(--mono); font-size: .88em; background: var(--bg-soft); padding: .15em .35em; border-radius: 4px; }
.doc pre { background: #0f1720; color: #e6edf3; padding: 16px; border-radius: var(--radius); overflow: auto; }
.doc pre code { background: none; padding: 0; color: inherit; }
.doc blockquote { margin: 1.2em 0; padding: .2em 1em; border-left: 4px solid var(--line); color: var(--muted); }
.doc hr { border: 0; border-top: 1px solid #000; margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: .94rem; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg-soft); }
.doc td p, .doc th p { margin: 0; }

/* callout */
.callout { border-left: 4px solid var(--info); background: var(--info-bg); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.2em 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-tip { border-color: var(--tip); background: var(--tip-bg); }
.callout-warning { border-color: var(--warning); background: var(--warning-bg); }
.callout-danger { border-color: var(--danger); background: var(--danger-bg); }

/* file */
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); margin: 1em 0; max-width: 520px; }
.file-card:hover { border-color: var(--brand); background: var(--bg-soft); }
.file-ext { flex: none; font: 700 .7rem/1 var(--font); background: var(--brand); color: #fff; padding: 8px 6px; border-radius: 6px; min-width: 44px; text-align: center; }
.file-name { flex: 1; font-weight: 600; word-break: break-all; }
.file-size { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* children */
.children h2 { font-size: 1.1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.card span { color: var(--muted); font-size: .9rem; }
.updated { color: var(--muted); font-size: .82rem; margin-top: 40px; }

/* footer */
.site-footer { background: var(--brand); color: #fff; font-size: .9rem; padding: 28px 0; }
.site-footer a { color: #fff; }
.site-footer p { margin: .3em 0; }
.footer-inner { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.site-footer .logo img { height: 30px; width: auto; display: block; }
.footer-content { flex: 1; min-width: 220px; opacity: .92; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .layout { grid-template-columns: 1fr; gap: 0; padding-top: 16px; }
  .sidebar { position: static; max-height: none; margin-bottom: 20px; overflow: visible; }
  /* su mobile la ricerca resta sempre visibile, l'indice si apre con ☰ */
  .sidebar .tree { display: none; }
  body.nav-open .sidebar .tree { display: block; }
  #search { margin-bottom: 0; }
  h1 { font-size: 1.6rem; }
  .site-header .logo img { height: 28px; }
  .header-content { font-size: .85rem; padding-left: 12px; }
}
@media (max-width: 420px) {
  .header-content { display: none; }
}
@media (max-width: 600px) {
  .nl { position: static; }
  .nl-toggle span { display: none; }
  .nl-toggle { padding: 6px 8px; }
  .nl-panel { position: absolute; left: 12px; right: 12px; width: auto; top: 60px; }
  .nl-panel::before { display: none; }
  .site-header { position: relative; }
}
/* i blocchi con sfondo/bordo si restringono accanto alle immagini flottanti invece di passarci sotto */
.doc .callout, .doc pre, .doc .table-wrap, .doc .file-card, .doc blockquote, .doc div[data-youtube-video] { overflow: hidden; }

/* layout libero: box posizionati in % della larghezza dell'area */
.doc .canvas { position: relative; container-type: inline-size; aspect-ratio: 100 / var(--ch); margin: 1.5em 0; clear: both; }
.doc .cbox { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1cqw); width: calc(var(--w) * 1%); min-height: calc(var(--h) * 1cqw); padding: .4em .6em; }
.doc .cbox > :first-child { margin-top: 0; }
.doc .cbox > :last-child { margin-bottom: 0; }
.doc .cbox figure.img { margin: 0 auto; }
.doc .cbox figure.img:not([style]) { width: 100%; }
.doc .cbox figure.img:not([style]) img { width: 100%; }
.doc .canvas-in { display: contents; }
.doc .canvas-arrows { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
/* frecce del layout libero: coordinate in unità = 1% della larghezza dell'area (cqw) */
.doc .carrow { position: absolute; left: calc(var(--x) * 1cqw); top: calc(var(--y) * 1cqw); width: calc(var(--l) * 1cqw); height: 0; transform-origin: 0 0; transform: rotate(calc(var(--a) * 1deg)); color: var(--c); pointer-events: none; --hl: calc(var(--t) * 2.2px + 8px); --hw: calc(var(--t) * 1.4px + 5px); filter: drop-shadow(0 0 1px rgba(255,255,255,.9)); }
.doc .carrow-line { position: absolute; left: 0; right: calc(var(--hl) - 2px); top: calc(var(--t) * -.5px); height: calc(var(--t) * 1px); background: currentColor; border-radius: 2px; }
.doc .carrow.dbl .carrow-line { left: calc(var(--hl) - 2px); }
.doc .carrow-head { position: absolute; right: 0; top: calc(var(--hw) * -1); width: 0; height: 0; border-left: var(--hl) solid currentColor; border-top: var(--hw) solid transparent; border-bottom: var(--hw) solid transparent; }
.doc .carrow-head.s { right: auto; left: 0; border-left: 0; border-right: var(--hl) solid currentColor; }
@media (max-width: 760px) {
  .doc .canvas-arrows { display: none; } /* sul telefono i box si impilano: le frecce non avrebbero più senso */
  .doc .canvas { aspect-ratio: auto; display: flex; flex-direction: column; gap: 1em; }
  .doc .cbox { position: static; width: auto; min-height: 0; order: var(--o); padding: 0; }
}
/* il testo nei box scala con la larghezza (riferimento: colonna di 880px = 16px), così il layout resta identico */
.doc .cbox { font-size: max(12.5px, 1.8182cqw); }
.doc .cbox h1 { font-size: 1.9em; } .doc .cbox h2 { font-size: 1.45em; } .doc .cbox h3 { font-size: 1.15em; } .doc .cbox h4 { font-size: 1em; }
@media (max-width: 760px) { .doc .cbox { font-size: inherit; } }

/* ---------- immagine a tutto schermo con zoom ---------- */
.doc img.zoomable { cursor: zoom-in; }
html.lb-lock, html.lb-lock body { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .85); display: none; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: zoom-out; }
.lb.open { display: flex; animation: lb-in .15s ease; }
.lb.zoomed { cursor: grab; }
.lb.zoomed:active { cursor: grabbing; }
@keyframes lb-in { from { opacity: 0 } to { opacity: 1 } }
.lb-img { max-width: none; flex: none; transform-origin: center center; will-change: transform; }

/* ---------- banner cookie ---------- */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 900; display: flex; justify-content: center; pointer-events: none; }
.cookie-banner[hidden] { display: none; }
.cookie-inner { pointer-events: auto; max-width: 880px; width: 100%; background: #fff; color: var(--ink); border-radius: 14px; box-shadow: 0 16px 50px rgba(0,0,0,.22); border-top: 4px solid var(--brand); padding: 18px 20px; display: flex; gap: 20px; align-items: center; }
.cookie-text { flex: 1; min-width: 0; }
.cookie-title { margin: 0 0 4px; font-weight: 700; }
.cookie-desc { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.cookie-links { margin: 6px 0 0; font-size: .82rem; }
.cookie-actions { display: flex; gap: 8px; flex: none; }
.cookie-actions button { border-radius: 8px; padding: 10px 16px; font: 600 .9rem var(--font); cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.cookie-actions .cookie-yes { background: var(--brand); border-color: var(--brand); color: #fff; }
.cookie-actions .cookie-yes:hover { background: var(--brand-dark); }
@media (max-width: 700px) {
  .cookie-inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .cookie-actions button { flex: 1; }
}

/* home: le più viste */
.popular { margin-top: 32px; }
.popular h2 { font-size: 1.1rem; }
.popular ol { margin: 0; padding-left: 1.6em; columns: 2; column-gap: 40px; }
.popular li { padding: 3px 0; break-inside: avoid; }
.popular li::marker { color: var(--brand); font-weight: 700; }
.popular a { text-decoration: none; }
.popular a:hover { text-decoration: underline; }
@media (max-width: 700px) { .popular ol { columns: 1; } }

/* ricerca: risultati in un riquadro scorrevole, così campo e menu restano visibili */
@media (min-width: 861px) {
  #search .pagefind-ui__drawer { max-height: 55vh; overflow: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
}

/* navigazione senza ricaricare */
main.content { transition: opacity .12s; }
main.content.loading { opacity: .45; pointer-events: none; }

/* accesso e modifica della pagina dal sito */
.acct { position: relative; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nl ~ .acct { margin-left: 0; }
.acct + .lang-switch { margin-left: 0; }
.hd-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 6px 12px; font: 600 .85rem/1 var(--font); cursor: pointer; white-space: nowrap; }
.hd-btn:hover, .hd-btn[aria-expanded="true"], .hd-btn.on { background: rgba(255,255,255,.26); }
.hd-btn[hidden] { display: none; }
.acct-edit { background: #fff; color: var(--brand); border-color: #fff; }
.acct-edit:hover, .acct-edit.on { background: #fde8e8; }
.acct-panel input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .95rem; }
.acct-panel input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.acct-menu { width: 240px; }
.acct-full { color: var(--brand); font-size: .9rem; }
.acct-note:empty { display: none; }
.ils-edit-panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--ils-edit-w, 50vw); z-index: 950; background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.ils-edit-panel[hidden] { display: none; }
.ils-edit-panel iframe { flex: 1; width: 100%; border: 0; }
.ils-edit-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--brand); color: #fff; font-size: 14px; }
.ils-edit-sp { flex: 1; }
.ils-edit-full { color: #fff; text-decoration: none; font-size: 13px; opacity: .9; }
.ils-edit-full:hover { opacity: 1; text-decoration: underline; }
.ils-edit-close { border: 0; background: rgba(255,255,255,.15); color: #fff; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; }
.ils-edit-grip { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
body.ils-resizing { cursor: col-resize; user-select: none; }
body.ils-resizing iframe { pointer-events: none; }
body.ils-editing { margin-right: var(--ils-edit-w, 50vw); }
@media (max-width: 900px) {
  .ils-edit-panel { width: 100%; }
  body.ils-editing { margin-right: 0; overflow: hidden; }
  .hd-btn .t { display: none; }
  .hd-btn { padding: 6px 8px; }
  .acct { position: static; }
}

/* pagina a tutta larghezza: menu attaccato al bordo sinistro, contenuto su tutto il resto */
.wrap { max-width: none; padding-left: 24px; padding-right: 24px; }
.layout.wrap { padding-left: 0; padding-top: 0; column-gap: 40px; }
.layout > .sidebar { top: 0; max-height: 100vh; min-height: calc(100vh - 68px); padding: 24px 16px 32px 20px; background: var(--bg-soft); border-right: 1px solid var(--line); }
.layout > .content { padding-top: 28px; }
@media (max-width: 860px) {
  .layout.wrap { padding-left: 16px; padding-right: 16px; padding-top: 16px; }
  .layout > .sidebar { min-height: 0; max-height: none; padding: 0; background: none; border-right: 0; }
  .layout > .content { padding-top: 0; }
}
.layout > .sidebar .tree a:hover, .layout > .sidebar .tree-group:hover, .layout > .sidebar .tree-toggle:hover, .layout > .sidebar .tree-tools button:hover { background: #e7ebf0; }

/* titoli di sezione: i "riquadri" con solo un titolo diventano intestazioni pulite */
.doc blockquote:has(> :is(h1, h2, h3, h4):only-child) { border-left: 0; padding: 0; margin: 2.2em 0 .9em; color: var(--ink); overflow: visible; }
.doc blockquote:has(> :is(h1, h2, h3, h4):only-child) > :is(h1, h2, h3, h4) { margin: 0; }
.doc h2 { font-size: 1.5rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--ink); margin: 2.2em 0 .8em; padding-bottom: .45em; border-bottom: 1px solid var(--line); position: relative; }
.doc h2::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; border-radius: 2px; background: var(--brand); }
.doc h3 { font-size: 1.18rem; line-height: 1.35; font-weight: 700; color: var(--ink); margin: 1.8em 0 .6em; padding-left: .7em; border-left: 3px solid var(--brand); }
.doc h4 { font-size: 1rem; font-weight: 700; color: var(--ink); margin: 1.5em 0 .5em; text-transform: none; letter-spacing: .01em; }
.doc :is(h2, h3, h4) strong, .doc :is(h2, h3, h4) b { font-weight: inherit; }
.doc > :first-child, .doc > blockquote:first-child > :first-child { margin-top: 0; }
/* le citazioni vere (testo) restano riquadri, più leggeri */
.doc blockquote:not(:has(> :is(h1, h2, h3, h4):only-child)) { border-left: 3px solid var(--line); background: var(--bg-soft); border-radius: 0 8px 8px 0; padding: .6em 1em; color: var(--ink); }

/* sezioni apribili dentro la pagina */
.sec-tools { display: flex; justify-content: flex-end; gap: 4px; margin: -8px 0 4px; }
.sec-tools button { border: 0; background: none; color: var(--muted); font: 500 .8rem var(--font); padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.sec-tools button:hover { background: var(--bg-soft); color: var(--ink); }
.sec-head { position: relative; display: flex; align-items: flex-end; gap: 8px; cursor: pointer; }
.sec-head > :first-child { flex: 1; min-width: 0; }
.sec-l3 > .sec-head, .sec-l4 > .sec-head { align-items: center; }
.sec-toggle { flex: none; width: 30px; height: 30px; margin-bottom: .55em; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.sec-l2 > .sec-head > .sec-toggle { margin-bottom: 1.1em; }
.sec-l3 > .sec-head > .sec-toggle, .sec-l4 > .sec-head > .sec-toggle { margin: 1.4em 0 .4em; }
.sec-toggle::before { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.sec.closed > .sec-head > .sec-toggle::before { transform: rotate(-45deg); }
.sec-head:hover .sec-toggle { background: var(--bg-soft); color: var(--ink); }
.sec.closed > .sec-body { display: none; }
.sec.closed > .sec-head :is(h2, h3, h4) { margin-bottom: .4em; }
@media print { .sec.closed > .sec-body { display: block; } .sec-toggle, .sec-tools { display: none; } }

/* menu: triangolini a sinistra dei nomi, nomi allineati */
.tree-group { justify-content: flex-start; gap: 2px; padding-left: 2px; }
.tree-group::after { content: none; }
.tree-group::before { content: '▸'; flex: none; width: 20px; text-align: center; font-size: .75em; color: var(--muted); transition: transform .15s; }
.tree li.group.open > .tree-group::before { transform: rotate(90deg); }
.tree-row { gap: 2px; }
.tree-row > .tree-toggle { order: -1; width: 20px; height: 26px; margin-left: 2px; }
.tree-row > a { padding-left: 2px; }
.tree li:not(.group):not(.has-kids) > a { padding-left: 24px; }
.tree-home { padding-left: 8px; }
.tree-row { align-items: flex-start; }
.tree-group { align-items: flex-start; }
.tree-group::before { line-height: 1.65rem; }
.tree-row > .tree-toggle { margin-top: 3px; }
.tree-group::before, .tree-toggle::before { font-size: 1.05em; }
.tree-group::before { width: 20px; }

/* linguetta delle sezioni a sinistra del titolo */
.sec-head { display: block; }
.sec-head :is(h1, h2, h3, h4) { position: relative; }
.sec-head .sec-toggle { position: absolute; left: -34px; top: 50%; margin: 0 !important; transform: translateY(-50%); width: 26px; height: 26px; }
.sec-l2 > .sec-head .sec-toggle { top: calc(50% - .22em); }
.sec-l3 > .sec-head .sec-toggle, .sec-l4 > .sec-head .sec-toggle { left: -30px; }
.sec-l3 > .sec-head h3 .sec-toggle { left: calc(-30px - .7em - 3px); }
@media (max-width: 860px) {
  .sec-head :is(h2, h4) { padding-left: 30px; }
  .sec-head h3 { padding-left: calc(.7em + 28px); }
  .sec-head .sec-toggle, .sec-l3 > .sec-head h3 .sec-toggle, .sec-l4 > .sec-head .sec-toggle { left: -2px; }
  .sec-l3 > .sec-head h3 .sec-toggle { left: calc(.7em - 2px); }
}
.sec.closed > .sec-head .sec-toggle::before { transform: rotate(-45deg); }

/* 👍 / 👎 alla fine delle sezioni */
.fb { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin: 10px 0 4px; }
.fb-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; width: 34px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer; opacity: .55; filter: grayscale(1); transition: opacity .15s, filter .15s, border-color .15s; padding: 0; }
.fb-btn:hover, .fb-btn.on { opacity: 1; filter: none; }
.fb-btn.on { border-color: var(--brand); background: #fdecec; }
.fb-thanks { font-size: .8rem; color: var(--muted); min-width: 3.5em; }
.fb-thanks:empty { min-width: 0; }
@media print { .fb { display: none; } }

/* nuova pagina dal sito */
.add-panel input[name=title] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .95rem; }
.add-panel input[name=title]:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.add-opt { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--ink); }
.add-opt[hidden] { display: none; }
.add-opt input { accent-color: var(--brand); }
.acct-add { white-space: nowrap; }
.add-panel { right: auto; left: 0; }
.add-panel::before { right: auto; left: 28px; }
@media (max-width: 900px) { .add-panel { left: auto; right: 0; } .add-panel::before { display: none; } }

/* bozze visibili agli editor collegati */
.tree a.is-draft { color: var(--muted); font-style: italic; }
.draft-badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #fff4d6; color: #8a6100; font: 600 .68rem/1.5 var(--font); font-style: normal; vertical-align: 1px; }

/* =====================================================================
   Material Design 3 — livello di stile (colori e identità Ilevia invariati)
   token: colore per ruoli, stati (hover 8% · focus/pressione 10%), forme,
   elevazioni, tipografia e movimento; aree cliccabili ≥ 48px sul touch
   ===================================================================== */
:root {
  --md-primary: var(--brand);
  --md-on-primary: #fff;
  --md-sec-c: #fbe3e0;          /* secondary container: indicatore attivo */
  --md-on-sec-c: #8f0b0b;
  --md-surface: #fff;
  --md-surface-low: var(--bg-soft);
  --md-surface-c: #eef1f5;
  --md-surface-high: #e6eaef;
  --md-on-surface: var(--ink);
  --md-on-surface-var: var(--muted);
  --md-outline: #7b8796;        /* bordi dei campi: contrasto ≥ 3:1 */
  --md-outline-var: var(--line);
  --sh-xs: 4px; --sh-s: 8px; --sh-m: 12px; --sh-l: 16px; --sh-xl: 28px; --sh-full: 999px;
  --el1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --el2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
  --el3: 0 1px 3px rgba(0,0,0,.3), 0 4px 8px 3px rgba(0,0,0,.15);
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.05, .7, .1, 1);
  --dur-s: 150ms; --dur-m: 250ms;
  --st-h: linear-gradient(color-mix(in srgb, currentColor 8%, transparent) 0 0);
  --st-p: linear-gradient(color-mix(in srgb, currentColor 10%, transparent) 0 0);
  --radius: var(--sh-m);
  --pagefind-ui-scale: .75;
  --pagefind-ui-border-radius: var(--sh-full);
  --pagefind-ui-border-width: 0px;
  --pagefind-ui-background: var(--md-surface-high);
  --pagefind-ui-text: var(--md-on-surface);
}
.ic { display: block; flex: none; }

/* stati di interazione: livello sopra lo sfondo, colore del contenuto */
:is(.nl-toggle, .hd-btn, .lang-switch a, .nav-toggle, .tree a, .tree-group, .tree-toggle, .tree-tools button, .card, .file-card,
    .sec-tools button, .sec-toggle, .fb-btn, .cookie-actions button, .nl-submit, .ils-edit-close, .popular a) {
  transition: background-color var(--dur-s) var(--ease), box-shadow var(--dur-s) var(--ease), border-color var(--dur-s) var(--ease), color var(--dur-s) var(--ease);
}
:is(.nl-toggle, .hd-btn, .lang-switch a, .nav-toggle, .tree a, .tree-group, .tree-toggle, .tree-tools button, .card, .file-card,
    .sec-tools button, .fb-btn, .cookie-actions button, .nl-submit, .ils-edit-close):hover { background-image: var(--st-h); }
:is(.nl-toggle, .hd-btn, .lang-switch a, .nav-toggle, .tree a, .tree-group, .tree-toggle, .tree-tools button, .card, .file-card,
    .sec-tools button, .fb-btn, .cookie-actions button, .nl-submit, .ils-edit-close):active { background-image: var(--st-p); }
/* focus da tastiera sempre visibile */
:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.site-header :focus-visible, .site-footer :focus-visible, .ils-edit-bar :focus-visible { outline-color: #fff; }
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }

/* ---------- top app bar ---------- */
.header-inner { min-height: 64px; gap: 8px; }
.site-header .logo { margin-right: 8px; }
.nav-toggle { width: 48px; height: 48px; margin-left: -12px; border-radius: var(--sh-full); align-items: center; justify-content: center; padding: 0; }
.nl-toggle, .hd-btn { height: 40px; padding: 0 16px 0 12px; border-radius: var(--sh-full); font: 500 .875rem/1 var(--font); letter-spacing: .01em; gap: 8px; background: transparent; border: 1px solid rgba(255,255,255,.7); }
.nl-toggle:hover, .nl-toggle[aria-expanded="true"], .hd-btn:hover, .hd-btn[aria-expanded="true"], .hd-btn.on { background-color: rgba(255,255,255,.12); }
.acct-edit { background: #fff; color: var(--md-primary); border-color: #fff; }
.acct-edit:hover, .acct-edit.on { background-color: #fff; }
.acct { gap: 8px; }
.lang-switch { gap: 0; padding: 4px; border-radius: var(--sh-full); background: rgba(0,0,0,.12); }
.lang-switch a { min-width: 40px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: var(--sh-full); font: 500 .8125rem/1 var(--font); letter-spacing: .04em; opacity: 1; color: rgba(255,255,255,.88); }
.lang-switch a.current { background: #fff; color: var(--md-primary); }
.lang-switch a:hover:not(.current) { background-color: transparent; }

/* pannelli a comparsa dall'header (newsletter, accesso, nuova pagina) */
.nl-panel { border-radius: var(--sh-l); box-shadow: var(--el3); padding: 24px; gap: 16px; top: calc(100% + 8px); }
.nl-panel::before { display: none; }
.nl-title { font-size: 1.375rem; line-height: 1.75rem; font-weight: 500; }
.nl-text { font-size: .875rem; line-height: 1.25rem; }
.nl-panel input[type=email], .acct-panel input, .add-panel input[name=title] {
  height: 48px; padding: 0 16px; border: 1px solid var(--md-outline); border-radius: var(--sh-xs); font-size: 1rem; background: var(--md-surface); color: var(--md-on-surface);
  transition: border-color var(--dur-s) var(--ease);
}
.nl-panel input[type=email]:hover, .acct-panel input:hover, .add-panel input[name=title]:hover { border-color: var(--md-on-surface); }
.nl-panel input[type=email]:focus, .acct-panel input:focus, .add-panel input[name=title]:focus { outline: 2px solid var(--md-primary); outline-offset: -2px; border-color: transparent; }
.nl-panel ::placeholder { color: var(--md-on-surface-var); opacity: 1; }
.nl-consent, .add-opt { font-size: .875rem; line-height: 1.25rem; gap: 12px; min-height: 40px; align-items: center; }
.nl-consent input, .add-opt input { width: 18px; height: 18px; margin: 0; }
.nl-submit { height: 40px; padding: 0 24px; border-radius: var(--sh-full); font: 500 .875rem/1 var(--font); letter-spacing: .01em; }
.nl-submit:hover { background-color: var(--md-primary); box-shadow: var(--el1); }
.nl-submit:disabled { opacity: 1; background: color-mix(in srgb, var(--md-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-on-surface) 38%, transparent); box-shadow: none; }
.acct-full { display: inline-flex; align-items: center; min-height: 40px; font-weight: 500; }

/* ---------- navigation drawer (indice a sinistra) ---------- */
@media (min-width: 861px) {
  /* sfondo del menu fino in fondo alla pagina, anche quando il contenuto è più lungo */
  .layout.wrap { background: linear-gradient(90deg, var(--md-surface-low) calc(var(--sidebar) - 1px), var(--md-outline-var) calc(var(--sidebar) - 1px) var(--sidebar), transparent var(--sidebar)); }
  .layout > .sidebar { background: none; border-right: 0; padding: 16px 12px 32px; }
}
#search { min-height: 48px; margin-bottom: 12px; }
#search .pagefind-ui { --pagefind-ui-scale: .75; --pagefind-ui-border-radius: 999px; --pagefind-ui-border-width: 0px; --pagefind-ui-background: var(--md-surface-high); --pagefind-ui-text: var(--md-on-surface); --pagefind-ui-border: var(--md-outline-var); }
#search .pagefind-ui__search-input { background: var(--md-surface-high); border: 0; font-size: .875rem; padding-left: 44px; height: 48px; }
#search .pagefind-ui__form::before { left: 16px; }
#search .pagefind-ui__form::before { left: 18px; top: 16px; opacity: .8; }
#search:empty { height: 48px; border: 0; border-radius: var(--sh-full); background: var(--md-surface-high); }
#search .pagefind-ui__search-input { font-weight: 400; color: var(--md-on-surface); padding-right: 16px; }
#search .pagefind-ui__form:has(.pagefind-ui__search-clear:not(.pagefind-ui__suppressed)) .pagefind-ui__search-input { padding-right: 72px; }
#search .pagefind-ui__search-input::placeholder { color: var(--md-on-surface-var); opacity: 1; }
#search .pagefind-ui__search-input:focus { outline: 2px solid var(--md-primary); outline-offset: 0; }
.sidebar { font-size: .875rem; }
.tree-head { min-height: 48px; padding: 0 0 0 4px; margin-bottom: 0; }
.tree-home { font-weight: 600; padding: 0 12px; margin: 0; color: var(--md-on-surface-var); font-size: .875rem; letter-spacing: .01em; display: flex; align-items: center; min-height: 40px; border-radius: var(--sh-full); }
.tree-tools { gap: 0; }
.tree-tools button { width: 40px; height: 40px; border-radius: var(--sh-full); display: inline-flex; align-items: center; justify-content: center; color: var(--md-on-surface-var); }
.layout > .sidebar .tree a:hover, .layout > .sidebar .tree-group:hover, .layout > .sidebar .tree-toggle:hover, .layout > .sidebar .tree-tools button:hover { background-color: transparent; }
.tree a, .tree-group { min-height: 40px; display: flex; align-items: center; padding-top: 8px; padding-bottom: 8px; padding-right: 12px; line-height: 1.35; border-radius: var(--sh-full); color: var(--md-on-surface); font-weight: 400; }
.tree-row > a { font-weight: 500; }
.tree-group { font-weight: 500; }
.tree li { margin: 1px 0; }
.tree li.active > a, .tree li.active > .tree-row > a { background: var(--md-sec-c); color: var(--md-on-sec-c); font-weight: 600; }
.tree li ul { border-left: 1px solid var(--md-outline-var); margin-left: 16px; padding-left: 4px; }
.tree-row { align-items: center; gap: 0; }
.tree-row > .tree-toggle { order: -1; width: 32px; height: 32px; margin: 0 -4px 0 0; border-radius: var(--sh-full); align-self: center; }
.tree-row > a { padding-left: 4px; }
.tree li:not(.group):not(.has-kids) > a { padding-left: 32px; }
.tree-toggle::before, .tree-group::before {
  content: ''; display: block; width: 20px; height: 20px; flex: none; background: currentColor; font-size: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--dur-m) var(--ease); color: var(--md-on-surface-var);
}
.tree-toggle::before { color: inherit; }
.tree-group { padding-left: 6px; gap: 6px; align-items: center; }
.tree-group::before { width: 20px; line-height: normal; }
.tree .ext { margin-left: 4px; }
.draft-badge { border-radius: var(--sh-xs); padding: 0 6px; font-weight: 500; }

/* ---------- contenuto ---------- */
h1 { font-size: 2rem; line-height: 2.5rem; font-weight: 600; letter-spacing: 0; }
.lead { font-size: 1.125rem; line-height: 1.6; }
.cards { gap: 16px; }
.card { border-radius: var(--sh-m); border-color: var(--md-outline-var); padding: 16px; gap: 6px; background: var(--md-surface); }
.card:hover { border-color: var(--md-outline-var); box-shadow: var(--el1); }
.card strong, .card b, .card > :first-child { font-size: 1rem; line-height: 1.5rem; font-weight: 600; }
.card span { font-size: .875rem; line-height: 1.25rem; color: var(--md-on-surface-var); }
.card time { font-size: .75rem; letter-spacing: .03em; }
.children h2, .popular h2 { font-size: 1.375rem; line-height: 1.75rem; font-weight: 500; border: 0; padding: 0; margin: 2em 0 .5em; }
.children h2::after, .popular h2::after { content: none; }
.file-card { border-radius: var(--sh-m); min-height: 56px; }
.file-card:hover { border-color: var(--md-outline-var); background-color: transparent; box-shadow: var(--el1); }
.file-ext { border-radius: var(--sh-s); }
.doc figure.img img, .doc div[data-youtube-video] iframe, .doc pre { border-radius: var(--sh-m); }
.callout { border-radius: 0 var(--sh-m) var(--sh-m) 0; padding: 16px; }
/* tabelle (data table): cornice arrotondata, righe separate */
.doc .table-wrap { border: 1px solid var(--md-outline-var); border-radius: var(--sh-m); }
.doc .table-wrap table { margin: 0; }
.doc .table-wrap :is(th, td) { border-width: 0 1px 1px 0; padding: 12px 16px; }
.doc .table-wrap tr > :last-child { border-right: 0; }
.doc .table-wrap tr:last-child > td { border-bottom: 0; }
.doc .table-wrap th { font-weight: 600; font-size: .875rem; letter-spacing: .01em; background: var(--md-surface-low); }
/* tabella dentro una cella (es. i parametri di ogni DPT): compatta */
.doc td > .table-wrap, .doc td > table { margin: 0; }
.doc td .table-wrap { border-radius: var(--sh-s, 8px); }
.doc td .table-wrap table { font-size: .85rem; }
.doc td .table-wrap :is(th, td) { padding: 5px 10px; }
.doc td .table-wrap th { font-size: .8rem; }
.doc td:has(> .table-wrap) { min-width: 320px; }
.doc td > p + .table-wrap { margin-top: 10px; }
.popular li { padding: 4px 0; }
.popular a { display: inline-block; padding: 6px 0; }

/* sezioni apribili: text button e icon button */
.sec-tools { gap: 8px; margin: -8px 0 8px; }
.sec-tools button { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 8px; border-radius: var(--sh-full); font: 500 .875rem/1 var(--font); color: var(--md-primary); }
.sec-tools button:hover { background-color: transparent; color: var(--md-primary); }
.sec-head .sec-toggle { border-radius: var(--sh-full); width: 32px; height: 32px; color: var(--md-on-surface-var); }
.sec-head:hover .sec-toggle { background-color: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.sec-toggle::before { transition: transform var(--dur-m) var(--ease); }
@media (min-width: 861px) {
  .sec-head .sec-toggle { left: -38px; }
  .sec-l3 > .sec-head .sec-toggle, .sec-l4 > .sec-head .sec-toggle { left: -36px; }
  .sec-l3 > .sec-head h3 .sec-toggle { left: calc(-36px - .7em - 3px); }
}

/* 👍 / 👎: icon button "outlined", selezionato = tonal */
.fb { gap: 8px; margin: 16px 0 8px; }
.fb-btn { width: 40px; height: 40px; border-radius: var(--sh-full); border: 1px solid var(--md-outline); background: transparent; color: var(--md-on-surface-var); opacity: 1; filter: none; display: inline-flex; align-items: center; justify-content: center; }
.fb-btn:hover { opacity: 1; filter: none; color: var(--md-on-surface); }
.fb-btn.on { background: var(--md-sec-c); border-color: transparent; color: var(--md-on-sec-c); }
.fb-thanks { font-size: .875rem; }

/* banner cookie: dialogo con elevazione, azioni come pulsanti M3 */
.cookie-inner { border-radius: var(--sh-xl); border-top: 0; box-shadow: var(--el3); padding: 24px; gap: 24px; }
.cookie-title { font-size: 1.125rem; line-height: 1.5rem; font-weight: 600; margin-bottom: 8px; }
.cookie-desc { font-size: .875rem; line-height: 1.25rem; }
.cookie-links { font-size: .875rem; line-height: 1.25rem; margin-top: 8px; }
.cookie-actions { gap: 8px; }
.cookie-actions button { height: 40px; padding: 0 24px; border-radius: var(--sh-full); font: 500 .875rem/1 var(--font); letter-spacing: .01em; border: 1px solid var(--md-outline); color: var(--md-primary); background: transparent; }
.cookie-actions .cookie-yes { border-color: var(--md-primary); }
.cookie-actions .cookie-yes:hover { background-color: var(--md-primary); box-shadow: var(--el1); }

/* pannello di modifica dal sito */
.ils-edit-bar { min-height: 56px; padding: 0 8px 0 16px; gap: 8px; }
.ils-edit-full { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--sh-full); font-weight: 500; }
.ils-edit-close { width: 40px; height: 40px; border-radius: var(--sh-full); background: transparent; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ils-edit-panel { box-shadow: var(--el3); }

/* navigazione senza ricaricare: dissolvenza M3 */
main.content { transition: opacity var(--dur-s) var(--ease); }

/* ---------- telefono: drawer modale con sfondo oscurato ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .sidebar .tree { display: block; position: fixed; z-index: 1001; top: 0; left: 0; bottom: 0; width: min(360px, 86vw); overflow: auto; overscroll-behavior: contain;
    background: var(--md-surface-low); border-radius: 0 var(--sh-l) var(--sh-l) 0; padding: 12px 12px 24px; box-shadow: var(--el1);
    transform: translateX(-105%); visibility: hidden; transition: transform var(--dur-m) var(--ease), visibility 0s linear var(--dur-m); }
  body.nav-open .sidebar .tree { transform: none; visibility: visible; transition: transform var(--dur-m) var(--ease-out), visibility 0s; }
  body::after { content: ''; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.32); opacity: 0; pointer-events: none; transition: opacity var(--dur-m) var(--ease); }
  body.nav-open::after { opacity: 1; pointer-events: auto; }
  html:has(body.nav-open) { overflow: hidden; }
  .layout > .sidebar { position: static; margin-bottom: 16px; }
  .header-inner { min-height: 64px; }
  .site-header .wrap { padding-left: 16px; padding-right: 8px; }
  .nl-toggle, .hd-btn { width: 40px; padding: 0; justify-content: center; }
  .sec-tools { margin-top: 0; }
}
@media (max-width: 600px) { .nl-toggle span { display: none; } .nl-toggle { padding: 0; } .nl-panel { top: 64px; } }
@media (max-width: 420px) { .lang-switch a { min-width: 36px; padding: 0 8px; } .acct { gap: 4px; } }

/* touch: aree cliccabili di almeno 48px */
@media (pointer: coarse) {
  .tree a, .tree-group { min-height: 48px; }
  .tree-row > .tree-toggle { width: 40px; height: 40px; margin-right: -8px; }
  .tree li:not(.group):not(.has-kids) > a { padding-left: 36px; }
  .fb-btn, .sec-tools button { min-height: 40px; }
  .fb-btn { width: 48px; height: 48px; }
  .sec-head .sec-toggle { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0s !important; animation-duration: 0s !important; } }

/* H1 nel testo della pagina: titolo più grande dell'H2 */
.doc h1 { clear: both; font-size: 1.9rem; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; color: var(--ink); margin: 2.2em 0 .7em; }
.doc :is(h1) strong, .doc h1 b { font-weight: inherit; }
.sec-l1 > .sec-head .sec-toggle { top: 50%; }
@media (max-width: 860px) { .doc h1 { font-size: 1.55rem; } .sec-head h1 { padding-left: 30px; } }

/* 👍 / 👎: manine a colori dentro i pulsanti tondi */
.fb-btn { font-size: 20px; line-height: 1; }
.fb-btn span { display: block; transform: translateY(1px); }

/* manine sul titolo della sezione: visibili solo passando sopra il titolo */
.sec-head { position: relative; }
.sec-head > .fb { position: absolute; right: 0; top: 50%; transform: translateY(-50%); margin: 0; padding-left: 12px; background: var(--bg); opacity: 0; visibility: hidden; transition: opacity var(--dur-s) var(--ease), visibility 0s linear var(--dur-s); }
.sec-l2 > .sec-head > .fb { top: calc(50% - .3em); }
.sec-head:hover > .fb, .sec-head > .fb:focus-within { opacity: 1; visibility: visible; transition: opacity var(--dur-s) var(--ease), visibility 0s; }
.sec-head > .fb .fb-btn { width: 36px; height: 36px; font-size: 18px; }
.sec-head > .fb .fb-thanks:empty { display: none; }
/* senza mouse (telefono/tablet) restano visibili, più discrete */
@media (hover: none) {
  .sec-head > .fb { opacity: .85; visibility: visible; }
}

/* manine subito accanto al testo del titolo (non in fondo a destra), visibili passando sul titolo */
.sec-head .fb { position: static; transform: none; display: inline-flex; vertical-align: middle; gap: 4px; margin: -4px 0 0 12px; padding: 0; background: none; opacity: 0; visibility: hidden; font-size: 16px; font-weight: 400; letter-spacing: 0;
  transition: opacity var(--dur-s) var(--ease), visibility 0s linear var(--dur-s); }
.sec-head:hover .fb, .sec-head .fb:focus-within, .sec-head .fb:has(.fb-btn.on) { opacity: 1; visibility: visible; transition: opacity var(--dur-s) var(--ease), visibility 0s; }
.sec-head .fb .fb-btn { width: 34px; height: 34px; font-size: 17px; }
.sec-head .fb .fb-thanks { font-size: 13px; color: var(--muted); }
.sec-head .fb .fb-thanks:empty { display: none; }
@media (hover: none) { .sec-head .fb { opacity: .85; visibility: visible; } }
@media print { .sec-head .fb { display: none; } }
/* manine sempre visibili accanto al titolo */
.sec-head .fb { opacity: 1; visibility: visible; transition: none; }

/* 👍 / 👎 sul titolo della pagina + suggerimento anonimo */
h1 .fb-page { display: inline-flex; vertical-align: middle; gap: 6px; margin: -6px 0 0 16px; font-size: 16px; font-weight: 400; letter-spacing: 0; line-height: 1; }
h1 .fb-page .fb-btn { width: 40px; height: 40px; font-size: 19px; }
.fb-form { margin: 4px 0 20px; padding: 16px; max-width: 640px; border: 1px solid var(--md-outline-var); border-radius: var(--sh-m); background: var(--md-surface-low); display: grid; gap: 8px; animation: fb-in var(--dur-m) var(--ease-out); }
@keyframes fb-in { from { opacity: 0; transform: translateY(-4px) } }
.fb-q { font-weight: 600; font-size: 1rem; }
.fb-form textarea { width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--md-outline); border-radius: var(--sh-xs); font: inherit; font-size: .95rem; resize: vertical; background: #fff; color: var(--ink); }
.fb-form textarea:focus { outline: 2px solid var(--md-primary); outline-offset: -2px; border-color: transparent; }
.fb-hint { margin: 0; font-size: .8125rem; color: var(--muted); }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fb-actions button { height: 40px; padding: 0 20px; border-radius: var(--sh-full); font: 500 .875rem/1 var(--font); cursor: pointer; border: 1px solid transparent; background: transparent; color: var(--md-primary); }
.fb-actions .fb-send { background: var(--md-primary); color: #fff; }
.fb-actions .fb-send:disabled { opacity: .5; cursor: default; }
.fb-actions button:hover { background-image: var(--st-h); }
.fb-msg { margin: 0; color: var(--danger); font-size: .875rem; }
.fb-msg:empty { display: none; }
.fb-done { margin: 0; font-weight: 600; color: var(--tip); }
@media (max-width: 600px) { h1 .fb-page { display: flex; margin: 8px 0 0; } }
@media print { h1 .fb-page, .fb-form { display: none; } }

/* titolo con icona */
.doc .title-banner { display: flex; align-items: center; gap: 24px; margin: 1.8em 0 1.2em; clear: both; }
.doc .title-banner .tb-icon { flex: none; width: 76px; height: 76px; border-radius: 12px; background: var(--tb, #3d5a98); box-shadow: inset 0 -4px 0 rgba(0,0,0,.22), 0 2px 5px rgba(0,0,0,.18); display: grid; place-items: center; overflow: hidden; padding: 0; border: 0; }
.doc .title-banner .tb-icon i { display: block; width: 46px; height: 46px; background: #fff; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.doc .title-banner .tb-icon.has-img { background: #fff; }
.doc .title-banner .tb-icon img { display: block; width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; margin: 0; max-width: none; }
.doc .title-banner .tb-title { flex: 1; min-width: 0; margin: 0; padding: .1em 0 .55em; border-bottom: 2px solid #111; font-size: 1.9rem; line-height: 1.2; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; color: var(--ink); }
@media (max-width: 640px) { .doc .title-banner { gap: 14px; } .doc .title-banner .tb-icon { width: 56px; height: 56px; } .doc .title-banner .tb-icon i { width: 34px; height: 34px; } .doc .title-banner .tb-title { font-size: 1.35rem; } }

/* titoli nei riquadri (come nell'editor): riga rossa verticale a sinistra, alta quanto il testo, niente sottolineatura */
.doc blockquote:has(> :is(h1, h2, h3, h4):only-child),
.doc .sec-head > blockquote:has(> :is(h1, h2, h3, h4):only-child) { border-left: 3px solid var(--brand); padding: 0 0 0 .7em; margin: 1.8em 0 .8em; background: none; border-radius: 0; color: var(--ink); overflow: visible; }
.doc blockquote:has(> :is(h1, h2, h3, h4):only-child) > :is(h1, h2, h3, h4) { margin: 0; padding: 0; border: 0; line-height: 1.25; }
.doc blockquote:has(> :is(h1, h2, h3, h4):only-child) > :is(h1, h2, h3, h4)::after { content: none; }
@media (min-width: 861px) {
  .doc .sec-head > blockquote > :is(h1, h2, h3, h4) .sec-toggle { left: calc(-38px - .7em - 3px); }
}
@media (max-width: 860px) {
  .doc .sec-head > blockquote:has(> :is(h1, h2, h3, h4):only-child) > :is(h1, h2, h3, h4) { padding-left: 30px; }
  .doc .sec-head > blockquote > :is(h1, h2, h3, h4) .sec-toggle { left: -4px; }
}

/* titoli H2–H4 (senza più le citazioni attorno): riga rossa verticale a sinistra, alta quanto il testo */
.doc :is(h2, h3, h4) { border-left: 3px solid var(--brand); border-bottom: 0; padding: 0 0 0 .7em; line-height: 1.25; margin: 1.9rem 0 .85rem; }
.doc h2::after { content: none; }
.doc > :is(h2, h3, h4):first-child { margin-top: 0; }
.sec-l2 > .sec-head .sec-toggle { top: 50%; }
@media (min-width: 861px) {
  .doc .sec-head :is(h2, h3, h4) .sec-toggle { left: -41px; }
}
@media (max-width: 860px) {
  .doc .sec-head :is(h2, h3, h4) { padding-left: calc(.7em + 30px); }
  .doc .sec-head :is(h2, h3, h4) .sec-toggle { left: calc(.7em - 4px); }
}

/* immagini cliccabili (es. riquadri "Documentazione per prodotto") */
.doc figure.img a.img-link { display: block; border-radius: 10px; transition: transform var(--dur-m, .2s) ease, box-shadow var(--dur-m, .2s) ease; }
.doc figure.img a.img-link img { display: block; }
.doc figure.img a.img-link:hover { transform: translateY(-3px); }
.doc figure.img a.img-link:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
@media (max-width: 760px) {
  /* area a blocchi fatta solo di immagini (es. griglia prodotti): due colonne invece di una */
  .doc .canvas:not(:has(.cbox > :not(figure.img))) { display: grid; grid-template-columns: 1fr 1fr; gap: .5em 1em; }
}

/* invito a dare un parere in fondo alla pagina */
.fb-end { margin: 3rem 0 1rem; padding: 22px 20px 24px; border: 1px solid var(--md-outline-var, #e3e3e3); border-radius: 16px; background: var(--md-surface-low, #fafafa); text-align: center; }
.fb-end-q { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.fb-end-sub { margin: 4px 0 16px; font-size: .9rem; color: var(--muted); }
.fb-end .fb-big { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.fb-end .fb-big .fb-btn { width: auto; height: auto; min-width: 128px; padding: 12px 20px 12px 16px; gap: 10px; font-size: 32px; border-radius: 999px; }
.fb-end .fb-big .fb-btn > span[aria-hidden] { transform: none; }
.fb-end .fb-big .fb-lbl { font-size: .95rem; font-weight: 600; letter-spacing: 0; }
.fb-end .fb-big .fb-btn:hover > span[aria-hidden] { transform: scale(1.12); transition: transform var(--dur-s, .15s) ease; }
.fb-end .fb-form { margin: 16px auto 0; text-align: left; }
@media (max-width: 520px) { .fb-end .fb-big .fb-btn { min-width: 0; flex: 1 1 130px; font-size: 28px; } }
@media print { .fb-end { display: none; } }

/* =====================================================================
   Modalità scura — html[data-theme="dark"] (automatica dal sistema o scelta col pulsante in alto)
   ===================================================================== */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: var(--sh-full, 999px); background: none; color: inherit; cursor: pointer; }
.theme-toggle:hover { background: rgba(255,255,255,.14); }
.theme-toggle .ic { display: none; }
html[data-theme-mode="auto"] .theme-toggle .ic-auto, html:not([data-theme-mode]) .theme-toggle .ic-auto,
html[data-theme-mode="light"] .theme-toggle .ic-light, html[data-theme-mode="dark"] .theme-toggle .ic-dark { display: block; }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4e8ee;
  --muted: #a4afbd;
  --line: #2e3744;
  --bg: #11151b;
  --bg-soft: #181e26;
  --link: #ff8a80;
  --info: #8cc4ff; --info-bg: #13263a;
  --tip: #7fd8a4; --tip-bg: #13291d;
  --warning: #f5c56b; --warning-bg: #2f2410;
  --danger: #ff9b8f; --danger-bg: #351816;
  --md-sec-c: #3d1c1c;
  --md-on-sec-c: #ffb4aa;
  --md-surface: #181e26;
  --md-surface-low: #151a21;
  --md-surface-c: #1f262f;
  --md-surface-high: #27303b;
  --md-outline: #7f8b9b;
  --pagefind-ui-tag: #27303b;
  --el1: 0 1px 2px rgba(0,0,0,.6), 0 1px 3px 1px rgba(0,0,0,.35);
  --el2: 0 1px 2px rgba(0,0,0,.6), 0 2px 6px 2px rgba(0,0,0,.35);
  --el3: 0 1px 3px rgba(0,0,0,.6), 0 4px 8px 3px rgba(0,0,0,.35);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
/* intestazione e piè di pagina: rosso Ilevia un po' più scuro, per non abbagliare */
html[data-theme="dark"] .site-header, html[data-theme="dark"] .site-footer, html[data-theme="dark"] .ils-edit-bar { background: #8e0b0b; }
/* link leggibili sul fondo scuro */
html[data-theme="dark"] a { color: var(--link); }
html[data-theme="dark"] .site-header a, html[data-theme="dark"] .site-footer a, html[data-theme="dark"] .ils-edit-bar a { color: #fff; }
html[data-theme="dark"] .lang-switch a.current { background: #fff; color: #8e0b0b; }
html[data-theme="dark"] .tree a, html[data-theme="dark"] .tree-group, html[data-theme="dark"] .tree-home { color: var(--ink); }
html[data-theme="dark"] .tree li.active > a, html[data-theme="dark"] .tree li.active > .tree-row > a { background: var(--md-sec-c); color: var(--md-on-sec-c); }
html[data-theme="dark"] .layout > .sidebar .tree a:hover, html[data-theme="dark"] .layout > .sidebar .tree-group:hover,
html[data-theme="dark"] .layout > .sidebar .tree-toggle:hover, html[data-theme="dark"] .layout > .sidebar .tree-tools button:hover { background: var(--md-surface-high); }
/* superfici che erano bianche */
html[data-theme="dark"] :is(.nl-panel, .nl-panel::before, .cookie-inner, .cookie-actions button, .ils-edit-panel, .fb-btn, #search:empty) { background: var(--md-surface); color: var(--ink); }
html[data-theme="dark"] .cookie-actions .cookie-yes { background: var(--brand); color: #fff; }
html[data-theme="dark"] .fb-btn.on { background: var(--md-sec-c); }
html[data-theme="dark"] .draft-badge { background: #3a2f12; color: #f5c56b; }
html[data-theme="dark"] :is(input, textarea, select) { background: var(--md-surface-c); color: var(--ink); border-color: var(--md-outline); }
html[data-theme="dark"] .doc hr { border-top-color: #c9d0da; }
html[data-theme="dark"] .doc .title-banner .tb-title { border-bottom-color: var(--ink); }
html[data-theme="dark"] .doc pre { background: #0a0e13; border: 1px solid var(--line); }
html[data-theme="dark"] .doc :is(th, thead td) { background: var(--md-surface-high); }
/* immagini con parti trasparenti (schemi, loghi): fondo chiaro per restare leggibili */
html[data-theme="dark"] .doc figure.img img { background: #fff; }
/* il bordo/ombra delle card */
html[data-theme="dark"] :is(.card, .file-card, .fb-end) { border-color: var(--line); }
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim, html.theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease !important; }
}
html[data-theme="dark"] :is(.sec-tools button, .sec-toggle) { color: var(--link); }

/* contatti del supporto nella barra in alto */
.hd-contacts { display: flex; align-items: center; gap: 4px; flex: none; }
.hd-contact { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; color: #fff; text-decoration: none; font-weight: 500; font-size: .9rem; white-space: nowrap; }
.hd-contact:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.hd-contact svg { flex: none; }
@media (max-width: 1180px) { .hd-contact span { display: none; } .hd-contact { padding: 8px; } }

@media (max-width: 600px) { .hd-contacts { display: none; } }
/* telefono stretto con tre lingue: tutto sta nella barra */
@media (max-width: 440px) {
  .header-inner { gap: 6px; }
  .site-header .logo img { height: 28px; }
  .lang-switch a { padding-left: 8px; padding-right: 8px; min-width: 0; }
  .theme-toggle { width: 34px; height: 34px; }
}
@media (max-width: 380px) {
  .site-header .logo img { height: 24px; }
  .site-header :is(.nl-toggle, .acct-btn, .acct-edit, .acct-add) { width: 34px; height: 34px; min-width: 0; padding: 0; justify-content: center; }
  .lang-switch a { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 340px) { .site-header .theme-toggle { display: none; } }

/* link a un paragrafo */
.doc :is(h1, h2, h3, h4)[id] { scroll-margin-top: 84px; }
.doc .h-link { opacity: 0; margin-left: 8px; vertical-align: middle; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; line-height: 0; transition: opacity .15s; }
.doc :is(h2, h3, h4):hover .h-link, .doc .h-link:focus-visible { opacity: 1; }
.doc .h-link:hover { color: var(--brand); background: var(--bg-soft); }
.doc .h-link.ok { opacity: 1; color: #2e7d32; }
@media (hover: none) { .doc .h-link { opacity: .55; } }
@media print { .doc .h-link { display: none; } }
/* cartella del menu ancora vuota: visibile, senza freccia e non apribile */
.tree li.group.empty > .tree-group { cursor: default; color: var(--muted); }
.tree li.group.empty > .tree-group::after { content: none; }
.tree li.group.empty > .tree-group::before { content: ''; background: none; -webkit-mask: none; mask: none; }

/* link "password dimenticata" nel pannello di accesso */
.acct-panel .acct-forgot { display: block; margin-top: 8px; font-size: 13px; text-align: center; color: inherit; opacity: .8; }
.acct-panel .acct-forgot:hover { opacity: 1; }

/* campo di ricerca nella pagina (blocco tableFilter) */
.doc .table-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 1.2em 0; position: sticky; top: var(--tf-top, 0); z-index: 5; padding: 8px 0; background: var(--bg, #fff); }
.doc .table-filter .tf-field { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border: 1px solid var(--line); border-radius: 22px; background: var(--md-surface-low, var(--bg-soft)); color: var(--muted); }
.doc .table-filter .tf-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.doc .table-filter input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink, inherit); height: 100%; }
.doc .table-filter input::-webkit-search-cancel-button { display: none; }
.doc .table-filter .tf-clear { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 2px; }
.doc .table-filter .tf-count { font-size: .9rem; color: var(--muted); }
.doc .tf-hide, .doc tr[hidden] { display: none !important; }
