/* daCLOUD — cassa, pagamento, finestre, messaggi, stati vuoti, documento, accessi, integrazioni
   I fogli di questa cartella si caricano in ordine (numero iniziale): l'ordine conta, i successivi
   rifiniscono i precedenti. */

/* ------------------------------------------------------------- cassa */

.register-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; align-items: start; }
.register-products { display: flex; flex-direction: column; min-height: 60vh; }

.register-toolbar { display: flex; gap: 12px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.register-toolbar select { min-width: 200px; }

.category-chips { display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--line-soft); }

.category-chip {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
}

.category-chip.active { color: #fff; }

.product-grid {
    display: grid;
}

.product-tile {
    display: grid;
    gap: 4px;
    align-content: start;
    text-align: left;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
}

.product-tile:disabled { opacity: .5; cursor: not-allowed; }
.product-tile strong { font-size: var(--text-md); line-height: 1.3; }
.product-category { font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; color: var(--green-600); }
.product-price { font-family: var(--font-num); margin-top: auto; }
.product-stock { font-size: var(--text-sm); color: var(--muted); }

.register-cart { display: flex; flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 40px); }
.cart-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.cart-head h2 { font-size: var(--text-lg); }
.cart-items { flex: 1; overflow-y: auto; min-height: 120px; }

.cart-line { padding: 12px 0; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.cart-line:last-child { border-bottom: 0; }
.cart-line-top { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-md); }
.cart-line-top span { font-family: var(--font-num); font-weight: 650; }
.cart-line-actions { display: flex; align-items: center; justify-content: space-between; }

.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty-control button { border: 0; background: var(--surface); color: var(--ink-2); font-size: var(--text-lg); cursor: pointer; }
.qty-control button:hover { background: var(--green-50); color: var(--green-700); }
.qty-control span { min-width: 30px; text-align: center; font-family: var(--font-num); font-weight: 650; font-size: var(--text-md); }

.remove-line { border: 0; background: none; color: var(--muted); font-size: var(--text-sm); cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.remove-line:hover { color: var(--danger); background: var(--danger-bg); }

.cart-empty { display: grid; place-items: center; text-align: center; padding: 32px 12px; color: var(--muted); font-size: var(--text-base); }
.cart-empty .empty-icon { margin: 0 auto 8px; }

.cart-summary { border-top: 1px solid var(--line); display: grid; gap: 6px; background: var(--surface-2); }
.cart-summary-row { display: flex; justify-content: space-between; font-size: var(--text-base); color: var(--ink-2); }
.cart-summary-row strong { font-family: var(--font-num); }
.cart-summary-row.total { font-size: var(--text-lg); color: var(--ink); padding-top: 8px; border-top: 1px dashed var(--line); }
.cart-summary-row.total strong { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -.02em; }

.cart-checkout { display: grid; gap: 8px; border-top: 1px solid var(--line); }

.nonfiscal-note {
    text-align: center;
    font-size: var(--text-xs);
    letter-spacing: .06em;
    font-weight: 650;
    color: var(--amber);
    background: var(--amber-bg);
    padding: 6px;
}

/* ------------------------------------------------------------- pagamento */

.payment-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.payment-option {
    display: grid;
    gap: 4px;
    border: 1.5px solid var(--line);
    cursor: pointer;
    background: var(--surface);
}

.payment-option input { position: absolute; opacity: 0; pointer-events: none; }
.payment-option strong { font-size: var(--text-md); }
.payment-option small { font-size: var(--text-sm); color: var(--muted); }
.payment-option.selected { border-color: var(--green-500); background: var(--green-50); }

.cash-pad { display: grid; gap: 12px; margin-top: 16px; }
.cash-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; }

.cash-quick button {
    border: 1px solid var(--line);
    background: var(--surface);
    font-family: var(--font-num);
    font-weight: 650;
    cursor: pointer;
}

.cash-quick button:hover { border-color: var(--green-400); background: var(--green-50); }

.change-box {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    background: var(--green-50);
    border: 1px solid var(--green-200);
}

.change-box span { font-size: var(--text-base); color: var(--green-800); font-weight: 550; }
.change-box strong { font-family: var(--font-num); color: var(--green-700); letter-spacing: -.02em; }
.change-box.insufficient { background: var(--amber-bg); border-color: var(--amber-line); }
.change-box.insufficient span { color: var(--amber); }
.change-box.insufficient strong { color: var(--amber); font-size: var(--text-lg); }

/* ------------------------------------------------------------- modale */

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 100;
    animation: fade .16s ease;
}

@keyframes fade { from { opacity: 0; } }

.modal {
    width: min(620px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.modal-sm { width: min(430px, 100%); }
.modal-lg { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-close { border: 0; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .modal-foot-start { margin-right: auto; }  /* 2.11.0: azione distruttiva staccata dal gruppo principale */

/* ------------------------------------------------------------- toast */

.toast-stack { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
/* 4.4.7: gli avvisi non intercettano i clic sui pulsanti sotto (solo quelli con un'azione restano cliccabili) */
.toast-stack { pointer-events: none; }
.toast-stack .toast.is-action, .toast-stack .toast:has(button, a) { pointer-events: auto; }

.toast {
    background: var(--ink);
    color: #fff;
    font-size: var(--text-base);
    max-width: 340px;
}

.toast.error { background: var(--danger); }
.toast.warning { background: var(--amber); }

/* ------------------------------------------------------------- vuoto */

.empty-state { display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink-2); font-size: var(--text-md); margin-bottom: 4px; }
.empty-state span { font-size: var(--text-base); }
.empty-state p strong, .empty-state p em { display: inline; margin: 0; font-size: inherit; } /* 4.3.0: il grassetto dentro una frase resta nella frase (era un titolo a capo) */

.empty-icon {
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    font-size: var(--text-2xl);
}

/* ------------------------------------------------------------- documento (ricevuta a schermo) */

.receipt {
    width: 100%;
    max-width: 330px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    font-family: var(--font-num);
    font-size: var(--text-sm);
    color: var(--ink);
}

/* 2.13.0: intestazione dello scontrino con logo del brand e punto vendita (sede). */
.receipt-head { text-align: center; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px dashed var(--line); }
.receipt-logo { display: block; width: auto; height: auto; max-width: 72%; max-height: 64px; margin: 0 auto 8px; object-fit: contain; }
.receipt h3 { text-align: center; font-size: var(--text-lg); margin: 0 0 2px; line-height: 1.2; }
.receipt-store { font-size: var(--text-sm); font-weight: 600; color: var(--ink); line-height: 1.25; }
.receipt-store-addr { font-size: var(--text-xs); color: var(--ink-2); margin-top: 1px; }

.receipt-warning {
    margin: 12px 0;
    padding: 6px;
    text-align: center;
    font-weight: 700;
    font-size: var(--text-xs);
    letter-spacing: .06em;
    border: 1px dashed var(--amber);
    color: var(--amber);
    border-radius: var(--r-sm);
}

/* 2.1.0: documento commerciale emesso (non è un avviso) */
.receipt-warning.is-fiscal {
    background: var(--green-50);
    color: var(--green-800);
    border-color: var(--green-300);
}

.receipt-meta { display: grid; gap: 2px; font-size: var(--text-xs); color: var(--ink-2); padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.receipt-lines { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.receipt-line { display: flex; justify-content: space-between; gap: 12px; line-height: 1.35; }
.receipt-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--ink); font-size: var(--text-xl); font-weight: 700; }
.receipt-footnote { margin-top: 12px; text-align: center; font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------------- accessi */

.access-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.access-stat { display: grid; gap: 2px; }
.access-stat span { font-size: var(--text-sm); color: var(--muted); }
.access-stat strong { letter-spacing: -.02em; }

.store-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.store-card { display: grid; gap: 12px; align-content: start; }
.store-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.store-card-code { font-family: var(--font-num); font-size: var(--text-sm); font-weight: 700; letter-spacing: .06em; }
.store-card h3 { font-size: var(--text-lg); }
.store-card p { font-size: var(--text-base); color: var(--muted); }
.store-card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.store-card-metrics span { display: block; font-size: var(--text-sm); color: var(--muted); }
.store-card-metrics strong { font-family: var(--font-num); font-size: var(--text-xl); }
.store-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

