/* Design system LL Italia — variabili comuni a shell e moduli */
:root {
  /* Palette dal logo ufficiale LL Italia: blu #1d3583, tricolore #01963f / #e40513 */
  --blu: #1d3583;
  --blu-scuro: #14265e;
  --verde: #01963f;
  --sfondo: #f2f4f7;
  --carta: #ffffff;
  --testo: #16212c;
  --testo-tenue: #55636f;
  --bordo: #d5dce2;
  --ok: #01963f;
  --errore: #e40513;
  --attesa: #a05e00;
  --info: #1d3583;
  --raggio: 14px;
  --tocco: 56px;           /* altezza minima dei target di tocco */
  --ombra: 0 1px 3px rgba(16, 28, 66, 0.12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--testo);
  background: var(--sfondo);
  min-height: 100vh;
}

/* Testata della shell */
.testata {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--blu);
  color: #fff;
  box-shadow: var(--ombra);
}

.testata-riga {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tocco);
  padding: env(safe-area-inset-top) 12px 0 12px;
}

/* Banda tricolore del logo, sotto la testata */
.testata-tricolore {
  height: 4px;
  background: linear-gradient(to right,
    #01963f 0 33.4%, #ffffff 33.4% 66.7%, #e40513 66.7% 100%);
}

.marchio {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  flex: none;
}

.marchio img { width: 100%; height: 100%; display: block; }

.titolo-app {
  flex: 1;
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ingranaggio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #fff;
  text-decoration: none;
  font-size: 1.5rem;
}

/* Contenitore delle viste */
.vista {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 12px calc(32px + env(safe-area-inset-bottom));
}

.scheda {
  background: var(--carta);
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  padding: 16px;
  margin-bottom: 16px;
}

.scheda h2 { margin: 0 0 8px; font-size: 1.25rem; }
.scheda p { margin: 8px 0; }
.tenue { color: var(--testo-tenue); font-size: 0.95rem; }

/* Pulsanti: grandi, ad alto contrasto */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tocco);
  padding: 12px 16px;
  border: none;
  border-radius: var(--raggio);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primario { background: var(--blu); color: #fff; }
.btn-successo { background: var(--verde); color: #fff; }
.btn-secondario { background: var(--carta); color: var(--blu); border: 2px solid var(--blu); }
.btn-piccolo { min-height: 44px; font-size: 1rem; width: auto; padding: 8px 14px; }

/* Campi modulo */
.campo { margin: 14px 0; }
.campo label { display: block; font-weight: 700; margin-bottom: 6px; }

.campo input,
.campo select,
.campo textarea {
  width: 100%;
  min-height: var(--tocco);
  padding: 12px;
  border: 2px solid var(--bordo);
  border-radius: var(--raggio);
  font: inherit;
  font-size: 1.1rem;
  background: #fff;
  color: var(--testo);
}

.campo textarea { min-height: 90px; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none;
  border-color: var(--blu);
}
.campo .aiuto { margin-top: 4px; }

/* Interruttore (checkbox grande) */
.campo-interruttore {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tocco);
  font-weight: 700;
}
.campo-interruttore input { width: 28px; height: 28px; flex: none; }

/* Tessere dei moduli in home */
.griglia-moduli { display: grid; grid-template-columns: 1fr; gap: 12px; }

.tessera {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--carta);
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  padding: 18px 16px;
  min-height: 84px;
  text-decoration: none;
  color: var(--testo);
}

.tessera .icona { font-size: 2.2rem; }
.tessera .nome { font-size: 1.2rem; font-weight: 800; margin: 0; }
.tessera .descrizione { margin: 2px 0 0; color: var(--testo-tenue); font-size: 0.95rem; }

/* Badge di stato */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.badge-coda { background: var(--info); }
.badge-invio { background: var(--attesa); }
.badge-inviata { background: var(--ok); }
.badge-errore { background: var(--errore); }

/* Avvisi */
.avviso {
  border-radius: var(--raggio);
  padding: 12px 14px;
  margin: 12px 0;
  font-weight: 600;
}
.avviso-info { background: #e8ecf7; color: var(--info); }
.avviso-errore { background: #fdeaea; color: #b3040f; }
.avviso-attenzione { background: #fdf3e0; color: var(--attesa); }

.avviso-noscript { padding: 24px; text-align: center; }

.nascosto { display: none !important; }

/* Avviso di aggiornamento: sempre visibile, non copre i comandi principali */
.barra-aggiornamento {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--blu);
  color: #fff;
  border-radius: var(--raggio);
  box-shadow: 0 4px 14px rgba(16, 28, 66, 0.3);
  padding: 12px 14px;
}

.barra-aggiornamento span { flex: 1; font-weight: 600; }

.barra-aggiornamento button {
  flex: none;
  min-height: 44px;
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--blu);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Elenco della pagina Informazioni */
.info-elenco { margin: 0 0 16px; }
.info-elenco dt {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--testo-tenue);
  margin-top: 12px;
}
.info-elenco dd { margin: 2px 0 0; }

/* Il numero per cui si telefona al supporto: deve saltare all'occhio, non
   annegare fra gli altri. */
.info-elenco dd.valore-errore { color: var(--errore); font-weight: 700; }

/* Coppia annulla/conferma per le azioni che non si tornano indietro */
.azioni-riga {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.azioni-riga .btn { flex: 1; }

/* Fotocamera dentro l'app: a tutto schermo, comandi grandi, pensata per essere
   usata con i guanti e con il sole negli occhi */
.senza-scorrimento { overflow: hidden; }

.fotocamera {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
}

.fotocamera-testata {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.85);
}

.fotocamera-chiudi {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.fotocamera-titolo { flex: 1 1 auto; font-weight: 700; }

.fotocamera-conta {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--blu);
  font-weight: 700;
  font-size: 0.9rem;
}

.fotocamera-conta:empty { background: none; }

.fotocamera-video {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  object-fit: cover;
  background: #000;
}

.fotocamera-suggerimento {
  margin: 0;
  padding: 8px 14px 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.fotocamera-suggerimento:empty { padding: 0; }

.fotocamera-rullino {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 12px 0;
  min-height: 0;
}

.fotocamera-rullino img {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.fotocamera-rullino:empty { padding: 0; }

.fotocamera-comandi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
}

.fotocamera-scatta {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border: 4px solid #fff;
  border-radius: 50%;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.fotocamera-scatta span {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
}

.fotocamera-scatta:disabled span { background: rgba(255, 255, 255, 0.5); }

.fotocamera-fine { flex: 1 1 auto; }

.fotocamera-avviso {
  margin: 0;
  padding: 6px 14px 0;
  color: #ffd9d0;
  font-size: 0.9rem;
  text-align: center;
}

.fotocamera-avviso:empty { padding: 0; }

/* Riquadro del QR di configurazione. Vive qui e non in un modulo perché il
   meccanismo è della shell: lo usano tutti i moduli che si configurano da
   link. */
.qr-configurazione {
  background: #fff;
  border: 1px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 10px;
  margin: 14px 0;
  text-align: center;
}

.qr-configurazione svg { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto; }
