/* ==========================================================================
   Radar Appalto — componenti condivisi (redesign 09/2026; stile «Familiare + Revolut» dal 03/10/2026)
   Richiede tokens.css. Usato da home, pagine SEO, guide e dashboard.
   Nomi BEM corti: .blocco, .blocco__parte, .blocco--variante, stato .is-*.
   Un componente = un blocco di regole, in quest'ordine: base → layout → componenti → utilità.
   ========================================================================== */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--fs-2); line-height: var(--lh);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: var(--lh-tight); margin: 0 0 var(--sp-3); color: var(--ink); letter-spacing: -0.02em; }
h1 { font-size: var(--fs-6); font-weight: var(--w-bold); }
h2 { font-size: var(--fs-5); font-weight: var(--w-bold); }
h3 { font-size: var(--fs-4); font-weight: var(--w-bold); }
p { margin: 0 0 var(--sp-4); }
a { color: var(--cta); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--cta-hover); }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: var(--sp-2) var(--sp-4); z-index: var(--z-toast); }
.skip-link:focus { left: var(--sp-4); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--sp-4); }
.wrap--narrow { max-width: var(--wrap-narrow); }
.section { padding: var(--sp-7) 0; }
.section--tight { padding: var(--sp-5) 0; }
.section--band { background: var(--surface-2); }
.stack > * + * { margin-top: var(--sp-4); }
.stack--sm > * + * { margin-top: var(--sp-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 48em) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }
.sep { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }

/* ---------- tipografia di servizio ---------- */
.kicker { display: inline-block; font-size: var(--fs-1); font-weight: var(--w-medium); color: var(--ink-3); margin-bottom: var(--sp-2); }   /* niente maiuscole spaziate: segnale da interfaccia generata (studio 02/10) */
.lead { font-size: var(--fs-3); color: var(--ink-2); }
.small { font-size: var(--fs-1); color: var(--ink-3); }
.note { font-size: var(--fs-0); color: var(--ink-3); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; }
.hl { color: inherit; }   /* niente parola evidenziata nel titolo: segnale da interfaccia generata (studio 02/10) */
.eyebrow { font-size: var(--fs-1); color: var(--ink-3); margin: 0 0 var(--sp-1); }
.h-sec { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-4); }
.h-sec > * { min-width: 0; }
.h-sec h2, .h-sec h3 { margin: 0; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-5); border-radius: var(--r-pill);
  border: 1.5px solid var(--line-card); background: var(--surface-2); color: var(--ink);
  font-weight: var(--w-medium); font-size: var(--fs-2); line-height: 1.2; text-decoration: none;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--line-soft); color: var(--ink); filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn--primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); color: var(--cta-ink); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--cta); text-decoration: underline; text-underline-offset: 3px; padding: 0 var(--sp-2); }
.btn--ghost:hover { background: var(--accent); color: var(--accent-ink); filter: none; }
@media (max-width: 47.99em) { .btn { white-space: normal; text-align: center; line-height: 1.25; } }   /* su telefono un'etichetta lunga va a capo invece di sbordare dallo schermo */
.btn--sm { min-height: 2.25rem; padding: 0 var(--sp-4); font-size: var(--fs-1); border-radius: var(--r-pill); }
.btn--block { display: flex; width: 100%; }
.btn--icon { width: var(--tap); min-height: var(--tap); padding: 0; border-radius: var(--r-pill); }   /* anche con .btn--sm: la x di chiusura resta toccabile */
.btn--lg { min-height: 3.25rem; font-size: var(--fs-3); padding: 0 var(--sp-6); }

/* ---------- chip (filtro / stato) e badge (etichetta) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 2.25rem; padding: 0 var(--sp-3);
  border-radius: var(--r-pill); border: 1.5px solid var(--line-card); background: var(--surface-2);
  color: var(--ink-2); font-size: var(--fs-1); font-weight: var(--w-medium); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--line-card-hover); color: var(--ink); }
.chip.is-on { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: var(--w-bold); }
.chip__x { margin-left: var(--sp-1); opacity: .7; }
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-1); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
/* chip dei suggerimenti sotto le caselle di ricerca: vanno a capo (niente scorrimento nascosto) e non si
   allungano: la didascalia dei numeri, stretta dal flex, andava a capo dieci volte e gonfiava le pillole */
.chips--sugg { flex-wrap: wrap; overflow: visible; align-items: center; row-gap: var(--sp-1); }
.chips--sugg .chip { flex: 0 0 auto; }
/* una pillola piu' lunga dello schermo va a capo dentro di se' (08/10: in Oggi «efficientamento energetico a Cosenza
   sotto 100 mila» usciva dal bordo e tutta la pagina scorreva di lato al telefono) */
.chips--sugg .chip { max-width: 100%; white-space: normal; text-align: left; }
.chips--sugg .note { flex-basis: 100%; margin: 0; }
.badge {
  display: inline-flex; align-items: center; gap: .3em; padding: .15em .65em; border-radius: var(--r-pill);
  font-size: var(--fs-0); font-weight: var(--w-bold); line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger); color: #fff; }   /* pieno: e' l'unico badge che deve saltare all'occhio, senza lampeggiare */
.badge--accent { background: var(--accent); color: var(--accent-ink); }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--line-card); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-1); }
.card--flat { box-shadow: none; }
.card--band { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card--brand { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.card--brand h2, .card--brand h3, .card--brand a { color: inherit; }
.card__title { font-size: var(--fs-3); font-weight: var(--w-bold); margin: 0 0 var(--sp-1); }
.card__meta { font-size: var(--fs-1); color: var(--ink-3); }

/* ---------- statistica (numero + etichetta) ---------- */
.stat { display: flex; flex-direction: column; gap: 0.1rem; }
.stat__n { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-5); font-weight: var(--w-black); letter-spacing: var(--track-num); line-height: 1.1; color: var(--ink); }
.stat__n--xl { font-size: var(--fs-7); }
.stat__l { font-size: var(--fs-1); color: var(--ink-3); }
.stats { display: flex; gap: var(--sp-3); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: var(--sp-1); scrollbar-width: none; }
.stats::-webkit-scrollbar { display: none; }
.stats > .card { flex: 0 0 10.5rem; scroll-snap-align: start; padding: var(--sp-4); }
@media (min-width: 48em) { .stats { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; } .stats > .card { flex: initial; } }

/* ---------- card gara (condivisa: home, dashboard, pagine SEO) ---------- */
.gara {
  position: relative; display: grid; gap: var(--sp-2); padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line-card); border-radius: var(--r-lg);
  text-decoration: none; color: inherit;
}
.gara:hover { border-color: var(--line-card-hover); }
.gara.is-key { border-color: var(--cta); box-shadow: 0 0 0 3px var(--accent); }
.gara__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); min-width: 0; }
.gara__top .badge { flex: 0 1 auto; min-width: min-content; white-space: normal; text-align: right; line-height: 1.3; }
@media (min-width: 48em) { .gara__top .badge { white-space: nowrap; } }   /* desktop: il badge non va a capo ('· RC' su una riga sola) */   /* puo' andare a capo ma mai piu' stretto della parola piu' lunga: 'Urgente' sbordava dalla card */
.gara__ente { font-size: var(--fs-1); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
/* tre righe, poi un tocco apre tutto: due righe dell'oggetto ANAC contenevano solo il preambolo
   («Piano Strategico … D.M. 3 maggio 2024, n.173 - …») e il lavoro vero restava fuori. Il tetto
   in altezza e' esplicito perche' il solo line-clamp lasciava intravedere mezza riga in piu'. */
.gara__ogg { font-weight: var(--w-bold); font-size: var(--fs-2); line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-height: calc(3 * 1.3em); cursor: pointer; }
.gara__ogg.is-full { -webkit-line-clamp: unset; max-height: none; }
/* «cosa chiede», in italiano semplice, sotto l'oggetto ANAC */
.gara__riass { margin: 0; font-size: var(--fs-1); line-height: 1.45; color: var(--ink-2); }
.gara__ogg:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.gara__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-1); color: var(--ink-2); align-items: center; }
.gara__val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: var(--w-bold); color: var(--ink); }
.gara__scad { display: inline-flex; align-items: center; gap: .35em; }
.gara__scad::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: currentColor; }
.gara__scad--urg { color: var(--danger); font-weight: var(--w-bold); }
.gara__scad--soon { color: var(--warn); font-weight: var(--w-bold); }
.gara__scad--ok { color: var(--ok); }
.gara__why { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
/* un motivo lungo («Servizi tecnici (ingegneria e architettura)») in un badge a riga unica allargava la
   card oltre lo schermo e il telefono rimpiccioliva tutta la pagina: i badge dei motivi vanno a capo */
.gara__why .badge { white-space: normal; text-align: left; }
.sheet .chip { white-space: normal; text-align: left; }          /* le SOA con la descrizione lunga */
/* nel pannello del profilo i due campi importo affiancati (input number, larghezza intrinseca ~200px)
   sfondavano i 375px e il telefono rimpiccioliva tutto: campi a larghezza piena e, stretti, in colonna */
/* ...ma NON caselle e pallini: a larghezza piena il pallino finiva in mezzo e «Tutta Italia» spinto a destra su due
   righe (Alberto, 18/09, zona nel profilo). Stessa esclusione della regola .field input qui sotto. */
.sheet .field input:not([type="checkbox"]):not([type="radio"]), .sheet .field select { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 480px) { .sheet .grid--2 { grid-template-columns: 1fr; } }
.h-sec > a { white-space: nowrap; }
@media (pointer: coarse) { .btn--sm { min-height: 2.75rem; } }  /* col dito servono 44 px */
.gara__act { display: flex; gap: var(--sp-2); align-items: center; justify-content: space-between; margin-top: var(--sp-1); }
.gara__act .btn { flex: 1; min-height: var(--tap); }   /* i due bottoni della card sono i piu' toccati: area piena */
@media (min-width: 48em) { .gara__act .btn { flex: initial; } }
.gare { display: grid; gap: var(--sp-3); }

/* ---------- timbro dell'ente e scheda gara «a regolo» (design Familiare + Revolut, 03/10/2026) ----------
   Il timbro: tondo, il colore dice che ente e' (Comune verde, territoriale blu, sanita' indaco, nazionale prugna,
   altro ardesia). La scheda: chi, cosa, poi quattro caselle sempre nello stesso posto, il verdetto con UN segno,
   i motivi, le azioni. Le classi stanno su .gara--r, cosi' le pagine generate (che usano .gara) non cambiano. */
.timbro { --c: var(--verde); width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--c); color: #fff; flex: none;
  display: inline-grid; place-items: center; font-weight: var(--w-bold); font-size: var(--fs-0); letter-spacing: .03em; line-height: 1;
  box-shadow: inset 0 0 0 2.5px var(--c), inset 0 0 0 3.8px rgba(255, 255, 255, .6); }
.timbro--provincia { --c: #2C5683; }
.timbro--sanita { --c: #3F4A8A; }
.timbro--stato { --c: var(--indagine); }
.timbro--altro { --c: #4B5560; }
.gara--r { gap: var(--sp-3); padding: var(--sp-4); }
.gara__testa { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.gara__chi { display: grid; min-width: 0; flex: 1; }
.gara--r .gara__ente { font-size: var(--fs-2); font-weight: var(--w-bold); color: var(--ink); }
.gara__dove { font-size: var(--fs-0); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gara__st { flex: none; }
.gara--r .gara__ogg { font-size: var(--fs-2); }
.gara__ind { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--indagine-bg); color: var(--indagine); font-size: var(--fs-1); font-weight: var(--w-medium); }
.gara__regolo { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-soft); }
.gara__casella { display: grid; align-content: start; gap: .1rem; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.gara__casella:nth-child(odd) { padding-right: var(--sp-3); border-right: 1px solid var(--line-soft); }
.gara__casella:nth-child(even) { padding-left: var(--sp-3); }
.gara__casella b { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-3); font-weight: var(--w-bold); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.gara__casella span { font-size: var(--fs-0); color: var(--ink-3); }
.gara__tempo--urg b { color: var(--danger); }
.gara__tempo--soon b { color: var(--warn); }
.gara__barra { flex: 1; min-width: 2rem; height: 4px; border-radius: var(--r-pill); background: var(--line-soft); overflow: hidden; }
.gara__barra i { display: block; height: 100%; border-radius: inherit; background: var(--ink-3); }
.gara__tempo--urg .gara__barra i { background: var(--danger); }
.gara__tempo--soon .gara__barra i { background: var(--warn); }
.gara__verd { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-weight: var(--w-bold); font-size: var(--fs-1); }
.gara__vico { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: #fff; font-size: .85rem; }
.gara__verd--ok { color: var(--ok); }      .gara__verd--ok .gara__vico { background: var(--ok); }
.gara__verd--warn { color: var(--warn); }  .gara__verd--warn .gara__vico { background: var(--warn); }
.gara__verd--danger { color: var(--danger); } .gara__verd--danger .gara__vico { background: var(--danger); }
.gara--r .gara__act { margin-top: 0; }
.gara--r .gara__act .btn { flex: 1; }
.btn--seguita { background: var(--accent); color: var(--accent-ink); }
.gara__det { background: transparent; color: var(--cta); }
.gara__det:hover { background: var(--accent); color: var(--accent-ink); filter: none; }
@media (min-width: 48em) { .gara--r .gara__act .btn { flex: initial; min-width: 9rem; } }
.gare > *, .grid > *, .stack > * { min-width: 0; }

/* ---------- tabella → card impilate sotto md ---------- */
.rows { width: 100%; border-collapse: collapse; font-size: var(--fs-1); }
.rows th { text-align: left; font-size: var(--fs-0); font-weight: var(--w-bold); color: var(--ink-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); }
.rows td { padding: var(--sp-3); border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.rows td.num, .rows th.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows tr.is-key td { background: var(--accent); }
@media (max-width: 47.99em) {
  .rows thead { display: none; }
  .rows tr { display: grid; gap: var(--sp-1); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
  .rows td { display: block; padding: 0; border: 0; }
  .rows td.num { text-align: left; }
  .rows td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-0); color: var(--ink-3); }
  /* righe toccabili: su telefono diventano card con bordo e l'azione "Apri" in fondo */
  .rows--tap tr[role="button"] { background: var(--surface); border: 1px solid var(--line-card); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2); }
  .rows--tap tr[role="button"]:active { background: var(--surface-2); }
  .rows--tap .rows__go { text-align: left; margin-top: var(--sp-1); }
}
.rows--tap tr[role="button"] { cursor: pointer; }
.rows--tap tr[role="button"]:hover td { background: var(--surface-2); }
.rows__go { text-align: right; white-space: nowrap; }
/* Solo il bottone FINTO: negli elenchi dove si tocca la riga, «Apri →» e' un <span> che serve a far
   capire che la riga si apre, e non deve rubare il clic alla riga. I bottoni VERI nella stessa
   colonna (<button> «Mi interessa», «Scheda», «Segui») devono ricevere il clic: con la regola su
   tutti i .btn erano morti, senza un errore in console (Alberto, 16/09: «i pulsanti scheda e segui
   non vanno»; in Gare toccava la riga e si apriva il dettaglio, quindi non si notava). */
.rows__go span.btn { pointer-events: none; }

/* ---------- form ---------- */
.field { display: grid; gap: var(--sp-1); }
.field__label { font-size: var(--fs-1); font-weight: var(--w-bold); color: var(--ink-2); }
.field__hint { font-size: var(--fs-0); color: var(--ink-3); }
.input, .field select, .field input:not([type="checkbox"]):not([type="radio"]), .field textarea {
  width: 100%; min-height: var(--tap); padding: 0 var(--sp-4); border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font-size: var(--fs-2);
}
.field textarea { padding: var(--sp-2) var(--sp-3); min-height: 6rem; }
.field select:focus, .field input:focus, .input:focus { border-color: var(--ink); outline: 3px solid var(--focus); outline-offset: 1px; }
.field--inline { display: flex; gap: var(--sp-2); align-items: stretch; }
.field--inline .input { flex: 1; min-width: 0; }
@media (max-width: 29.99em) { .field--inline { flex-wrap: wrap; } .field--inline .btn { flex: 1 1 100%; } }
.check { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-1); color: var(--ink-2); }
.check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; accent-color: var(--cta); }

/* ---------- sheet: bottom sheet su telefono, modale centrata da md ---------- */
.sheet { position: fixed; top: 0; right: 0; bottom: 0; left: 0; margin: 0; border: 0; padding: 0; background: transparent; width: 100%; height: 100%; max-width: 100%; max-height: 100%; transform: none; overflow: hidden; }
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { display: grid; align-items: end; justify-items: center; }
.sheet__card { width: 100%; max-width: 100%; min-width: 0; max-height: 92vh; overflow: auto; overflow-x: hidden; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-2); }
.sheet__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.sheet__head h2, .sheet__head h3 { margin: 0; font-size: var(--fs-3); }
.sheet__body { padding: var(--sp-4); min-width: 0; overflow-x: hidden; overflow-wrap: anywhere; }
.sheet__foot { position: sticky; bottom: 0; padding: var(--sp-3) var(--sp-4); background: var(--surface); border-top: 1px solid var(--line-soft); display: flex; gap: var(--sp-2); }
.sheet__foot > .input { flex: 1; min-width: 0; width: auto; }   /* input + bottone nella stessa riga senza sfondare */
@media (min-width: 48em) {
  .sheet[open] { align-items: center; }
  .sheet__card { max-width: 44rem; max-height: 88vh; border-radius: var(--r-xl); }
}

/* ---------- tab bar (mobile in basso) / tab in alto (desktop) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); display: grid; grid-auto-flow: column; background: var(--surface); border-top: 1px solid var(--line-soft); padding-bottom: env(safe-area-inset-bottom); }
.tabbar__item { display: grid; justify-items: center; gap: 2px; padding: var(--sp-2) 0 var(--sp-2); min-height: 3.5rem; color: var(--ink-3); text-decoration: none; font-size: var(--fs-0); font-weight: var(--w-medium); border: 0; background: none; cursor: pointer; }
.tabbar__item svg { width: 1.5rem; height: 1.5rem; }
.tabbar__item.is-active { color: var(--ink); font-weight: var(--w-bold); }
.tabbar__item.is-active svg { color: var(--cta); }
.has-tabbar { padding-bottom: 4.5rem; }
@media (min-width: 48em) {
  .tabbar { position: static; grid-auto-flow: column; justify-content: start; gap: var(--sp-2); border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0; }
  .tabbar__item { grid-auto-flow: column; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3); min-height: 0; font-size: var(--fs-2); border-bottom: 3px solid transparent; }
  .tabbar__item.is-active { border-bottom-color: var(--cta); color: var(--ink); }
  .tabbar__item svg { width: 1.15rem; height: 1.15rem; }
  .has-tabbar { padding-bottom: 0; }
}

/* ---------- header sito ---------- */
.header { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.header__in { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: 3.5rem; }
.header__logo { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: var(--w-bold); font-size: var(--fs-3); color: var(--brand); text-decoration: none; font-family: var(--font-head); }
.header__nav { display: flex; gap: var(--sp-4); align-items: center; }
.header__nav a { color: var(--ink-2); text-decoration: none; font-weight: var(--w-medium); }
.header__nav a:hover { color: var(--ink); }
.header__nav .hide-sm { display: none; }
@media (min-width: 48em) { .header__nav .hide-sm { display: inline; } }

/* ---------- stati vuoti, skeleton, toast, fab ---------- */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); border: 1.5px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-2); }
.empty__title { font-weight: var(--w-bold); color: var(--ink); margin: 0 0 var(--sp-2); }
.skeleton { display: block; height: 1em; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
/* gli avvisi stanno SOPRA il bottone fisso: alla stessa altezza lo coprivano e si prendevano il tocco (16/09) */
.toasts { position: fixed; left: var(--sp-4); right: var(--sp-4); bottom: calc(var(--sp-4) + 4rem + var(--tap) + var(--sp-2)); z-index: var(--z-toast); display: grid; gap: var(--sp-2); pointer-events: none; }
.toast { pointer-events: auto; margin: 0 auto; max-width: 30rem; padding: var(--sp-3) var(--sp-5); border-radius: var(--r-lg); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: var(--fs-1); }
.toast--ok { background: var(--ok); color: #fff; }
.toast--warn { background: var(--warn); color: #fff; }
.fab { position: fixed; right: var(--sp-4); bottom: calc(var(--sp-4) + 4rem); z-index: var(--z-sticky); min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--r-pill); background: var(--ink); color: var(--bg); border: 0; font-weight: var(--w-bold); box-shadow: var(--shadow-2); display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
@media (min-width: 48em) { .fab { bottom: var(--sp-5); } .toasts { bottom: calc(var(--sp-5) + var(--tap) + var(--sp-2)); } }
/* con una scheda aperta il bottone fisso sta sotto al modale del browser: si vede ma non si puo' toccare, quindi
   si nasconde. Si guarda direttamente il dialogo aperto: l'evento «close» in certi browser non arriva (16/09) */
body:has(dialog.sheet[open]) .fab { display: none; }

/* ---------- blocco oscurato (anteprima pubblica) ---------- */
.locked { position: relative; border: 1px solid var(--line-card); background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.locked__list { filter: blur(5px); user-select: none; pointer-events: none; padding: var(--sp-4); opacity: .85; }
.locked__box { position: relative; margin: calc(-1 * var(--sp-6)) var(--sp-4) var(--sp-4); background: var(--surface); border: 1.5px solid var(--cta); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-2); }
.locked__what { display: grid; gap: var(--sp-1); margin: 0 0 var(--sp-4); padding: 0; list-style: none; font-size: var(--fs-1); color: var(--ink-2); }
.locked__what li::before { content: "✓ "; color: var(--ok); font-weight: var(--w-bold); }

/* ---------- checklist attivazione ---------- */
.todo { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.todo__item { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-card); border-radius: var(--r-lg); background: var(--surface); }
.todo__item.is-done { color: var(--ink-3); text-decoration: line-through; }
.todo__mark { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: .8rem; }
.todo__item.is-done .todo__mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.todo__item .btn { margin-left: auto; }

/* ---------- utilità ---------- */
.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* «La tua azienda» nella prova (05/10/2026; in ui.css dal 15/10 per le pagine generate): le proposte dall'archivio ANAC sotto il campo */
.ac { position: relative; }
.ac__in { width: 100%; }
.ac__lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  max-height: 18rem; overflow-y: auto; }
.ac__lista li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; cursor: pointer; }
.ac__lista li:hover { background: var(--accent); }
.ac__lista li strong { font-weight: 600; overflow-wrap: break-word; }
.ac__lista li span { font-size: .85rem; color: var(--ink-2); }
.ac__lista li.ac__altro { border-top: 1px solid var(--line); }
.ac__lista li.ac__altro strong { font-weight: 500; }
