:root {
  --blu: #0B3D5C; --verde: #1A7F37; --rosso: #CF222E; --arancio: #D9480F;
  --azzurro: #0969DA; --grigio: #57606A; --sfondo: #F3F5F7; --bianco: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--sfondo); color: #1F2328; font-size: 17px; line-height: 1.35;
}
header {
  background: var(--blu); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
header a { color: #fff; text-decoration: none; }
header .titolo { font-weight: 700; font-size: 18px; }
header .utente { font-size: 13px; opacity: .85; }
header form { display: inline; }
header button { background: none; border: 1px solid #ffffff80; color: #fff; border-radius: 6px;
  padding: 4px 8px; font-size: 13px; }
main { padding: 16px; max-width: 560px; margin: 0 auto; }
h1 { font-size: 22px; margin: 4px 0 16px; }

#offline { display: none; background: var(--rosso); color: #fff; text-align: center;
  padding: 8px; font-weight: 600; }
body.offline #offline { display: block; }

.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.msg.success { background: #DAFBE1; color: #116329; }
.msg.error { background: #FFEBE9; color: #A40E26; }
.msg.warning { background: #FFF8C5; color: #7D4E00; }
.msg.info { background: #DDF4FF; color: #0A3069; }

.btn {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 18px 16px;
  font-size: 20px; font-weight: 700; text-align: center; text-decoration: none;
  color: #fff; background: var(--blu); margin-bottom: 12px; cursor: pointer;
}
.btn.grande { padding: 34px 16px; font-size: 26px; }
.btn.verde { background: var(--verde); }
.btn.rosso { background: var(--rosso); }
.btn.arancio { background: var(--arancio); }
.btn.azzurro { background: var(--azzurro); }
.btn.chiaro { background: #fff; color: var(--blu); border: 2px solid var(--blu); }
.btn:active { filter: brightness(.9); }

.scheda { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px #0000001a; }

/* esito scansione */
.esito { border-radius: 16px; padding: 18px; color: #fff; margin-bottom: 16px; text-align: center; }
.esito .stato { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.esito.verde { background: var(--verde); }
.esito.azzurro { background: var(--azzurro); }
.esito.rosso { background: var(--rosso); }
.persona { display: flex; gap: 14px; align-items: center; }
.persona img, .persona .nofoto { width: 96px; height: 126px; object-fit: cover; border-radius: 8px;
  background: #D0D7DE; flex: none; display: flex; align-items: center; justify-content: center;
  color: var(--grigio); font-size: 13px; }
.persona .nome { font-size: 22px; font-weight: 700; }
.persona .ditta { color: var(--grigio); font-weight: 600; }
.motivi { margin: 0; padding-left: 20px; font-size: 18px; }
.avvisi { background: #FFF8C5; color: #7D4E00; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* elenchi */
.riga { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid #D0D7DE; }
.riga:last-child { border-bottom: 0; }
.riga .ora { font-weight: 700; font-size: 20px; color: var(--blu); min-width: 58px; }
.riga .chi { flex: 1; }
.riga .sub { color: var(--grigio); font-size: 14px; }
.riga a.piccolo { background: var(--grigio); color: #fff; border-radius: 8px; padding: 8px 10px;
  text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px;
  color: #fff; background: var(--grigio); vertical-align: middle; }
.tag.visitatore { background: var(--arancio); }
.tag.emergenza { background: var(--rosso); }

/* moduli */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=search], input:not([type]) {
  width: 100%; font-size: 18px; padding: 12px; border: 1px solid #8C959F; border-radius: 10px;
}
.help, .helptext { color: var(--grigio); font-size: 13px; }
.errorlist { color: var(--rosso); margin: 4px 0; padding-left: 18px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: center; margin: 16px 0; font-weight: 600; }
.check input { width: 24px; height: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border: 1px solid var(--rosso); color: var(--rosso); background: #fff;
  border-radius: 20px; padding: 8px 12px; font-size: 16px; font-weight: 600; }

/* scanner */
.video { position: relative; background: #000; border-radius: 14px; overflow: hidden;
  aspect-ratio: 1 / 1; margin-bottom: 14px; }
.video video { width: 100%; height: 100%; object-fit: cover; }
.video .mirino { position: absolute; inset: 18%; border: 4px solid #ffffffd0; border-radius: 16px; }
#stato-scanner { text-align: center; color: var(--grigio); margin-bottom: 12px; min-height: 1.4em; }
.contatore { font-size: 15px; font-weight: 600; opacity: .9; }

/* consegne e foto */
.tag.consegna { background: var(--azzurro); }
input[type=number] { width: 100%; font-size: 18px; padding: 12px; border: 1px solid #8C959F; border-radius: 10px; }
.anteprime, .miniature { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.anteprime figure { position: relative; margin: 0; }
.anteprime img, .miniature img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }
.anteprime figure button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: var(--rosso); color: #fff; font-weight: 700; }
.aggiungi-foto { margin-bottom: 0; }
