:root {
  --azzurro: #0877be;
  --notte: #082b49;
  --blu: #155786;
  --cielo: #57b5e8;
  --ghiaccio: #eaf6fc;
  --bianco: #ffffff;
  --inchiostro: #102432;
  --grigio: #637784;
  --riga: #d7e4eb;
  --verde: #16854a;
  --rosso: #d83a3a;
  --ombra: 0 8px 24px rgba(8, 43, 73, 0.08);
  --radius: 8px;
  --shell: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--inchiostro);
  background: var(--bianco);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, select, input, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--azzurro); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--notte); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(87, 181, 232, 0.65);
  outline-offset: 2px;
}
h1, h2, h3, h4, strong, .metric-value { font-family: "Manrope", "Segoe UI", sans-serif; letter-spacing: 0; }
h1, h2, h3, h4 { color: var(--notte); line-height: 1.15; margin: 0; font-weight: 600; }
h1 { font-size: 2.3rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-160%); background: var(--notte); color: white; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { transform: none; }
.tricolore { height: 4px; background: linear-gradient(90deg, var(--verde) 0 33.333%, #f4f7f8 33.333% 66.666%, var(--rosso) 66.666%); }

.site-header { background: rgba(255,255,255,.97); border-bottom: 1px solid var(--riga); }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.wordmark { color: var(--notte); text-decoration: none; text-transform: uppercase; font-family: "Manrope", sans-serif; line-height: 1.05; flex: 0 0 auto; }
.wordmark-prefix { display: block; color: var(--blu); font-size: .68rem; font-weight: 500; letter-spacing: .1em; }
.wordmark strong { display: block; font-size: 1.12rem; font-weight: 600; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a { color: var(--grigio); text-decoration: none; padding: 10px 13px; border-radius: 6px; font-weight: 500; }
.main-nav a:hover { background: var(--ghiaccio); color: var(--notte); }
.main-nav a[aria-current="page"] { color: var(--bianco); background: var(--notte); }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--riga); border-radius: 6px; background: white; color: var(--notte); cursor: pointer; }
.menu-toggle { display: none; font-size: 1.25rem; }

#app { min-height: 68vh; }
.page { padding: 42px 0 64px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.page-head-copy { max-width: 720px; }
.eyebrow { color: var(--azzurro); text-transform: uppercase; font-size: .76rem; font-weight: 600; letter-spacing: .1em; margin-bottom: 8px; }
.lead { color: var(--grigio); font-size: 1.12rem; margin-top: 10px; max-width: 760px; }
.updated { color: var(--grigio); font-size: .85rem; white-space: nowrap; }

.filters { display: grid; grid-template-columns: 150px 180px minmax(230px, 1fr) auto; align-items: end; gap: 12px; padding: 18px 0 22px; border-top: 1px solid var(--riga); border-bottom: 1px solid var(--riga); }
.filter-field { display: grid; gap: 6px; min-width: 0; }
.filter-field label, .field-label { color: var(--grigio); font-size: .78rem; font-weight: 600; }
.control { width: 100%; min-height: 42px; border: 1px solid #b9ccd6; border-radius: var(--radius); background: white; color: var(--inchiostro); padding: 8px 11px; }
.control:hover { border-color: var(--azzurro); }
.button { min-height: 42px; border: 1px solid var(--riga); border-radius: var(--radius); background: white; color: var(--notte); padding: 8px 14px; cursor: pointer; font-weight: 600; }
.button:hover { border-color: var(--azzurro); background: var(--ghiaccio); }
.button.primary { background: var(--azzurro); border-color: var(--azzurro); color: white; }
.button.text { border-color: transparent; background: transparent; color: var(--azzurro); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 24px 0 30px; }
.metric { background: #f7fbfd; border: 1px solid var(--riga); border-radius: var(--radius); padding: 18px; min-width: 0; }
.metric-label { color: var(--grigio); font-size: .78rem; font-weight: 600; }
.metric-value { display: block; color: var(--notte); font-size: 1.65rem; margin: 5px 0 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-note { color: var(--blu); font-size: .82rem; }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.segmented { display: inline-flex; border: 1px solid var(--riga); border-radius: var(--radius); padding: 3px; background: white; }
.segmented button { border: 0; background: transparent; color: var(--grigio); border-radius: 6px; padding: 7px 12px; cursor: pointer; font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--notte); color: white; }
.data-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; align-items: start; }
.data-main { min-width: 0; }
.context-note { border-left: 3px solid var(--cielo); padding: 4px 0 4px 16px; color: var(--grigio); font-size: .92rem; }
.context-note strong { color: var(--notte); display: block; margin-bottom: 6px; }

.bar-chart { border-top: 1px solid var(--riga); }
.bar-row { display: grid; grid-template-columns: minmax(145px, 230px) minmax(140px, 1fr) 118px; align-items: center; gap: 14px; min-height: 46px; border-bottom: 1px solid var(--riga); }
.bar-label { color: var(--notte); text-decoration: none; min-width: 0; }
.bar-label strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label span { color: var(--grigio); font-size: .75rem; }
.bar-track { height: 12px; border-radius: 999px; background: var(--ghiaccio); position: relative; overflow: hidden; }
.bar-track.diverging::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--grigio); opacity: .55; }
.bar-fill { position: absolute; left: var(--start, 0%); width: var(--width, 0%); height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cielo), var(--azzurro)); transition: width 180ms ease; }
.bar-fill.negative { background: var(--blu); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--notte); font-weight: 600; }
.nd { display: inline-block; color: var(--grigio); background: #f1f4f6; border-radius: 6px; padding: 2px 7px; font-size: .78rem; font-weight: 600; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--riga); }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--riga); text-align: left; }
.data-table th { color: var(--grigio); font-size: .75rem; font-weight: 600; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tbody tr:hover { background: #f7fbfd; }
.federation-link { color: var(--notte); font-weight: 600; text-decoration: none; }
.sort-button { border: 0; background: transparent; color: inherit; font-weight: inherit; padding: 0; cursor: pointer; }

.search-row { display: grid; grid-template-columns: minmax(260px, 1fr) 190px 170px; gap: 12px; margin-bottom: 24px; }
.federation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.federation-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; min-height: 138px; border: 1px solid var(--riga); border-radius: var(--radius); padding: 16px; color: var(--inchiostro); text-decoration: none; background: white; }
.federation-card:hover { border-color: var(--cielo); box-shadow: var(--ombra); color: var(--inchiostro); }
.logo-surface { display: grid; place-items: center; overflow: hidden; border: 1px solid var(--riga); border-radius: var(--radius); background: #f7fbfd; }
.logo-surface-card { width: 72px; height: 72px; }
.logo-surface img { display: block; width: 84%; height: 84%; object-fit: contain; }
.logo-surface-dark { background: #12395f; border-color: rgba(255,255,255,.24); }
.federation-card h2 { font-size: .98rem; margin-bottom: 4px; }
.federation-card p { color: var(--grigio); font-size: .83rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--ghiaccio); color: var(--blu); font-size: .72rem; font-weight: 600; }
.chip.coverage-complete { background: #e7f5ec; color: #17643a; }
.chip.coverage-partial { background: #fff2c7; color: #725500; }
.empty-state { padding: 48px 20px; text-align: center; background: var(--ghiaccio); border-radius: var(--radius); }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--grigio); margin-bottom: 16px; }

.back-link { display: inline-block; margin-bottom: 16px; font-weight: 600; text-decoration: none; }
.profile-head { background: linear-gradient(115deg, var(--notte), var(--azzurro)); color: white; border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.logo-surface-profile { width: 104px; height: 92px; background: white; }
.logo-surface-profile.logo-surface-dark { background: #12395f; }
.profile-head h1, .profile-head a { color: white; }
.profile-head p { color: rgba(255,255,255,.78); margin-top: 6px; }
.profile-links { display: grid; gap: 8px; justify-items: end; }
.profile-links a { font-weight: 600; }
.profile-controls { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 24px 0 4px; }
.profile-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.history-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; padding: 10px 0 36px; }
.chart-frame { min-height: 310px; border-bottom: 1px solid var(--riga); position: relative; }
.line-chart { width: 100%; height: 310px; overflow: visible; }
.line-grid { stroke: var(--riga); stroke-width: 1; }
.line-primary { fill: none; stroke: var(--azzurro); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.line-secondary { fill: none; stroke: var(--notte); stroke-width: 2; stroke-dasharray: 6 5; opacity: .6; }
.line-point { fill: white; stroke: var(--azzurro); stroke-width: 3; }
.chart-label { fill: var(--grigio); font-family: "Source Sans 3", sans-serif; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--grigio); font-size: .8rem; margin-top: 10px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--azzurro); margin-right: 5px; }
.legend-dot.secondary { background: var(--notte); opacity: .6; }
.composition-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding-top: 28px; border-top: 1px solid var(--riga); }
.composition-list { display: grid; gap: 12px; margin-top: 18px; }
.composition-item { display: grid; grid-template-columns: minmax(140px, 1fr) 1fr 64px; align-items: center; gap: 10px; font-size: .85rem; }
.composition-track { height: 8px; background: var(--ghiaccio); border-radius: 999px; overflow: hidden; }
.composition-fill { height: 100%; background: var(--azzurro); border-radius: inherit; }
.composition-value { text-align: right; font-variant-numeric: tabular-nums; }
.coverage-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding: 14px 0; border-top: 1px solid var(--riga); border-bottom: 1px solid var(--riga); color: var(--grigio); }
.statement { padding-top: 36px; }
.statement-note { color: var(--grigio); max-width: 760px; margin: 10px 0 18px; }
.statement-table { min-width: 920px; }
.statement-table .statement-section th { background: var(--notte); color: white; font-family: "Manrope", sans-serif; font-size: .82rem; padding: 10px 12px; }
.statement-row.statement-total { background: #f4f9fc; font-weight: 600; }
.statement-code { width: 92px; color: var(--grigio); font-variant-numeric: tabular-nums; }
.statement-label { padding-left: calc(10px + var(--level, 0) * 14px) !important; min-width: 330px; }
.statement-source { color: var(--grigio); font-size: .78rem; min-width: 160px; }

.article-layout { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 54px; align-items: start; }
.article-toc { position: sticky; top: 24px; border-left: 1px solid var(--riga); padding-left: 16px; display: grid; gap: 7px; }
.article-toc strong { color: var(--notte); margin-bottom: 4px; }
.article-toc a { color: var(--grigio); text-decoration: none; font-size: .88rem; }
.article-body { min-width: 0; }
.article-body section { padding: 26px 0; border-bottom: 1px solid var(--riga); scroll-margin-top: 24px; }
.article-body section:first-child { padding-top: 0; }
.article-body h2 { margin-bottom: 12px; }
.article-body p + p, .article-body p + ul, .article-body ul + p { margin-top: 12px; }
.article-body ul { padding-left: 20px; }
.formula { margin: 18px 0; padding: 18px; border-left: 4px solid var(--azzurro); background: var(--ghiaccio); color: var(--notte); font-family: "Manrope", sans-serif; font-weight: 600; text-align: center; }
.account-tree { margin-top: 18px; border-top: 1px solid var(--riga); }
.account-tree details { border-bottom: 1px solid var(--riga); padding: 12px 0; }
.account-tree summary { cursor: pointer; color: var(--notte); font-weight: 600; }
.account-tree ul { color: var(--grigio); margin-bottom: 0; }
.method-schema { margin-top: 20px; border-top: 1px solid var(--riga); }
.method-schema > details { border-bottom: 1px solid var(--riga); }
.method-schema > details > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 15px 0; cursor: pointer; color: var(--notte); font-weight: 700; }
.method-schema > details > summary small { color: var(--grigio); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.method-schema-rows { padding: 0 0 14px; }
.method-schema-row { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; padding: 7px 8px 7px calc(8px + var(--level, 0) * 13px); border-top: 1px solid #edf3f6; color: var(--grigio); font-size: .86rem; }
.method-schema-row:first-child { border-top: 0; }
.method-schema-code { color: #587083; font-variant-numeric: tabular-nums; }
.method-schema-total { background: #f4f9fc; color: var(--notte); font-weight: 600; }
.callout { background: #f7fbfd; border: 1px solid var(--riga); border-radius: var(--radius); padding: 18px; margin-top: 18px; }
.author-profile { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 24px; align-items: center; margin-top: 18px; }
.author-photo { width: 148px; aspect-ratio: 4 / 5; display: block; object-fit: cover; object-position: 50% 38%; border: 1px solid var(--riga); border-radius: var(--radius); background: #eaf4fa; }
.author-name { margin-bottom: 14px; font-size: 1.08rem; }
.author-links { display: grid; gap: 10px; }
.author-links a { display: flex; align-items: center; gap: 10px; width: fit-content; overflow-wrap: anywhere; }
.contact-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; background: var(--notte); color: white; font-size: .75rem; font-weight: 700; text-decoration: none; }
.contact-icon-mail::before { content: ""; width: 12px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px; background: linear-gradient(145deg, transparent 46%, currentColor 48% 52%, transparent 54%) left top / 50% 100% no-repeat, linear-gradient(215deg, transparent 46%, currentColor 48% 52%, transparent 54%) right top / 50% 100% no-repeat; }

.site-footer { color: var(--grigio); background: #f7fbfd; border-top: 1px solid var(--riga); }
.site-footer .tricolore { height: 3px; }
.footer-grid { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 32px; padding-top: 28px; padding-bottom: 32px; font-size: .82rem; }
.footer-grid strong { color: var(--notte); }
.footer-disclaimer { max-width: 650px; }
.footer-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.loading-state { padding-block: 80px; color: var(--grigio); }

@media (max-width: 980px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-layout, .history-layout { grid-template-columns: 1fr; }
  .context-note { max-width: 720px; }
  .federation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-head { grid-template-columns: 90px minmax(0, 1fr); }
  .logo-surface-profile { width: 90px; height: 82px; }
  .profile-links { grid-column: 2; justify-items: start; grid-auto-flow: column; }
  .article-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 30px; }
  .footer-grid { grid-template-columns: 1fr 2fr; }
  .footer-meta { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 14px; }
}

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 28px), var(--shell)); }
  h1 { font-size: 1.8rem; }
  .header-inner { min-height: 68px; }
  .menu-toggle { display: block; }
  .main-nav { display: none; position: absolute; z-index: 20; top: 72px; left: 14px; right: 14px; background: white; border: 1px solid var(--riga); border-radius: var(--radius); box-shadow: var(--ombra); padding: 8px; flex-direction: column; align-items: stretch; }
  .main-nav.is-open { display: flex; }
  .page { padding-top: 30px; }
  .page-head { display: block; }
  .updated { display: block; margin-top: 12px; }
  .filters, .search-row { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr; gap: 8px; }
  .metric { padding: 14px 16px; }
  .metric-value { font-size: 1.4rem; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .bar-row { grid-template-columns: minmax(95px, 130px) minmax(90px, 1fr) 90px; gap: 8px; }
  .bar-label strong { font-size: .78rem; }
  .bar-label span { display: none; }
  .bar-value { font-size: .82rem; }
  .federation-grid { grid-template-columns: 1fr; }
  .federation-card { min-height: 116px; }
  .profile-head { padding: 20px; grid-template-columns: 72px minmax(0, 1fr); align-items: start; }
  .logo-surface-profile { width: 72px; height: 68px; }
  .profile-head h1 { font-size: 1.35rem; }
  .profile-links { grid-column: 1 / -1; grid-auto-flow: row; }
  .profile-controls { align-items: stretch; flex-direction: column; }
  .profile-metrics, .composition-grid { grid-template-columns: 1fr; }
  .composition-item { grid-template-columns: minmax(120px, 1fr) 1fr 52px; }
  .article-layout { grid-template-columns: 1fr; }
  .article-toc { position: static; border-left: 0; border-bottom: 1px solid var(--riga); padding: 0 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-toc strong { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-meta { grid-column: auto; }
  .author-profile { grid-template-columns: 112px minmax(0, 1fr); gap: 18px; }
  .author-photo { width: 112px; }
  .method-schema > details > summary { align-items: flex-start; flex-direction: column; gap: 3px; }
  .method-schema-row { grid-template-columns: 72px minmax(0, 1fr); padding-left: calc(5px + var(--level, 0) * 7px); }
}

@media (max-width: 430px) {
  .filters, .search-row { grid-template-columns: 1fr; }
  .filters .button { width: 100%; }
  .toolbar-actions { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .bar-row { grid-template-columns: 94px minmax(64px, 1fr) 78px; }
  .federation-card { grid-template-columns: 58px minmax(0, 1fr); padding: 13px; }
  .logo-surface-card { width: 58px; height: 58px; }
  .author-profile { grid-template-columns: 1fr; }
  .article-toc { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
