/* =========================================================
   ContaPasti — stile
   Idea: il tavolo (sfondo) e la ricevuta (il dato che conta).
   Colori con un significato solo: blu penna = azione,
   verde/giallo/rosso = budget, arancione = coperti da inserire.
   ========================================================= */

:root {
  --tavolo: #E4E7EA;
  --carta: #FFFFFF;
  --inchiostro: #1B2230;
  --inchiostro-2: #596273;
  --filo: #D3D8DE;
  --biro: #2743C9;
  --biro-testo: #FFFFFF;
  --verde: #1C7C46;
  --giallo: #A07600;
  --rosso: #C4332A;
  --arancio: #D95B08;
  --arancio-fondo: #FFF0E3;
  --ombra-ricevuta: rgba(27, 34, 48, .10);

  --font: 'Titillium Web', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-cifre: 'Doto', 'Courier New', ui-monospace, monospace;

  --nav-h: 66px;
  --margine: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tavolo: #151A21;
    --carta: #212833;
    --inchiostro: #E6E9ED;
    --inchiostro-2: #9BA4B1;
    --filo: #323B48;
    --biro: #8098FF;
    --biro-testo: #0F1530;
    --verde: #45C281;
    --giallo: #E5BE45;
    --rosso: #FF7066;
    --arancio: #FF9147;
    --arancio-fondo: #3A2616;
    --ombra-ricevuta: rgba(0, 0, 0, .35);
  }
}

.sem-verde  { --sem: var(--verde); }
.sem-giallo { --sem: var(--giallo); }
.sem-rosso  { --sem: var(--rosso); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--tavolo);
  color: var(--inchiostro);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { line-height: 1.15; }

a { color: var(--biro); }

:focus-visible {
  outline: 2px solid var(--biro);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cifra { font-variant-numeric: tabular-nums; }

/* ---------- Impaginazione ---------- */

.vista {
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 18px)
    var(--margine)
    calc(var(--nav-h) + env(safe-area-inset-bottom) + 36px);
  outline: none;
}

body.in-form .vista {
  padding-bottom: calc(env(safe-area-inset-bottom) + 112px);
}

.caricamento {
  color: var(--inchiostro-2);
  padding: 32px 0;
}

.sezione { margin: 0 0 30px; }

.sezione > h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 10px;
}

/* ---------- Testata evento ---------- */

.testata { margin: 0 0 14px; }

.testata-riga {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.testata h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.testata p { margin: 2px 0 0; color: var(--inchiostro-2); }

.testata .stato-evento { color: var(--inchiostro); font-weight: 600; }

.btn-icona {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px -8px 0 0;
  border-radius: 50%;
  color: var(--biro);
}

/* ---------- La ricevuta: l'elemento che conta ---------- */

.ricevuta {
  position: relative;
  margin: 0 0 34px;
  padding: 18px 20px 20px;
  background: var(--carta);
  border-radius: 3px 3px 0 0;
  filter: drop-shadow(0 1px 1px var(--ombra-ricevuta)) drop-shadow(0 10px 18px var(--ombra-ricevuta));
}

/* Bordo a dentelli, come lo strappo di uno scontrino */
.ricevuta::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 9px;
  background: var(--carta);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M0 0h14L7 9z'/%3E%3C/svg%3E") repeat-x 0 0 / 14px 9px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M0 0h14L7 9z'/%3E%3C/svg%3E") repeat-x 0 0 / 14px 9px;
}

.ricevuta-testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.ricevuta-etichetta {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--inchiostro-2);
}

.ricevuta-cifra {
  margin: 4px 0 14px;
  font-family: var(--font-cifre);
  font-weight: 900;
  font-size: clamp(3.1rem, 16.5vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ricevuta-cifra.vuota { color: var(--inchiostro-2); }

/* Timbro del budget */
.timbro {
  flex-shrink: 0;
  padding: 1px 10px 2px;
  border: 2px solid var(--sem);
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--carta), inset 0 0 0 3.5px var(--sem);
  color: var(--sem);
  font-size: 15px;
  font-weight: 700;
  transform: rotate(-7deg);
  white-space: nowrap;
}

/* Metro: livello della media rispetto al budget (la tacca è il budget) */
.metro {
  position: relative;
  height: 10px;
  margin: 0 0 8px;
  background: var(--tavolo);
  border-radius: 5px;
}

.metro-livello {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  background: var(--sem, var(--inchiostro-2));
}

.metro-tacca {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--inchiostro);
}

.ricevuta-riga {
  margin: 0;
  color: var(--inchiostro-2);
  font-size: 15px;
}

.ricevuta-riga strong { color: var(--inchiostro); font-weight: 600; }

.ricevuta-avviso {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--arancio-fondo);
  color: var(--arancio);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Calcolatore prossimo pasto ---------- */

.calcolo-testa {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.calcolo-testa h2 { margin: 0; font-size: 19px; white-space: nowrap; }

.persone {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--inchiostro-2);
  font-size: 15px;
}

.stepper {
  display: inline-grid;
  grid-template-columns: 44px 48px 44px;
  align-items: center;
  border: 1.5px solid var(--filo);
  border-radius: 999px;
  background: var(--carta);
}

.stepper button {
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--biro);
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.stepper button:disabled { color: var(--filo); cursor: default; }

.stepper output {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tetti {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  background: var(--filo);
  border: 1px solid var(--filo);
  border-radius: 12px;
  overflow: hidden;
}

.tetti > div { padding: 12px 14px 14px; background: var(--carta); }

.tetti dt { font-size: 14px; color: var(--inchiostro-2); }

.tetti dd {
  margin: 2px 0 0;
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calcolo-nota {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--inchiostro-2);
}

/* ---------- Ripartizione pranzi / cene / extra ---------- */

.ripartizione {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 30px;
  border-top: 1px solid var(--filo);
  border-bottom: 1px solid var(--filo);
}

.ripartizione > div { padding: 12px 10px 12px 14px; min-width: 0; }

.ripartizione > div + div { border-left: 1px solid var(--filo); }

.ripartizione > div:first-child { padding-left: 2px; }

.ripartizione span {
  display: block;
  font-size: 14px;
  color: var(--inchiostro-2);
}

.ripartizione strong {
  display: block;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sem, var(--inchiostro));
}

.ripartizione small {
  display: block;
  font-size: 13px;
  color: var(--inchiostro-2);
}

/* ---------- Giorno per giorno ---------- */

.giorno { margin: 0 0 18px; }

.giorno-testa {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 12px;
  padding: 0 2px 6px;
}

.giorno-testa h3 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; }

.giorno-sintesi {
  font-size: 15px;
  font-weight: 600;
  color: var(--sem, var(--inchiostro-2));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.giorno.vuoto .giorno-testa { padding-bottom: 0; }

.giorno-fuori {
  margin: -2px 2px 6px;
  font-size: 14px;
  color: var(--inchiostro-2);
}

.righe {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--carta);
  border-radius: 12px;
  overflow: hidden;
}

.righe li + li .riga { border-top: 1px solid var(--filo); }

.riga {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  color: inherit;
  text-decoration: none;
}

.riga:active { background: var(--tavolo); }

.riga.da-controllare {
  background: var(--arancio-fondo);
  box-shadow: inset 4px 0 0 var(--arancio);
}

.riga-ora {
  font-size: 14px;
  color: var(--inchiostro-2);
  font-variant-numeric: tabular-nums;
}

.riga-corpo { min-width: 0; }

.riga-titolo {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.riga-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--inchiostro-2);
}

.riga.da-controllare .riga-meta { color: var(--arancio); font-weight: 600; }

.riga-meta svg { flex-shrink: 0; }

.riga-cifre { text-align: right; }

.riga-importo {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.riga-pc {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--sem, var(--inchiostro-2));
  font-variant-numeric: tabular-nums;
}

/* ---------- Elenco eventi ---------- */

.lista-eventi {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  background: var(--carta);
  border-radius: 12px;
  overflow: hidden;
}

.lista-eventi li + li a { border-top: 1px solid var(--filo); }

.lista-eventi a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.lista-eventi a:active { background: var(--tavolo); }

.ev-nome {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-meta, .ev-stato, .ev-conteggio { grid-column: 1; font-size: 14px; color: var(--inchiostro-2); }

.ev-stato.in-corso { color: var(--biro); font-weight: 600; }

.ev-media {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sem, var(--inchiostro-2));
}

.ev-media small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--inchiostro-2);
}

.piede {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  color: var(--inchiostro-2);
  font-size: 14px;
}

/* ---------- Stati vuoti ed errori ---------- */

.stato-vuoto { padding: 28px 2px; }

.stato-vuoto h1 { margin: 0 0 8px; font-size: 26px; }

.stato-vuoto p { margin: 0 0 20px; color: var(--inchiostro-2); max-width: 32em; }

/* ---------- Pulsanti ---------- */

.btn-primario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--biro);
  color: var(--biro-testo);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-primario:disabled { opacity: .55; cursor: progress; }

.btn-secondario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  white-space: nowrap;
  border: 1.5px solid var(--biro);
  border-radius: 10px;
  background: transparent;
  color: var(--biro);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondario:focus-within { outline: 2px solid var(--biro); outline-offset: 2px; }

.btn-testo {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--biro);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-pericolo {
  align-self: flex-start;
  margin-top: 8px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--rosso);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Moduli ---------- */

.barra-form {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
}

.barra-form h1 { margin: 0; font-size: 23px; }

.modulo {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.campo > span,
.campo > legend,
.campo-titolo {
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--inchiostro-2);
}

/* :where() tiene bassa la specificità, così i casi particolari sotto vincono senza forzature */
.campo :where(input:not([type="radio"]):not([type="file"]), select, textarea) {
  width: 100%;
  min-height: 50px;
  padding: 11px 12px;
  border: 1.5px solid var(--filo);
  border-radius: 10px;
  background: var(--carta);
  color: var(--inchiostro);
  font: inherit;
  font-size: 17px;
  -webkit-appearance: none;
          appearance: none;
}

.campo select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%23596273' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.campo textarea { resize: vertical; min-height: 72px; }

.campo :where(input, select, textarea):focus {
  border-color: var(--biro);
  outline: 2px solid var(--biro);
  outline-offset: 0;
}

.campo input[type="date"],
.campo input[type="time"] { min-width: 0; }

.campo-doppio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.con-valuta { position: relative; }

.campo .con-valuta input { padding-right: 38px; }

.con-valuta > span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--inchiostro-2);
  font-weight: 600;
  pointer-events: none;
}

.campo .con-valuta.grande input {
  min-height: 62px;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.con-valuta.grande > span { font-size: 22px; }

/* Controllo a segmenti: pranzo, cena, extra */
.segmenti {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--filo);
  border-radius: 12px;
  background: var(--carta);
}

.segmenti label { position: relative; }

.segmenti input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmenti span {
  display: block;
  padding: 10px 0;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
}

.segmenti input:checked + span { background: var(--inchiostro); color: var(--carta); }

.segmenti input:focus-visible + span { outline: 2px solid var(--biro); outline-offset: 1px; }

/* Coperti */
.coperti .stepper { width: max-content; grid-template-columns: 54px 76px 54px; }

.coperti .stepper button { height: 52px; font-size: 28px; }

.campo input.coperti-input {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.campo input.coperti-input:focus { outline: none; }

.coperti .stepper:focus-within { border-color: var(--biro); }

.coperti-nota {
  display: none;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--arancio);
}

.coperti.da-controllare .stepper {
  border-color: var(--arancio);
  background: var(--arancio-fondo);
}

.coperti.da-controllare .coperti-nota { display: block; }

.anteprima-pc:empty { display: none; }

.anteprima-pc {
  margin: -6px 0 0;
  min-height: 1.45em;
  font-weight: 600;
  color: var(--sem, var(--inchiostro-2));
  font-variant-numeric: tabular-nums;
}

.campo-nota {
  margin: -2px 0 0;
  font-size: 14px;
  color: var(--arancio);
  font-weight: 600;
}

/* Foto dello scontrino */
.foto { display: flex; flex-direction: column; gap: 10px; }

.foto-anteprima {
  display: flex;
  justify-content: center;
  max-height: 36vh;
  background: var(--carta);
  border-radius: 12px;
  overflow: hidden;
}

.foto-anteprima img {
  display: block;
  max-width: 100%;
  max-height: 36vh;
  object-fit: contain;
}

.foto-azioni {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.foto-azioni input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.foto .btn-testo { align-self: flex-start; padding: 2px 0; }

.errore-modulo {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rosso) 12%, var(--carta));
  color: var(--rosso);
  font-weight: 600;
}

/* Lettura automatica: pannello sotto la foto */
.lettura {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-left: 4px solid var(--biro);
  border-radius: 4px 12px 12px 4px;
  background: var(--carta);
}

.lettura.errore { border-left-color: var(--rosso); }

.lettura .btn-secondario { align-self: stretch; }

.lettura .btn-testo { padding: 2px 0; }

.lettura-stato { margin: 0; font-weight: 600; }

.lettura.errore .lettura-stato { color: var(--rosso); }

.lettura-nota { margin: 0; font-size: 15px; color: var(--inchiostro-2); }

.lettura-avvisi {
  margin: 0;
  padding-left: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--arancio);
}

/* Barra di attesa: scorre durante la lettura, ferma se il movimento è ridotto */
.lettura-barra {
  position: relative;
  align-self: stretch;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--filo);
}

.lettura-barra::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  border-radius: 2px;
  background: var(--biro);
  animation: lettura-scorre 1.3s ease-in-out infinite;
}

@keyframes lettura-scorre {
  from { left: -40%; }
  to   { left: 100%; }
}

/* Campi compilati dalla lettura: restano in blu finché non li tocchi */
.campo.letto :where(input, select, textarea) {
  border-color: var(--biro);
  background: color-mix(in srgb, var(--biro) 8%, var(--carta));
}

.coperti.letto .stepper {
  border-color: var(--biro);
  background: color-mix(in srgb, var(--biro) 8%, var(--carta));
}

/* Righe lette */
.righe-lette { align-self: stretch; }

.righe-lette summary {
  padding: 4px 0;
  color: var(--biro);
  font-weight: 600;
  cursor: pointer;
}

.righe-lette table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-size: 15px;
}

.righe-lette td {
  padding: 6px 4px;
  border-top: 1px solid var(--filo);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.righe-lette td.q {
  width: 2.6em;
  color: var(--inchiostro-2);
  font-variant-numeric: tabular-nums;
}

.righe-lette td.imp {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.righe-lette small {
  display: block;
  font-size: 13px;
  color: var(--inchiostro-2);
}

.righe-lette tr.riga-coperto td { color: var(--inchiostro-2); }

.righe-lette tfoot td { font-weight: 700; }

/* Pulsante di salvataggio sempre raggiungibile */
.azioni-form {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 12px var(--margine) calc(12px + env(safe-area-inset-bottom));
  background: var(--tavolo);
  border-top: 1px solid var(--filo);
}

.azioni-form .btn-primario {
  display: flex;
  width: 100%;
  max-width: 528px;
  margin: 0 auto;
}

/* ---------- Barra di navigazione ---------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 96px 1fr;
  align-items: end;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--carta);
  border-top: 1px solid var(--filo);
}

.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 0 10px;
  color: var(--inchiostro-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.nav a.attivo { color: var(--biro); }

.nav .nav-piu {
  justify-self: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin: -24px 0 8px;
  padding: 0;
  border-radius: 50%;
  background: var(--biro);
  color: var(--biro-testo);
  box-shadow: 0 0 0 5px var(--tavolo), 0 8px 18px color-mix(in srgb, var(--biro) 40%, transparent);
}

body.in-form .nav { display: none; }

/* ---------- Avviso temporaneo ---------- */

.avviso {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 22px);
  z-index: 20;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  text-align: center;
  border-radius: 999px;
  background: var(--inchiostro);
  color: var(--tavolo);
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.avviso.visibile { opacity: 1; transform: translate(-50%, 0); }

.avviso.errore { background: var(--rosso); color: #fff; }

/* ---------- Accesso ---------- */

body.accesso {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px var(--margine);
}

.accesso-box { width: min(100%, 380px); }

.accesso-ricevuta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 22px 24px;
}

.marchio {
  margin: 0;
  font-family: var(--font-cifre);
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.accesso-testo { margin: 0; color: var(--inchiostro-2); }

.accesso-ricevuta .btn-primario { width: 100%; margin-top: 4px; }

/* ---------- Movimento ridotto ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
