/* App da banco: si usa in piedi, con una mano, con la fila davanti. Da qui le due sole regole
   di stile che contano — bersagli grandi e testo che si legge senza avvicinare il telefono. */

:root {
    --sfondo: #0f172a;
    --superficie: #1e293b;
    --bordo: #334155;
    --testo: #f1f5f9;
    --sfumato: #94a3b8;
    --accento: #22c55e;
    --buono: #22c55e;
    --cattivo: #f87171;
    --raggio: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    min-height: 100dvh;
    background: var(--sfondo);
    color: var(--testo);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: 480px;
    margin: 0 auto;
}

.schermo {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100dvh - 32px);
}

.schermo[hidden] {
    display: none;
}

.centrato {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.intestazione h1,
.intestazione h2 {
    margin: 0;
    font-size: 1.4rem;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
}

.sfumato {
    color: var(--sfumato);
    margin: 0;
}

.piccolo {
    font-size: 0.85rem;
}

/* --- Schede ---------------------------------------------------------------------------------- */

.scheda {
    background: var(--superficie);
    border: 1px solid var(--bordo);
    border-radius: var(--raggio);
    padding: 16px;
    width: 100%;
}

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

.voce + .voce {
    border-top: 1px solid var(--bordo);
}

.voce span {
    color: var(--sfumato);
}

/* Lo sconto è il numero che l'operatore deve battere sul registratore: è il più grande della
   schermata perché è l'unico che finisce sullo scontrino. */
.grande-voce strong {
    font-size: 1.9rem;
    color: var(--accento);
}

.metrica {
    text-align: center;
}

.metrica-valore {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
}

.metrica-etichetta {
    color: var(--sfumato);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Bottoni --------------------------------------------------------------------------------- */

.bottone {
    font: inherit;
    font-weight: 600;
    color: var(--testo);
    background: var(--superficie);
    border: 1px solid var(--bordo);
    border-radius: var(--raggio);
    padding: 14px 20px;
    min-height: 52px;
    cursor: pointer;
}

.bottone:disabled {
    opacity: 0.45;
    cursor: default;
}

.bottone.primario {
    background: var(--accento);
    border-color: var(--accento);
    color: #052e16;
}

.bottone.grande {
    min-height: 72px;
    font-size: 1.25rem;
    margin-top: auto;   /* incollato in basso: è dove sta il pollice */
}

.bottone.piatto {
    background: none;
    border: none;
    color: var(--sfumato);
}

.bottone.tondo {
    width: 64px;
    height: 64px;
    min-height: 64px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
}

/* --- Stepper persone -------------------------------------------------------------------------- */

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 8px 0;
}

.stepper-valore {
    font-size: 3rem;
    font-weight: 700;
    min-width: 2ch;
    text-align: center;
}

/* --- Scansione -------------------------------------------------------------------------------- */

.lettore {
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: var(--raggio);
    overflow: hidden;
}

/* html5-qrcode inietta il <video> e un <canvas>: senza questo il video esce dal riquadro. */
.lettore video,
.lettore canvas,
.lettore img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

.riga {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.riga input {
    flex: 1;
    min-width: 0;
    font: inherit;
    padding: 14px;
    color: var(--testo);
    background: var(--sfondo);
    border: 1px solid var(--bordo);
    border-radius: var(--raggio);
}

summary {
    cursor: pointer;
    color: var(--sfumato);
}

/* --- Esito, attesa ---------------------------------------------------------------------------- */

.icona-grande {
    font-size: 4rem;
    line-height: 1;
}

.icona-grande.buono {
    color: var(--buono);
}

.icona-grande.cattivo {
    color: var(--cattivo);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bordo);
    border-top-color: var(--accento);
    border-radius: 50%;
    animation: gira 0.8s linear infinite;
}

@keyframes gira {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2.4s;
    }
}
