/* App Operatore di NextCAR: aspetto della bozza approvata il 29/11/2026 (stile\APP.md). Tasti grandi per mani sporche e guanti,
   testi grandi, contrasto alto; chiaro o scuro secondo il telefono. */
:root {
  --bg: #ECEEF0; --sup: #FFFFFF; --sup2: #F1F3F5; --linea: #DDE1E5; --linea2: #BFC6CD;
  --testo: #1A1E22; --testo2: #434B54; --testo3: #5F6872;
  --accento: #C2410C; --accento-testo: #FFFFFF; --ok: #1E7A46; --avviso: #7A4F00; --avviso-tenue: #FBF1DA;
  --errore: #B42318; --errore-tenue: #FDECEA; --presa: #D3E2FA; --presa-testo: #1D3FB8; --confermata: #E2F2E8; --confermata-testo: #1E7A46;
  --testata: #1F2428; --testata-testo: #F1F3F4; --splash: #15181B;
  --ombra: 0 1px 2px rgba(0, 0, 0, 0.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215; --sup: #181B1F; --sup2: #23282E; --linea: #2A2F35; --linea2: #3B424A;
    --testo: #E9EBEE; --testo2: #BAC1C8; --testo3: #8F98A1;
    --accento: #FF8A3D; --accento-testo: #1B0F06; --ok: #2E9E62; --avviso: #E8B95A; --avviso-tenue: #2A2312;
    --errore: #FF7B72; --errore-tenue: #3A1715; --presa: #172A4D; --presa-testo: #9DC0FF; --confermata: #13261B; --confermata-testo: #5BC98A;
    --ombra: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 18px; background: var(--bg); color: var(--testo);
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accento); outline-offset: 2px; }
.senza-js { padding: 24px; font-size: 20px; }

#app {
  position: relative; min-height: 100%; height: 100dvh; max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

@keyframes entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spunta { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes sale { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes gira { to { transform: rotate(360deg); } }
.entra { animation: entra .35s ease-out both; }
.spunta { animation: spunta .55s cubic-bezier(.2, .8, .3, 1.2) both; }
.sale { animation: sale .25s ease-out both; }
.pulsa { animation: pulsa 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .entra, .spunta, .sale, .pulsa { animation: none; } }

/* splash e schermate a tutta pagina scura */
.schermo-splash { background: var(--splash); }
.splash {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); background: var(--splash); color: #F1F3F4; text-align: center;
}
.logo-grande { width: 132px; height: 132px; }
.splash-nome { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.splash-ditta { font-size: 19px; font-weight: 500; color: #AEB6BE; margin-top: -16px; }
.splash-nota { font-size: 16px; color: #AEB6BE; max-width: 340px; line-height: 1.4; }
.splash-errore { font-size: 17px; font-weight: 600; color: #FFB4AB; background: #3A1715; border-radius: 16px; padding: 12px 16px; max-width: 360px; }
.splash .tasto-grande { width: 100%; max-width: 420px; background: #FF8A3D; color: #1B0F06; }
.splash .tasto-secondario { width: 100%; max-width: 420px; color: #F1F3F4; border-color: #3B424A; }
.istruzioni { text-align: left; background: #1F2428; border-radius: 20px; padding: 18px 20px; font-size: 18px; line-height: 1.5; max-width: 420px; width: 100%; }
.istruzioni ol { margin: 8px 0 0; padding-left: 22px; }
.istruzioni li { margin-bottom: 6px; }
.attesa { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #3B424A; border-top-color: #FF8A3D; animation: gira 0.9s linear infinite; }

/* testata */
.testata {
  display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--testata); color: var(--testata-testo);
}
.testata img { width: 36px; height: 36px; }
.testata-ditta { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prova { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: #1B0F06; background: #E8B95A; border-radius: 8px; padding: 4px 8px; }
.rete { display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 8px 12px; font-size: 15px; font-weight: 700; background: #1E3327; color: #A8E6C1; }
.rete .punto { width: 10px; height: 10px; border-radius: 5px; background: #5BC98A; }
.rete.assente { background: #3A2E12; color: #F2D28A; }
.rete.assente .punto { background: #E8B95A; }

/* corpo delle schermate */
.pagina { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.contenuto { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 14px; padding: 8px 18px 18px; }
.titolo-riga { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; }
.titolo { font-size: 28px; font-weight: 800; }
.sottotitolo { padding: 0 18px 8px; font-size: 18px; color: var(--testo2); }
.indietro { width: 56px; height: 56px; border: 0; border-radius: 16px; background: transparent; color: var(--testo); display: flex; align-items: center; justify-content: center; }
.fondo { display: flex; flex-direction: column; gap: 10px; padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); background: var(--bg); }

.tasto-grande {
  height: 72px; border: 0; border-radius: 20px; background: var(--accento); color: var(--accento-testo);
  font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 20px;
}
.tasto-grande.ok { background: var(--ok); color: #FFFFFF; }
.tasto-grande:disabled { background: var(--linea); color: var(--testo3); }
.tasto-secondario {
  height: 60px; border: 2px solid var(--linea2); border-radius: 18px; background: transparent; color: var(--testo);
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px;
}

/* main */
.saluto { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.data-lunga { font-size: 18px; margin-top: 6px; color: var(--testo2); }
.aree { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.area {
  border: 0; border-radius: 24px; padding: 24px; min-height: 200px; background: var(--accento); color: #FFFFFF;
  display: flex; flex-direction: column; justify-content: space-between; text-align: left; gap: 16px;
}
@media (prefers-color-scheme: dark) { .area { background: #C2410C; } }
.area-alto { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.area-nome { font-size: 34px; font-weight: 800; letter-spacing: 0.5px; }
.area-sotto { font-size: 18px; margin-top: 4px; opacity: 0.92; }
.riquadro-storico {
  border: 2px solid var(--linea); border-radius: 24px; padding: 20px 22px; min-height: 96px; background: var(--sup); color: var(--testo);
  display: flex; align-items: center; gap: 16px; text-align: left;
}
.riquadro-storico .grande { font-size: 22px; font-weight: 700; }
.riquadro-storico .piccolo { font-size: 16px; margin-top: 2px; color: var(--testo2); }
.avviso { border-radius: 18px; padding: 14px 16px; background: var(--avviso-tenue); color: var(--avviso); font-size: 17px; font-weight: 600; line-height: 1.35; }
.errore { border-radius: 18px; padding: 14px 16px; background: var(--errore-tenue); color: var(--errore); font-size: 17px; font-weight: 600; line-height: 1.35; }
.piede { margin-top: auto; padding-top: 8px; text-align: center; font-size: 14px; color: var(--testo3); }
.piede button { border: 0; background: transparent; color: var(--testo3); font-size: 14px; text-decoration: underline; padding: 8px; }

/* rifiuti */
.giorni { display: flex; gap: 10px; padding: 4px 18px 10px; }
.giorno { flex: 1; height: 56px; border-radius: 16px; font-size: 19px; font-weight: 700; border: 2px solid var(--linea2); background: transparent; color: var(--testo); }
.giorno.scelto { border-color: var(--accento); background: var(--accento); color: var(--accento-testo); }
.scheda { border-radius: 22px; padding: 16px; background: var(--sup); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--ombra); }
.scheda-alto { display: flex; align-items: center; gap: 12px; }
.iniziale { width: 44px; height: 44px; border-radius: 14px; color: #FFFFFF; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; flex-shrink: 0; }
.scheda-nome { font-size: 22px; font-weight: 700; }
.scheda-sotto { font-size: 14px; color: var(--testo3); }
.kg {
  height: 76px; border-radius: 18px; border: 2px dashed var(--linea2); background: transparent; color: var(--testo3);
  font-size: 20px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.kg.pieno { border-style: solid; background: var(--sup2); color: var(--testo); font-size: 38px; font-weight: 800; }
.kg .unita { font-size: 20px; font-weight: 600; opacity: 0.7; }
.due { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tre { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tre .piccolo-tasto { font-size: 16px; gap: 6px; padding: 0 4px; }
.piccolo-tasto {
  height: 56px; border-radius: 16px; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--linea2); background: transparent; color: var(--testo); padding: 0 8px; overflow: hidden;
}
.piccolo-tasto.con-foto { border-color: var(--ok); background: var(--ok); color: #FFFFFF; }
.piccolo-tasto.con-nota { border-color: var(--testo2); background: var(--sup2); }
.nascosto { display: none; }

/* riepilogo */
.voce-riepilogo { border-radius: 20px; padding: 16px 18px; background: var(--sup); display: flex; flex-direction: column; gap: 6px; }
.voce-riepilogo .alto { display: flex; align-items: center; gap: 12px; }
.pallino { width: 14px; height: 14px; border-radius: 7px; flex-shrink: 0; }
.voce-riepilogo .nome { flex: 1; font-size: 22px; font-weight: 700; }
.voce-riepilogo .peso { font-size: 30px; font-weight: 800; }
.voce-riepilogo .peso span { font-size: 18px; font-weight: 600; }
.voce-riepilogo .dettagli { font-size: 16px; color: var(--testo2); overflow-wrap: anywhere; }

/* esito */
.esito { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 28px; text-align: center; }
.cerchio { width: 148px; height: 148px; border-radius: 74px; color: #FFFFFF; display: flex; align-items: center; justify-content: center; background: var(--ok); }
.cerchio.coda { background: #B7791F; }
.cerchio.male { background: var(--errore); }
.esito-titolo { font-size: 32px; font-weight: 800; }
.esito-testo { font-size: 19px; color: var(--testo2); max-width: 320px; line-height: 1.4; }
.esito .tasto-grande, .esito .tasto-secondario { width: 100%; max-width: 420px; }

/* storico */
.voce-storico { border-radius: 18px; padding: 14px 16px; background: var(--sup); display: flex; align-items: center; gap: 14px; }
.barra { width: 12px; height: 44px; border-radius: 6px; flex-shrink: 0; }
.voce-storico .testi { flex: 1; min-width: 0; }
.voce-storico .grande { font-size: 19px; font-weight: 700; }
.voce-storico .piccolo { font-size: 15px; color: var(--testo3); overflow-wrap: anywhere; }
.stato { flex-shrink: 0; border-radius: 12px; padding: 8px 10px; font-size: 14px; font-weight: 700; text-align: center; max-width: 120px; background: var(--sup2); color: var(--testo2); }
.stato.coda { background: var(--avviso-tenue); color: var(--avviso); }
.stato.preso { background: var(--presa); color: var(--presa-testo); }
.stato.confermato { background: var(--confermata); color: var(--confermata-testo); }
.stato.scartato { background: var(--errore-tenue); color: var(--errore); }
.errore-testo { color: var(--errore); font-weight: 600; }
.voce-storico.invio { border: 0; width: 100%; text-align: left; color: var(--testo); font: inherit; min-height: 72px; }
.pallini { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.barra.corta { height: 12px; }
.riga-stato { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vuoto { padding: 32px 12px; text-align: center; font-size: 19px; color: var(--testo2); }

/* fogli che salgono dal basso */
.velo { position: absolute; inset: 0; background: rgba(10, 12, 14, 0.55); display: flex; flex-direction: column; justify-content: flex-end; z-index: 10; }
.foglio {
  border-radius: 28px 28px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); background: var(--sup);
  display: flex; flex-direction: column; gap: 12px; max-height: 100%; overflow-y: auto;
}
.foglio-alto { display: flex; align-items: center; gap: 12px; }
.foglio-titolo { flex: 1; font-size: 22px; font-weight: 700; }
.annulla { height: 48px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--sup2); color: var(--testo); font-size: 17px; font-weight: 600; }
.display { border-radius: 18px; padding: 10px 18px; background: var(--sup2); display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; min-height: 76px; }
.display .valore { font-size: 56px; font-weight: 800; letter-spacing: -1px; }
.display .valore.vuoto-kg { color: var(--testo3); }
.display .unita { font-size: 24px; font-weight: 600; color: var(--testo2); }
.tastierino { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tasto { height: 68px; border: 0; border-radius: 18px; background: var(--sup2); color: var(--testo); font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tasto.speciale { background: var(--linea); }
.tasto:active, .tasto-grande:active, .piccolo-tasto:active, .giorno:active { transform: scale(0.97); }
.campo-nota { height: 64px; border: 2px solid var(--linea2); border-radius: 16px; padding: 0 16px; font-size: 21px; font-family: inherit; background: var(--bg); color: var(--testo); width: 100%; }
.etichetta { font-size: 16px; color: var(--testo2); }
.anteprima { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 16px; background: var(--sup2); }
