:root {
  --blue: #204660;
  --blue-dark: #16334a;
  --blue-soft: #e8eef3;
  --text: #333;
  --muted: #5f6254;
  --bg: #f7f7f7;
  --coral: #f36a55;
  --gold: #c99f22;
  --olive: #737665;
  --line: #dde3e8;
  --radius: 10px;
  --serif: 'Crimson Text', Georgia, serif;
  --sans: 'Work Sans', system-ui, -apple-system, sans-serif;
  --toc: 290px;
  --top: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 20px); }
body { margin: 0; font-family: var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.65; font-size: 16.5px; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
[data-lucide] { width: 1em; height: 1em; }
h1, h2, h3 { font-family: var(--serif); color: var(--blue); line-height: 1.15; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: var(--blue-soft); color: var(--blue-dark); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
pre { background: var(--blue-dark); color: #e6eef5; padding: 18px 20px; border-radius: 12px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
pre code { background: none; color: inherit; padding: 0; }
kbd { display: inline-block; background: #fff; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 7px; font-size: .78em; font-weight: 600; color: var(--blue); line-height: 1.7; vertical-align: 1px; }

.progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; background: var(--coral); transform-origin: 0 50%; transform: scaleX(var(--sp, 0)); z-index: 60; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius); background: var(--blue); color: #fff; text-decoration: none; font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border: 2px solid var(--blue); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-ghost { background: transparent; color: var(--blue); }

/* ---------- Testata ---------- */
.top { position: fixed; inset: 0 0 auto; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 24px; color: var(--blue); }
.brand em { font-style: italic; font-weight: 600; color: var(--coral); }
.top-actions { margin-left: auto; display: flex; gap: 10px; }
.toc-toggle { display: none; background: none; border: 0; font-size: 24px; color: var(--blue); padding: 6px; cursor: pointer; }

/* ---------- Indice ---------- */
.toc { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--toc); overflow-y: auto; padding: 22px 18px 40px; background: #fff; border-right: 1px solid var(--line); z-index: 30; }
.search { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0 12px; color: var(--olive); margin-bottom: 18px; }
.search:focus-within { border-color: var(--blue); }
.search input { border: 0; outline: 0; font: 15px var(--sans); padding: 10px 0; width: 100%; background: none; }
.toc-part { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--olive); margin: 18px 10px 8px; }
.toc nav { display: grid; }
.toc nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 15px; color: #444; border-left: 3px solid transparent; transition: background .2s, color .2s; }
.toc nav a:hover { background: var(--bg); }
.toc nav a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; border-left-color: var(--coral); }
.toc nav a.hide { display: none; }
.toc-empty { color: var(--olive); font-size: 14px; padding: 0 12px; }

/* ---------- Documento ---------- */
.doc { margin-left: var(--toc); padding: calc(var(--top) + 40px) 56px 60px; max-width: calc(var(--toc) + 1000px); }
.hero-doc { padding: 20px 0 30px; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--olive); margin: 0 0 14px; }
.kicker::before { content: ''; display: block; width: 100px; height: 4px; background: var(--coral); margin-bottom: 16px; }
.hero-doc h1 { font-size: clamp(38px, 5vw, 60px); margin: 0 0 16px; }
.hero-doc h1 em { color: var(--coral); }
.lead { font-size: 19px; color: #555; max-width: 40em; margin: 0 0 30px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick a { display: grid; gap: 2px; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; transition: transform .2s, box-shadow .2s; }
.quick a:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(15, 37, 54, .1); }
.quick svg { width: 28px; height: 28px; color: var(--coral); margin-bottom: 8px; }
.quick b { color: var(--blue); }
.quick span { font-size: 14px; color: #666; }

.part-title { display: flex; align-items: baseline; gap: 16px; margin: 70px 0 10px; padding: 26px 30px; border-radius: 16px; background: var(--blue); color: #fff; font-family: var(--serif); font-size: 34px; font-weight: 700; }
.part-title span { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #f3d27a; }
.part-title.admin { background: linear-gradient(120deg, var(--blue-dark), #2a5878); }

.chapter { padding: 46px 0 20px; border-bottom: 1px solid var(--line); opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s; }
.chapter.in { opacity: 1; transform: none; }
.chapter.hide { display: none; }
.chapter h2 { font-size: 38px; margin: 0 0 18px; position: relative; padding-top: 18px; }
.chapter h2::before { content: ''; position: absolute; top: 0; left: 0; width: 60px; height: 4px; background: var(--coral); }
.chapter h3 { font-size: 24px; margin: 22px 0 8px; }
.chapter ul, .chapter ol { padding-left: 22px; }
.chapter li { margin: 6px 0; }
.inl { width: 18px !important; height: 18px !important; vertical-align: -3px; color: var(--blue); }
.badge { display: inline-block; vertical-align: middle; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--gold); padding: 3px 9px; border-radius: 99px; }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 34px; align-items: start; margin: 10px 0 20px; }
.two > div > h3:first-child { margin-top: 0; }
.shot { margin: 16px 0; }
.shot img { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(15, 37, 54, .12); cursor: zoom-in; transition: transform .3s; background: #fff; }
.shot img:hover { transform: scale(1.01); }
.shot figcaption { font-size: 14px; color: var(--olive); margin-top: 10px; text-align: center; }
.shot.wide { margin: 24px 0; }

.ann-wrap { position: relative; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: var(--coral); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; box-shadow: 0 0 0 4px rgba(243, 106, 85, .3), 0 4px 10px rgba(0, 0, 0, .25); pointer-events: none; animation: pinpop .5s both; }
.chapter.in .pin { animation-play-state: running; }
@keyframes pinpop { from { transform: translate(-50%, -50%) scale(0); } }
.legend { columns: 2; column-gap: 40px; padding-left: 0 !important; list-style: none; counter-reset: l; }
.legend li { break-inside: avoid; position: relative; padding-left: 40px; margin: 0 0 12px; counter-increment: l; }
.legend li::before { content: counter(l); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--coral); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; }

.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps > li { counter-increment: s; position: relative; padding: 4px 0 10px 50px; margin: 0 0 8px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 18px; display: grid; place-items: center; }
.steps > li:not(:last-child)::after { content: ''; position: absolute; left: 16px; top: 40px; bottom: -6px; width: 2px; background: var(--line); }

.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 10px 0 20px; }
.tool { display: flex; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.tool > svg { flex: none; width: 42px; height: 42px; padding: 10px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); }
.tool b { color: var(--blue); }
.tool p { margin: 4px 0 0; font-size: 15px; color: #555; }

.callout { display: flex; gap: 14px; align-items: flex-start; background: var(--blue-soft); border-radius: 12px; padding: 16px 18px; margin: 18px 0; font-size: 15.5px; }
.callout > svg { flex: none; width: 22px; height: 22px; color: var(--blue); margin-top: 2px; }
.callout.tip { background: #fbf3dc; }
.callout.tip > svg { color: #9d7a12; }
.callout.warn { background: #fde6e2; }
.callout.warn > svg { color: #c2402c; }

.wtable { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.wtable > div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.wtable b { display: block; color: var(--blue); margin-top: 10px; }
.wtable p { margin: 4px 0 0; font-size: 14.5px; color: #555; }
.wi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--c); font-size: 20px; }

.keys { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.keys td { padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.keys td:first-child { white-space: nowrap; width: 1%; }
.keys tr:last-child td { border-bottom: 0; }

.faq { display: grid; gap: 10px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 2px 20px; }
.faq summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--blue); padding: 14px 28px 14px 0; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--coral); transition: transform .3s; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { margin: 0 0 16px; color: #555; }

.checklist { display: grid; gap: 8px; margin: 14px 0; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.checklist input { width: 18px; height: 18px; accent-color: var(--coral); margin-top: 3px; flex: none; }
.checklist label:has(input:checked) { background: #eef7f1; }

.doc-foot { display: flex; align-items: center; gap: 16px; margin-top: 60px; padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.doc-foot div { flex: 1; display: grid; }
.doc-foot b { font-family: var(--serif); font-size: 22px; color: var(--blue); }
.doc-foot span { font-size: 14px; color: var(--olive); }
.doc-foot { flex-wrap: wrap; }
.doc-legal { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--olive); }

mark { background: #ffe58a; border-radius: 3px; padding: 0 2px; }

.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 22, 34, .88); display: grid; place-items: center; padding: 30px; cursor: zoom-out; animation: fade .25s; }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 92vh; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.lightbox button { position: absolute; top: 18px; right: 18px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; color: var(--blue); font-size: 22px; display: grid; place-items: center; cursor: pointer; }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chapter { opacity: 1; transform: none; transition: none; }
  .pin { animation: none; }
}
@media (max-width: 1100px) {
  .two { grid-template-columns: 1fr; }
  .wtable { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .toc { transform: translateX(-100%); transition: transform .3s; box-shadow: 20px 0 40px rgba(0, 0, 0, .12); }
  .toc.open { transform: none; }
  .toc-toggle { display: block; }
  .doc { margin-left: 0; padding: calc(var(--top) + 24px) 16px 40px; }
  .top { padding: 0 12px; }
  .top-actions .btn-ghost { display: none; }
  .legend { columns: 1; }
  .tools, .wtable { grid-template-columns: 1fr; }
  .part-title { font-size: 26px; padding: 20px; flex-direction: column; gap: 4px; }
  .chapter h2 { font-size: 30px; }
  .pin { width: 20px; height: 20px; font-size: 11px; }
}
@media (max-width: 520px) {
  .quick { grid-template-columns: 1fr; }
  .top-actions .btn { padding: 8px 10px; }
  .brand em { display: none; }
}
@media print {
  .top, .toc, .progress, .lightbox { display: none !important; }
  .doc { margin: 0; padding: 0; max-width: none; }
  .chapter { opacity: 1; transform: none; break-inside: avoid-page; }
  .shot img { box-shadow: none; }
}
.shot.crop img { width: auto; max-width: 100%; max-height: 560px; margin: 0 auto; }
