* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f8f9fa; color: #202122; line-height: 1.6; font-size: 16px; }

.wrapper { display: flex; max-width: 1400px; margin: 0 auto; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 280px; min-width: 280px; background: #fff; border-right: 1px solid #a2a9b1; padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 0 16px 16px; border-bottom: 1px solid #eaecf0; margin-bottom: 12px; }
.sidebar-logo h1 { font-size: 18px; color: #3366cc; }
.sidebar-logo h1 a { color: #3366cc; text-decoration: none; }
.sidebar-logo p { font-size: 11px; color: #54595d; }
.sidebar nav ul { list-style: none; padding: 0 8px; }
.sidebar nav ul li { margin: 0; }
.sidebar nav ul li a { display: block; padding: 6px 12px; font-size: 13px; color: #3366cc; text-decoration: none; border-radius: 4px; }
.sidebar nav ul li a:hover { background: #eaecf0; text-decoration: underline; }
.sidebar nav ul li.active a { background: #eaf3ff; color: #1a1a1a; font-weight: 600; }
.sidebar .nav-title { padding: 8px 12px 4px; font-size: 11px; font-weight: 600; color: #54595d; text-transform: uppercase; letter-spacing: 1px; }

/* Content */
.content { flex: 1; padding: 24px 32px 60px; max-width: 960px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin: 0 auto; }
.content h1 { font-size: 28px; font-weight: 400; border-bottom: 1px solid #a2a9b1; padding-bottom: 8px; margin-bottom: 20px; font-family: 'Georgia', serif; }
.content h2 { font-size: 22px; font-weight: 400; border-bottom: 1px solid #eaecf0; padding-bottom: 4px; margin: 28px 0 14px; font-family: 'Georgia', serif; }
.content h3 { font-size: 18px; font-weight: 600; margin: 22px 0 10px; }
.content p { margin: 0 0 12px; text-align: justify; }
.content ul, .content ol { margin: 0 0 12px 32px; }
.content li { margin-bottom: 4px; }
.content a { color: #3366cc; text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content blockquote { background: #f8f9fa; border-left: 4px solid #3366cc; padding: 12px 20px; margin: 16px 0; font-style: italic; color: #54595d; }
.content table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.content th, .content td { border: 1px solid #a2a9b1; padding: 8px 12px; text-align: left; }
.content th { background: #eaecf0; font-weight: 600; }
.content img { max-width: 100%; height: auto; border: 1px solid #eaecf0; border-radius: 4px; margin: 16px 0; }
.content .img-caption { font-size: 13px; color: #54595d; text-align: center; margin-top: -12px; margin-bottom: 16px; }

/* Infobox */
.infobox { float: right; width: 280px; background: #f8f9fa; border: 1px solid #a2a9b1; border-collapse: collapse; margin: 0 0 16px 20px; font-size: 13px; }
.infobox th { background: #eaecf0; text-align: center; font-size: 16px; padding: 10px; }
.infobox td { padding: 6px 10px; vertical-align: top; }
.infobox td:first-child { font-weight: 600; width: 100px; }

/* TOC */
.toc { background: #f8f9fa; border: 1px solid #a2a9b1; padding: 14px 20px; margin: 16px 0 24px; display: inline-block; min-width: 260px; }
.toc-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; text-align: center; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul li { padding: 2px 0; font-size: 13px; }
.toc ul li a { color: #3366cc; }
.toc ul ul { padding-left: 20px; }

/* References */
.references { font-size: 13px; color: #54595d; border-top: 1px solid #a2a9b1; margin-top: 40px; padding-top: 16px; }
.references ol { margin-left: 24px; }

/* Breadcrumb */
.breadcrumb { font-size: 12px; color: #54595d; margin-bottom: 16px; }
.breadcrumb a { color: #3366cc; }
.breadcrumb span { color: #54595d; }

/* Search */
.search-box { padding: 8px 16px 12px; }
.search-box input { width: 100%; padding: 6px 10px; border: 1px solid #a2a9b1; border-radius: 4px; font-size: 13px; outline: none; }
.search-box input:focus { border-color: #3366cc; }

/* Nav buttons at bottom */
.nav-buttons { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 16px; border-top: 1px solid #eaecf0; }
.nav-buttons a { padding: 8px 16px; background: #f8f9fa; border: 1px solid #a2a9b1; border-radius: 4px; color: #3366cc; text-decoration: none; font-size: 13px; }
.nav-buttons a:hover { background: #eaecf0; }

/* Term highlight */
.term { color: #3366cc; cursor: help; border-bottom: 1px dashed #3366cc; }

/* Footer */
.footer { text-align: center; padding: 16px 0; font-size: 12px; color: #54595d; border-top: 1px solid #eaecf0; margin-top: 40px; }

.answer-capsule { background: #f0f5ff; border-left: 4px solid #3366cc; padding: 12px 16px; margin: 8px 0 16px; font-size: 15px; line-height: 1.5; border-radius: 0 6px 6px 0; }
@media (max-width: 860px) {
  .wrapper { flex-direction: column; }
  .sidebar { width: 100%; min-width: auto; height: auto; position: relative; border-right: none; border-bottom: 1px solid #a2a9b1; padding: 12px 0; }
  .content { padding: 16px; }
  .infobox { float: none; width: 100%; margin: 16px 0; }
}

/* ===== Estensioni Guida Definitiva ===== */
/* Tendina nella sidebar */
.sidebar nav ul.collapsible { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.sidebar nav ul.collapsible.open { max-height: 700px; }
.nav-title { cursor: pointer; user-select: none; }
.nav-title::after { content: " ▾"; font-size: 9px; color: #a2a9b1; }

/* Keywords */
.keywords { margin: 36px 0 0; padding-top: 16px; border-top: 1px solid #a2a9b1; }
.keywords b { display: block; margin-bottom: 10px; color: #202122; font-size: 13px; }
.keywords a { display: inline-block; margin: 0 8px 8px 0; padding: 5px 13px; background: #f8f9fa; border: 1px solid #a2a9b1; border-radius: 999px; font-size: 13px; color: #3366cc; }
.keywords a:hover { background: #eaf3ff; }

/* Video */
.video-embed { aspect-ratio: 16/9; background: #000; }
.video-embed.vertical { aspect-ratio: 9/16; max-width: 330px; margin: 0 auto; }
.video-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-box { max-width: 660px; margin: 24px auto; text-align: center; }
.video-box .video-embed { border-radius: 8px; overflow: hidden; border: 1px solid #eaecf0; }
.video-box figcaption { font-size: 13px; color: #54595d; margin-top: 8px; }
.video-card { background: #fff; border: 1px solid #a2a9b1; border-radius: 8px; overflow: hidden; margin: 0 0 20px; }
.video-card .testo { padding: 14px 18px; }
.video-card h3 { font-size: 15.5px; margin-bottom: 6px; }
.video-card p { font-size: 13.5px; color: #54595d; }

/* Griglie e card */
.grid { display: grid; gap: 18px; margin: 18px 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card { background: #f8f9fa; border: 1px solid #a2a9b1; border-radius: 8px; padding: 20px; }
.card .icona { font-size: 26px; margin-bottom: 8px; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card p { font-size: 14px; color: #54595d; }
.card .link-card { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 13.5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.badge-verde { background: #e6f6ee; color: #1e8e5a; }
.badge-rosso { background: #fdeceb; color: #c0332b; }
.badge-blu { background: #e8f0fe; color: #3366cc; }

/* Callout */
.evidenza { background: #e6f6ee; border-left: 4px solid #1e8e5a; padding: 14px 18px; margin: 18px 0; border-radius: 0 6px 6px 0; }
.avviso { background: #fdeceb; border-left: 4px solid #c0332b; padding: 14px 18px; margin: 18px 0; border-radius: 0 6px 6px 0; }
.nota { background: #fdf3e3; border-left: 4px solid #b7791f; padding: 14px 18px; margin: 18px 0; border-radius: 0 6px 6px 0; }

/* Prima/Dopo e casi */
.primadopo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
.primadopo figure { margin: 0; position: relative; }
.primadopo img { width: 100%; border: 1px solid #a2a9b1; border-radius: 6px; }
.primadopo figcaption { position: absolute; top: 8px; left: 8px; background: rgba(32,33,34,.8); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.casi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 18px 0; }
.casi-grid figure { margin: 0; }
.casi-grid img { width: 100%; border: 1px solid #a2a9b1; border-radius: 6px; background: #0d1420; }
.casi-grid figcaption { font-size: 12.5px; color: #54595d; text-align: center; margin-top: 4px; }

/* CTA */
.cta-finale { background: #3366cc; color: #fff; border-radius: 8px; padding: 34px; text-align: center; margin: 40px 0 0; }
.cta-finale h2 { color: #fff; border: none; }
.cta-finale p { color: #dbe6fb; }
.btn { display: inline-block; padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: 14px; margin: 4px 4px; }
.btn-verde { background: #1e8e5a; color: #fff; }
.btn-verde:hover { color: #fff; background: #187a4c; text-decoration: none; }
.btn-bianco { background: #fff; color: #0d2f63; }
.btn-outline { border: 1.5px solid #3366cc; color: #3366cc; }

/* Hero home in stile wiki */
.hero { background: #eaf3ff; border: 1px solid #a2a9b1; border-radius: 8px; padding: 30px 34px; margin: 0 0 26px; }
.hero-eyebrow { display: inline-block; background: #3366cc; color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { border: none; }
.hero p.lead { color: #54595d; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 18px; }
.stat b { display: block; font-size: 22px; color: #3366cc; }
.stat span { font-size: 12.5px; color: #54595d; }

/* Classi contenuto */
.content .container { padding: 0; }
.lead { font-size: 16.5px; color: #54595d; margin-bottom: 22px; }
.indice { background: #f8f9fa; border: 1px solid #a2a9b1; padding: 14px 20px; margin: 18px 0; font-size: 14px; }
.indice b { display: block; margin-bottom: 6px; }
.indice ol { margin-bottom: 0; }
.quote { background: #f8f9fa; border-left: 4px solid #3366cc; padding: 14px 20px; margin: 18px 0; font-style: italic; color: #54595d; }
.quote .da { display: block; margin-top: 8px; font-style: normal; font-size: 13px; }
.tabella { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.tabella th, .tabella td { border: 1px solid #a2a9b1; padding: 8px 12px; text-align: left; }
.tabella th { background: #eaecf0; font-weight: 600; }
.tabella .ok { color: #1e8e5a; font-weight: 700; }
.tabella .no { color: #c0332b; font-weight: 700; }
.content img.bordo { border: 1px solid #a2a9b1; border-radius: 6px; }
.content figure { margin: 20px 0; text-align: center; }
.content figcaption { font-size: 13px; color: #54595d; margin-top: 6px; }
.sidebar nav ul li a.active { background: #eaf3ff; color: #1a1a1a; font-weight: 600; }

@media (max-width: 860px) {
  .grid-2, .grid-3, .casi-grid, .primadopo { grid-template-columns: 1fr; }
}
