:root {
  --sfondo: #f6f5f1;
  --scheda: #ffffff;
  --inchiostro: #1d1f1e;
  --tenue: #5d6360;
  --linea: #e1dfd8;
  --accento: #2b6f7c;
  --accento-testo: #ffffff;
  --accento-tenue: #e3eff1;
  --ok-sfondo: #e5f1e8;
  --ok-testo: #1d4d2c;
  --errore-sfondo: #fbe8e5;
  --errore-testo: #7a2418;
  --avviso-sfondo: #fdf3dc;
  --avviso-testo: #6b4a05;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sfondo: #151716;
    --scheda: #1e2120;
    --inchiostro: #ecebe7;
    --tenue: #a4a9a6;
    --linea: #303432;
    --accento: #6fc1cf;
    --accento-testo: #0e1a1c;
    --accento-tenue: #1f3236;
    --ok-sfondo: #1b3324;
    --ok-testo: #bfe5c9;
    --errore-sfondo: #3a1f1b;
    --errore-testo: #f4c3bb;
    --avviso-sfondo: #3a2f14;
    --avviso-testo: #f3dc9f;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--sfondo);
  color: var(--inchiostro);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pagina {
  max-width: 34rem;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.testata {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--linea);
  margin-bottom: 8px;
}

.marchio {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--accento);
  text-decoration: none;
}

.codice-testata {
  color: var(--tenue);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 22px 0 14px;
  font-weight: 650;
}

p { margin: 0 0 14px; }

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

.tenue { color: var(--tenue); }

.etichetta-piccola {
  margin: 22px 0 0;
  color: var(--tenue);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.codice-grande {
  font-size: 60px;
  line-height: 1;
  margin: 4px 0 10px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* Passi per il cliente */
.passi {
  list-style: none;
  counter-reset: passo;
  padding: 0;
  margin: 0 0 18px;
}

.passi li {
  counter-increment: passo;
  position: relative;
  padding: 14px 16px 14px 60px;
  margin-bottom: 10px;
  background: var(--scheda);
  border: 1px solid var(--linea);
  border-radius: 14px;
}

.passi li::before {
  content: counter(passo);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accento-tenue);
  color: var(--accento);
  font-weight: 700;
  font-size: 16px;
  line-height: 30px;
  text-align: center;
}

.storia {
  color: var(--tenue);
  min-height: 1.55em;
}

.contatto {
  padding-top: 14px;
  border-top: 1px solid var(--linea);
}

/* Operatore */
.scheda {
  background: var(--scheda);
  border: 1px solid var(--linea);
  border-radius: 16px;
  padding: 18px 16px;
  margin: 16px 0 18px;
}

label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  margin: 0 0 16px;
  font: inherit;
  color: var(--inchiostro);
  background: var(--sfondo);
  border: 1px solid var(--linea);
  border-radius: 10px;
}

input[type="text"]:focus {
  outline: 3px solid color-mix(in srgb, var(--accento) 35%, transparent);
  border-color: var(--accento);
}

.pulsanti { display: grid; gap: 10px; }

.pulsanti-affiancati {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pulsante {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 650;
  color: var(--accento-testo);
  background: var(--accento);
  border: 1px solid var(--accento);
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.pulsante.secondario {
  color: var(--accento);
  background: transparent;
}

.pulsante:disabled { opacity: 0.5; cursor: progress; }

.pulsante:focus-visible, .link:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accento) 45%, transparent);
  outline-offset: 2px;
}

.conferma {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--avviso-sfondo);
  color: var(--avviso-testo);
}

.esito {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 550;
}

.esito.ok { background: var(--ok-sfondo); color: var(--ok-testo); }
.esito.errore { background: var(--errore-sfondo); color: var(--errore-testo); }

.collegamenti { margin: 0 0 10px; font-size: 15px; }

.link {
  padding: 0;
  font: inherit;
  color: var(--tenue);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* Home */
.riga-codice {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.riga-codice input[type="text"] {
  margin: 0;
  height: 54px;
  text-transform: uppercase;
  font-size: 22px;
  letter-spacing: 0.06em;
}

.riga-codice .pulsante { width: auto; padding: 12px 22px; }

.nascosto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.piede {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--linea);
  color: var(--tenue);
  font-size: 14px;
}

.piede p { margin-bottom: 6px; }
