/* ══ CARRELLO — card, iconbar, pannelli, footer ═════════════════ */
/* Tab #tc: regole definitive in sezione CART REDESIGN v3 sotto */

/* ── Header clienti (pillole) ──────────────────────────────── */
#cart-tabs-bar {
  display: flex !important;
  gap: 7px !important;
  flex-wrap: wrap !important;
  padding: 10px 10px 8px !important;
  margin-bottom: 0 !important;
  background: var(--pos-bg) !important;
  border-bottom: 1px solid var(--pos-border) !important;
  align-items: center !important;
}

/* Pillola generica carrello */
.cart-tab-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 7px 13px !important;
  border-radius: 20px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  border: 2px solid transparent !important;
  white-space: nowrap !important;
  min-height: 34px !important;
  touch-action: manipulation !important;
  transition: filter .12s, transform .1s !important;
  font-family: 'Inter', sans-serif !important;
  letter-spacing: .2px !important;
}
.cart-tab-pill:active { transform: scale(.95) !important; filter: brightness(.85) !important; }

/* Pillola + NUOVO */
.cart-tab-pill.new-cart-pill {
  background: transparent !important;
  border: 2px dashed var(--accent) !important;
  color: var(--accent) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

/* Pillola attiva */
.cart-tab-pill.active {
  box-shadow: 0 0 0 2px #fff3, 0 2px 8px rgba(0,0,0,.4) !important;
}

/* Colori per tipo pagamento */
.cart-tab-pill[data-tipo="fattura"]    { background: var(--pos-blue) !important;   color: #fff !important; }
.cart-tab-pill[data-tipo="contanti"]   { background: var(--pos-green) !important;  color: #fff !important; }
.cart-tab-pill[data-tipo="preventivo"] { background: var(--pos-yellow) !important; color: #fff !important; }
.cart-tab-pill[data-tipo="sospeso"]    { background: var(--pos-red) !important;    color: #fff !important; }
.cart-tab-pill[data-tipo=""]           { background: #3a3d40 !important;            color: #ddd !important; }

/* ════════════════════════════════════════════════════════════════
   RIEPILOGO ORDINE — foglio preparazione (cassa + checklist)
   ════════════════════════════════════════════════════════════════ */

.riepilogo-modal {
  background: #0a0b0d;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 100%;
  height: 92vh;
  max-height: 92vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -12px 48px rgba(0,0,0,.85);
  border-top: 2px solid #2d2f35;
}

/* Header fisso */
.riepilogo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 2px solid #25272c;
  flex-shrink: 0;
  background: #08090b;
}
.riepilogo-header-main { flex: 1; min-width: 0; }
.riepilogo-header-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.riepilogo-title {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
  letter-spacing: .02em;
}
.riepilogo-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #12141a;
  border: 1px solid #2a2d36;
}
.riepilogo-total-label {
  font-size: 12px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.riepilogo-total-val {
  font-size: 22px;
  font-weight: 900;
  color: #f6e05e;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.riepilogo-meta {
  font-size: 12px;
  color: #a0a7b4;
  margin-top: 6px;
}
.riepilogo-meta-sconto { color: #68d391; font-weight: 700; }
.riepilogo-counter {
  background: rgba(246,224,94,.12);
  color: #f6e05e;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(246,224,94,.35);
  font-variant-numeric: tabular-nums;
}
.riepilogo-close {
  background: #1f2128;
  border: 1px solid #3d424d;
  color: #cbd5e0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.riepilogo-close:active { background: #2d313b; }

/* Lista scrollabile (flex fill) */
.riepilogo-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: #0a0b0d;
}

/* Righe alternate + bordo (alta leggibilità) */
.riepilogo-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #1e2026;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .15s, border-color .15s;
  user-select: none;
  -webkit-user-select: none;
}
.riepilogo-row:nth-child(odd)  { background: #101218; }
.riepilogo-row:nth-child(even) { background: #0c0e12; }
.riepilogo-row:active:not(.riepilogo-row-done) { background: #1a1d26 !important; }

/* Spuntato = preso (sfondo diverso + testo barrato, senza re-render) */
.riepilogo-row-done {
  background: rgba(56, 161, 105, 0.22) !important;
  border-bottom-color: #2f4a3a;
  box-shadow: inset 4px 0 0 0 rgba(56, 161, 105, 0.85);
}
.riepilogo-row-done .riepilogo-item-name {
  color: #c8f5dc;
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.riepilogo-row-done .riepilogo-item-qty,
.riepilogo-row-done .riepilogo-item-sub {
  opacity: 0.82;
}

/* Checkbox quadrato cassa */
.riepilogo-check {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid #6b7280;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  color: transparent;
  margin-top: 2px;
  background: #1a1c22;
  transition: background .12s, border-color .12s, color .12s;
}
.riepilogo-check-on {
  background: #276749;
  border-color: #48bb78;
  color: #fff;
}

/* Info articolo */
.riepilogo-item-info { flex: 1; min-width: 0; }
.riepilogo-item-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.28;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.riepilogo-item-code {
  font-size: 11px;
  color: #9ca3af;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  margin-top: 3px;
  line-height: 1.3;
}
.riepilogo-code-m,
.riepilogo-code-f,
.riepilogo-code-sep { color: #9ca3af; }
.riepilogo-item-nota {
  font-size: 11px;
  color: #f6ad55;
  font-style: italic;
  margin-top: 3px;
}

/* Destra: qty (giallo) + importo (verde) */
.riepilogo-item-right {
  text-align: right;
  flex-shrink: 0;
  padding-left: 4px;
}
.riepilogo-item-qty {
  font-size: 16px;
  font-weight: 900;
  color: #f6e05e;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.riepilogo-item-sub {
  font-size: 15px;
  color: #9ae6b4;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* Footer fisso */
.riepilogo-footer {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  border-top: 2px solid #25272c;
  flex-shrink: 0;
  background: #08090b;
}
.riepilogo-btn-reset {
  background: #1f2128;
  border: 1px solid #3d424d;
  color: #a0aec0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.riepilogo-btn-reset:active { background: #2d313b; }
.riepilogo-btn-close {
  flex: 1;
  background: linear-gradient(180deg, #f6e05e 0%, #ecc94b 100%);
  border: none;
  color: #1a202c;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .03em;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 0 #b7791f;
}
.riepilogo-btn-close:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b7791f;
}

/* Molti articoli: compattezza senza ridurre troppo i font */
.riepilogo-modal--dense .riepilogo-header {
  padding: 10px 12px 10px;
}
.riepilogo-modal--dense .riepilogo-title { font-size: 16px; }
.riepilogo-modal--dense .riepilogo-total-val { font-size: 20px; }
.riepilogo-modal--dense .riepilogo-total-row { margin-top: 6px; padding: 6px 8px; }
.riepilogo-modal--dense .riepilogo-row {
  padding: 7px 12px;
  gap: 10px;
}
.riepilogo-modal--dense .riepilogo-check {
  width: 26px;
  height: 26px;
  font-size: 14px;
}
.riepilogo-modal--dense .riepilogo-item-name { font-size: 14px; }
.riepilogo-modal--dense .riepilogo-item-qty { font-size: 15px; }
.riepilogo-modal--dense .riepilogo-item-sub { font-size: 14px; }

/* Overlay riepilogo: sheet a tutta larghezza dal basso */
#riepilogo-overlay.open {
  align-items: flex-end !important;
  justify-content: center !important;
}

/* ── Garanzia min 44px su bottoni touch principali ─────── */
button[touch-action="manipulation"],
.cart-tab-pill,
.numpad-btn,
.ct-qty-btn,
.ct-icon-btn,
.ct-fbtn,
.ct-btn-cerca,
.tab-bottom-btn {
  min-height: 44px;
}

/* Animazione caricamento DB */
@keyframes _dbspin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE-FIRST: Carrello (tab ordini → ordini.css)
   ═══════════════════════════════════════════════════════════════ */

/* ── Carrello: tab bar scrollabile orizzontalmente ── */
#cart-tabs-bar {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  gap: 8px !important;
  padding: 10px 12px 10px !important;
}
#cart-tabs-bar::-webkit-scrollbar { display: none !important; }

/* ── Pillole carrello: più alte e leggibili ── */
.cart-tab-pill {
  min-height: 40px !important;
  padding: 8px 16px !important;
  font-size: 13px !important;
  flex-shrink: 0 !important; /* non si restringono */
}
.cart-tab-pill.new-cart-pill {
  min-height: 40px !important;
  padding: 8px 14px !important;
}

/* ── Barra ricerca carrello: font 16px anti-zoom iOS ── */
#cart-search {
  font-size: 16px !important;
  padding: 12px 14px !important;
  border-radius: 12px !important;
}

/* ── Riepilogo: righe più alte se pochi articoli (lista “comoda”) ── */
.riepilogo-modal:not(.riepilogo-modal--dense) .riepilogo-row {
  min-height: 60px !important;
  padding: 14px 16px !important;
}
.riepilogo-modal:not(.riepilogo-modal--dense) .riepilogo-check {
  width: 32px !important;
  height: 32px !important;
  font-size: 17px !important;
}
.riepilogo-modal:not(.riepilogo-modal--dense) .riepilogo-item-name {
  font-size: 16px !important;
}
.riepilogo-modal--dense .riepilogo-row {
  min-height: 50px !important;
}
.riepilogo-btn-reset,
.riepilogo-btn-close {
  min-height: 52px !important;
}
.riepilogo-modal:not(.riepilogo-modal--dense) .riepilogo-btn-close {
  font-size: 18px !important;
}

/* ── Numpad overlay: tasti più grandi ── */
.numpad-btn {
  min-height: 56px !important;
  font-size: 24px !important;
  border-radius: 14px !important;
}

/* ── Overlay nuovo cliente: input grandi ── */
#nc-overlay input {
  font-size: 16px !important;
  padding: 12px 14px !important;
}


/* ══════════════════════════════════════════════════════════════════════════════
   FOOTER CARRELLO — 3 TASTI OPERATIVI GRANDI
   Layout: flex row, tasti grandi separati, usabili con una mano su iPhone
   ══════════════════════════════════════════════════════════════════════════════ */

/* Riga dei 3 tasti principali: Svuota / Riepilogo / Conferma */
.pos-footer-btns-big {
  display: flex !important;
  gap: 8px !important;
  padding: 10px 10px 4px !important;
}

/* Stile base di ogni tasto grande nel footer */
.pos-big-btn {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 12px 4px !important;
  border-radius: 12px !important;
  border: none !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .5px !important;
  cursor: pointer !important;
  min-height: 58px !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
}
.pos-big-btn span { font-size: 10px !important; }

/* 🗑️ SVUOTA — rosso */
.pos-big-btn-danger {
  background: rgba(229,62,62,.15) !important;
  border: 1px solid rgba(229,62,62,.5) !important;
  color: #fc8181 !important;
}
.pos-big-btn-danger:active { background: rgba(229,62,62,.3) !important; }

/* 👀 RIEPILOGO — arancione medio */
.pos-big-btn-orange {
  background: rgba(245,196,0,.12) !important;
  border: 1px solid rgba(245,196,0,.4) !important;
  color: var(--accent) !important;
}
.pos-big-btn-orange:active { background: rgba(245,196,0,.25) !important; }

/* 🛍️ CONFERMA — arancione acceso, più prominente */
.pos-big-btn-confirm {
  background: linear-gradient(135deg, var(--accent), #ff9800) !important;
  border: none !important;
  color: #111 !important;
  font-weight: 900 !important;
}
.pos-big-btn-confirm:active { opacity: .85 !important; }
.pos-big-btn-confirm:disabled { opacity: .4 !important; }



/* ══════════════════════════════════════════════════════════════════════════════
   CART REDESIGN v3 — DEFINITIVO
   Giallo #FFD700 | Dark #121212 | max-width 600px centrato | Responsive
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
  --ct-bg:      #121212;
  --ct-card:    #1a1b1d;
  --ct-border:  #2a2b2e;
  --ct-text:    #f0f0f0;
  --ct-muted:   #7a7d82;
  --ct-yellow:  #FFD700;
  --ct-yellow2: #e6c200;
  --ct-red:     #e53e3e;
  --ct-green:   #48bb78;
  --ct-blue:    #4299e1;
  --ct-r:       10px;
  --ct-max:     600px;   /* larghezza massima su PC */
}

/* ── Tab carrello ─────────────────────────────────────────────────────────── */
#tc {
  background: var(--ct-bg) !important;
  padding: 0 !important;
  min-height: 100vh !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   TESTATA CARRELLO — 3 righe fisse, centrate, max 600px
   Riga 1: [ORDINI centrato]
   Riga 2: [CLIENTI▾] [＋NUOVO]
   Riga 3: pillole nomi (scroll laterale, non trabocca mai)
   ═══════════════════════════════════════════════════════════════════════ */

/* Contenitore testata — sticky sotto app-header */
#ct-header-wrap {
  position: sticky;
  top: 56px;               /* altezza app-header */
  z-index: 200;
  background: #111;
  border-bottom: 2px solid var(--ct-yellow);
  width: 100%;
  box-sizing: border-box;
}

/* Centro tutte le righe interne */
.ct-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  max-width: var(--ct-max);
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
}

/* RIGA UNICA — ORDINI + CLIENTI + NUOVO */
.ct-header-row--compact {
  justify-content: center;
  padding-top: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #1e1e1e;
  gap: 6px;
}

/* RIGA 3 — pillole scroll laterale */
.ct-header-row--pills {
  padding-top: 4px;
  padding-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;        /* NO wrap — SOLO scroll orizzontale */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 5px;
}
.ct-header-row--pills::-webkit-scrollbar { display: none; }

/* ── Tasto ORDINI — rosso, discreto ────────────────────────────── */
#ct-btn-ordfor {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 16px;
  border: 1px solid rgba(229,62,62,.35);
  background: transparent;
  color: rgba(252,129,129,.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .1s, filter .1s;
  min-height: 30px;
  white-space: nowrap;
}
#ct-btn-ordfor:active { transform: scale(.96); filter: brightness(.88); }

/* ── Tasto CLIENTI — arancione, discreto ───────────────────────── */
#ct-btn-clienti {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 16px;
  border: 1px solid rgba(246,173,85,.4);
  background: transparent;
  color: #f6ad55;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 30px;
  white-space: nowrap;
  transition: background .12s;
}
#ct-btn-clienti:active { background: rgba(255,215,0,.1); }

/* Badge numero clienti */
#ct-btn-clienti .ct-pill-n {
  background: rgba(246,173,85,.2);
  color: #f6ad55;
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Tasto NUOVO — giallo acceso, ben visibile ───────────────────── */
.ct-pill--new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: 20px;
  border: 2px solid #FFD700;
  background: rgba(255,215,0,.15);
  color: #FFD700;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  min-height: 34px;
  letter-spacing: .5px;
}
.ct-pill--new:active { background: rgba(255,215,0,.3); }

/* ── Pillole clienti: non si restringono mai ────────────────────── */
.ct-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 34px;
  touch-action: manipulation;
  background: #2a2b2e;
  color: #888;
  transition: filter .12s, transform .1s;
}
.ct-pill.active {
  background: var(--ct-yellow);
  color: #111;
  border-color: var(--ct-yellow);
}
.ct-pill--mod {
  border: 2px dashed var(--ct-yellow) !important;
  background: repeating-linear-gradient(45deg,#111,#111 6px,#1e1c00 6px,#1e1c00 12px) !important;
  color: var(--ct-yellow) !important;
}
.ct-pill-n {
  background: rgba(0,0,0,.35);
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 9px;
  margin-left: 2px;
}
.ct-pill:active { transform: scale(.95); filter: brightness(.85); }

/* ══ DROPDOWN CLIENTI ════════════════════════════════════════════ */
#ct-clienti-dropdown {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1500;
}
#ct-clienti-dropdown.open { display: block; }

#ct-clienti-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}
#ct-clienti-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 94%;
  max-width: 400px;
  max-height: 75vh;
  background: #1a1b1d;
  border: 1px solid var(--ct-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.8);
  overflow-y: auto;
  padding: 16px 14px 20px;
  -webkit-overflow-scrolling: touch;
}
#ct-clienti-panel h3 {
  font-size: 16px;
  font-weight: 900;
  color: var(--ct-yellow);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ct-border);
}
.ct-clienti-day {
  font-size: 10px;
  font-weight: 700;
  color: var(--ct-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 12px 0 5px 2px;
}
.ct-clienti-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ct-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
  margin-bottom: 4px;
  transition: background .1s;
  font-family: inherit;
}
.ct-clienti-btn:active { background: #252628; }
.ct-clienti-btn.active {
  background: rgba(255,215,0,.1);
  border-color: rgba(255,215,0,.35);
  color: var(--ct-yellow);
}
.ct-clienti-n {
  background: rgba(255,215,0,.15);
  color: var(--ct-yellow);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.ct-clienti-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px;
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid var(--ct-border);
  background: transparent;
  color: var(--ct-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
}

/* ── Body carrello — centrato, spazio footer ─────────────── */
#cart-body {
  max-width: var(--ct-max);
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px 200px !important;
  background: var(--pos-bg) !important;
}

/* ── Stato vuoto ─────────────────────────────────────────────────── */
.ct-empty { text-align: center; padding: 60px 20px; color: var(--ct-muted); }
.ct-empty-icon { font-size: 56px; margin-bottom: 12px; opacity: .3; }
.ct-empty p { font-size: 14px; }

/* ── Box inviato ─────────────────────────────────────────────────── */
.ct-inviato-box { background: #1a2a1a; border: 1px solid #38a16944; border-radius: 12px; padding: 14px; margin-bottom: 12px; overflow: hidden; }
.ct-inviato-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ct-inviato-label {
  font-size: 14px;
  font-weight: 800;
  color: #68d391;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.ct-inviato-nome  { font-size: 10px; color: #555; }
.ct-price-big { font-size: 18px; font-weight: 900; color: var(--ct-yellow); }
.ct-inviato-row { padding: 5px 0; border-bottom: 1px solid #1e2e1e; display: flex; justify-content: space-between; align-items: center; }
.ct-price-sm  { text-align: right; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--ct-yellow); }

/* Promemoria esauriti — solo dopo invio cassa, dentro .ct-inviato-box: striscia verde acqua sottile a tutta larghezza */
.ct-inviato-box .ct-inviato-esauriti-banner {
  display: block;
  box-sizing: border-box;
  width: calc(100% + 28px);
  margin: 10px -14px -14px;
  padding: 6px 10px;
  border-radius: 0 0 12px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  background: #7dd3c0;
  color: #1a365d;
  border: none;
  border-top: 1px solid rgba(17, 24, 39, 0.1);
  letter-spacing: 0.02em;
}

/* Banner modifica cantiere */
.ct-banner-mod {
  background: repeating-linear-gradient(45deg, #1a1700, #1a1700 8px, #0d0d00 8px, #0d0d00 16px);
  border: 1px dashed var(--ct-yellow);
  border-radius: 6px; padding: 5px 10px; margin: 4px 8px;
  display: flex; align-items: center; gap: 6px;
}
.ct-banner-mod-title { font-size: 11px; font-weight: 800; color: var(--ct-yellow); }

/* ── Pulsanti base ────────────────────────────────────────────────── */
.ct-btn-yellow {
  background: rgba(255,215,0,.12); border: 1px solid rgba(255,215,0,.4);
  border-radius: 8px; color: var(--ct-yellow); font-size: 13px; font-weight: 700;
  padding: 10px 14px; cursor: pointer; touch-action: manipulation;
}
.ct-btn-solid {
  background: var(--ct-yellow); border: none; border-radius: 8px;
  color: #111; font-size: 13px; font-weight: 800; cursor: pointer; touch-action: manipulation;
}
.ct-btn-ghost {
  background: transparent; border: 1px solid #333; border-radius: 8px;
  cursor: pointer; touch-action: manipulation;
}

/* ── CERCA PER CODICE ────────────────────────────────────────────── */
#cart-action-btns {
  padding: 4px 8px 2px;
}
.ct-btn-cerca {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 16px;
  background: linear-gradient(135deg, #b38600, var(--ct-yellow));
  color: #111; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; touch-action: manipulation; min-height: 40px;
  box-shadow: 0 2px 10px rgba(255,215,0,.2);
}
.ct-btn-cerca:active { filter: brightness(.88); }

/* ── Barra ricerca testo ─────────────────────────────────────────── */
#cart-search-wrap { padding: 4px 8px; }

/* ── Sticky totale ───────────────────────────────────────────────── */
.ct-sticky-total {
  position: sticky; top: calc(56px + 48px); z-index: 100;
  background: var(--ct-bg); padding: 6px 10px 4px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--ct-border); margin-bottom: 6px;
  max-width: var(--ct-max); margin-left: auto; margin-right: auto;
  width: 100%; box-sizing: border-box;
}
.ct-sticky-client {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: #ececec;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ct-sticky-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ct-sconto-badge { background: rgba(255,215,0,.15); color: var(--ct-yellow); padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; flex-shrink: 0; }
/* Badge FATTURA nel carrello (sticky bar + sezione "Ordine inviato"):
   testo rosso acceso, bordo giallo, grassetto — stesso stile dell'ord-fattura-badge. */
.ct-fattura-badge {
  display: inline-block;
  background: #0e0e0e;
  border: 2px solid #ffd400;
  color: #ff2d2d;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .6px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 1px rgba(255, 0, 0, .35);
  box-shadow: 0 0 0 1px rgba(255, 212, 0, .25), 0 0 6px rgba(255, 212, 0, .25);
}
body.light-mode .ct-fattura-badge {
  background: #fffceb;
  color: #d40000;
  border-color: #d4a300;
  box-shadow: 0 0 0 1px rgba(212, 163, 0, .25);
}
.ct-sticky-n     { font-size: 12px; color: var(--ct-muted); font-weight: 600; flex-shrink: 0; }
.ct-btn-sconto {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid rgba(255,215,0,.35); background: transparent;
  color: var(--ct-yellow); font-size: 11px; font-weight: 700;
  cursor: pointer; touch-action: manipulation;
}

/* ══ CARD ARTICOLO ═══════════════════════════════════════════════════════ */
.ct-card {
  background: var(--ct-card);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-r);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
#tc .ct-card {
  overflow: visible;
}
.ct-card--checked { border-color: rgba(56,161,105,.5) !important; background: rgba(56,161,105,.03) !important; }
.ct-card--mod {
  border: 2px dashed var(--ct-yellow) !important;
  background: linear-gradient(var(--ct-card), var(--ct-card)) padding-box,
    repeating-linear-gradient(45deg,var(--ct-yellow) 0,var(--ct-yellow) 4px,#111 4px,#111 10px) border-box !important;
}

/* Griglia: nome (min >0 così non collassa) | qtà | prezzo | tot */
#tc .ct-card .ord-grid {
  grid-template-columns:
    minmax(11rem, 1.2fr)
    minmax(72px, auto)
    minmax(6.5rem, 1fr)
    minmax(6.5rem, 1fr);
  column-gap: 5px;
  padding: 0 4px;
  align-items: center;
  box-sizing: border-box;
}
#tc .ct-card .ord-gc-desc {
  min-width: 0;
}
#tc .ct-card .ord-gc-qty {
  min-width: 0;
}
#tc .ct-card .ord-gc-qty {
  justify-self: center;
}
#tc .ct-card .ord-gc-price,
#tc .ct-card .ord-gc-sub {
  min-width: 6.5rem;
  overflow: visible;
}
/* Nome: a capo solo tra parole (mai una lettera per riga — no overflow-wrap:anywhere) */
#tc .ct-card .ord-item-name {
  display: block;
  overflow: visible;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
  min-height: 0;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}
#tc .ct-card .ord-gc-sub {
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
}
#tc .ct-card .ord-gc-sub .ct-prz-stack,
#tc .ct-card .ord-gc-sub .ct-prz-stack--tot {
  align-items: flex-end;
  text-align: right;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#tc .ct-card .ord-gc-sub .ord-gc-sub-val {
  width: 100%;
  max-width: 100%;
  text-align: right;
  box-sizing: border-box;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Tab carrello: spazio tra griglia prezzi e barra forbici / leggibilità */
#tc .ct-card .ord-grid-row {
  padding-top: 6px;
  padding-bottom: 10px;
}
#tc .ct-card .ord-gc-price {
  align-items: center;
  justify-content: flex-start;
  font-size: 12px;
  line-height: 1.3;
  color: #c4c4c4;
  gap: 4px;
}
#tc .ct-card .ord-gc-sub {
  font-size: 12px;
  line-height: 1.3;
  font-weight: 900;
  color: var(--ct-yellow);
  min-height: 0;
  gap: 2px;
}
#tc .ct-card .ord-gc-sub .ct-prz-stack--tot {
  width: 100%;
}
/* Totale riga articolo: giallo, compatto, allineato a destra nella colonna */
#tc .ct-card .ord-gc-sub-val {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
/* Codici: mag giallo e f. fornitore affiancati (niente seconda “pillola”) */
#tc .ct-card .ord-item-codes-line {
  flex-wrap: nowrap;
  gap: 4px 6px;
  align-items: center;
}
#tc .ct-card .ord-item-codes-line .ord-code-mag {
  flex-shrink: 0;
}
#tc .ct-card .ord-item-codes-line .ord-code-forn.ord-code-forn--inp {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}
/* Input codice fornitore: come testo inline, no riquadro (solo tratto sottile) */
#tc .ct-codf-inp {
  flex: 1 1 auto;
  min-width: 2.25em;
  max-width: 8em;
  box-sizing: border-box;
  padding: 0 2px;
  border: none;
  border-radius: 0;
  border-bottom: 1px dashed rgba(252, 129, 129, 0.45);
  background: transparent;
  color: #fc8181 !important;
  font-size: 11px;
  font-weight: 800;
  font-family: inherit;
  outline: none;
}
#tc .ct-codf-inp:focus {
  border-bottom-color: var(--ct-yellow, #f5c400);
  color: #ffb4b4 !important;
}
/* Stack prezzi con sconto: niente sovrapposizioni (override line-height globali) */
#tc .ct-card .ct-prz-stack {
  gap: 5px;
  padding: 2px 0 3px;
  flex-shrink: 0;
}
#tc .ct-card .ord-gc-price .ct-prz-stack {
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#tc .ct-card .ct-prz-stack.ct-prz-stack--unit .ct-old--orig,
#tc .ct-card .ct-prz-stack.ct-prz-stack--unit .ct-sub--final,
#tc .ct-card .ct-prz-stack.ct-prz-stack--unit .ct-prz-sconto-sav {
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#tc .ct-card .ct-prz-stack .ct-old--orig {
  position: relative;
  z-index: 0;
  line-height: 1.25;
  margin: 0;
  padding: 0 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#tc .ct-card .ct-prz-stack .ct-sub--final {
  line-height: 1.2;
  margin: 0;
  padding: 0 1px;
}
#tc .ct-card .ct-prz-stack .ct-prz-sconto-sav {
  line-height: 1.25;
  margin: 0;
  margin-top: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#tc .ct-card .ct-prz-stack--tot .ct-sub--final {
  font-size: 16px;
  text-align: right;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Prezzo unità con fascia sconto: compatto nella colonna */
#tc .ct-card .ct-prz-stack.ct-prz-stack--unit .ct-sub--final {
  font-size: 14px;
}
/* Zona Base €/kg con sconto: seconda riga sotto tag+campo */
#tc .ct-card .ct-pb-inline:has(.ct-pb-struck) {
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 5px;
}
#tc .ct-card .ct-pb-inline:has(.ct-pb-struck) .ct-pb-disc {
  flex: 1 1 100%;
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding-top: 1px;
}
/* €/UM: una riga, non troncato (es. €784,00) */
#tc .ct-card .ord-gc-price .ct-punit {
  border: none;
  border-bottom: none;
  background: transparent;
  box-shadow: none;
  margin-top: 0;
  padding: 2px 4px;
  font-size: 14px;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-weight: 700;
  color: #d8d8d8;
  cursor: text;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
  caret-color: var(--ct-yellow, #ffd700);
  -webkit-appearance: none;
  appearance: none;
  touch-action: auto;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#tc .ct-card .ord-gc-price .ct-punit:focus {
  border: none;
  border-bottom: none;
  outline: none;
  color: var(--ct-muted, #aaa);
}
#tc .ct-card .ord-gc-price .ct-punit:focus-visible {
  outline: 1px solid rgba(255, 215, 0, 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}
#tc .ct-sticky-total {
  color: var(--ct-yellow);
}

/* Griglia riga: qtà/prezzi centrati in altezza; desc multi-riga in alto */
#tc .ct-card .ord-gc-desc {
  align-self: start;
}
/* Stepper come prima (− | qtà | + in riga); +/− = rettangoli verticali (pochi px in larghezza) */
#tc .ct-qty--compact {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}
#tc .ct-qty--compact .ct-qty-btn {
  width: 22px;
  height: 34px;
  min-width: 22px;
  min-height: 32px;
  max-width: 24px;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
  border-radius: 5px;
  flex-shrink: 0;
  line-height: 1;
  box-sizing: border-box;
}
#tc .ct-qty--compact .ct-qty-val {
  min-width: 26px;
  max-width: 48px;
  height: 34px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 900;
  padding: 0 3px;
  border-radius: 5px;
  box-sizing: border-box;
  white-space: nowrap;
}
/* Select UM più compatto; numero quantità più evidente */
#tc .ct-um-select.ct-um--mini {
  min-height: 22px;
  min-width: 26px;
  padding: 1px 3px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 5px;
}

/* Riga A: foto | info | prezzo — LEGACY, usata solo nello stato inviato */
.ct-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 10px 6px;
}

/* ── Cart grid: stepper compatto dentro griglia ──────────────────── */
.ct-grid-qty {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ct-qty--compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}
.ct-qty--compact .ct-qty-btn {
  min-width: 24px; min-height: 24px; font-size: 14px;
  padding: 0; border-radius: 5px;
}
.ct-qty--compact .ct-qty-val {
  min-width: 26px; min-height: 24px; font-size: 13px;
  padding: 0 1px;
}
.ct-um--mini {
  font-size: 9px; min-height: 20px; padding: 0 3px;
  border-radius: 4px; min-width: 30px;
}

/* Riga B: stepper qty + UM */
.ct-row-b {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 8px;
  border-top: 1px solid rgba(255,255,255,.04);
}
.ct-row-b-spacer { flex: 1; }

/* Miniatura foto */
.ct-thumb {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0; cursor: pointer;
  background: #252628;
}
.ct-thumb--empty {
  width: 48px; height: 48px; border-radius: 8px; background: #252628;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

/* ── NOME PRODOTTO: SEMPRE leggibile, va a capo ───────────────────── */
.ct-info { flex: 1; min-width: 0; }
.ct-nome {
  font-size: 13px;
  font-weight: 700;
  color: var(--ct-text);
  white-space: normal;           /* SEMPRE a capo — mai troncato */
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  display: block;
  width: 100%;
  cursor: pointer;
  margin-bottom: 4px;
}

/* ── CODICI: 16px, affiancati, visibili ───────────────────────────── */
.ct-codes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
}
.ct-code {
  font-size: 13px;
  color: var(--ct-muted);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ct-code b {
  color: var(--ct-yellow);
  font-weight: 800;
  font-size: 14px;
}
.ct-code--mag b {
  color: var(--ct-yellow) !important;
  font-size: 14px !important;
}
.ct-code-sep { color: #3a3a3a; font-size: 11px; margin: 0 2px; }

/* Input Cod.Fornitore — cliccabile, rosso chiaro */
.ct-codf-inp {
  font-size: 14px;
  font-weight: 800;
  color: #fc8181;                /* rosso = fornitore */
  font-family: 'Courier New', monospace;
  background: transparent;
  border: none;
  border-bottom: 1px dashed #fc818166;
  padding: 0 2px;
  width: 80px;
  min-width: 40px;
  max-width: 120px;
  outline: none;
  cursor: text;
}
.ct-codf-inp:focus {
  border-bottom-color: #fc8181;
  background: rgba(252,129,129,.07);
  border-radius: 2px;
}

/* ── PREZZI ─────────────────────────────────────────────────────────── */
.ct-price-block {
  text-align: right;
  flex-shrink: 0;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 2px;
}

/* Prezzo normale — giallo */
.ct-sub {
  font-size: 17px; font-weight: 900; color: var(--ct-yellow);
  line-height: 1.1; white-space: nowrap;
}

/* Prezzo ORIGINALE — BLU sbarrato */
.ct-old,
.ct-old--orig {
  font-size: 9px;
  color: var(--ct-blue);
  text-decoration: line-through;
  display: block;
  text-align: center;
  font-weight: 600;
  line-height: 1.1;
}

/* Prezzo FINALE scontato — VERDE acceso, grassetto */
.ct-sub--final {
  font-size: 12px;
  font-weight: 900;
  color: var(--ct-green);
  line-height: 1.1;
  white-space: nowrap;
  display: block;
  text-align: center;
}

/* Input prezzo/unità (piccolo sotto il prezzo) — non tagliare importi tipo 0,0024 */
.ct-punit {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 28px;
  text-align: center;
  font-size: 8px;
  color: #555;
  background: transparent;
  border: none;
  border-bottom: 1px dashed #333;
  padding: 3px 2px;
  margin-top: 2px;
  font-family: monospace, ui-monospace, sans-serif;
  cursor: text;
  outline: none;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
}
.ct-punit:focus { border-bottom-color: var(--ct-yellow); color: var(--ct-muted); }

/* ── STEPPER QTÀ ─────────────────────────────────────────────────── */
.ct-qty { display: flex; align-items: center; gap: 1px; }
.ct-qty-btn {
  min-width: 44px; min-height: 44px;
  background: #1e2022; border: 1px solid var(--ct-border);
  border-radius: 10px; color: var(--ct-yellow);
  font-size: 22px; font-weight: 700;
  cursor: pointer; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.ct-qty-btn:active { background: #2e3033; }
.ct-qty-val {
  min-width: 50px; min-height: 44px;
  background: #111; border: 1px solid var(--ct-border);
  border-radius: 8px; text-align: center;
  font-size: 18px; font-weight: 900; color: var(--ct-text);
  cursor: pointer; touch-action: manipulation; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* ── U.M. select ────────────────────────────────────────────────── */
.ct-um-select {
  padding: 8px 6px; border: 1px solid var(--ct-border);
  border-radius: 8px; background: #111; color: var(--ct-yellow);
  font-size: 13px; font-weight: 700; cursor: pointer;
  outline: none; min-width: 56px; min-height: 44px;
  text-align-last: center; touch-action: manipulation;
}
.ct-um-select:focus { border-color: var(--ct-yellow); }

/* ── ICONBAR ────────────────────────────────────────────────────── */
.ct-iconbar {
  display: flex;
  align-items: flex-start;
  gap: 6px 8px;
  padding: 8px 8px 8px;
  margin-top: 2px;
  border-top: 1px solid rgba(255,255,255,.04);
  flex-wrap: wrap;
  row-gap: 8px;
}
.ct-icon-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 1px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid #2a2b2e; background: transparent;
  color: var(--ct-muted); cursor: pointer; touch-action: manipulation;
  font-size: 8px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; min-height: 36px; min-width: 36px;
  transition: background .1s, color .1s, border-color .1s;
  -webkit-tap-highlight-color: transparent;
}
.ct-icon-btn svg { width: 15px; height: 15px; }
.ct-icon-btn--on { color: var(--ct-yellow); border-color: rgba(255,215,0,.4); background: rgba(255,215,0,.08); }
.ct-icon-btn--rotolo { color: var(--ct-red); border-color: rgba(229,62,62,.5); background: rgba(229,62,62,.1); }
.ct-icon-btn--scag { color: #63b3ed; border-color: rgba(99,179,237,.5); background: rgba(99,179,237,.1); }
.ct-icon-btn--ordina span { font-size: 8px; }
.ct-icon-btn--del { color: #555; border-color: transparent; }
.ct-icon-btn--del:active { color: var(--ct-red); }
.ct-icon-btn--dao-clear {
  font-size: 14px;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  color: #aaa;
  border-color: #444;
  background: #252525;
  min-width: 40px;
  padding: 4px 6px;
}
.ct-icon-btn--dao-clear:active { color: #e0e0e0; }
.ct-icon-btn--sconti { border-style: dashed; }
.ct-icon-btn:active { filter: brightness(.82); }

/* ── FORBICI + % INLINE ─────────────────────────────────────────── */
.ct-forbici-row {
  display: flex;
  align-items: center;
  gap: 4px 6px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  padding-bottom: 2px;
}
.ct-sc-inline {
  display: flex; align-items: center; gap: 2px;
}
.ct-sc-inp {
  width: 32px; padding: 2px 1px; border: 1px solid #333;
  border-radius: 4px; background: #111; color: #68d391;
  font-size: 11px; font-weight: 700; text-align: center;
}
.ct-sc-pct { font-size: 10px; color: #68d391; font-weight: 700; }
.ct-sc-risp { font-size: 9px; color: var(--ct-yellow); font-weight: 700; margin-left: 1px; }

/* ── PANNELLI A COMPARSA ────────────────────────────────────────── */
.ct-panel {
  padding: 10px 12px 12px;
  background: #141516;
  border-top: 1px solid #222;
}
.ct-panel-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.ct-pl { font-size: 11px; color: var(--ct-muted); font-weight: 600; white-space: nowrap; }

/* ── Input sconto %: grande, ricalcola LIVE ─────────────────────── */
.ct-pi {
  width: 80px; padding: 8px; border-radius: 8px;
  border: 2px solid rgba(255,215,0,.4);
  background: #111; color: var(--ct-yellow);
  font-size: 18px; font-weight: 900; text-align: center;
  -webkit-appearance: none; outline: none;
}
.ct-pi:focus { border-color: var(--ct-yellow); }

/* Preview blu/verde nel pannello sconto */
.ct-panel-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px; border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.ct-pp-orig { font-size: 13px; color: var(--ct-blue); text-decoration: line-through; font-weight: 600; }
.ct-pp-fin  { font-size: 15px; color: var(--ct-green); font-weight: 900; }

/* Scaglioni */
.ct-scag-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 11px; color: var(--ct-muted); }
.ct-si { width: 54px; padding: 5px; border: 1px solid #333; border-radius: 6px; background: #111; color: var(--ct-text); font-size: 13px; text-align: center; }
.ct-si--pct { color: var(--ct-yellow); }
.ct-scag-res { color: var(--ct-green); font-size: 12px; font-weight: 700; }
.ct-scag-del { background: transparent; border: none; color: #555; cursor: pointer; font-size: 14px; padding: 0 4px; }
.ct-scag-add { margin-top: 6px; padding: 5px 12px; border-radius: 6px; border: 1px dashed #3182ce; background: transparent; color: #3182ce; font-size: 11px; font-weight: 700; cursor: pointer; }

/* Textarea nota */
.ct-nota-inp {
  width: 100%; min-height: 70px; padding: 8px 10px;
  border: 1px solid var(--ct-border); border-radius: 8px;
  background: #111; color: var(--ct-text); font-size: 13px;
  resize: vertical; font-family: inherit; outline: none;
}
.ct-nota-inp:focus { border-color: var(--ct-yellow); }

/* Preview nota sotto la card */
.ct-nota-prev {
  padding: 5px 12px; font-size: 11px; color: #f6ad55;
  background: rgba(246,173,85,.07); border-top: 1px solid #2a2b2e;
  font-style: italic;
}

/* Badge stati */
.ct-badges { padding: 5px 10px 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.ct-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: rgba(255,255,255,.07); color: var(--ct-muted);
}
.ct-badge--red    { background: rgba(229,62,62,.15);   color: #fc8181; }
.ct-badge--yellow { background: rgba(255,215,0,.12);   color: var(--ct-yellow); }
.ct-badge--blue   { background: rgba(49,130,206,.12);  color: #63b3ed; }

/* Nota ordine (textarea sopra footer carrello) */
.pos-nota-ordine-wrap {
  padding: 0 10px 8px !important;
}
#cart-order-nota-row {
  padding: 8px 10px !important;
}
.pos-nota-ordine {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 8px 10px !important;
  border: 1px solid var(--ct-border) !important;
  border-radius: 8px !important;
  background: #111 !important;
  color: var(--ct-muted) !important;
  font-size: 12px !important;
  resize: none !important;
  font-family: inherit !important;
  outline: none !important;
}
.pos-nota-ordine:focus {
  border-color: var(--ct-yellow) !important;
  color: var(--ct-text) !important;
}

/* Prezzo base €/kg: a sinistra "Base" + campo; a destra gli importi base in orizzontale */
.ct-pb-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-top: 3px;
  padding: 4px 2px 4px;
  border-top: 1px solid rgba(255,255,255,.1);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  overflow: visible;
}
.ct-pb-tag {
  font-size: 8px;
  font-weight: 800;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  flex-shrink: 0;
}
.ct-pb-inp {
  width: 52px;
  min-width: 38px;
  max-width: 80px;
  flex: 0 1 52px;
  box-sizing: border-box;
  padding: 3px 5px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #1a1a1c;
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}
.ct-pb-inp::placeholder { color: #666; -webkit-text-fill-color: #666; }
.ct-pb-inp:focus {
  outline: none;
  border-color: var(--ct-yellow, #f5c400);
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}
.ct-pb-disc {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 8px;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  margin-left: auto;
  font-size: 10px;
  line-height: 1.15;
}
.ct-pb-struck {
  text-decoration: line-through;
  color: #9ca3af;
  font-weight: 600;
  font-size: 10px;
}
.ct-pb-final {
  color: #48bb78;
  font-weight: 900;
  font-size: 12px;
}
.ct-pb-sav {
  color: #f6ad55;
  font-weight: 700;
  font-size: 9px;
}

/* Superficie MQ: H × L compatti vicino all'UM */
.ct-mq-hl {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px 4px;
  margin-top: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.ct-mq-hl-lbl {
  font-size: 8px;
  font-weight: 800;
  color: #888;
  flex-shrink: 0;
}
.ct-mq-x {
  font-size: 10px;
  color: #666;
  font-weight: 700;
  flex-shrink: 0;
  padding: 0 1px;
}
.ct-mq-inp {
  width: 36px;
  min-width: 32px;
  max-width: 52px;
  flex: 0 1 40px;
  box-sizing: border-box;
  padding: 2px 4px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #1a1a1c;
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
}
.ct-mq-inp::placeholder { color: #555; -webkit-text-fill-color: #555; }
.ct-mq-inp:focus {
  outline: none;
  border-color: var(--ct-yellow, #f5c400);
}

/* Scampolo / totale riga: verticale (listino sopra, finale sotto) */
.ct-prz-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.ct-prz-stack .ct-old--orig {
  display: block;
  font-size: 10px;
  line-height: 1.2;
  text-decoration: line-through;
  color: #9ca3af;
  font-weight: 600;
}
.ct-prz-stack .ct-sub--final {
  display: block;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 900;
  color: #48bb78;
}
.ct-prz-stack--tot .ct-sub--final {
  font-size: 17px;
}
.ct-prz-stack .ct-prz-sconto-sav {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: #f6ad55;
  margin-top: 0;
}
.ct-prz-stack--tot .ct-prz-sconto-sav {
  font-size: 10px;
}
.ct-prz-single {
  font-size: 12px;
  font-weight: 900;
  color: #999;
  white-space: nowrap;
}

/* Badge promo Giornalino [G] vicino ai prezzi (ricerca/carrello/ordini). */
.promo-g-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid #ff9800;
  background: #ff9800;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.2px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.ct-price-promo-wrap {
  margin-top: 3px;
  display: flex;
  justify-content: center;
  width: 100%;
}
/* Compat overlay modifica ordine */
.ct-prezzo-base-row {
  margin: 4px 0 6px;
  padding: 4px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ct-prezzo-base-lbl { font-size: 9px; color: #888; display: block; margin-bottom: 4px; }
.ct-prezzo-base-inp {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #3d3d44;
  border-radius: 6px;
  background: #1a1a1c;
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
}
.ct-prezzo-base-inp:focus {
  outline: none;
  border-color: var(--ct-yellow, #f5c400);
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}
.ct-prezzo-base-hint { font-size: 9px; color: #666; margin-top: 3px; display: block; }

/* ── POPUP COLORE ORDINE ─────────────────────────────────────────── */
.ct-color-popup {
  position: absolute; z-index: 7999;
  background: #1e2022; border: 1px solid #333; border-radius: 12px;
  padding: 12px; min-width: 200px; max-width: min(92vw, 320px);
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
}
.ct-color-title { font-size: 10px; font-weight: 700; color: var(--ct-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.ct-color-opt {
  display: block; width: 100%; padding: 7px 10px; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--ct-text);
  font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; margin-bottom: 3px;
  font-family: inherit;
}
.ct-color-opt-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ct-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.ct-color-opt--clear {
  color: var(--ct-muted) !important;
  border-color: transparent !important;
  margin-bottom: 0;
}
.ct-color-custom {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 0 6px; padding-top: 10px; border-top: 1px solid #333;
}
.ct-color-custom-lbl { font-size: 10px; color: #888; font-weight: 600; }
.ct-ord-col-pick {
  width: 42px; height: 30px; border: 1px solid #444; padding: 0;
  background: transparent; cursor: pointer; border-radius: 8px;
}
.ct-color-opt--mini {
  display: inline-flex !important; width: auto !important; margin: 0 !important;
  font-size: 11px !important; padding: 6px 12px !important;
}
.ct-color-opt:hover { background: rgba(255,255,255,.07); }
.ct-color-opt:last-child { margin-bottom: 0; }

/* ── MODAL FOTO ──────────────────────────────────────────────────── */
.ct-modal-foto {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.92); display: flex;
  align-items: center; justify-content: center; padding: 16px;
}
.ct-modal-box  { position: relative; max-width: 100%; max-height: 100%; }
.ct-modal-img  { max-width: 100%; max-height: 85vh; border-radius: 12px; object-fit: contain; display: block; }
.ct-modal-close {
  position: absolute; top: -14px; right: -14px;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.15); color: #fff; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ══ STICKY FOOTER CARRELLO ════════════════════════════════════════ */
#cart-pos-footer {
  position: fixed;
  bottom: 58px;
  left: 0;
  right: 0;
  z-index: 300;
  background: linear-gradient(135deg, #0d0d00, #111200);
  border-top: 2px solid var(--ct-yellow);
  box-shadow: 0 -3px 16px rgba(255,215,0,.15);
}
.ct-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  height: 58px;
  box-sizing: border-box;
  max-width: var(--ct-max);
  width: 100%;
  margin: 0 auto;
}
.ct-footer-tot { font-size: 22px; font-weight: 900; color: var(--ct-yellow); white-space: nowrap; flex-shrink: 0; }
.ct-footer-sym { font-size: 13px; color: #888; margin-right: 2px; }
.ct-footer-btns { display: flex; gap: 5px; align-items: center; }

.ct-fbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 5px 10px; border-radius: 10px; border: none;
  font-size: 9px; font-weight: 800; letter-spacing: .3px;
  cursor: pointer; min-height: 46px; min-width: 56px;
  touch-action: manipulation; user-select: none;
  transition: opacity .12s;
}
.ct-fbtn:disabled { opacity: .35; cursor: not-allowed; }
.ct-fbtn--danger    { background: rgba(229,62,62,.15); border: 1px solid rgba(229,62,62,.4); color: #fc8181; }
/* ELIMINA: rettangolo verticale stretto per risparmiare spazio sulla bottom bar mobile */
.ct-fbtn.ct-fbtn--danger {
  width: 35px !important;
  min-width: 35px !important;
  max-width: 35px !important;
  padding: 5px 0 !important;
  overflow: hidden;
}
.ct-fbtn.ct-fbtn--danger > span { display: none; }
.ct-fbtn--riepilogo { background: rgba(255,215,0,.1);  border: 1px solid rgba(255,215,0,.35); color: var(--ct-yellow); }
.ct-fbtn--cassa     { background: linear-gradient(135deg, var(--ct-yellow2), var(--ct-yellow)); color: #111; font-weight: 900; }
.ct-fbtn--avvisa    { background: rgba(99,179,237,.12); border: 1px solid rgba(99,179,237,.4); color: #63b3ed; }
.ct-fbtn--avvisa-on { background: rgba(99,179,237,.25); border: 1px solid #63b3ed; color: #90cdf4; animation: ctAvvisaPulse 2s ease-in-out infinite; }
/* Stesso schema di danger/riepilogo/avvisa: vetro + bordo, tinta viola #6f42c1 */
.ct-fbtn--fattura    { background: rgba(111,66,193,.12); border: 1px solid rgba(111,66,193,.42); color: #b794f4; }
.ct-fbtn--fattura-on { background: rgba(111,66,193,.24); border: 1px solid rgba(111,66,193,.65); color: #d6bcfa; }
@keyframes ctAvvisaPulse { 0%,100%{box-shadow:0 0 0 0 rgba(99,179,237,.4)} 50%{box-shadow:0 0 0 6px rgba(99,179,237,0)} }
.ct-fbtn--warn {
  background: rgba(229,62,62,.25) !important;
  border: 1px solid rgba(229,62,62,.6) !important;
  color: #fc8181 !important;
  animation: ctWarn .25s ease 2;
}
@keyframes ctWarn { 0%{transform:scale(1)} 50%{transform:scale(1.08)} 100%{transform:scale(1)} }

/* ── Flash aggiunta articolo ─────────────────────────────────────── */
.cart-item-flash { animation: ctFlash .5s ease; }
@keyframes ctFlash { 0%{background:#FFD70022} 100%{background:transparent} }

/* ── Animazione fade-in generico ─────────────────────────────────── */
@keyframes ctFade { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }

/* ── LIGHT MODE ──────────────────────────────────────────────────── */
body.light-mode #ct-header-wrap { background: #fff; border-bottom-color: var(--accent); }
body.light-mode .ct-card { background: #fff; border-color: #e0e0e0; }
body.light-mode .ct-sticky-total { background: #f2f2f2; }
body.light-mode .ct-sticky-client { color: #1a1a1a; }
body.light-mode #cart-body { background: #f2f2f2; }
body.light-mode #cart-pos-footer { background: linear-gradient(135deg,#fff9e6,#fffbe8); border-top-color: var(--accent); }
body.light-mode .ct-inviato-box .ct-inviato-esauriti-banner { background: #81e6d9; color: #1a365d; border-top-color: rgba(0, 0, 0, 0.1); }
body.light-mode .ct-footer-tot { color: var(--accent); }
body.light-mode .ct-pill { background: #eee; color: #555; }
body.light-mode .ct-pill.active { background: var(--accent); color: #111; }
body.light-mode #ct-clienti-panel { background: #fff; }
body.light-mode .ct-clienti-btn { color: #333; }
body.light-mode .ct-panel { background: #f5f5f5; }
/* Prezzo base UM: in light mode testo scuro su campo chiaro (sempre leggibile) */
body.light-mode .ct-pb-inline { border-top-color: rgba(0,0,0,.12); }
body.light-mode .ct-pb-inp {
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a;
  background: #fff;
  border-color: #c5c5c5;
}
body.light-mode .ct-pb-inp:focus {
  color: #000 !important;
  -webkit-text-fill-color: #000;
  border-color: var(--accent, #c9a000);
}
body.light-mode .ct-pb-inp::placeholder {
  color: #888;
  -webkit-text-fill-color: #888;
}
body.light-mode .ct-mq-inp {
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a;
  background: #fff;
  border-color: #c5c5c5;
}
body.light-mode .ct-mq-inp:focus {
  border-color: var(--accent, #c9a000);
}

/* ── MOBILE: denso ma prezzi grandi, nome largo, touch ≥44px (pollice) ─ */
@media (max-width: 520px) {
  #cart-body {
    padding-left: 4px !important;
    padding-right: 4px !important;
    padding-top: 4px !important;
  }
  #tc #cart-search-wrap { padding: 2px 6px; }
  #tc #cart-action-btns { padding: 2px 6px 0; }
  #tc .ct-btn-cerca {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
  }
  #tc .ct-sticky-total {
    padding: 3px 8px 2px;
    margin-bottom: 2px;
    gap: 6px;
  }
  #tc .ct-sticky-n { font-size: 10px; }
  #tc .ct-btn-sconto { padding: 6px 10px; font-size: 11px; min-height: 40px; }
  #tc .ct-card {
    margin-bottom: 3px;
    border-radius: 6px;
  }
  #tc .ct-card .ord-grid-row {
    padding-top: 2px !important;
    padding-bottom: 3px !important;
  }
  #tc .ord-items-wrap .ord-grid-head {
    padding-top: 1px;
    padding-bottom: 1px;
  }
  #tc .ord-gh {
    padding: 3px 2px;
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  #tc .ct-iconbar {
    padding: 3px 4px 4px;
    gap: 4px;
    row-gap: 3px;
    margin-top: 0;
  }
  /* Azioni: area minima 44×44 per tap */
  #tc .ct-icon-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 8px;
    box-sizing: border-box;
  }
  #tc .ct-forbici-row { gap: 4px; align-items: center; }
  #tc .ct-sc-inline .ct-sc-inp {
    min-height: 40px;
    box-sizing: border-box;
  }
  #tc .ct-pb-inline {
    margin-top: 1px;
    padding: 3px 0 2px;
    gap: 4px;
    border-top: none;
  }
  #tc .ct-pb-disc {
    gap: 3px 6px;
  }
  #tc .ct-pb-final { font-size: 11px; }
  #tc .ct-grid-qty { gap: 3px; align-items: center; }
  /* Telefono: stessi rettangoli verticali un po’ più larghi per il tap */
  #tc .ct-qty--compact {
    gap: 3px;
  }
  #tc .ct-qty--compact .ct-qty-btn {
    width: 26px;
    height: 38px;
    min-width: 26px;
    min-height: 36px;
    max-width: 28px;
    font-size: 16px;
    border-radius: 6px;
    box-sizing: border-box;
  }
  #tc .ct-qty--compact .ct-qty-val {
    min-width: 28px;
    max-width: 52px;
    height: 38px;
    min-height: 36px;
    font-size: 14px;
    font-weight: 900;
    border-radius: 6px;
    box-sizing: border-box;
    padding: 0 3px;
  }
  /* Telefono: minimi che entrano in ~320px senza azzerare il nome (fr dopo i min) */
  #tc .ct-card .ord-grid {
    grid-template-columns:
      minmax(6.25rem, 1fr)
      minmax(64px, auto)
      minmax(4.5rem, 1fr)
      minmax(4.5rem, 1fr);
    column-gap: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #tc .ct-card .ord-gc-price,
  #tc .ct-card .ord-gc-sub {
    min-width: 4.5rem;
  }
  /* Sopra ordini.css (line-clamp / -webkit-box) e overflow-wrap su mobile */
  #tc .ct-card .ord-item-name {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    word-break: normal;
    overflow-wrap: break-word;
    min-height: 0;
  }
  /* UM più piccolo; cifra quantità più grande (override sopra) */
  #tc .ct-um-select.ct-um--mini {
    min-height: 26px;
    min-width: 30px;
    padding: 1px 3px;
    font-size: 9px;
    font-weight: 700;
  }
  #tc .ct-card .ord-gc-price {
    font-size: 12px;
  }
  #tc .ct-card .ord-gc-sub {
    font-size: 12px;
  }
  #tc .ct-card .ord-gc-sub-val {
    font-size: 16px;
  }
  #tc .ct-card .ord-gc-price .ct-punit {
    font-size: 14px;
    min-height: 0;
    padding: 2px 0;
  }
  #tc .ct-card .ct-prz-stack--tot .ct-sub--final {
    font-size: 16px;
  }
  #tc .ct-card .ct-prz-stack.ct-prz-stack--unit .ct-sub--final {
    font-size: 14px;
  }
  /* Prezzi scampolo + totale (#tc carrello) */
  #tc .ct-card .ct-prz-stack .ct-old--orig {
    font-size: 11px;
  }
  #tc .ct-card .ct-prz-stack .ct-prz-sconto-sav,
  #tc .ct-card .ct-prz-stack--tot .ct-prz-sconto-sav {
    font-size: 11px;
  }
}

/* Tab carrello — solo mobile: codice magazzino lungo va a capo (come tab ordini) */
@media (max-width: 768px) {
  #tc .ct-card .ord-item-codes-line {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 8px;
  }
  #tc .ct-card .ord-code-mag {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* Touch scroll + scrollbar nascosta (solo schermi stretti / touch) — Riepilogo + scorrimento area Carrello */
@media (max-width: 768px) {
  .riepilogo-list {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .riepilogo-list::-webkit-scrollbar {
    display: none;
  }
  body:has(#tc.tab-content.active) {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body:has(#tc.tab-content.active)::-webkit-scrollbar {
    display: none;
  }
}

/* ── RESPONSIVE: dimensioni ridotte su PC ────────────────────────── */
@media (min-width: 601px) {
  .ct-qty-btn { min-width: 36px; min-height: 36px; font-size: 18px; }
  .ct-qty-val { min-width: 40px; min-height: 34px; font-size: 15px; }
  .ct-um-select { min-height: 36px; font-size: 12px; }
  .ct-icon-btn  { min-height: 38px; min-width: 40px; }
}

/* ═══════════════════════════════════════════════════════════════
   CONFRONTO ARTICOLI — shell grafica (stile AgriEuro / RatTazzi scuro)
   ═══════════════════════════════════════════════════════════════ */

.tc-compare-shell {
  width: 100%;
  margin: 12px 0 10px;
  box-sizing: border-box;
}

.tc-compare-btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(245, 196, 0, 0.45);
  background: linear-gradient(180deg, #f5c400 0%, #d4a50a 100%);
  color: #111;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  box-shadow: 0 2px 12px rgba(245, 196, 0, 0.25);
  transition: filter 0.12s, transform 0.08s;
}
.tc-compare-btn:active {
  transform: scale(0.99);
  filter: brightness(0.95);
}
.tc-compare-btn.tc-compare-btn--on {
  border-color: #68d391;
  background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
  color: #68d391;
  box-shadow: 0 0 0 1px rgba(104, 211, 145, 0.35);
}

/* Area espansa sotto il carrello, larghezza schermo (compensa padding #cart-body) */
.tc-compare-area {
  display: none;
  width: calc(100% + 20px);
  max-width: none;
  margin: 12px -10px 0;
  box-sizing: border-box;
  border-top: 2px solid #2a2b2e;
  border-bottom: 2px solid #2a2b2e;
  background: #0c0d0e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tc-compare-inner {
  padding: 0 0 14px;
  box-sizing: border-box;
}

.tc-compare-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #252628;
  background: #0f1011;
}

.tc-compare-pick-cart {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(104, 211, 145, 0.45);
  background: rgba(56, 161, 105, 0.12);
  color: #68d391;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
 flex: 1 1 auto;
  min-width: 0;
}
.tc-compare-pick-cart:active {
  background: rgba(56, 161, 105, 0.22);
}

.tc-compare-topbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.tc-compare-diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #b8bcc4;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tc-compare-diff-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #ed8936;
}

.tc-compare-close-global {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #e2e2e2;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}
.tc-compare-close-global:active {
  background: rgba(255, 255, 255, 0.06);
}

.tc-compare-grid-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px 4px;
  scrollbar-width: thin;
}

.tc-compare-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 10px;
  min-width: min(100%, 680px);
  width: max-content;
  max-width: none;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .tc-compare-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

/* Colonna singolo articolo */
.comp-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  min-width: 132px;
  max-width: 200px;
  padding: 10px 10px 12px;
  border-radius: 10px;
  border: 1px solid #2a2b2e;
  background: #141517;
  box-sizing: border-box;
}

.comp-col-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #aaa;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  touch-action: manipulation;
}
.comp-col-remove:active {
  color: #fff;
  background: rgba(229, 62, 62, 0.35);
}

/* Foto: niente placeholder; mostra solo se c'è un'immagine reale */
.comp-col-photo {
  display: none;
  margin: 0 0 8px;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  background: #0a0a0b;
}
.comp-col-photo:has(img) {
  display: block;
}
.comp-col-photo img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
}

.comp-col-name {
  margin: 0 24px 8px 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
  color: #f0f0f0;
}

.comp-col-codes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  margin-bottom: 8px;
}
.comp-code-m {
  color: var(--ct-yellow, #f5c400);
}
.comp-code-sep {
  color: #4a5568;
  font-weight: 400;
}
.comp-code-f {
  color: #fc8181;
}

.comp-col-desc {
  flex: 1 1 auto;
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #c5ccd6;
  font-weight: 600;
  min-height: 9.8em;
  overflow-wrap: break-word;
  word-break: break-word;
}
.comp-col-desc-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: inherit;
}
.comp-desc-line {
  display: block;
  min-height: 1.45em;
  padding-left: 2px;
}

.comp-col-price {
  margin-top: auto;
  padding: 8px 0 10px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #68d391;
  line-height: 1.1;
}
.comp-col-price--best {
  color: #68d391;
}
.comp-col-price-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f0fff4;
  background: linear-gradient(180deg, #38a169 0%, #2f855a 100%);
  vertical-align: middle;
}

.comp-col-cta {
  width: 100%;
  padding: 10px 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #38a169 0%, #276749 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(56, 161, 105, 0.35);
}
.comp-col-cta:active {
  filter: brightness(0.92);
}

/* Confronto: evidenzia campi che differiscono tra colonne */
.comp-col.tc-compare--diff-on .comp-col-field--diff {
  background: rgba(237, 137, 54, 0.14);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(237, 137, 54, 0.45);
  padding: 6px 8px;
  margin-left: -4px;
  margin-right: -4px;
}
.comp-col.tc-compare--diff-on .comp-col-name.comp-col-field--diff {
  margin-right: 20px;
}
.comp-col.tc-compare--diff-on .comp-col-price.comp-col-field--diff {
  padding-left: 8px;
  padding-right: 8px;
}

.comp-col-present {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 8px;
  border-radius: 8px;
  background: rgba(229, 62, 62, 0.14);
  border: 1px solid rgba(252, 129, 129, 0.45);
  color: #fc8181;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* Colonna “+” ricerca */
.comp-col--add {
  border-style: dashed;
  border-color: #3d4045;
  background: #0f1011;
  justify-content: center;
  align-items: stretch;
  padding: 8px;
  min-height: 280px;
}

.comp-col-add-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 220px;
  padding: 16px 10px;
  border: 2px dashed rgba(104, 211, 145, 0.35);
  border-radius: 10px;
  background: rgba(56, 161, 105, 0.06);
  color: #9ae6b4;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}
.comp-col-add-btn:active {
  background: rgba(56, 161, 105, 0.12);
}
.comp-col-add-plus {
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  color: #68d391;
}
.comp-col-add-label {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  max-width: 11em;
}

/* Modale codice magazzino (confronto articoli) */
.tc-compare-cod-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.tc-compare-cod-bd {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.tc-compare-cod-panel {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 18px 16px 16px;
  border-radius: 14px;
  background: #1a1a1c;
  border: 1px solid #333;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.tc-compare-cod-title {
  font-size: 14px;
  font-weight: 800;
  color: #f0f0f0;
  margin-bottom: 10px;
}
.tc-compare-cod-inp {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid #3d3d42;
  background: #111;
  color: #f5f5f5;
  margin-bottom: 14px;
}
.tc-compare-cod-inp:focus {
  outline: none;
  border-color: var(--ct-yellow, #f5c400);
}
.tc-compare-cod-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.tc-compare-cod-cancel,
.tc-compare-cod-ok {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #444;
  cursor: pointer;
  touch-action: manipulation;
}
.tc-compare-cod-cancel {
  background: #2a2a2e;
  color: #ccc;
}
.tc-compare-cod-ok {
  background: var(--ct-yellow, #f5c400);
  color: #111;
  border-color: transparent;
}

.tc-compare-cod-sug {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.tc-compare-cod-hint {
  font-size: 11px;
  color: #666;
  text-align: center;
  padding: 8px 4px;
}
.tc-compare-cod-sug-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  touch-action: manipulation;
  color: inherit;
}
.tc-compare-cod-sug-t {
  font-size: 12px;
  font-weight: 700;
  color: #e8e8e8;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tc-compare-cod-sug-c {
  font-size: 10px;
}
.tc-compare-cod-sug-m {
  color: var(--ct-yellow, #f5c400);
  font-weight: 700;
}
.tc-compare-cod-sug-f {
  color: #fc8181;
  font-weight: 600;
}

.tc-compare-cart-panel .tc-compare-cart-list {
  max-height: min(50vh, 320px);
  overflow-y: auto;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.tc-compare-cart-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #141517;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  touch-action: manipulation;
  color: inherit;
}
.tc-compare-cart-row:active {
  background: #1c1e22;
}
.tc-compare-cart-row-t {
  font-size: 12px;
  font-weight: 700;
  color: #f0f0f0;
  line-height: 1.3;
}
.tc-compare-cart-row-m {
  font-size: 10px;
  color: var(--ct-yellow, #f5c400);
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════
   MAGAZZINO (#mag-list) — cronologia Ultimi aggiunti / modificati:
   pulsanti X e cestino sempre sopra badge/foto e cliccabili
   ════════════════════════════════════════════════════════════════ */

#mag-list.mag-list--chrono {
  position: relative;
}

#mag-list .mag-card {
  position: relative;
  isolation: isolate;
}

/* Spazio riservato in alto a destra per la X (non copre titolo/descrizione a sinistra) */
#mag-list .mag-card--chrono {
  padding-right: 48px;
  padding-top: 2px;
  box-sizing: border-box;
}

#mag-list .mag-card-chrono-actions {
  position: absolute;
  right: 10px;
  top: 10px;
  left: auto;
  z-index: 60;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mag-list .mag-card-footer-actions {
  position: relative;
  z-index: 55;
  pointer-events: auto;
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: stretch;
}

#mag-list .mag-del-btn {
  -webkit-tap-highlight-color: rgba(229, 62, 62, 0.3);
  touch-action: manipulation;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 56;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease,
    border-color 0.15s ease, filter 0.12s ease;
}

#mag-list .mag-del-btn--corner {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(229, 62, 62, 0.55);
  background: #1a1a1a;
  color: #e53e3e;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#mag-list .mag-del-btn--footer {
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
  padding: 8px;
  border-radius: 7px;
  border: 1px solid rgba(229, 62, 62, 0.45);
  background: rgba(26, 26, 26, 0.98);
  color: #e53e3e;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

#mag-list .mag-del-btn--corner:hover,
#mag-list .mag-del-btn--footer:hover {
  background: #2a1f1f;
  border-color: #fc8181;
  box-shadow: 0 2px 14px rgba(229, 62, 62, 0.35);
  filter: brightness(1.08);
}

#mag-list .mag-del-btn--corner:active,
#mag-list .mag-del-btn--footer:active {
  transform: scale(0.96);
  filter: brightness(0.92);
}

/* Badge informativi non intercettano tap sopra la card */
#mag-list .mag-card--chrono > div:not(.mag-card-chrono-actions):not(.mag-card-footer-actions) {
  position: relative;
  z-index: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   CARRELLO — Toggle iconbar dal codice magazzino + numero progressivo riga
   (Modifica chirurgica: solo presentazione, nessuna logica di calcolo.)
   ──────────────────────────────────────────────────────────────────────── */

/* Numero progressivo davanti al nome prodotto */
#tc .ct-card .ord-item-name .ct-card-num {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 215, 0, 0.55);
  letter-spacing: 0.2px;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
  vertical-align: baseline;
}

/* Codice magazzino come toggle iconbar: cursor + feedback tap */
#tc .ct-card .ord-code-mag.ord-code-mag--toggle {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
/* Variante "placeholder" se non c'è codice magazzino: solo "···" cliccabile */
#tc .ct-card .ord-code-mag.ord-code-mag--ph {
  letter-spacing: 1px;
  opacity: 0.65;
}
#tc .ct-card .ord-code-mag.ord-code-mag--toggle:hover {
  filter: brightness(1.1);
}
#tc .ct-card .ord-code-mag.ord-code-mag--toggle:active {
  transform: scale(0.96);
  filter: brightness(0.9);
}
#tc .ct-card .ord-code-mag.ord-code-mag--toggle:focus-visible {
  outline: 2px solid var(--ct-yellow, #f5c400);
  outline-offset: 1px;
}

/* Mobile: padding leggermente maggiore per garantire un'area di tap comoda
   senza alterare la disposizione verticale (font/dimensioni invariati) */
@media (max-width: 768px) {
  #tc .ct-card .ord-code-mag.ord-code-mag--toggle {
    padding: 4px 8px;
    line-height: 1.6;
  }
  #tc .ct-card .ord-item-name .ct-card-num {
    font-size: 10px;
  }
}

