:root {
    --blu: #00338D;
    --blu-scuro: #00205b;
    --oro: #EBB700;
    --carta: #f6f7fb;
    --testo: #1d2433;
    --grigio: #5b6475;
    --bordo: #dfe3ec;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--carta); color: var(--testo); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--blu); text-underline-offset: .2em; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { color: var(--blu-scuro); line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); margin: .2em 0 .6em; letter-spacing: -.025em; }
h2 { font-size: 1.45rem; margin: 1.4em 0 .6em; }
h3 { font-size: 1.15rem; }
p { margin: .6em 0 1em; }
:focus-visible { outline: 3px solid var(--blu); outline-offset: 4px; }
.eroe :focus-visible, .piede :focus-visible { outline-color: var(--oro); }
.salta-contenuto { position: absolute; top: -120px; left: 16px; z-index: 30; padding: 12px 18px; color: var(--blu-scuro); background: var(--oro); font-weight: 700; }
.salta-contenuto:focus { top: 12px; }
.striscia-bozza { padding: 8px 16px; background: #b00020; color: #fff; text-align: center; font-size: .82rem; font-weight: 650; letter-spacing: .02em; }
.testata { background: #fff; border-bottom: 4px solid var(--oro); }
.testata-interno { max-width: 1160px; margin: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }
.marchio { display: flex; align-items: center; gap: 12px; color: var(--blu-scuro); text-decoration: none; min-width: 0; }
.marchio img { height: 44px; width: auto; flex: 0 0 auto; }
.marchio span { display: flex; flex-direction: column; gap: 4px; line-height: 1.25; }
.marchio strong { font-size: 1.3rem; letter-spacing: -.02em; }
.marchio small { color: var(--grigio); font-size: .72rem; max-width: 260px; }
.menu { width: 100%; }
.menu ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.menu form { margin: 0; }
.menu a, .menu button { display: flex; align-items: center; min-height: 44px; padding: 9px 12px; border: 0; border-radius: 6px; color: var(--blu-scuro); background: transparent; font: inherit; font-size: .88rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--carta); }
main.pagina { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 16px 56px; min-width: 0; }
.eroe { padding: 32px 22px; margin-bottom: 24px; border-radius: 12px; background: linear-gradient(135deg, var(--blu), var(--blu-scuro)); color: #fff; }
.eroe .dentro { max-width: 960px; margin: auto; }
.eroe h1, .eroe h2, .eroe h3 { color: #fff; }
.eroe p { max-width: 720px; font-size: 1.08rem; }
.eroe .claim { font-size: .8rem; color: var(--oro); font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.eroe .saluto { color: var(--oro); font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
.eroe .passi { color: #fff; padding-left: 1.6em; max-width: 720px; }
.eroe .passi li { padding-left: .3em; margin: .7em 0; overflow-wrap: anywhere; }
.eroe .passi li::marker { color: var(--oro); font-weight: 750; }
.chi-sei { background: var(--carta); border-left: 4px solid var(--oro); padding: 16px; margin: 0 0 22px; overflow-wrap: anywhere; }
.chi-sei h2 { margin-top: 0; }
.esci-link { display: inline-block; min-height: 44px; padding: 8px 0; border: 0; background: transparent; color: var(--blu); font: inherit; text-align: left; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.esci-link:hover { text-decoration-thickness: 2px; }
.lead { font-size: 1.15rem; }
.piccolo, .aiuto, .etichetta { color: var(--grigio); font-size: .85rem; }
.etichetta { display: block; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; }
.azioni { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 2px solid transparent; border-radius: 6px; background: var(--oro); color: var(--blu-scuro); font: inherit; font-size: 1rem; font-weight: 750; line-height: 1.35; text-decoration: none; text-align: center; cursor: pointer; }
.bottone:hover { background: #f6c522; }
.bottone.secondario { border-color: var(--blu); background: #fff; color: var(--blu); }
.bottone.secondario:hover { background: #eef3ff; }
.bottone.pericolo { background: #b00020; color: #fff; }
.bottone.pericolo:hover { background: #89001a; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
.griglia, .due-colonne, .form-griglia { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.scheda { min-width: 0; margin-bottom: 22px; padding: 22px; border: 1px solid var(--bordo); border-top: 4px solid var(--blu); border-radius: 8px; background: #fff; box-shadow: 0 4px 18px rgb(0 32 91 / 4%); }
.griglia > .scheda { margin-bottom: 0; }
.scheda.oro { border-top-color: var(--oro); }
.scheda > h2:first-child, .scheda > h3:first-child { margin-top: 0; }
form { margin: 0; }
fieldset { min-width: 0; margin: 0 0 20px; padding: 16px; border: 1px solid var(--bordo); border-radius: 6px; }
legend { padding: 0 6px; font-weight: 700; color: var(--blu-scuro); }
.campo { margin-bottom: 18px; min-width: 0; }
label { display: block; margin-bottom: 6px; font-size: .95rem; font-weight: 650; }
input, select, textarea { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #a9b3c4; border-radius: 5px; background: #fff; color: var(--testo); font: inherit; font-size: 16px; line-height: 1.5; }
label > input, label > select, label > textarea { margin-top: 6px; }
/* Luoghi suggeriti: la lista segue il campo senza spostare gli altri controlli. */
.campo-luoghi { position: relative; }
.luoghi-lista { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: 4px 0 0; padding: 0; list-style: none; border: 1px solid var(--bordo); border-radius: 6px; background: #fff; box-shadow: 0 4px 18px rgb(0 32 91 / 12%); max-height: 320px; max-height: min(320px, 50vh); overflow-y: auto; overscroll-behavior: contain; }
.luoghi-lista [role="option"] { min-height: 44px; padding: 10px 12px; font-size: 16px; font-weight: 400; cursor: pointer; overflow-wrap: anywhere; border-bottom: 1px solid var(--bordo); }
.luoghi-lista [role="option"]:last-child { border-bottom: 0; }
.luoghi-lista [role="option"]:hover, .luoghi-lista [aria-selected="true"] { background: var(--carta); box-shadow: inset 4px 0 var(--blu); }
.luoghi-nome, .luoghi-indirizzo { display: block; }
.luoghi-nome { color: var(--blu-scuro); font-weight: 700; }
.luoghi-indirizzo { color: var(--grigio); }
.luoghi-lista .luoghi-fonte { margin-top: 4px; white-space: normal; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
input[type="hidden"] { display: none; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 22px; min-height: 22px; height: 22px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--blu); }
label:has(input[type="checkbox"]), label:has(input[type="radio"]), .scelta { display: flex; align-items: center; min-height: 44px; gap: 6px; font-weight: 500; }
input[type="checkbox"], input[type="radio"] { flex-shrink: 0; }
input[type="file"] { padding: 8px; overflow: hidden; }
textarea { min-height: 130px; resize: vertical; }
[aria-invalid="true"] { border: 2px solid #b00020; }
.tabella-scorre { width: 100%; overflow-x: auto; border: 1px solid var(--bordo); border-radius: 6px; background: #fff; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabella-scorre table { min-width: 640px; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--bordo); }
th { color: var(--blu-scuro); background: #edf1f8; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
caption { padding: 12px 14px; text-align: left; font-weight: 700; }
.contatori { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.contatori > * { padding: 18px 14px; border: 1px solid var(--bordo); border-radius: 8px; background: #fff; color: var(--grigio); font-size: .85rem; overflow-wrap: anywhere; }
.contatori strong, .contatori b, .contatori .numero { display: block; margin-bottom: 6px; color: var(--blu); font-size: 2.3rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge.si { color: #175630; background: #e3f4e9; }
.badge.no { color: #91001a; background: #fde6eb; }
.badge.forse { color: #684c00; background: #fff3c5; }
.badge.nessuna { color: #465165; background: #edf0f5; }
.avviso { padding: 14px 18px; margin: 0 0 20px; border: 1px solid #b6cbed; border-left: 4px solid var(--blu); border-radius: 6px; background: #edf4ff; color: var(--blu-scuro); overflow-wrap: anywhere; }
.avviso.errore { border-color: #e8a4b1; border-left-color: #b00020; background: #fff0f3; color: #8a0019; }
.avviso.ok { border-color: #9dcead; border-left-color: #23703d; background: #edf8f0; color: #19542e; }
pre { max-width: 100%; overflow-x: auto; padding: 16px; border-radius: 6px; background: #edf1f8; font-size: .85rem; }
iframe { width: 100%; min-height: 480px; border: 1px solid var(--bordo); background: #fff; }
.piede { background: var(--blu-scuro); color: #dfe6f5; font-size: .88rem; }
.piede-interno { max-width: 1120px; margin: auto; padding: 22px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.piede a { display: inline-flex; align-items: center; min-height: 44px; color: #fff; }
@media (min-width: 700px) {
    .testata-interno { padding: 20px 24px; }
    main.pagina { padding: 36px 24px 72px; }
    .eroe { padding: 48px 36px; }
    .griglia, .due-colonne, .form-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-griglia .intera { grid-column: 1 / -1; }
    .contatori { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .piede-interno { padding: 24px; }
}
@media (min-width: 1040px) {
    .menu { width: auto; }
    .contatori { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media print {
    body { display: block; background: #fff; color: #000; font-size: 11pt; }
    .menu, .salta-contenuto, .azioni, .piede { display: none; }
    main.pagina { max-width: none; padding: 20px 0; }
    .scheda { box-shadow: none; }
    .tabella-scorre { overflow: visible; }
    .tabella-scorre table { min-width: 0; }
    th, td { padding: 6px; overflow-wrap: anywhere; }
}

/* Giro 2: elenco autorità leggibile, legenda, coda, WhatsApp, lista per l'ingresso */
.elenco-autorita { margin: 4px 0 14px 30px; padding: 0; list-style: disc; color: var(--testo); font-size: 1rem; }
.elenco-autorita li { margin: 2px 0; text-transform: none; letter-spacing: normal; font-weight: 400; }
.legenda { margin: 0 0 18px; background: var(--carta); border-radius: 6px; padding: 10px 14px; }
.legenda summary { cursor: pointer; font-weight: 650; color: var(--blu-scuro); min-height: 32px; }
.legenda code { background: #fff; border: 1px solid var(--bordo); border-radius: 4px; padding: 0 4px; }
.contatori.piccoli strong { font-size: 1.4rem; }
.nota-piccola { color: var(--grigio); font-size: .88rem; }
.consenso { align-items: flex-start; font-size: .92rem; line-height: 1.4; }
.consenso input { margin-top: 4px; }
.bottone.whatsapp { background: #25D366; color: #08301a; font-size: .85rem; padding: 8px 12px; margin: 0; white-space: nowrap; }
.tabella-ingresso { width: 100%; border-collapse: collapse; }
.tabella-ingresso th, .tabella-ingresso td { border-bottom: 1px solid var(--bordo); padding: 10px 8px; text-align: left; vertical-align: top; }
.tabella-ingresso .spunta { width: 2.2em; text-align: center; font-size: 1.2rem; }

@media print {
  .striscia-bozza, .testata, .piede, .non-stampare, .azioni { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main.pagina { max-width: none; padding: 0; }
  .lista-ingresso h1 { font-size: 16pt; margin: 0 0 4pt; }
  .tabella-ingresso th, .tabella-ingresso td { border-bottom: 1px solid #999; padding: 4pt 6pt; }
  .tabella-ingresso tr { page-break-inside: avoid; }
}

/* Giro 4: link «?» alla guida, riquadro del mittente, anteprima viva */
.aiuto-guida { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--carta); border: 1px solid var(--bordo); color: var(--blu); font-size: .9rem; font-weight: 700; text-decoration: none; vertical-align: middle; margin-left: 6px; }
.aiuto-guida:hover { background: var(--oro); color: var(--blu-scuro); }
.riquadro-mittente { border-top-color: var(--oro); }
.riquadro-mittente .in-uso { background: var(--carta); border-radius: 6px; padding: 10px 12px; }
.riquadro-mittente .strada { border-left: 4px solid var(--bordo); padding: 2px 0 2px 12px; margin: 12px 0; }
.riquadro-mittente h4 { margin: 0 0 4px; color: var(--blu-scuro); }
.riquadro-mittente button[disabled] { opacity: .6; cursor: not-allowed; }
.anteprima-viva { background: #fffdf3; border: 1px dashed var(--oro); border-radius: 6px; padding: 12px 14px; margin: 0 0 18px; }
.anteprima-testo { white-space: pre-wrap; font-size: .95rem; }
[hidden] { display: none !important; }

/* Guida d'uso: indice laterale fisso su desktop, in alto su telefono */
.guida { display: block; }
.guida-indice { background: var(--carta); border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; }
.guida-indice h2 { margin: 0 0 6px; font-size: 1.05rem; }
.guida-indice ol { margin: 0; padding-left: 1.3em; }
.guida-indice a { display: inline-block; padding: 6px 0; }
.guida section { scroll-margin-top: 90px; margin-bottom: 32px; }
.guida ol.passi { list-style: none; counter-reset: passo; padding: 0; }
.guida ol.passi > li { counter-increment: passo; position: relative; padding: 4px 0 14px 56px; min-height: 44px; }
.guida ol.passi > li::before { content: counter(passo); position: absolute; left: 0; top: 0; width: 42px; height: 42px; border-radius: 50%;
  background: var(--blu); color: #fff; font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.guida figure { margin: 14px 0; }
.guida figure img { border: 1px solid var(--bordo); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.guida figcaption { font-size: .88rem; color: var(--grigio); margin-top: 6px; }
.guida aside.attenzione { background: #fff8dc; border-left: 5px solid var(--oro); padding: 10px 14px; border-radius: 4px; margin: 14px 0; }
.guida aside.consiglio { background: #eaf1fd; border-left: 5px solid var(--blu); padding: 10px 14px; border-radius: 4px; margin: 14px 0; }
.guida aside.attenzione::before { content: 'Attenzione · '; font-weight: 700; color: #5c4500; }
.guida aside.consiglio::before { content: 'Consiglio · '; font-weight: 700; color: var(--blu-scuro); }
@media (min-width: 960px) {
  main.pagina:has(.guida) { max-width: 1120px; }
  .guida { display: grid; grid-template-columns: 250px 1fr; gap: 32px; align-items: start; }
  .guida-indice { position: sticky; top: 90px; }
}
@media print {
  .guida { display: block; }
  .guida-indice { position: static; border: 1px solid #999; }
  .guida section { page-break-inside: avoid; }
  .guida ol.passi > li::before { background: #fff; color: #000; border: 2px solid #000; }
  .aiuto-guida { display: none; }
}

/* «Aggiungi ospiti a mano» */
.ospiti-a-mano { border-top: 1px solid var(--bordo); margin-top: 18px; padding-top: 8px; }
.riga-ospite { border: 1px solid var(--bordo); border-radius: 6px; padding: 8px 12px 0; margin: 0 0 12px; }
.riga-ospite legend { font-weight: 650; color: var(--blu-scuro); padding: 0 4px; }
.riga-ospite.con-errore { border-color: #b00020; background: #fff6f7; }
/* La tua casella (profilo): bottoni affiancati, inviti fermi leggibili. */
.riquadro-casella form { display: inline-block; margin: 4px 8px 4px 0; }
.inviti-fermi li { margin-bottom: 10px; }
.in-riga { display: inline; margin-left: .5em; }
/* Home: schede evento compatte, tipo in evidenza, ordinamento (19/11/2026) */
.griglia-eventi { gap: 14px; }
.evento-card { padding: 14px 16px; font-size: .95rem; }
.evento-card h2 { margin: 4px 0 6px; font-size: 1.15rem; line-height: 1.3; }
.evento-card p { margin: 0 0 8px; }
.tipo-evento { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tipo-pillola { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eef3ff; color: var(--blu-scuro); font-weight: 700; font-size: .85rem; }
.tipo-evento .chi { color: #555; font-size: .85rem; }
.contatori-evento { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; }
.azioni-evento { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.azioni-evento .bottone { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.azioni-evento form { display: inline; }
.ordina-eventi { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.ordina-eventi select { min-height: 40px; }
@media (min-width: 1000px) { .griglia-eventi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
