/* Regolamenti: stile comune a tutte le pagine dei regolamenti (economia.html, codice-penale.html, ...) */
.rg-page [hidden] { display: none !important; }
.rg-page .article-header { min-height: 46vh; min-height: 46svh; }
.rg-page .article-header h1 { margin-bottom: 10px; }
.rg-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.rg-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  font: 600 14px/1 var(--font); text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none;
  color: var(--paper); background: rgba(12,12,12,0.4); border: 1px solid rgba(255,255,255,0.35); cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.rg-btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.rg-btn svg { width: 16px; height: 16px; }
@media (hover: hover) { .rg-btn:hover { background: var(--brand-2); color: var(--ink); border-color: var(--brand-2); } }

/* Note in stile GitBook: info, attenzione, sanzione, esempio */
.rg-note {
  display: flex; gap: 14px; padding: 18px 20px; margin: 16px 0;
  background: rgba(64,229,255,0.06); border: 1px solid rgba(64,229,255,0.22); border-left: 3px solid var(--brand-2);
}
.rg-note::before {
  content: 'i'; flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  font-size: 14px; font-weight: 900; color: var(--ink); background: var(--brand-2);
}
.rg-note.warn { background: rgba(255,201,60,0.06); border-color: rgba(255,201,60,0.25); border-left-color: #FFC93C; }
.rg-note.warn::before { content: '!'; background: #FFC93C; }
.rg-page .rg-note p { margin: 0; font-size: 16px; line-height: 1.6; color: rgba(255,255,255,0.85); }
.rg-intro { max-width: 62rem; margin: 0 0 40px; }
.rg-page .rg-intro p + p { margin-top: 10px; }
.rg-page .rg-note p.rg-sign { font-size: 14px; color: var(--shade-400); }
.rg-sanction, .rg-example { margin: 16px 0; padding: 14px 18px; }
.rg-sanction { background: rgba(255,77,77,0.07); border: 1px solid rgba(255,77,77,0.22); border-left: 3px solid #ff4d4d; }
.rg-example { border: 1px dashed var(--shade-700); background: rgba(255,255,255,0.02); }
.rg-label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.rg-sanction .rg-label { color: #ff8080; }
.rg-example .rg-label { color: var(--brand-2); }
.rg-page .rg-sanction p, .rg-page .rg-example p { margin: 0; font-size: 15px; }

/* Titoli di sezione */
.rg-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; padding-bottom: 16px; border-bottom: 2px solid var(--paper); }
.rg-icon {
  flex: none; width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
}
.rg-kicker { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--brand-2); }
.rg-head h2 { font-size: clamp(22px, 6vw, 28px); font-weight: 800; text-transform: uppercase; line-height: 1.05; letter-spacing: 0.01em; }
.rg-sub { margin: 14px 0 20px; font-size: 15px; line-height: 1.6; color: rgba(255,255,255,0.65); }
.rg-sub a { color: var(--brand-2); }
.rg-note p a { color: var(--brand-2); }

/* In breve: i numeri chiave */
.rg-summary { margin-bottom: 48px; }
.rg-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.rg-key {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; text-decoration: none; color: var(--paper);
  background: linear-gradient(180deg, #171717 0%, #111 100%); border: 1px solid var(--shade-800); border-top: 2px solid var(--brand-2);
  transition: transform 0.35s var(--ease-out), border-color 0.25s;
}
.rg-key strong { font-size: 26px; font-weight: 900; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.rg-key span { font-size: 13px; line-height: 1.35; color: rgba(255,255,255,0.72); }
.rg-key small { margin-top: auto; padding-top: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-2); }
@media (hover: hover) { .rg-key:hover { transform: translateY(-4px); border-color: var(--brand-2); } }

/* Layout: indice + ricerca a lato, testo al centro */
.rg-side {
  position: sticky; top: var(--header-h); z-index: 20;
  margin: 0 calc(var(--gutter-r) * -1) 24px calc(var(--gutter-l) * -1); padding: 12px var(--gutter-r) 6px var(--gutter-l);
  background: rgba(12,12,12,0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--shade-800);
}
.rg-search { position: relative; display: flex; align-items: center; }
.rg-search > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--shade-400); pointer-events: none; }
.rg-search input {
  width: 100%; min-height: 48px; padding: 12px 44px 12px 44px; border-radius: 0; outline: none; -webkit-appearance: none; appearance: none;
  font: 500 16px var(--font); color: var(--paper); background: var(--shade-900); border: 1px solid var(--shade-700);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.rg-search input::placeholder { color: var(--shade-400); }
.rg-search input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(64,229,255,0.15); }
.rg-search input::-webkit-search-cancel-button { filter: invert(1); cursor: pointer; }
.rg-search kbd {
  position: absolute; right: 12px; display: none; padding: 2px 8px; font: 700 12px var(--font); color: var(--shade-400);
  border: 1px solid var(--shade-700); pointer-events: none;
}
@media (hover: hover) { .rg-search kbd { display: block; } }
.rg-search input:focus ~ kbd, .rg-search input:not(:placeholder-shown) ~ kbd { display: none; }
.rg-count { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--brand-2); }
.rg-count:empty { display: none; }
.rg-toc summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer;
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.rg-toc summary::-webkit-details-marker { display: none; }
.rg-toc summary::after {
  content: ''; width: 8px; height: 8px; margin-right: 6px; border-right: 2px solid; border-bottom: 2px solid;
  transform: translateY(-2px) rotate(45deg); transition: transform 0.3s var(--ease-out);
}
.rg-toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.rg-toc summary small { margin-left: 8px; margin-right: auto; font-weight: 600; letter-spacing: 0.04em; color: var(--shade-400); }
.rg-toc-nav { position: relative; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 14px 0; }
.rg-toc-nav ul { list-style: none; border-left: 1px solid var(--shade-800); }
.rg-toc-nav ul.rg-toc-top { margin: 6px 0; }
.rg-toc-cap { margin: 14px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--shade-400); }
.rg-toc-nav a {
  display: flex; gap: 8px; margin-left: -1px; padding: 7px 10px; border-left: 2px solid transparent;
  font-size: 15px; line-height: 1.3; color: rgba(255,255,255,0.65); text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.rg-toc-nav a span { flex: none; min-width: 3.4em; font-weight: 700; color: var(--shade-400); font-variant-numeric: tabular-nums; }
.rg-toc[data-depth="chapter"] .rg-toc-nav a span { min-width: 4.9em; }
.rg-toc-nav a:hover { color: var(--paper); }
.rg-toc-nav a.is-active { color: var(--paper); border-left-color: var(--brand-2); background: rgba(64,229,255,0.06); }
.rg-toc-nav a.is-active span { color: var(--brand-2); }
.rg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.rg-chip {
  min-height: 34px; padding: 6px 11px; font: 600 13px var(--font); text-transform: uppercase; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.8); background: var(--shade-900); border: 1px solid var(--shade-700); cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.rg-chip:hover { color: var(--brand-2); border-color: var(--brand-2); }
.rg-toc-extra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--shade-800); }
.rg-toc-extra .rg-btn { min-height: 38px; padding: 8px 12px; font-size: 12px; background: transparent; border-color: var(--shade-700); }
.rg-content { min-width: 0; max-width: 52rem; }

/* Capitoli e articoli */
.rg-chapter, .rg-block { margin: 0 0 56px; }
.rg-subhead {
  display: flex; align-items: center; gap: 12px; margin: 36px 0 4px;
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brand-2);
}
.rg-subhead::after { content: ''; flex: 1; height: 1px; background: var(--shade-800); }
.rg-art { margin: 0 -16px; padding: 24px 16px; border-bottom: 1px solid var(--shade-800); }
.rg-art:target { animation: rgFlash 1.8s ease-out; }
@keyframes rgFlash { from { background: rgba(64,229,255,0.14); } to { background: transparent; } }
.rg-art header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.rg-art header > div { flex: 1; min-width: 0; }
.rg-num { display: inline-block; margin-bottom: 8px; padding: 3px 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); background: var(--brand-2); }
.rg-art h3 { font-size: 20px; font-weight: 800; text-transform: uppercase; line-height: 1.15; letter-spacing: 0.01em; color: rgba(255,255,255,0.92); }
.rg-art p, .rg-art li, .rg-faq p { font-size: 16px; line-height: 1.65; letter-spacing: 0.01em; color: rgba(255,255,255,0.74); }
.rg-art p + p, .rg-art ul + p, .rg-faq p + p { margin-top: 12px; }
.rg-art strong, .rg-faq strong { color: var(--paper); font-weight: 700; }
.rg-art p a, .rg-faq p a { color: var(--brand-2); text-underline-offset: 3px; }
.rg-art ul { list-style: none; display: grid; gap: 6px; margin: 12px 0; }
.rg-art ul li { position: relative; padding-left: 22px; }
.rg-art ul li::before { content: ''; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px; background: var(--brand-2); }
.rg-art ol { display: grid; gap: 6px; margin: 12px 0; padding-left: 1.4em; }
.rg-art ol li::marker { font-weight: 800; color: var(--brand-2); }
.rg-copy {
  position: relative; flex: none; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  color: var(--shade-400); background: none; border: 1px solid var(--shade-800); transition: color 0.2s, border-color 0.2s;
}
.rg-copy svg { width: 18px; height: 18px; }
.rg-copy:hover { color: var(--brand-2); border-color: var(--brand-2); }
.rg-copy.copied { color: var(--ink); background: var(--brand-2); border-color: var(--brand-2); }
.rg-copy.copied::after {
  content: 'Link copiato'; position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; white-space: nowrap; padding: 5px 9px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); background: var(--brand-2);
}
.rg-page .rg-see {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--shade-400);
}
.rg-page .rg-see a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; text-decoration: none;
  color: rgba(255,255,255,0.85); border: 1px solid var(--shade-700); transition: color 0.2s, border-color 0.2s;
}
.rg-page .rg-see a:hover { color: var(--brand-2); border-color: var(--brand-2); }
.rg-table { width: 100%; margin: 14px 0; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rg-table th, .rg-table td { padding: 11px 14px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--shade-800); }
.rg-table th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--shade-400); }
.rg-table td { color: rgba(255,255,255,0.8); }
.rg-table th:last-child, .rg-table td:last-child { text-align: right; }
.rg-table td:last-child { font-weight: 800; color: var(--paper); }
.rg-page mark { color: var(--paper); background: rgba(64,229,255,0.3); box-shadow: 0 0 0 2px rgba(64,229,255,0.3); }
.rg-table-wrap { margin: 14px 0; overflow-x: auto; }
.rg-table-wrap .rg-table { margin: 0; }
.rg-table a { color: var(--brand-2); text-underline-offset: 3px; }

/* Strumenti */
.rg-tools { display: grid; gap: 20px; }
.rg-tool { padding: 22px 20px; background: linear-gradient(180deg, #171717 0%, #111 100%); border: 1px solid #2a2a2a; border-top: 3px solid var(--brand-2); }
.rg-tools > .rg-tool:nth-child(3n+2) { border-top-color: #7CFC00; }
.rg-tools > .rg-tool:nth-child(3n) { border-top-color: #FFC93C; }
.rg-tool h3 { margin-bottom: 6px; font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.rg-tool-desc { margin-bottom: 16px; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,0.65); }
.rg-tool-desc a { color: var(--brand-2); }
.rg-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rg-field { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--shade-400); }
.rg-field input, .rg-field select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 0; outline: none; color-scheme: dark;
  font: 600 16px var(--font); color: var(--paper); background: var(--ink); border: 1px solid var(--shade-700);
}
.rg-field input:focus, .rg-field select:focus { border-color: var(--brand-2); }
.rg-results { display: grid; gap: 1px; margin-top: 16px; background: var(--shade-800); border: 1px solid var(--shade-800); }
.rg-result { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 12px 14px; font-size: 14px; color: rgba(255,255,255,0.7); background: var(--ink); }
.rg-result output { font-size: 18px; font-weight: 800; color: var(--paper); font-variant-numeric: tabular-nums; }
.rg-result.total output { font-size: 22px; color: var(--brand-2); }
.rg-tool-note { margin-top: 10px; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.6); }
.rg-tool-note:empty { display: none; }
.rg-checks { list-style: none; display: grid; gap: 8px; margin-top: 16px; }
.rg-checks li {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.45;
  color: rgba(255,255,255,0.82); background: var(--ink); border: 1px solid var(--shade-800);
}
.rg-checks li::before { flex: none; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.rg-checks .ok::before { content: '\2713'; color: var(--ink); background: #7CFC00; }
.rg-checks .ko { border-color: rgba(255,77,77,0.45); }
.rg-checks .ko::before { content: '\2715'; color: #fff; background: #ff4d4d; }
.rg-checks .info::before { content: 'i'; color: #fff; background: var(--shade-700); }
.rg-checks small { flex: none; margin-left: auto; padding-top: 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-2); }

/* Domande frequenti */
.rg-faq details { border-bottom: 1px solid var(--shade-800); }
.rg-faq summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; cursor: pointer;
  font-size: 17px; font-weight: 700; line-height: 1.3; color: rgba(255,255,255,0.92); transition: color 0.2s;
}
.rg-faq summary::-webkit-details-marker { display: none; }
.rg-faq summary::after {
  content: '+'; flex: none; width: 32px; height: 32px; display: grid; place-items: center; font-size: 20px; font-weight: 500;
  border: 1px solid var(--shade-700); transition: transform 0.3s var(--ease-out), background 0.2s, color 0.2s;
}
.rg-faq details[open] summary::after { transform: rotate(45deg); color: var(--ink); background: var(--paper); border-color: var(--paper); }
.rg-faq summary:hover { color: var(--brand-2); }
.rg-faq details > div { padding: 0 0 18px; }
.rg-empty { padding: 32px 24px; text-align: center; border: 1px dashed var(--shade-700); }
.rg-empty h3 { margin-bottom: 8px; font-size: 20px; font-weight: 800; text-transform: uppercase; }
.rg-empty p { margin-bottom: 16px; font-size: 15px; color: rgba(255,255,255,0.65); }
.rg-empty .rg-chips { justify-content: center; }

/* Con l'indice affiancato i salti alle ancore non finiscono sotto la barra di ricerca */
@media (max-width: 1023px) { html { scroll-padding-top: calc(var(--header-h) + 9rem); } }
@media (min-width: 768px) {
  .rg-page .article-header { min-height: 56vh; min-height: 56svh; }
  .rg-btn { font-size: 0.9375rem; }
  .rg-head h2 { font-size: 2rem; line-height: 2.25rem; }
  .rg-icon { width: 3.5rem; height: 3.5rem; font-size: 1.75rem; }
  .rg-art h3 { font-size: 1.5rem; }
  .rg-art p, .rg-art li, .rg-faq p { font-size: clamp(1.0625rem, 0.4vw + 0.95rem, 1.3rem); }
  .rg-faq summary { font-size: 1.25rem; }
  .rg-tool { padding: 1.75rem; }
}
@media (min-width: 1024px) {
  .rg-keys { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
  .rg-key strong { font-size: clamp(1.75rem, 2.2vw, 2.5rem); }
  .rg-key span { font-size: 0.9375rem; }
  .rg-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .rg-side {
    top: calc(var(--header-h) + 1.5rem); margin: 0; padding: 0;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0;
  }
  .rg-toc-nav { max-height: calc(100vh - var(--header-h) - 14rem); }
}
@media (min-width: 1280px) {
  .rg-layout { grid-template-columns: 18rem minmax(0, 1fr); gap: 4.5rem; }
}

@media print {
  .sidebar, .site-header, .mobile-menu, .site-footer, .read-progress, .back-link, .rg-hero-actions,
  .rg-side, .rg-copy, .rg-see, .rg-noprint, .rg-empty, .article-header-bg, .article-header-overlay { display: none !important; }
  body, .rg-page * { color: #000 !important; background: transparent !important; box-shadow: none !important; }
  main { margin: 0 !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .rg-page .article-header { min-height: 0; margin: 0; padding: 0 0 16px; display: block; }
  .article-body { padding: 0 !important; }
  .rg-layout { display: block !important; }
  .rg-content { max-width: none; }
  .rg-key, .rg-art, .rg-faq details { break-inside: avoid; }
  .rg-faq summary::after { display: none; }
}
