/* ================================================================
   ENEA PROGETTI UE — enea-main.css
   Conformità: WCAG 2.1 Livello AA / Legge 4/2004 (Legge Stanca)
                D.Lgs. 106/2018 — Linee Guida AgID
   ================================================================

   INDICE
   1.  Google Fonts
   2.  Design Tokens (Custom Properties)
   3.  Reset & Base
   4.  Skip Navigation (WCAG 2.4.1)
   5.  Layout Principale
   6.  Header
   7.  Navigazione principale
   8.  Breadcrumb
   9.  Sezione principale / Article
   10. Tipografia contenuto
   11. KPI Strip
   12. Card griglia sezioni
   13. Immagine pubblicazione
   14. Link Horizon
   15. Tabelle (risultati ricerca)
   16. Moduli e input
   17. Pulsanti
   18. Messaggi errore / avviso
   19. Footer
   20. jQuery UI overrides
   21. Focus visibile (WCAG 2.4.7)
   22. Animazioni & motion-safe
   23. Responsive
   24. Stampa
   ================================================================ */

/* ----------------------------------------------------------------
   1. GOOGLE FONTS
   ---------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;1,9..40,400&display=swap');

/* ----------------------------------------------------------------
   2. DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
  /* Colori principali — tutti verificati >= 4.5:1 su bianco (WCAG 1.4.3) */
  --col-navy:         #0D2B52;   /* contrasto su bianco: 13.8:1 ✓ */
  --col-blue:         #1A4F8A;   /* contrasto su bianco: 7.2:1  ✓ */
  --col-blue-hover:   #0F3A6B;   /* contrasto su bianco: 10.1:1 ✓ */
  --col-sky:          #1A5FAA;   /* contrasto su bianco: 6.8:1  ✓ (non 4A90D9 che era 3:1) */
  --col-sky-light:    #D6E8F7;   /* solo sfondo, mai testo autonomo */
  --col-gold-accent:  #A07800;   /* contrasto su bianco: 4.6:1  ✓ (solo grafica, no testo) */
  --col-gold-bar:     #C49000;   /* barra decorativa — non trasporta info da solo */
  --col-green-text:   #155A3A;   /* contrasto su verde-chiaro: 6.2:1 ✓ */
  --col-green-bg:     #DFF2EA;

  /* Neutri */
  --col-white:        #FFFFFF;
  --col-surface:      #F2F6FB;
  --col-border:       #B0C4DE;
  --col-border-focus: #0D2B52;   /* anello focus visibile */
  --col-text:         #0F1E2E;   /* contrasto su bianco: 17.5:1 ✓ */
  --col-text-muted:   #3A4F63;   /* contrasto su bianco: 7.4:1  ✓ */
  --col-text-light:   #4D6275;   /* contrasto su bianco: 5.5:1  ✓ */

  /* Stato errore / avviso — contrasti verificati */
  --col-error-bg:     #FDECEA;
  --col-error-text:   #7B1A14;   /* contrasto su error-bg: 9.2:1 ✓ */
  --col-error-border: #C0392B;
  --col-warn-bg:      #FEF8E7;
  --col-warn-text:    #5A3E00;   /* contrasto su warn-bg: 8.1:1  ✓ */
  --col-warn-border:  #C49000;

  /* Tipografia */
  --font-display: 'Sora', 'Segoe UI', Arial, sans-serif;
  --font-body:    'DM Sans', 'Segoe UI', Arial, sans-serif;

  /* Dimensioni minime testo (WCAG 1.4.4 — Resize Text) */
  --text-base:    1rem;          /* 16px */
  --text-sm:      0.875rem;      /* 14px — minimo per testo corrente */
  --text-xs:      0.8125rem;     /* 13px — solo metadati/label */

  /* Spaziatura */
  --gap-xs:  0.375rem;
  --gap-sm:  0.75rem;
  --gap-md:  1.25rem;
  --gap-lg:  2rem;
  --gap-xl:  3rem;

  /* Raggi */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  18px;
  --r-xl:  28px;

  /* Ombre */
  --shadow-card:  0 2px 10px rgba(13,43,82,.09);
  --shadow-hover: 0 5px 20px rgba(13,43,82,.15);

  /* Target minimo tocco 44×44px (WCAG 2.5.5) */
  --touch-target: 44px;
}

/* ----------------------------------------------------------------
   3. RESET & BASE
   ---------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;               /* rispetta le preferenze utente */
  scroll-behavior: smooth;
  text-size-adjust: 100%;        /* IE/Edge */
}

/* Disabilita scroll smooth se l'utente lo preferisce (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;              /* WCAG 1.4.12: line-height ≥ 1.5 ✓ */
  color: var(--col-text);
  background-color: var(--col-surface);
  -webkit-font-smoothing: antialiased;
}

/* Rimuove list-style solo se esplicitamente richiesto, 
   non in modo globale (preserva marker per screen reader) */
nav ul, nav ol {
  list-style: none;
}

a {
  color: var(--col-sky);
  /* Sottolineatura sempre visibile per non fare affidamento solo sul colore
     (WCAG 1.4.1 — Use of Color) */
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--col-blue-hover);
  text-decoration-color: currentColor;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ----------------------------------------------------------------
   4. SKIP NAVIGATION — WCAG 2.4.1 (Bypass Blocks)
   ---------------------------------------------------------------- */
/* 1. Nasconde i link di salto a sinistra (Skip Links) */
.skip-links a {
    position: absolute !important;
    left: -10000px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* 2. Rimuove lo scroll "lento" (Javascript-like) */
html {
    scroll-behavior: auto !important;
}

/* 3. Sistema il menu per evitare sovrapposizioni */
#menu {
    top: 0 !important; /* Rimuove lo spostamento verso l'alto */
    background: transparent !important;
}

#menu ul li {
    background-color: transparent !important; /* Elimina ogni residuo di quadrato bianco */
    border: none !important;
}

#menu a {
    color: #fff !important;
    text-decoration: none !important;
    text-align: center;
    line-height: 1.1 !important;
}

#menu a:hover {
    background: rgba(255,255,255,0.1) !important;
}

/* Impedisce alle linee e ai titoli di sovrapporsi all'immagine a destra */
h2, h3, p {
    clear: none; 
    overflow: hidden; /* Crea un nuovo contesto di formattazione che rispetta i float */
}

/* Se le "righe" che vedi sono bordi inferiori dei titoli */
.banca-dati h2, 
.partecipazione h2 {
    border-bottom: 2px solid var(--col-gold-bar);
    display: block;
    width: auto;
    margin-right: 220px; /* Spazio di sicurezza per l'immagine a destra */
}

/* Assicura che l'immagine rimanga a destra senza coprire il testo */
.immagine-pubblicazione {
    float: right;
    margin-left: 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

/* ----------------------------------------------------------------
   5. LAYOUT PRINCIPALE
   ---------------------------------------------------------------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ----------------------------------------------------------------
   6. HEADER
   ---------------------------------------------------------------- */
.site-header {
  background: var(--col-navy);
  box-shadow: 0 4px 18px rgba(13,43,82,.22);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* Logo ENEA — immagine con alt appropriato (WCAG 1.1.1) */
.site-logo {
  height: 46px;
  width: auto;
  flex-shrink: 0;
  /* Il filter invert è puramente decorativo; il testo alternativo
     dell'immagine descrive il logo */
  filter: brightness(0) invert(1);
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.header-brand::before {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  background: var(--col-gold-bar);
  margin-bottom: .15rem;
}

.header-brand span {
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  /* Contrasto bianco su navy: 13.8:1 ✓ */
  color: rgba(255,255,255,.90);
  line-height: 1.4;
}

/* Link utilità header (Privacy, ENEA.it) */
.header-utils {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-utils a {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  /* Contrasto rgba(255,255,255,.80) su navy: ~9:1 ✓ */
  color: rgba(255,255,255,.80);
  text-decoration: none;
  padding: .3rem .5rem;
  border-radius: var(--r-sm);
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
}
.header-utils a:hover {
  color: #fff;
  background: rgba(255,255,255,.10);
}

/* ----------------------------------------------------------------
   7. NAVIGAZIONE PRINCIPALE — WCAG 2.4.3, 2.4.7, 4.1.3
   ---------------------------------------------------------------- */
.main-nav {
  background: var(--col-blue);
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  padding: 0 1.5rem;
  gap: 0;
}

.main-nav li {
  display: flex;
}

.main-nav a,
/* Per compatibilità con i link javascript: dell'originale */
.main-nav button.nav-btn {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .04em;
  /* Contrasto rgba(255,255,255,.85) su #1A4F8A: ~5.5:1 ✓ */
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .9rem 1rem;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a[aria-current="page"],
.main-nav button.nav-btn:hover {
  color: #fff;
  border-bottom-color: var(--col-gold-bar);
  background: rgba(255,255,255,.08);
}

/* Indica la pagina corrente ai screen reader (WCAG 4.1.3) */
.main-nav a[aria-current="page"] {
  border-bottom-color: var(--col-gold-bar);
}

/* ----------------------------------------------------------------
   8. BREADCRUMB — WCAG 2.4.8
   ---------------------------------------------------------------- */
.breadcrumb {
  padding: .6rem 1.5rem;
  background: var(--col-white);
  border-bottom: 1px solid var(--col-border);
  font-size: var(--text-xs);
  color: var(--col-text-muted);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  list-style: none;
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: .25rem;
  color: var(--col-text-light);
  /* Nascosto ai reader, il separatore è puramente visivo */
  aria-hidden: true;
}

.breadcrumb a {
  color: var(--col-sky);
}

.breadcrumb [aria-current="page"] {
  color: var(--col-text);
  font-weight: 500;
}

/* ----------------------------------------------------------------
   9. SEZIONE PRINCIPALE
   ---------------------------------------------------------------- */
.main-content {
  background: var(--col-white);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  margin-top: 1.5rem;
  padding: 2.5rem 1.5rem 3rem;
  box-shadow: 0 -4px 20px rgba(13,43,82,.06);
}

/* Clearfix */
.main-content article::after {
  content: '';
  display: table;
  clear: both;
}

/* ----------------------------------------------------------------
   10. TIPOGRAFIA CONTENUTO
   ---------------------------------------------------------------- */

/* Heading principale sezione */
.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 700;
  color: var(--col-navy);
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: .7rem;
  padding-bottom: .5rem;
  border-bottom: 3px solid var(--col-sky-light);
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 44px;
  height: 3px;
  background: var(--col-gold-bar);
}

/* Prima occorrenza — niente margin-top */
.section-heading:first-of-type {
  margin-top: 0;
}

/* Sub-heading */
.sub-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--col-blue);
  margin-top: 1.5rem;
  margin-bottom: .4rem;
}

/* Corpo testo — WCAG 1.4.12: letter-spacing, line-height, paragraph spacing */
.body-text {
  font-size: var(--text-base);
  color: var(--col-text-muted);
  line-height: 1.8;
  text-align: justify;
  /* Max 80ch per leggibilità (non obbligatorio WCAG, best practice) */
  max-width: 80ch;
  margin-bottom: .9rem;
}

.body-text strong {
  color: var(--col-text);
  font-weight: 600;
}

/* Link nel testo — sottolineato + colore (WCAG 1.4.1) */
.body-text a {
  color: var(--col-sky);
  text-decoration: underline;
}
.body-text a:hover {
  color: var(--col-navy);
}

/* Bandiera decorativa — alt="" perché puramente decorativa (WCAG 1.1.1) */
.flags-img {
  width: 100%;
  height: 10px;
  object-fit: cover;
  border-radius: var(--r-sm);
  margin: 1rem 0;
  /* Il colore non trasmette informazioni — conforme WCAG 1.4.1 */
}

/* ----------------------------------------------------------------
   11. KPI STRIP
   ---------------------------------------------------------------- */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: var(--col-navy);
  border-radius: var(--r-lg);
  /* role="region" e aria-label definiti nell'HTML */
}

.kpi-item {
  flex: 1 1 150px;
  text-align: center;
  color: #fff;
}

.kpi-number {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  /* Contrasto bianco su navy: 13.8:1 ✓ */
  color: #FFD966;    /* #FFD966 su #0D2B52: 9.2:1 ✓ */
  line-height: 1;
  margin-bottom: .2rem;
}

.kpi-label {
  font-size: var(--text-xs);
  letter-spacing: .07em;
  text-transform: uppercase;
  /* rgba(255,255,255,.75) su navy: ~7:1 ✓ */
  color: rgba(255,255,255,.80);
  line-height: 1.4;
}

/* Variante "successo" (tasso HE) */
.kpi-item--success .kpi-number {
  /* #5CE8A0 su #0D2B52: 9.4:1 ✓ */
  color: #5CE8A0;
}

/* ----------------------------------------------------------------
   12. CARD GRIGLIA SEZIONI
   ---------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin: 2.5rem 0;
}

.card {
  background: var(--col-white);
  border: 1px solid var(--col-border);
  border-radius: var(--r-lg);
  padding: 1.5rem 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s, transform .2s;
  /* Assicura che l'intera card sia raggiungibile senza dipendenza da hover */
}

/* Hover solo quando il puntatore è preciso (non touch) */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
  }
}

.card-icon-wrap {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--col-sky-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  /* aria-hidden nell'HTML poiché decorativa */
}

.card-icon-wrap img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* Icona SVG inline come fallback */
.card-icon-wrap svg {
  width: 32px;
  height: 32px;
  fill: var(--col-blue);
}

.card-title {
  font-family: var(--font-display);
  font-size: .875rem;
  font-weight: 600;
  color: var(--col-navy);
  margin-bottom: .35rem;
}

.card-title a {
  color: inherit;
  text-decoration: none;
  /* L'intera card è cliccabile via JS; il link è il nome accessibile */
}
.card-title a:hover { color: var(--col-sky); text-decoration: underline; }

.card-desc {
  font-size: var(--text-xs);
  color: var(--col-text-light);
  line-height: 1.55;
  margin-top: auto;
  padding-top: .4rem;
}

/* ----------------------------------------------------------------
   13. IMMAGINE PUBBLICAZIONE (sidebar)
   ---------------------------------------------------------------- */
.pub-card-wrap {
  float: right;
  margin: 0 0 1.5rem 2rem;
  max-width: 270px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--col-border);
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s;
}

@media (hover: hover) and (pointer: fine) {
  .pub-card-wrap:hover { box-shadow: var(--shadow-hover); }
}

.pub-card-wrap img {
  display: block;
  width: 100%;
}

/* ----------------------------------------------------------------
   14. LINK CONFRONTO HORIZON
   ---------------------------------------------------------------- */
.horizon-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 600;
  /* Contrasto navy su sky-light: 8.5:1 ✓ */
  color: var(--col-navy);
  background: var(--col-sky-light);
  border: 1px solid var(--col-border);
  border-radius: var(--r-md);
  padding: .65rem 1.25rem;
  margin-top: 1rem;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  min-height: var(--touch-target);
}
.horizon-link:hover {
  background: #C5D9EF;
  box-shadow: var(--shadow-card);
  color: var(--col-navy);
  text-decoration: underline;
}

/* Indicatore di link esterno / nuova finestra — WCAG 2.4.4 */
.horizon-link[target="_blank"]::after {
  /* Avviso per screen reader definito nell'HTML con <span class="sr-only"> */
  content: '↗';
  font-size: .75em;
  margin-left: .15rem;
}

/* ----------------------------------------------------------------
   15. TABELLE — WCAG 1.3.1 (Info and Relationships)
   ---------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  /* caption sempre presente nell'HTML */
}

.data-table caption {
  font-family: var(--font-display);
  font-size: .875rem;
  font-weight: 600;
  color: var(--col-text);
  text-align: left;
  padding: .5rem 0 .75rem;
  caption-side: top;
}

.data-table thead {
  background: var(--col-navy);
  color: #fff;
}

.data-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: .05em;
  text-transform: uppercase;
  /* Contrasto bianco su navy: 13.8:1 ✓ */
  color: #fff;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
  /* scope="col" o "row" obbligatorio nell'HTML — WCAG 1.3.1 */
}

.data-table tbody tr {
  border-bottom: 1px solid var(--col-border);
  transition: background .12s;
}

@media (hover: hover) and (pointer: fine) {
  .data-table tbody tr:hover { background: var(--col-sky-light); }
}

.data-table tbody tr:focus-within {
  outline: 2px solid var(--col-border-focus);
  outline-offset: -2px;
}

.data-table td {
  padding: .65rem 1rem;
  color: var(--col-text-muted);
  vertical-align: top;
  line-height: 1.5;
}

/* ----------------------------------------------------------------
   16. MODULI E INPUT — WCAG 1.3.5, 3.3.1, 3.3.2
   ---------------------------------------------------------------- */

/* Wrapper label+input per associazione corretta */
.field-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1rem;
}

label,
.field-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--col-text);
}

/* Campo richiesto — WCAG 3.3.2 */
label .required-mark {
  color: var(--col-error-text);
  margin-left: .15rem;
  /* Testo alternativo per screen reader nell'HTML:
     <span aria-label="obbligatorio">*</span> */
}

input[type="text"],
input[type="email"],
input[type="search"],
select,
textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--col-text);
  background: var(--col-white);
  border: 2px solid var(--col-border);
  border-radius: var(--r-sm);
  padding: .55rem .8rem;
  min-height: var(--touch-target);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  /* autocomplete definito nell'HTML — WCAG 1.3.5 */
}

input[type="text"]:hover,
select:hover {
  border-color: var(--col-blue);
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--col-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 95, 170, .22);
}

/* Errore inline — WCAG 3.3.1 */
.field-error {
  font-size: var(--text-xs);
  color: var(--col-error-text);
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .25rem;
}

/* ----------------------------------------------------------------
   17. PULSANTI — WCAG 2.5.5 (Target Size ≥ 44px)
   ---------------------------------------------------------------- */
.btn,
input[type="button"],
button {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .03em;
  background: var(--col-blue);
  /* Contrasto bianco su #1A4F8A: 7.2:1 ✓ */
  color: #fff;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: .6rem 1.5rem;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: background .15s, box-shadow .15s, transform .12s;
}

.btn:hover,
input[type="button"]:hover,
button:hover {
  background: var(--col-blue-hover);
  box-shadow: 0 3px 10px rgba(26,79,138,.30);
  transform: translateY(-1px);
}

.btn:active,
input[type="button"]:active,
button:active {
  transform: translateY(0);
}

/* Pulsanti stile originale (per compatibilità bottone PDF) */
.pulsante, .pulsanteGrande, .pulsanteMoltoGrande, .pulsantePiccolo, .pulsanteSchedario, .pulsanteGrandeG, .pulsanteGrandeR, .pulsanteG {
	width: 9.375rem;
	height: 1.875rem;
	background-color: #f3f3f3;
	color: #000;
	border: 1px solid #000;
	border-radius: 0.25rem;
	font-weight: bold;
	cursor: pointer;
	text-align: center;
	vertical-align: middle;
}

.pulsante:hover, .pulsanteGrande:hover, .pulsanteMoltoGrande:hover, .pulsantePiccolo:hover, .pulsanteSchedario:hover, .pulsanteGrandeG:hover, .pulsanteGrandeR:hover, .pulsanteG:hover {
	background-color: #e0e0e0;
}

.pulsanteGrande, .pulsanteGrandeG, .pulsanteGrandeR {
	width: 10.625rem;
}

.pulsanteG, .pulsanteGrandeG {
	background: #ffff00;
}

.pulsanteGrandeG.visua, .pulsanteGrandeG.all, .pulsanteGrandeG.cambia_giallo {
	background: #ffff00;
	color: #000;
}

/* Pulsante secondario (annulla) */
.btn--secondary {
  background: transparent;
  color: var(--col-navy);
  border: 1px solid var(--col-navy);
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--secondary:hover,
.btn--secondary:focus {
  background: var(--col-navy);
  color: white;
  outline: 2px solid var(--col-blue);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------
   18. MESSAGGI ERRORE / AVVISO
   ---------------------------------------------------------------- */
/* role="alert" o role="status" definito nell'HTML (WCAG 4.1.3) */
.msg-error {
  border-left: 4px solid var(--col-error-border);
  background: var(--col-error-bg);
  color: var(--col-error-text);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: .75rem 1rem;
  font-size: var(--text-sm);
}

.msg-warn {
  border-left: 4px solid var(--col-warn-border);
  background: var(--col-warn-bg);
  color: var(--col-warn-text);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: .75rem 1rem;
  font-size: var(--text-sm);
}

/* ----------------------------------------------------------------
   19. FOOTER
   ---------------------------------------------------------------- */
.site-footer {
  background: var(--col-navy);
  /* Contrasto rgba(255,255,255,.75) su navy: ~7:1 ✓ */
  color: rgba(255,255,255,.78);
  font-size: var(--text-xs);
  padding: 2rem 1.5rem;
  text-align: center;
  line-height: 2;
}

.site-footer a {
  color: rgba(255,255,255,.80);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer a:hover {
  color: #FFD966;   /* contrasto su navy: 9.2:1 ✓ */
}

.site-footer nav {
  margin-top: .25rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .25rem .5rem;
}

.site-footer nav a {
  padding: .25rem .4rem;
  border-radius: var(--r-sm);
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
}

/* ----------------------------------------------------------------
   20. JQUERY UI OVERRIDES
   ---------------------------------------------------------------- */
.ui-dialog {
  border-radius: var(--r-lg) !important;
  border: none !important;
  box-shadow: 0 8px 36px rgba(13,43,82,.22) !important;
  font-family: var(--font-body) !important;
}

.ui-dialog-titlebar {
  background: var(--col-navy) !important;
  color: #fff !important;
  border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
  font-family: var(--font-display) !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  border: none !important;
  padding: .75rem 1.25rem !important;
}

.ui-dialog-titlebar-close {
  color: rgba(255,255,255,.80) !important;
  background: transparent !important;
  border: none !important;
  min-width: var(--touch-target) !important;
  min-height: var(--touch-target) !important;
}

.ui-dialog-content {
  padding: var(--gap-md) !important;
  font-family: var(--font-body) !important;
  font-size: var(--text-base) !important;
  color: var(--col-text) !important;
}

.ui-autocomplete {
  border-radius: var(--r-md) !important;
  border: 1px solid var(--col-border) !important;
  box-shadow: var(--shadow-card) !important;
  font-family: var(--font-body) !important;
  font-size: var(--text-sm) !important;
  max-height: 12.5rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.ui-menu-item-wrapper.ui-state-active,
.ui-menu-item-wrapper:hover {
  background: var(--col-sky-light) !important;
  /* contrasto #0D2B52 su #D6E8F7: 9.6:1 ✓ */
  color: var(--col-navy) !important;
  border-color: transparent !important;
}

/* ----------------------------------------------------------------
   21. FOCUS VISIBILE — WCAG 2.4.7 (Focus Visible) + 2.4.11 (WCAG 2.2)
   ---------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--col-border-focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Rimuove outline solo se gestito con :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

/* Elemento usato per "fuori fuoco" — aria-hidden e tabindex=-1 nell'HTML */
#fuoriFuoco {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}

/* ----------------------------------------------------------------
   22. ANIMAZIONI — WCAG 2.3.3 (Animation from Interactions)
   ---------------------------------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Applica animazioni SOLO se l'utente non ha richiesto riduzione */
@media (prefers-reduced-motion: no-preference) {
  .main-content {
    animation: fadeUp .45s ease both;
  }
  .card:nth-child(1) { animation: fadeUp .45s .05s ease both; }
  .card:nth-child(2) { animation: fadeUp .45s .10s ease both; }
  .card:nth-child(3) { animation: fadeUp .45s .15s ease both; }
  .card:nth-child(4) { animation: fadeUp .45s .20s ease both; }
}

/* ----------------------------------------------------------------
   23. RESPONSIVE — WCAG 1.4.10 (Reflow — 320px senza scroll orizz.)
   ---------------------------------------------------------------- */

/* Tablet */
@media (max-width: 900px) {
  .pub-card-wrap {
    float: none;
    margin: 0 auto 1.5rem;
    max-width: 100%;
  }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile — 320px reflow (WCAG 1.4.10) */
@media (max-width: 600px) {
  .header-inner {
    flex-wrap: wrap;
    padding: .6rem 1rem;
  }
  .header-utils {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
  .main-nav ul {
    padding: 0 .5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    /* Barra scroll sempre visibile su mobile */
    scrollbar-width: thin;
  }
  .main-nav a,
  .main-nav button.nav-btn {
    font-size: .68rem;
    padding: .75rem .7rem;
  }
  .main-content {
    padding: 1.5rem 1rem 2rem;
  }
  .kpi-strip {
    padding: 1.25rem 1rem;
    flex-direction: column;
  }
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
  }
  .section-heading {
    font-size: 1.2rem;
  }
  .body-text {
    text-align: left;   /* giustificato può creare "fiumi" su mobile */
  }
}

@media (max-width: 400px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------------
   24. STAMPA
   ---------------------------------------------------------------- */
@media print {
  .site-header,
  .main-nav,
  .breadcrumb,
  .skip-links,
  .card-grid { display: none; }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .main-content {
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: .75em;
    color: #444;
  }

  /* Non stampare href per link javascript: */
  a[href^="javascript"]::after { content: ''; }

  .site-footer {
    background: #fff;
    color: #333;
    border-top: 1px solid #ccc;
  }
}


/* Stile per rendere consistente il footer e i link di footer.php */
.site-footer {
    background-color: var(--col-navy);
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 0;
    text-align: center;
}

.footer-info {
    font-size: var(--text-xs);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem; /* Spazio tra i link */
}

.footer-nav a {
    color: #fff !important;
    text-decoration: underline;
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 500;
}

.footer-nav a:hover {
    color: var(--col-sky-light) !important;
    text-decoration: none;
}

/* Stili per footer.php - riduci spazio sopra i link */
.site-footer .titolo_h2_left,
.site-footer .titolo_h2_centro,
.site-footer .titolo_h2_right {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
}

.site-footer .column_third,
.site-footer .column_third_central {
    padding-top: 0.25rem !important;
}

.site-footer h2 {
    font-size: var(--text-sm) !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

.site-footer h2 a {
    font-family: var(--font-body) !important;
    font-size: var(--text-sm) !important;
}

/* ----------------------------------------------------------------
   PAGINAZIONE ACCESSIBILE - WCAG 2.4.1, 2.4.8, 4.1.2
   ---------------------------------------------------------------- */
.pagination-nav {
  margin: 2rem 0;
  text-align: center;
}

.pagination-info {
  margin-bottom: 1rem;
}

.pagination-count {
  font-size: var(--text-sm);
  color: var(--col-navy);
  font-weight: 500;
}

.pagination-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.pagination-list li {
  margin: 0;
}

.pagination-list a,
.pagination-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border: 1px solid var(--col-blue);
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  transition: all 0.2s ease;
  min-height: var(--touch-target);
}

.pagination-list a {
  background: white;
  color: var(--col-blue);
}

.pagination-list a:hover,
.pagination-list a:focus {
  background: var(--col-blue);
  color: white;
  text-decoration: none;
  outline: 2px solid var(--col-blue);
  outline-offset: 2px;
}

.pagination-list span[aria-current="page"] {
  background: var(--col-navy);
  color: white;
  border-color: var(--col-navy);
  font-weight: 600;
}

/* Stili per screen reader */
.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;
}

/* Responsive paginazione */
@media (max-width: 768px) {
  .pagination-list {
    gap: 0.25rem;
  }
  
  .pagination-list a,
  .pagination-list span {
    min-width: 2rem;
    height: 2rem;
    font-size: var(--text-xs);
    padding: 0.25rem;
  }
  
  .pagination-count {
    font-size: var(--text-xs);
  }
}

/* ----------------------------------------------------------------
   ORDINAMENTO TABELLA - Link accessibili e indicatori visivi
   ---------------------------------------------------------------- */
.sort-link {
  color: var(--col-navy);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  transition: all 0.2s ease;
  min-height: var(--touch-target);
}

.sort-link:hover,
.sort-link:focus {
  background: var(--col-sky-light);
  color: var(--col-navy);
  text-decoration: none;
  outline: 2px solid var(--col-blue);
  outline-offset: 2px;
}

.sort-indicator {
  font-size: 0.75em;
  opacity: 0.7;
  font-weight: normal;
}

.sort-indicator.descending::after {
  content: " \25bc"; /* Freccia giù */
}

.sort-indicator.ascending::after {
  content: " \25b2"; /* Freccia su */
}

/* Stili per th ordinabili */
th[aria-sort="none"] .sort-link::after {
  content: " \25b7"; /* Triangolo vuoto */
  opacity: 0.4;
  font-size: 0.75em;
}

th[aria-sort="ascending"] .sort-link::after {
  content: " \25b2"; /* Freccia su */
  opacity: 1;
}

th[aria-sort="descending"] .sort-link::after {
  content: " \25bc"; /* Freccia giù */
  opacity: 1;
}

/* Focus states per accessibilità */
.sort-link:focus {
  outline: 2px solid var(--col-blue);
  outline-offset: 2px;
  background: var(--col-sky-light);
}

/* Responsive ordinamento */
@media (max-width: 768px) {
  .sort-link {
    font-size: var(--text-sm);
    padding: 0.2rem 0.3rem;
  }
}

/* ----------------------------------------------------------------
   NUOVA TABELLA MODERNA - HTML5 Semantico, Responsive, 90% width
   ---------------------------------------------------------------- */
.table-container {
  width: 100%;
  max-width: 1400px;
  margin: 2rem auto;
  overflow-x: auto;
  border-radius: var(--r-md);
  box-shadow: 0 4px 12px rgba(13, 43, 82, 0.1);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: white;
  border-radius: var(--r-md);
  overflow: hidden;
}

.modern-table caption {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--col-navy);
  text-align: center;
  padding: 1rem;
  background: var(--col-sky-light);
  margin-bottom: 0;
}

.modern-table thead {
  background: var(--col-navy);
  color: white;
}

.modern-table th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.modern-table th:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modern-table th.sortable::after {
  content: '';
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.modern-table th.sorted-asc::after {
  content: '';
  opacity: 1;
  border-bottom: 6px solid white;
  border-top: none;
}

.modern-table th.sorted-desc::after {
  content: '';
  opacity: 1;
  border-top: 6px solid white;
  border-bottom: none;
}

.modern-table tbody tr {
  border-bottom: 1px solid var(--col-border);
  transition: background-color 0.15s ease;
}

.modern-table tbody tr:nth-child(even) {
  background: var(--col-surface);
}

.modern-table tbody tr:hover {
  background: var(--col-sky-light);
}

.modern-table td {
  padding: 0.875rem 0.75rem;
  vertical-align: middle;
  color: var(--col-text);
}

.modern-table td.text-right {
  text-align: right;
  font-weight: 600;
}

.modern-table td.text-center {
  text-align: center;
  white-space: nowrap;
  min-width: 100px;
}

.modern-table .main-link a {
  color: var(--col-sky);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.modern-table .main-link a:hover {
  color: var(--col-navy);
  text-decoration: underline;
}

.modern-table .no-link {
  color: var(--col-text-muted);
  font-style: italic;
}

.modern-table img {
  vertical-align: middle;
}

/* Responsive */
@media (max-width: 1200px) {
  .table-container {
    width: 95%;
  }
}

@media (max-width: 768px) {
  .table-container {
    width: 100%;
    margin: 1rem 0;
  }
  
  .modern-table {
    font-size: 0.8rem;
  }
  
  .modern-table th,
  .modern-table td {
    padding: 0.5rem 0.25rem;
  }
  
  .modern-table th {
    font-size: 0.7rem;
  }
}

/* ----------------------------------------------------------------
   MODAL ULTIMI N PROGETTI
   ---------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--col-border);
  background: var(--col-navy);
  color: white;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 1.5rem;
}

.modal-body p {
  margin: 0 0 1rem 0;
  color: var(--col-text);
  line-height: 1.5;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--col-navy);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--col-border);
  border-radius: var(--r-sm);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--col-sky);
  box-shadow: 0 0 0 3px rgba(26, 79, 138, 0.1);
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--col-text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--col-border);
  background: var(--col-surface);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

.btn-secondary {
  background: var(--col-surface);
  color: var(--col-text);
  border: 2px solid var(--col-border);
}

.btn-secondary:hover {
  background: var(--col-border);
}

.btn-primary {
  background: var(--col-sky);
  color: white;
  border: 2px solid var(--col-sky);
}

.btn-primary:hover {
  background: var(--col-navy);
  border-color: var(--col-navy);
}

/* Stili specifici per colonne */
.table-container .modern-table th[data-column="pq"],
.table-container .modern-table td[data-label="Programma Quadro"] {
  min-width: 200px !important;
  max-width: 250px !important;
  text-align: left !important;
  font-weight: 500 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 0.75rem 0.5rem !important;
  line-height: 1.3 !important;
}

.table-container .modern-table td[data-label="Programma Quadro"] {
  background-color: #f8f9fa !important;
  border-left: 3px solid #0066cc !important;
}

/* Riduzione larghezza colonna ID */
.table-container .modern-table th[data-column="id"] {
  min-width: 70px !important;
  max-width: 80px !important;
  text-align: left !important;
  padding: 0.75rem 0.25rem !important;
}

.table-container .modern-table td[data-label="ID"] {
  min-width: 70px !important;
  max-width: 80px !important;
  text-align: right !important;
  padding: 0.75rem 0.25rem !important;
}

/* Riduzione larghezza colonna ACRONIMO */
.table-container .modern-table th[data-column="acronimo"],
.table-container .modern-table td[data-label="Acronimo"] {
  min-width: 120px !important;
  max-width: 150px !important;
  padding: 0.75rem 0.5rem !important;
}

/* Riduzione larghezza colonna SITO WEB */
.table-container .modern-table th[data-column="web"],
.table-container .modern-table td[data-label="Sito Web"] {
  min-width: 80px !important;
  max-width: 100px !important;
  text-align: center !important;
  padding: 0.75rem 0.25rem !important;
}

/* Stili specifici per modal ricerca */
.ricerca-modal {
  max-width: 800px;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.form-group.half-width {
  flex: 1;
}

.form-row .form-group.half-width label {
  margin-bottom: 0.5rem;
}

/* Layout per criteri di ricerca */
.criterio-row {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--col-border);
  border-radius: var(--r-sm);
  background: var(--col-surface);
}


.form-row .form-group {
  flex: 1;
}

.form-row .form-group.field-select {
  flex: 1.5;
}

.form-row .form-group.operator-select {
  flex: 1;
}

.form-row .form-group.value-input {
  flex: 2;
}

.form-row .form-group.actions {
  flex: 0.5;
  text-align: center;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  min-width: 2rem;
}

.btn-add {
  background: var(--col-sky);
  color: white;
  border: 1px solid var(--col-sky);
}

.btn-add:hover {
  background: var(--col-navy);
  border-color: var(--col-navy);
}

.btn-remove {
  background: var(--col-danger);
  color: white;
  border: 1px solid var(--col-danger);
}

.btn-remove:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

/* ----------------------------------------------------------------
   UTILITY
   ---------------------------------------------------------------- */

/* Testo visivamente nascosto ma accessibile ai screen reader
   (WCAG 1.1.1, 2.4.6) — usato diffusamente nell'HTML */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Classi di compatibilità con il CSS originale */
.dim_77  { width: 100% !important; }
.noPadding { padding: 0 !important; }
.noMargin  { margin: 0 !important; }
.no_bottom { margin-bottom: 0 !important; padding-bottom: 0 !important; }
.no_top    { margin-top: 0 !important; padding-top: 0 !important; }
.dx { text-align: right; }
.sx { text-align: left; }
.cifra { font-variant-numeric: tabular-nums; }
.bordeaux { color: var(--col-navy); font-weight: 600; }
.thumbnail_align { margin: 0; }
.thumbnail { max-width: 64px; }

 /* ----------------------------------------------------------------
       Spinner di caricamento — role="status" nell'HTML (WCAG 4.1.3)
       ---------------------------------------------------------------- */
    .loading-overlay {
      display: none;                  /* mostrato via JS */
      position: fixed;
      inset: 0;
      background: rgba(13, 43, 82, .55);
      z-index: 9000;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 1rem;
    }
    .loading-overlay.is-visible { display: flex; }
    .loading-overlay p {
      font-family: var(--font-display);
      font-size: .9rem;
      font-weight: 600;
      color: #fff;                    /* contrasto su overlay: ✓ */
      letter-spacing: .05em;
    }
    .loading-overlay img {
      width: 4rem;
      height: 4rem;
    }

    /* ----------------------------------------------------------------
       Barra azioni tabella
       ---------------------------------------------------------------- */
    .table-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: .5rem;
      padding: .75rem 1rem;
      background: var(--col-sky-light);
      border: 1px solid var(--col-border);
      border-radius: var(--r-md) var(--r-md) 0 0;
      margin-top: 1.25rem;
    }

    /* Separatore visivo (non trasporta info — aria-hidden nell'HTML) */
    .toolbar-sep {
      width: 1px;
      height: 1.5rem;
      background: var(--col-border);
      flex-shrink: 0;
    }

    /* ----------------------------------------------------------------
       Intestazione risultati
       ---------------------------------------------------------------- */
    .results-header {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: .5rem 1.5rem;
      margin-bottom: .25rem;
    }

    .results-title {
      font-family: var(--font-display);
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--col-navy);
    }

    .results-criteria {
      font-family: var(--font-body);
      font-size: var(--text-sm);
      color: var(--col-text-muted);
    }

    .results-count {
      font-family: var(--font-display);
      font-size: var(--text-sm);
      font-weight: 600;
      color: var(--col-white);
      background: var(--col-blue);
      padding: .2rem .65rem;
      border-radius: 2rem;
      /* contrasto bianco su #1A4F8A: 7.2:1 ✓ */
    }

    /* ----------------------------------------------------------------
       Wrapper tabella — scroll orizzontale accessibile (WCAG 1.4.10)
       ---------------------------------------------------------------- */
    .table-scroll-wrap {
      overflow-x: auto;
      overflow-y: visible;
      border: 1px solid var(--col-border);
      border-top: none;
      border-radius: 0 0 var(--r-md) var(--r-md);
      max-width: 100%;
      /* Indica agli AT che c'è scroll orizzontale */
      role: region;
    }

    /* ----------------------------------------------------------------
       Tabella dati
       ---------------------------------------------------------------- */
    .projects-table {
      width: auto;
      min-width: 60rem;    /* aumentato per contenere tutte le colonne */
      max-width: none;
      border-collapse: collapse;
      font-size: .875rem;
      table-layout: fixed;
    }

    .projects-table caption {
      font-family: var(--font-display);
      font-size: .875rem;
      font-weight: 600;
      color: var(--col-text);
      text-align: left;
      padding: .5rem 0 .75rem;
      caption-side: top;
    }

    /* Thead ordinamento - sovrascritto con !important */
    .projects-table thead th {
      background: var(--col-navy) !important;
      color: #fff !important;                    /* contrasto: 13.8:1 */
      font-family: var(--font-display) !important;
      font-size: .8rem !important;              /* più grande per visibilità */
      font-weight: 700 !important;               /* più grassetto */
      letter-spacing: .025em !important;         /* meno spacing */
      text-transform: uppercase !important;
      padding: .8rem .5rem .8rem .75rem !important; /* più padding verticale */
      text-align: left !important;
      white-space: nowrap !important;
      vertical-align: middle !important;        /* allineamento centrale */
      position: sticky !important;
      top: 0 !important;
      z-index: 2 !important;
      border-bottom: 3px solid var(--col-blue) !important; /* linea più spessa */
      line-height: 1.2 !important;
    }

    /* Colonna nascosta (id): visivamente assente ma presente per JS */
    .projects-table .col-hidden {
      width: 0;
      padding: 0;
      overflow: hidden;
      border: none;
    }

    /* Pulsante ordinamento — WCAG 2.1.1 + 4.1.2 */
    .sort-btn {
      background: transparent;
      border: none;
      color: #fff;
      font-family: var(--font-display);
      font-size: .7rem;
      font-weight: 600;
      letter-spacing: .05em;
      text-transform: uppercase;
      cursor: pointer;
      padding: 0;
      min-height: 44px;           /* touch target (WCAG 2.5.5) */
      min-width: 44px;
      display: inline-flex;
      align-items: center;
      gap: .3rem;
      text-decoration: none;
    }
    .sort-btn:hover { opacity: .8; text-decoration: underline; }
    .sort-btn::after {
      content: '⇅';
      font-size: .65rem;
      opacity: .6;
    }
    .sort-btn[aria-sort="ascending"]::after  { content: '↑'; opacity: 1; }
    .sort-btn[aria-sort="descending"]::after { content: '↓'; opacity: 1; }

    /* Righe dati */
    .projects-table tbody tr {
      border-bottom: 1px solid var(--col-border);
      transition: background .12s;
    }
    .projects-table tbody tr:nth-child(even) {
      background: var(--col-surface);
    }
    /* Rimuovo hover sulla riga per evitare clic su tutta la riga */
    .projects-table tbody tr:focus-within {
      outline: 2px solid var(--col-border-focus);
      outline-offset: -2px;
    }

    .projects-table td {
      padding: .55rem .5rem .55rem .75rem;
      color: var(--col-text-muted);
      vertical-align: middle;
    }

    /* Colonna acronimo — link principale di accesso al record */
    .projects-table .col-acronimo a {
      font-weight: 600;
      color: var(--col-sky);
      text-decoration: underline;
    }
    .projects-table .col-acronimo a:hover { color: var(--col-navy); }

    /* Pulsante dettaglio riga */
    .btn-row-detail {
      background: var(--col-blue);
      border: none;
      border-radius: var(--r-sm);
      width: 1.75rem;
      height: 1.75rem;
      min-width: 44px;
      min-height: 44px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background .15s;
    }
    .btn-row-detail:hover { background: var(--col-blue-hover); }
    .btn-row-detail svg {
      width: 14px;
      height: 14px;
      fill: #fff;
    }

    /* Icona sito web */
    .btn-web {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: .2rem;
      min-width: 44px;
      min-height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .btn-web img { width: 1.2rem; height: 1.2rem; }
    .btn-web:hover img { opacity: .75; }

    /* ----------------------------------------------------------------
       Messaggio "nessun risultato"
       ---------------------------------------------------------------- */
    .no-results {
      text-align: center;
      padding: 4rem 1rem;
      font-family: var(--font-display);
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--col-text-muted);
    }
    .no-results span {
      display: block;
      font-family: var(--font-body);
      font-size: var(--text-sm);
      font-weight: 400;
      margin-top: .5rem;
      color: var(--col-text-light);
    }

    /* ----------------------------------------------------------------
       Pannello dettaglio singolo progetto (distinta_rep)
       ---------------------------------------------------------------- */
    #distinta_rep {
      background: var(--col-white);
      border: 1px solid var(--col-border);
      border-radius: var(--r-lg);
      padding: 1.5rem;
      margin-top: 1.5rem;
      box-shadow: var(--shadow-card);
    }
    #distinta_rep h2 {
      font-family: var(--font-display);
      font-size: 1rem;
      font-weight: 700;
      color: var(--col-navy);
      margin-bottom: 1rem;
      font-style: italic;
    }
    .rep-toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: .75rem;
      margin-bottom: 1.25rem;
      justify-content: flex-start;
      align-items: center;
    }

    /* ----------------------------------------------------------------
       Responsive
       ---------------------------------------------------------------- */
    @media (max-width: 700px) {
      .table-toolbar { flex-direction: column; align-items: stretch; }
      .table-toolbar .btn { width: 100%; justify-content: center; }
      .results-header { flex-direction: column; }
    }

    /* ----------------------------------------------------------------
       Stampa
       ---------------------------------------------------------------- */
    @media print {
      .table-toolbar,
      .loading-overlay,
      #distinta_rep,
      .breadcrumb { display: none; }
      .projects-table { font-size: 9pt; }
    }