/* daCLOUD — componenti aggiuntivi: azioni di riga, codici a barre, menu utente, avvio, preferiti, marchio, registro
   I fogli di questa cartella si caricano in ordine (numero iniziale): l'ordine conta, i successivi
   rifiniscono i precedenti. */

/* ------------------------------------------------------------- fix UI 1.27 */
.turnstile-card { cursor: pointer; }

.qty-input { width: 56px; height: 30px; text-align: center; border: 1px solid var(--line); font: inherit; font-family: var(--font-num); background: #fff; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus-visible { border-color: var(--green-500); box-shadow: var(--focus); outline: none; }

.product-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); display: block; background: var(--surface-2); border: 1px solid var(--line-soft); } /* 1.92.0: da 150 px, le righe del catalogo erano altissime */

@keyframes login-float { 0% { transform: translateY(10px) rotate(-6deg); opacity: 0; } 15% { opacity: .95; } 85% { opacity: .95; } 100% { transform: translateY(-48px) rotate(12deg); opacity: 0; } }

/* tornelli: form monete + link azione */
.coin-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.coin-form label { display: inline-flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.coin-form input, .coin-form select { font: inherit; font-size: var(--text-md); color: var(--ink); font-weight: 400; } /* 1.99.3: come tutti gli altri campi (prima ereditavano il carattere piccolo dell'etichetta) */
.btn-link { display: inline; background: none; border: 0; padding: 0; color: var(--green-700); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; } /* 1.92.0: link di testo nelle frasi */
.btn-link:hover { color: var(--green-800); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: var(--danger-strong); }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
/* 1.92.0: azione di riga distruttiva = stesso pulsante, testo e bordo rossi */
.btn-secondary.danger { border-color: var(--danger-line); }
.btn-secondary.danger:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
/* azioni di riga: sempre su una riga, spaziatura unica */
td .btn-sm { white-space: nowrap; }
/* 1.92.0: azioni di riga allineate a destra, vanno a capo invece di uscire dalla card */
.row-actions { display: flex; flex-wrap: wrap; gap: var(--gap-actions); justify-content: flex-end; }
td > .row-actions { flex-wrap: nowrap; } /* 4.3.0: le azioni di riga restano su una riga a ogni larghezza (prima 2 + 1 a capo, o impilate sul telefono); la tabella scorre in orizzontale */
.doc-code { white-space: nowrap; }
td:has(> strong + .table-subline), td:has(> strong + small.table-subline) { min-width: 180px; } /* 4.3.1: nome con sottotitolo non si stringe a una parola per riga (la tabella scorre) */ /* 4.3.0: numeri di documento e fasce orarie non si spezzano ai trattini */
.btn.danger:hover:not(:disabled), .btn-ghost.danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); }

/* ---- Codici a barre: pulsante scansione ---- */
.scan-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted-2);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .1s ease;
}
.scan-btn:hover { background: var(--green-50); color: var(--green-700); }
.scan-btn:active { transform: translateY(-50%) scale(.9); }
.scan-btn svg { display: block; }

/* ---- Nota di aiuto sotto i campi ---- */
.hint-line { margin: 8px 0 0; line-height: 1.45; color: var(--muted); }

/* ---- Ritmo verticale coerente nei form dei modali (gli stili inline hanno precedenza) ---- */
.modal-body form > * + * { margin-top: 12px; }
/* 1.94.x→1.95.0: nei moduli a griglia la spaziatura la dà la griglia; il margine sfasava la prima riga (secondo campo 12 px più in basso) */
.modal-body form.form-grid > * + * { margin-top: 0; }
.modal-body form fieldset > .form-grid-2:first-child { margin-top: 0; }

/* ---- Anteprima immagine prodotto in cassa ---- */
.product-tile .tile-thumb { width: 100%; height: 76px; object-fit: cover; border-radius: var(--r-sm); margin-bottom: 8px; display: block; }

/* ---- Menu utente arricchito (topbar) ---- */
.user-popover-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-popover-head strong { display: block; font-size: var(--text-md); color: var(--ink); }
.user-popover-head small { display: block; color: var(--muted); font-size: var(--text-sm); margin-top: 1px; }
.user-popover-avatar { border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: var(--text-base); flex: none; }

/* ---- Splash d'avvio con nome brand animato ---- */
.app-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    animation: splash-out .55s ease 1.25s forwards;
}
.app-splash-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
    animation: splash-in .6s cubic-bezier(.22, .61, .36, 1) both;
}
.app-splash-brand .brand-mark {
    width: 60px;
    height: 60px;
    font-size: var(--text-5xl);
    color: #fff;
    animation: splash-mark 1.25s ease both;
}
@keyframes splash-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes splash-mark { 0% { transform: scale(.7) rotate(-8deg); opacity: 0; } 55% { transform: scale(1.06) rotate(2deg); opacity: 1; } 100% { transform: none; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* ---- Simboli matematici animati nel login tablet ---- */

@media (prefers-reduced-motion: reduce) {
    .app-splash { animation: splash-out .3s ease .35s forwards; }
    .app-splash-brand, .app-splash-brand .brand-mark { animation: none; }
}

/* ---- Badge periodo settimanale (gettoniera) ---- */
.period-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--green-50); color: var(--green-700); font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; vertical-align: middle; }

/* ---- Stella preferito cliccabile sulle tile di cassa ---- */
.product-tile, .tablet-product { position: relative; }
/* 1.89.2: contenitore tile + stella come pulsante fratello (non annidato). */
.product-tile-wrap { position: relative; display: grid; }
.product-tile-wrap > .product-tile, .product-tile-wrap > .tablet-product { height: 100%; }
.product-tile-wrap .product-category, .product-tile-wrap .tablet-product-category { padding-right: 32px; }
.fav-toggle {
    border: 0;
    padding: 0;
    font-family: inherit;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: var(--text-lg);
    line-height: 1;
    background: rgba(255, 255, 255, .82);
    cursor: pointer;
    transition: color .15s ease, transform .1s ease, background .15s ease;
}
.fav-toggle:hover { background: #fff; transform: scale(1.12); }

.fav-toggle:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }

/* ---- Fascia riepilogo Giacenze ---- */
.inv-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.inv-metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 4px; }
.inv-metric span { font-size: var(--text-base); color: var(--muted); font-weight: 600; }
.inv-metric strong { letter-spacing: -.02em; color: var(--ink); }
.inv-metric.is-alert strong { color: var(--danger); }
.inv-lists { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
@media (max-width: 720px) { .inv-lists { grid-template-columns: 1fr; } }

/* ---- Logo marchio (white-label) ---- */
.brand-logo { max-height: 30px; max-width: 48px; width: auto; object-fit: contain; display: block; }
.brand-logo-name { white-space: nowrap; }
.app-splash-brand .brand-logo { max-height: 64px; max-width: 260px; }
.brand-login .brand-logo, .brand-logo-invert { max-height: 46px; max-width: 200px; }
.brand-preview-img { max-height: 60px; max-width: 200px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; background: var(--surface); }
/* 2.56.4: scelta della tavolozza dei grafici */
.palette-pick { display: grid; gap: 8px; margin-top: 4px; }
.palette-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease; }
.palette-opt:hover { border-color: var(--green-400); }
.palette-opt.is-on { border-color: var(--green-600); box-shadow: inset 0 0 0 1px var(--green-600); }
.palette-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.palette-opt:focus-within { outline: 2px solid var(--green-600); outline-offset: 2px; }
.palette-sw { display: inline-flex; flex-shrink: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.palette-sw i { width: 16px; height: 26px; display: block; }
.palette-meta { display: grid; gap: 1px; min-width: 0; }
.palette-meta strong { font-size: var(--text-sm); }
.palette-meta small { color: var(--muted); font-size: var(--text-xs); }

/* ---- Registro attività (audit) ---- */
.audit-badge { display: inline-block; border-radius: 999px; font-weight: 700; letter-spacing: .02em; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.audit-badge.audit-sale { background: var(--danger-bg); color: var(--danger); }
.audit-badge.audit-closure { background: var(--green-50); color: var(--green-700); }
.audit-badge.audit-user { background: var(--info-bg); color: var(--info); }
/* 1.98.0: conteggio del contante (pannello e tablet usano gli stessi colori) */
.cash-count-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: var(--space-3); }
.cash-count-box legend { font-weight: 650; padding: 0 var(--space-2); }
.cash-count-box legend small { font-weight: 500; color: var(--muted); }
.cash-check { padding: var(--space-2) var(--space-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--text-md); }
.cash-check.ok { background: var(--green-50); color: var(--green-700); }
.cash-check.diff { background: var(--amber-bg); color: var(--amber-strong); }
/* 1.97.8: esito del conteggio del contante nelle chiusure */
.cash-count.ok { color: var(--green-700); }
.cash-count.diff { color: var(--amber-strong); font-weight: 600; }
/* 1.97.6: errore dell'ultimo backup esterno */
.offsite-error { color: var(--danger); font-weight: 600; }
/* 1.97.4: promemoria backup in dashboard */
.backup-reminder { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.backup-reminder-actions { display: flex; gap: var(--gap-actions); flex-wrap: wrap; }
.audit-badge.audit-auth { background: var(--amber-bg); color: var(--amber-strong); } /* 1.97.0 */

/* ---- Anagrafica fornitori: editor materiali ---- */
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: var(--surface-2); }
.supplier-materials-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; }
.supplier-materials-head h3 { margin: 0; font-size: var(--text-md); font-weight: 700; }
.material-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.material-row input { height: 36px; }
@media (max-width: 640px) { .material-row { grid-template-columns: 1fr 1fr; } }

/* ---- Banner storno documento ---- */
.receipt-storno-banner { background: var(--amber-bg); color: var(--amber); font-weight: 700; text-align: center; padding: 8px 12px; border-radius: var(--r-md); margin-bottom: 12px; font-size: var(--text-base); letter-spacing: .02em; }

/* ---- Ordini materiali ---- */
.order-mat-row { display: grid; grid-template-columns: 2fr 1fr 92px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.order-mat-row:last-child { border-bottom: 0; }
.order-mat-name { font-weight: 600; }
.order-qty { height: var(--control-h); text-align: right; } /* 1.99.3: stessa altezza degli altri campi */
/* 1.89.1: rimossa la seconda definizione di .status-pill (sovrascriveva la prima con colori diversi): un solo componente. */

/* ---- Rapportini manutenzione ---- */
.maint-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 16px; }
.maint-photos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; min-height: 20px; }
.maint-photo { position: relative; width: 90px; height: 90px; }
.maint-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); }
.maint-photo-del { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid var(--surface); cursor: pointer; font-size: var(--text-xs); line-height: 1; display: grid; place-items: center; }

/* ---- Matrice permessi per ruolo ---- */

/* ---- Editor checklist manutenzione ---- */
.maint-type-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.maint-type-row input { flex: 1; }

/* ---- Pulsante "Cambia password" nel menu utente ---- */
.user-popover button { display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer; font: inherit; color: var(--ink-2); }

