/* ============================================================
   CAMICERIA GEST — DESIGN SYSTEM UNIFICATO
   Tema: Blu Notte · Bronzo Caldo Neutro · Panna
   Versione: v20260508
   ============================================================

   REGOLA: questo file è l'unica fonte di verità per colori,
   tipografia, spaziatura e componenti condivisi.
   Tutti i pannelli (admin, operatore, su-misura, negozio,
   misure) ereditano questi token. Le differenze tra pannelli
   sono SOLO funzionali, mai grafiche.

   STRUTTURA:
   1. Token globali (:root)
   2. Reset & base
   3. Login (condiviso)
   4. Layout app: sidebar + topbar + main
   5. Componenti: card, button, table, badge, modal, wizard
   6. Toast & alert
   7. Catalogo tessuti
   8. Su Misura form
   9. Responsive (≤1024, ≤768, ≤480, ≤375)
   10. Safe area iPhone
   ============================================================ */

/* ============================================================
   1. TOKEN GLOBALI
   ============================================================ */
:root {

  /* ── Blu Notte ── */
  --night:          #0d1b2e;   /* sidebar bg, intestazioni tabelle, popup scuri */
  --night-2:        #152540;   /* hover sidebar, background scuri secondari      */
  --night-3:        #1c3157;   /* bordi attivi, accenti strutturali              */
  --night-4:        #243d6b;   /* gradient interno, nav-sub attivo              */

  /* ── Bronzo Caldo Neutro ── */
  --bronze:         #b08a4e;   /* azioni principali, icone nav, link             */
  --bronze-light:   #c9a46a;   /* hover bottoni, bordi card selezionate          */
  --bronze-lighter: #dfc090;   /* testi su sfondo scuro                          */
  --bronze-dark:    #8a6830;   /* stato attivo, gradient più scuri               */
  --bronze-bg:      #fdf8f2;   /* sfondo leggero su aree neutre                  */
  --bronze-subtle:  #f5ece0;   /* hover su bianco, selected row                  */

  /* ── Panna (sfondo app) ── */
  --cream:          #f4efe8;   /* background body principale                     */
  --cream-light:    #faf7f3;   /* card-header, topbar, sezioni secondarie        */
  --white:          #ffffff;   /* card, modal, input                             */

  /* ── Alias semantici (usati nei componenti) ── */
  --primary:        var(--bronze);
  --primary-dark:   var(--bronze-dark);
  --primary-light:  var(--bronze-subtle);
  --surface:        var(--white);
  --dark:           var(--night);

  /* ── Semantici stato ── */
  --success:        #2e7d52;
  --success-bg:     #d4f0e2;
  --success-border: #a3d9bb;
  --warning:        #b45309;
  --warning-bg:     #fef0d3;
  --warning-border: #f7c06e;
  --danger:         #b91c1c;
  --danger-bg:      #fde8e6;
  --danger-border:  #f5c2bf;
  --info:           #1e40af;
  --info-bg:        #dbeafe;
  --info-border:    #93c5fd;

  /* ── Grigi neutri ── */
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;

  /* ── Layout ── */
  --sidebar-w:   270px;
  --topbar-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --shadow:      0 2px 16px rgba(0,0,0,.07);
  --shadow-md:   0 4px 24px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.15);
  --shadow-xl:   0 24px 60px rgba(0,0,0,.22);
  --transition:  .2s ease;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Blocco zoom pinch PWA */
html { touch-action: pan-x pan-y; -ms-touch-action: pan-x pan-y; }
body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================================
   3. LOGIN PAGE — Full-screen night/bronze
   ============================================================ */

/* Body quando login è visibile */
.login-page {
  background: var(--night);
  overflow: hidden;
}

/* Contenitore principale: full-screen unico pannello */
#loginScreen {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* ── PANNELLO UNICO: full-screen branding + form ── */
.login-brand-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  overflow-y: auto;
  background: var(--night);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas onde: copre tutto lo schermo */
#waveCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Overlay gradiente per leggibilità */
.login-brand-panel::after {
  content: '';
  position: fixed; inset: 0;
  background:
    linear-gradient(180deg, rgba(13,27,46,.55) 0%, rgba(13,27,46,.2) 40%, rgba(13,27,46,.55) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Contenuto branding sopra canvas */
.login-brand-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px 40px;
  max-width: 420px;
  width: 100%;
}

/* Logo img */
.login-brand-logo { margin-bottom: 12px; }
.login-brand-logo-img {
  width: 80px; height: auto;
  display: block; margin: 0 auto;
  filter: brightness(0) invert(1) drop-shadow(0 4px 20px rgba(176,138,78,.45));
}

/* Titolo brand */
.login-brand-title {
  font-size: 1.75rem; font-weight: 900;
  color: #fff;
  letter-spacing: -.5px;
  line-height: 1.1;
  margin-bottom: 4px;
  text-shadow: 0 2px 16px rgba(0,0,0,.4);
}

/* Sottotitolo */
.login-brand-tagline {
  font-size: .75rem; font-weight: 600;
  color: var(--bronze-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: .9;
}

/* Immagine camicia reale */
.login-shirt-wrap {
  width: 150px;
  margin: 0 auto 20px;
  animation: shirtFloat 4s ease-in-out infinite;
}
.login-shirt-img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 40px rgba(176,138,78,.35)) drop-shadow(0 2px 12px rgba(0,0,0,.5));
}

@keyframes shirtFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* Feature pills */
.login-brand-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
  margin-top: 12px;
}
.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
  color: var(--bronze-lighter);
  background: rgba(176,138,78,.12);
  border: 1px solid rgba(176,138,78,.28);
  letter-spacing: .3px;
  backdrop-filter: blur(4px);
}
.login-pill i { font-size: .68rem; color: var(--bronze); }

/* Footer branding */
.login-brand-footer {
  font-size: .72rem;
  color: rgba(255,255,255,.38);
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-brand-dot { color: var(--bronze); font-size: .9rem; }

/* Niente divisore — unico pannello */
.login-brand-panel::before { display: none; }

/* ── FORM INTEGRATO nel pannello brand ── */
/* Nessun pannello destro separato — form inline */
.login-form-panel { display: none; }

/* Box form centrato e separato visivamente */
.login-form-box {
  width: 100%;
  max-width: 380px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(176,138,78,.25);
  border-radius: 16px;
  padding: 22px 24px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 8px;
}

/* Titolo "Accedi" sopra i campi */
.login-form-title-inline {
  font-size: .9rem;
  font-weight: 800;
  color: rgba(255,255,255,.85);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-form-title-inline i { color: var(--bronze); font-size: .85rem; }

/* ── Gruppi campo form login ── */
.lf-group { margin-bottom: 14px; }

.lf-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 800;
  color: rgba(255,255,255,.65);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.lf-label-icon {
  color: var(--bronze);
  font-size: .78rem;
}

.lf-input-wrap { position: relative; }

.lf-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(176,138,78,.25);
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  color: #fff;
  background: rgba(255,255,255,.08);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none;
}
.lf-input:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(176,138,78,.18);
  background: rgba(255,255,255,.12);
}
.lf-input::placeholder { color: rgba(255,255,255,.3); }

/* Password toggle */
.password-wrapper { position: relative; }
.password-wrapper .lf-input { padding-right: 48px; }
.toggle-pwd {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.4); font-size: 15px;
  transition: color .2s; padding: 4px;
}
.toggle-pwd:hover { color: var(--bronze); }

/* Errore login */
.login-error {
  background: rgba(220,38,38,.15);
  border: 1.5px solid rgba(220,38,38,.35);
  border-radius: 10px;
  padding: 11px 14px;
  color: #fca5a5;
  font-size: .875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* Bottone accedi — bronzo su sfondo scuro */
.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #b08a4e 0%, #c9a55a 50%, #b08a4e 100%);
  color: #fff; border: none; border-radius: 10px;
  font-family: inherit; font-size: .92rem; font-weight: 800;
  cursor: pointer; letter-spacing: .5px;
  transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 4px 20px rgba(176,138,78,.35);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.btn-login::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 100%);
  opacity: 0;
  transition: opacity .2s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(176,138,78,.5); }
.btn-login:hover::after { opacity: 1; }
.btn-login:active { transform: translateY(0); }

#loginArrow { font-size: .85rem; opacity: .8; transition: transform .2s; }
.btn-login:hover #loginArrow { transform: translateX(4px); }

/* Footer form */
.login-form-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: .7rem;
  color: rgba(255,255,255,.28);
}

/* ── Shake errore login ── */
@keyframes loginShake {
  0%,100% { transform: rotateY(180deg) translateX(0); }
  20%      { transform: rotateY(180deg) translateX(-6px); }
  40%      { transform: rotateY(180deg) translateX(6px); }
  60%      { transform: rotateY(180deg) translateX(-4px); }
  80%      { transform: rotateY(180deg) translateX(4px); }
}

/* ── DIVISORE "oppure" ── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(176,138,78,.22);
}
.login-divider-text {
  font-size: .68rem;
  font-weight: 700;
  color: rgba(255,255,255,.32);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── BOTTONE "Accedi come Negozio" ── */
.btn-login-negozio {
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: 1.5px solid rgba(176,138,78,.40);
  border-radius: 10px;
  color: var(--bronze-light);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all .2s;
  backdrop-filter: blur(6px);
}
.btn-login-negozio:hover {
  background: rgba(176,138,78,.10);
  border-color: var(--bronze);
  color: var(--bronze-lighter);
  transform: translateY(-1px);
}
.btn-login-negozio i { font-size: .85rem; }

/* ── FLIP CONTAINER form login ── */
/* Il .login-form-box diventa prospettico */
.login-form-flip-scene {
  width: 100%;
  max-width: 380px;
  perspective: 1000px;
  margin-bottom: 8px;
}

/* Il "libro" che ruota */
.login-form-flip-inner {
  position: relative;
  width: 100%;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  transform-style: preserve-3d;
  /* L'altezza si adatta alla faccia più alta */
  min-height: 320px;
}
.login-form-flip-inner.flipped {
  transform: rotateY(180deg);
}

/* Faccia fronte (operatore) e retro (negozio) */
.login-form-face {
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(176,138,78,.25);
  border-radius: 16px;
  padding: 22px 24px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
}
/* Retro: posizionato dietro e ruotato 180° */
.login-form-face-back {
  position: absolute;
  top: 0; left: 0;
  transform: rotateY(180deg);
  /* stile leggermente diverso: bordo store */
  border-color: rgba(176,138,78,.35);
  background: rgba(176,138,78,.05);
}

/* Bottone "← torna al login" nel form negozio */
.btn-login-back {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.45);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin-bottom: 12px;
  transition: color .2s;
}
.btn-login-back:hover { color: var(--bronze-light); }
.btn-login-back i { font-size: .7rem; }

/* ── FORM GLOBALE (modali, schede, ecc.) — invariato ── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: .8rem; font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 7px;
  letter-spacing: .3px; text-transform: uppercase;
}
.form-group label i { margin-right: 6px; color: var(--bronze); font-size: .85em; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(176,138,78,.15);
  background: var(--white);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-group select { cursor: pointer; }

/* Logo img login (compatibilità vecchi riferimenti) */
.logo-img-login { width: 140px; height: auto; display: block; object-fit: contain; }

/* ── RESPONSIVE LOGIN ── */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
  .login-brand-title { font-size: 1.5rem; }
  .login-shirt-wrap  { width: 130px; }
  .login-form-box    { padding: 20px 22px; }
}

/* Smartphone (≤ 600px) */
@media (max-width: 600px) {
  .login-brand-content  { padding: 24px 20px 32px; }
  .login-brand-title    { font-size: 1.3rem; }
  .login-brand-tagline  { margin-bottom: 14px; letter-spacing: 1.2px; }
  .login-shirt-wrap     { width: 110px; margin-bottom: 14px; }
  .login-brand-logo-img { width: 64px; }
  .login-brand-logo     { margin-bottom: 8px; }
  .login-form-box       { padding: 18px 16px; border-radius: 12px; }
  .lf-group             { margin-bottom: 11px; }
  .lf-input             { padding: 10px 12px; font-size: .87rem; }
  .btn-login            { padding: 11px; font-size: .88rem; }
  .login-form-title-inline { margin-bottom: 12px; font-size: .82rem; }
  .login-brand-pills    { margin-top: 10px; margin-bottom: 10px; gap: 6px; }
  .login-pill           { padding: 4px 11px; font-size: .68rem; }
  .login-brand-footer   { margin-top: 4px; }
}

/* Smartphone piccolo (≤ 380px) */
@media (max-width: 380px) {
  .login-brand-content  { padding: 18px 16px 24px; }
  .login-shirt-wrap     { width: 90px; margin-bottom: 10px; }
  .login-brand-title    { font-size: 1.15rem; }
  .login-form-box       { padding: 15px 13px; }
  .lf-group             { margin-bottom: 9px; }
}

/* ============================================================
   3b. PWA INSTALL BANNER
   ============================================================ */

#pwaInstallBanner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #162540 0%, #1e3358 100%);
  border: 1px solid rgba(176,138,78,.5);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(176,138,78,.15);
  max-width: 420px;
  width: calc(100% - 32px);
  backdrop-filter: blur(12px);
  transition: opacity .3s, transform .3s;
}

#pwaInstallBanner.pwa-hidden {
  display: none;
}

#pwaInstallBanner.pwa-visible {
  display: flex;
  animation: pwaSlideUp .35s ease-out;
}

@keyframes pwaSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-banner-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(176,138,78,.3);
}

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-banner-text strong {
  font-size: .88rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.pwa-banner-text span {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
}

.pwa-btn-install {
  flex-shrink: 0;
  padding: 9px 18px;
  background: linear-gradient(135deg, #b08a4e, #c9a55a);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .3px;
  box-shadow: 0 2px 10px rgba(176,138,78,.4);
  transition: transform .15s, box-shadow .15s;
}

.pwa-btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(176,138,78,.55);
}

.pwa-btn-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  transition: color .2s;
  line-height: 1;
}

.pwa-btn-dismiss:hover { color: rgba(255,255,255,.8); }

@media (max-width: 480px) {
  #pwaInstallBanner {
    bottom: 12px;
    border-radius: 12px;
    padding: 12px 12px;
    gap: 10px;
  }
  .pwa-banner-icon { width: 40px; height: 40px; border-radius: 10px; }
  .pwa-btn-install { padding: 8px 14px; font-size: .78rem; }
}

/* ============================================================
   4. LAYOUT APP
   ============================================================ */
#appWrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--night);
  color: white;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  border-right: 1px solid rgba(176,138,78,.15);
}
.sidebar::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(176,138,78,.45), transparent);
  pointer-events: none;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.sidebar-logo-img {
  height: 34px; width: auto;
  filter: invert(1) brightness(1.5) saturate(0.3);
  object-fit: contain; flex-shrink: 0;
}
.sidebar-logo span {
  font-size: .68rem; font-weight: 800;
  color: var(--bronze-light);
  letter-spacing: 1.8px; text-transform: uppercase;
  line-height: 1.2;
}
.sidebar-close {
  display: none; background: none; border: none;
  color: rgba(255,255,255,.3); font-size: 17px; cursor: pointer;
  padding: 6px; border-radius: 6px;
  transition: color var(--transition);
}
.sidebar-close:hover { color: rgba(255,255,255,.8); }

.sidebar-user {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.user-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(138,104,48,.4);
}
.user-name { font-weight: 700; font-size: .875rem; color: white; }
.user-role {
  font-size: .7rem; color: var(--bronze-light);
  text-transform: capitalize; margin-top: 2px;
  letter-spacing: .5px; opacity: .85;
}

.sidebar-nav { flex: 1; padding: 14px 10px; }
.nav-section-title {
  font-size: .6rem; font-weight: 800;
  letter-spacing: 1.8px;
  color: rgba(255,255,255,.2);
  text-transform: uppercase;
  padding: 12px 14px 5px;
  margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,.55); font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.9);
  border-color: rgba(176,138,78,.12);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(138,104,48,.55), rgba(176,138,78,.3));
  color: var(--bronze-light);
  font-weight: 700;
  border-color: rgba(176,138,78,.3);
  border-left: 3px solid var(--bronze-light);
  padding-left: 11px;
}
.nav-item i {
  width: 22px; text-align: center;
  font-size: .95rem; color: var(--bronze); flex-shrink: 0;
}
.nav-item.active i { color: var(--bronze-light); }

/* Menu a cascata (Outlook style) */
.nav-group-header { position: relative; }
.nav-group-toggle {
  margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 5px;
  transition: background .15s; flex-shrink: 0;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.12); }
.nav-group-toggle i {
  font-size: .65rem;
  color: rgba(255,255,255,.35);
  width: auto !important;
  transition: transform .25s ease;
}
.nav-group-toggle.is-open i {
  transform: rotate(90deg);
  color: var(--bronze-light);
}
.nav-sub-group {
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
}
.nav-sub-group.is-open { max-height: 500px; }
.nav-sub-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 32px;
  margin-bottom: 1px; border-radius: 8px;
  color: rgba(255,255,255,.45);
  font-size: .80rem; font-weight: 500;
  cursor: pointer; transition: all .15s;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-sub-item:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.85);
}
.nav-sub-item.active {
  background: rgba(138,104,48,.25);
  color: var(--bronze-light);
  font-weight: 600;
  border-left-color: var(--bronze-light);
}
.nav-sub-item i { width: 14px; text-align: center; flex-shrink: 0; font-size: .68rem; }
.nav-sub-badge {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  border-radius: 10px;
  font-size: .62rem; font-weight: 700;
  padding: 1px 6px; min-width: 18px; text-align: center;
  display: none; line-height: 1.6;
}
.nav-sub-item.active .nav-sub-badge { background: var(--bronze); color: #fff; }
.nav-sub-group .nav-sub-item::before {
  content: '';
  position: absolute; left: 18px; top: 50%;
  width: 6px; height: 1px;
  background: rgba(255,255,255,.15);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.btn-logout {
  width: 100%; padding: 11px;
  background: rgba(185,28,28,.1);
  border: 1px solid rgba(185,28,28,.2);
  color: #f87171; border-radius: 10px;
  font-family: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(185,28,28,.25); color: #fca5a5; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 190;
}

/* ── TOPBAR & MAIN ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  background: var(--cream);
}
.topbar {
  height: var(--topbar-h);
  background: var(--cream-light);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 12px rgba(0,0,0,.06);
}
.topbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--bronze-dark), var(--bronze-light), transparent);
  opacity: .5;
}
.hamburger {
  display: none; background: none; border: none;
  font-size: 1.25rem; cursor: pointer;
  color: var(--gray-600); padding: 6px; border-radius: 6px;
  transition: color var(--transition);
}
.hamburger:hover { color: var(--bronze); }
.topbar h2 { font-size: 1rem; font-weight: 700; color: var(--night); }
.topbar-right { margin-left: auto; }
.topbar-user {
  font-size: .8rem; font-weight: 700;
  padding: 6px 14px;
  background: var(--bronze-bg);
  border: 1px solid var(--bronze-light);
  border-radius: 20px; color: var(--bronze-dark);
  letter-spacing: .3px;
}

.page-content {
  flex: 1; padding: 28px;
  max-width: 1240px; width: 100%;
  margin: 0 auto;
}

/* ============================================================
   5. COMPONENTI
   ============================================================ */

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--gray-100);
  border-top: 3px solid transparent;
  cursor: default; position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--bronze-light), transparent);
  opacity: 0; transition: opacity var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card:hover::after { opacity: 1; }
.stat-card.border-bronze { border-top-color: var(--bronze); }
.stat-card.border-silver { border-top-color: var(--gray-400); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--bronze-subtle); color: var(--bronze-dark); }
.stat-icon.purple { background: #ede9fe; color: #5b21b6; }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-label {
  font-size: .72rem; color: var(--gray-500); font-weight: 700;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .8px;
}
.stat-value { font-size: 1.9rem; font-weight: 900; color: var(--night); line-height: 1; }

/* ── CARD GENERICA ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--gray-100);
  margin-bottom: 20px;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  background: var(--cream-light);
  position: relative;
}
.card-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--bronze-dark), transparent);
  opacity: .25;
}
.card-header h3 { font-size: .95rem; font-weight: 800; color: var(--night); }
.card-header h3 i { color: var(--bronze); margin-right: 8px; }
.card-body { padding: 24px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze));
  color: white;
  box-shadow: 0 3px 12px rgba(138,104,48,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6a4c20, var(--bronze-dark));
  box-shadow: 0 6px 20px rgba(138,104,48,.4);
  transform: translateY(-1px);
}
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #256645; transform: translateY(-1px); }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #991b1b; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #9a4a07; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--gray-600);
  border: 1.5px solid var(--gray-300);
}
.btn-outline:hover { border-color: var(--bronze); color: var(--bronze); background: var(--bronze-subtle); }
.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: 7px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.btn-ghost {
  background: transparent; border: none; color: var(--gray-500);
  cursor: pointer; transition: color var(--transition);
}
.btn-ghost:hover { color: var(--bronze); }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--night); color: rgba(255,255,255,.85);
  padding: 12px 16px;
  text-align: left; font-weight: 700; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 2px solid var(--bronze-dark);
  white-space: nowrap;
}
thead th:first-child { border-left: 3px solid var(--bronze); }
tbody tr { border-bottom: 1px solid var(--gray-100); transition: background var(--transition); }
tbody tr:hover { background: var(--bronze-subtle); }
tbody tr:hover td { color: var(--night); }
tbody td { padding: 12px 16px; color: var(--gray-600); vertical-align: middle; }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 20px;
  font-size: .7rem; font-weight: 700;
  white-space: nowrap; letter-spacing: .3px;
}
.badge-success { background: var(--success-bg); color: #145a30; border: 1px solid var(--success-border); }
.badge-danger  { background: var(--danger-bg);  color: #8b1a1a; border: 1px solid var(--danger-border); }
.badge-warning { background: var(--warning-bg); color: #78350f; border: 1px solid var(--warning-border); }
.badge-info    { background: var(--bronze-subtle); color: var(--bronze-dark); border: 1px solid var(--bronze-light); }
.badge-purple  { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.badge-teal    { background: #ccfbf1; color: #0f766e; border: 1px solid #5eead4; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-silver  { background: var(--gray-100); color: var(--gray-500); border: 1px solid var(--gray-300); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  transform: scale(.96) translateY(10px);
  transition: transform .25s ease;
  border-top: 3px solid var(--bronze);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 980px; }
.modal-header {
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--cream-light);
  position: sticky; top: 0; z-index: 1;
}
.modal-header h3 {
  font-size: 1.05rem; font-weight: 800; color: var(--night);
  display: flex; align-items: center; gap: 8px;
}
.modal-header h3 i { color: var(--bronze); }
.modal-close {
  background: var(--gray-100); border: none; border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; color: var(--gray-500);
  transition: all var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--gray-200); color: var(--night); }
.modal-body { padding: 22px 26px; }
.modal-footer {
  padding: 14px 26px 20px;
  display: flex; justify-content: flex-end; gap: 12px;
  border-top: 1px solid var(--gray-100);
}

/* ══════════════════════════════════════════════════
   WIZARD ORDINE CONFEZIONE — card contenitore
══════════════════════════════════════════════════ */
.wiz-card {
  background: #fff;
  border: 1.5px solid #e2d9cc;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(13,27,46,.08);
  margin-bottom: 24px;
}
.wiz-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
  font-size: 1.05rem; font-weight: 800;
  color: #f4efe8;
  letter-spacing: .02em;
}
.wiz-card-header i { color: #b08a4e; font-size: 1.1rem; }

/* ── WIZARD STEPS (progress bar) ── */
.wizard-steps {
  display: flex; justify-content: center; align-items: flex-start;
  gap: 0; padding: 24px 20px 20px;
  position: relative;
  background: #faf8f5;
  border-bottom: 1.5px solid #e2d9cc;
}
.wizard-steps::before {
  content: '';
  position: absolute; top: 44px; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, #e2d9cc 0%, #e2d9cc 100%);
  z-index: 0;
}
.wizard-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; flex: 1; position: relative; z-index: 1;
}
.wizard-step .step-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: #e8e4de; color: #9ca3af;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem;
  border: 3px solid #e2d9cc;
  transition: all .35s ease;
}
.wizard-step.active .step-circle {
  background: linear-gradient(135deg, #8a6830, #b08a4e);
  border-color: #c9a96e;
  color: white;
  box-shadow: 0 0 0 6px rgba(176,138,78,.18);
}
.wizard-step.completed .step-circle {
  background: #16a34a; border-color: #16a34a; color: white;
}
.wizard-step .step-label {
  font-size: .68rem; font-weight: 600;
  color: #9ca3af; text-align: center; line-height: 1.3;
}
.wizard-step.active .step-label   { color: #b08a4e; font-weight: 700; }
.wizard-step.completed .step-label { color: #16a34a; }

/* ── STEP PANELS ── */
.step-panel { display: none; }
.step-panel.active { display: block; padding: 20px 20px 4px; }
.step-panel h4 { font-size: 1.05rem; font-weight: 800; color: var(--night); margin-bottom: 6px; }
.step-panel .step-desc { color: var(--gray-500); font-size: .875rem; margin-bottom: 22px; }

/* ── LABEL / HINT / OPTIONAL ── */
.wiz-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #374151; margin-bottom: 7px;
}
.wiz-label i { color: #b08a4e; font-size: .8rem; }
.wiz-required { color: #dc2626; font-size: .9rem; font-weight: 900; margin-left: 2px; }
.wiz-optional {
  font-size: .72rem; font-weight: 400; color: #9ca3af;
  text-transform: none; letter-spacing: 0; margin-left: 4px;
}
.wiz-hint { font-size: .78rem; color: #9ca3af; margin-top: 5px; display: block; }
.wiz-input-bold { font-size: 1rem !important; font-weight: 600 !important; }
.wiz-select { width: 100%; }
.wiz-negozio-info {
  margin-top: 8px; padding: 10px 14px;
  background: #f8f5f0; border-radius: 8px;
  font-size: .82rem; color: #4b5563;
  border: 1px solid #e2d9cc;
}

/* ── BOTTONI WIZARD ── */
.btn-wiz-add {
  flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #0d1b2e, #162540);
  border: 1.5px solid #b08a4e;
  color: #b08a4e; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s ease;
}
.btn-wiz-add:hover { background: #b08a4e; color: white; border-color: #b08a4e; }

.btn-wiz-add-tessuto {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: linear-gradient(135deg, #8a6830, #b08a4e);
  border: none; color: white;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; transition: all .2s ease; flex-shrink: 0;
}
.btn-wiz-add-tessuto:hover { background: linear-gradient(135deg, #6e5226, #8a6830); transform: translateY(-1px); }

.btn-wiz-next {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 10px;
  background: linear-gradient(135deg, #8a6830, #b08a4e);
  border: none; color: white;
  font-size: .875rem; font-weight: 700; letter-spacing: .02em;
  cursor: pointer; transition: all .2s ease;
  box-shadow: 0 3px 10px rgba(176,138,78,.3);
}
.btn-wiz-next:hover { background: linear-gradient(135deg, #6e5226, #8a6830); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(176,138,78,.35); }

.btn-wiz-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  background: transparent; border: 1.5px solid #d1d5db;
  color: #4b5563; font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: all .2s ease;
}
.btn-wiz-back:hover { border-color: #b08a4e; color: #b08a4e; background: #faf8f5; }

.btn-wiz-confirm {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 10px;
  background: linear-gradient(135deg, #14532d, #16a34a);
  border: none; color: white;
  font-size: .9rem; font-weight: 700; letter-spacing: .02em;
  cursor: pointer; transition: all .2s ease;
  box-shadow: 0 3px 10px rgba(22,163,74,.25);
}
.btn-wiz-confirm:hover { background: linear-gradient(135deg, #0f3d22, #14532d); transform: translateY(-1px); }

/* ── WIZARD NAV ── */
.wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; padding: 16px 20px;
  border-top: 2px solid #e2d9cc;
  background: #f8f5f0;
  border-radius: 0 0 14px 14px;
}

/* Taglie */
.taglie-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.taglia-item {
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  border-radius: 10px; padding: 13px 8px; text-align: center;
  transition: all var(--transition);
}
.taglia-item:focus-within {
  border-color: var(--bronze); background: var(--bronze-subtle);
  box-shadow: 0 0 0 3px rgba(176,138,78,.1);
}
.taglia-label {
  font-weight: 800; font-size: 1.05rem; color: var(--night);
  display: block; margin-bottom: 8px;
}
.taglia-item input {
  width: 100%; text-align: center;
  border: 1.5px solid var(--gray-300); border-radius: 7px;
  padding: 8px 4px; font-size: 1rem; font-weight: 700;
  background: white; outline: none;
  transition: border-color var(--transition);
}
.taglia-item input:focus { border-color: var(--bronze); }

.taglie-total {
  background: linear-gradient(135deg, var(--night), var(--night-2));
  border-radius: 10px; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid rgba(176,138,78,.2);
}
.taglie-total span  { font-size: .9rem; font-weight: 600; color: var(--bronze-lighter); }
.taglie-total strong { font-size: 1.5rem; font-weight: 900; color: var(--bronze-light); }

/* Toggle switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--gray-100);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-weight: 600; color: var(--gray-700); font-size: .875rem; }
.toggle-desc  { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }
.switch, .toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input, .toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gray-300); border-radius: 34px; transition: .3s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .3s;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
input:checked + .slider { background: var(--bronze); }
input:checked + .slider::before { transform: translateX(22px); }

/* Form grids */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }

.section-divider { margin: 22px 0; border: none; border-top: 1px dashed var(--gray-200); }

/* Riepilogo */
.riepilogo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.riepilogo-item {
  background: var(--gray-50); border-radius: 10px; padding: 13px 16px;
  border: 1px solid var(--gray-200);
}
.riepilogo-item label {
  font-size: .68rem; font-weight: 700; letter-spacing: .6px;
  color: var(--gray-500); text-transform: uppercase;
  display: block; margin-bottom: 4px;
}
.riepilogo-item span { font-size: .95rem; font-weight: 600; color: var(--night); }

.taglie-summary {
  background: var(--gray-50); border-radius: 10px; padding: 14px;
  margin-bottom: 18px; border: 1px solid var(--gray-200);
}
.taglie-summary-title {
  font-size: .72rem; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.taglie-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.taglia-chip {
  background: var(--bronze-subtle); color: var(--bronze-dark);
  border: 1px solid var(--bronze-light);
  border-radius: 7px; padding: 5px 12px;
  font-size: .8rem; font-weight: 700;
}

/* ── ORDINE CARD ── */
.ordine-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 14px; padding: 0;
  margin-bottom: 14px;
  transition: all var(--transition);
  overflow: hidden; box-shadow: var(--shadow);
}
.ordine-card:hover {
  border-color: var(--bronze-light);
  box-shadow: 0 6px 24px rgba(176,138,78,.12);
}
.ordine-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px 12px;
  flex-wrap: wrap; gap: 8px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.ordine-card:hover .ordine-card-header {
  background: var(--bronze-subtle);
  border-left-color: var(--bronze);
}
.ordine-ref { font-weight: 800; font-size: 1rem; color: var(--night); }
.ordine-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; }
.ordine-meta span { font-size: .78rem; color: var(--gray-500); }
.ordine-meta i { margin-right: 4px; color: var(--bronze); }

.ordine-actions {
  display: flex; align-items: center;
  padding: 8px 12px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  gap: 4px; flex-wrap: wrap;
}
.oa-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 7px;
  border: 1.5px solid transparent;
  font-family: inherit; font-size: .77rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  background: white; white-space: nowrap;
}
.oa-btn span { display: inline; }
.oa-btn:hover { transform: translateY(-1px); }
.oa-detail { color: var(--bronze-dark); border-color: #dcc090; }
.oa-detail:hover { background: var(--bronze-subtle); border-color: var(--bronze); }
.oa-edit   { color: #0e6b99; border-color: #b3ddf5; }
.oa-edit:hover   { background: #e0f4ff; border-color: #7ec8f0; }
.oa-delete { color: var(--danger); border-color: var(--danger-border); }
.oa-delete:hover { background: var(--danger-bg); border-color: #f87171; }
.oa-email  { color: #1a6b3c; border-color: #a7f3d0; }
.oa-email:hover  { background: #ecfdf5; border-color: #6ee7b7; }
.oa-wa     { color: #15803d; border-color: #86efac; background: white; }
.oa-wa i   { color: #25D366; font-size: 1rem; }
.oa-wa:hover { background: #f0fdf4; border-color: #25D366; }
.oa-print  { color: var(--bronze-dark); border-color: #dcc090; }
.oa-print:hover  { background: var(--bronze-subtle); border-color: var(--bronze); }
.oa-pdf    { color: #8b1a1a; border-color: var(--danger-border); }
.oa-pdf:hover    { background: #fff5f5; border-color: #f87171; }
.oa-sep { width: 1px; height: 26px; background: var(--gray-200); margin: 0 3px; flex-shrink: 0; }

/* Search bar */
.search-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search-bar input,
.search-bar select {
  padding: 10px 16px;
  border: 1.5px solid var(--gray-200); border-radius: 10px;
  font-family: inherit; font-size: .875rem;
  background: white; outline: none; color: var(--gray-700);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar input { flex: 1; min-width: 200px; }
.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(176,138,78,.1);
}

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 3rem; color: var(--gray-300); margin-bottom: 16px; display: block; }
.empty-state h4 { font-size: 1rem; color: var(--gray-500); font-weight: 600; }
.empty-state p  { font-size: .875rem; color: var(--gray-400); margin-top: 6px; }

/* ── ALERT ── */
.alert {
  border-radius: 10px; padding: 13px 16px;
  font-size: .875rem; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: #145a30; border-color: var(--success-border); }
.alert-danger  { background: var(--danger-bg);  color: #7b1c1c; border-color: var(--danger-border); }
.alert-warning { background: var(--warning-bg); color: #78350f; border-color: var(--warning-border); }
.alert-info    { background: var(--bronze-subtle); color: var(--bronze-dark); border-color: var(--bronze-light); }
.alert i { margin-top: 1px; flex-shrink: 0; }

/* ── MULTI-TESSUTO BLOCKS ── */
.tessuto-block {
  border: 1.5px solid #e2d9cc;
  border-radius: 12px; margin-bottom: 14px; overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(13,27,46,.05);
}
.tessuto-block:focus-within {
  border-color: #b08a4e;
  box-shadow: 0 0 0 3px rgba(176,138,78,.1);
}
.tessuto-block-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
}
.tessuto-num-badge {
  background: linear-gradient(135deg, #8a6830, #c9a96e);
  color: white; font-weight: 800; font-size: .72rem;
  padding: 3px 10px; border-radius: 20px; flex-shrink: 0;
}
.tessuto-block-title {
  font-weight: 700; font-size: .875rem;
  color: rgba(255,255,255,.9);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tessuto-block-body { padding: 14px 16px; background: #fff; }

.taglie-grid-sm { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.taglia-item-sm {
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  border-radius: 7px; padding: 5px 2px; text-align: center;
  transition: all var(--transition);
}
.taglia-item-sm:focus-within { border-color: var(--bronze); background: var(--bronze-subtle); }
.taglia-label-sm { display: block; font-weight: 800; font-size: .7rem; color: var(--night); margin-bottom: 3px; }
.taglia-inp-sm {
  width: 100%; text-align: center;
  border: 1.5px solid var(--gray-300); border-radius: 4px;
  padding: 4px 2px; font-size: .8rem; font-weight: 700;
  background: white; outline: none;
  transition: border-color var(--transition);
}
.taglia-inp-sm:focus { border-color: var(--bronze); }

.taglie-subtotal {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 6px; font-size: .8rem; color: var(--gray-500);
}
.taglie-subtotal strong { font-size: 1rem; font-weight: 800; color: var(--bronze-dark); }

/* Spec accordion */
.spec-accordion { margin-top: 10px; }
.spec-accordion-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 16px;
  background: #f8f5f0;
  border: 1.5px solid #e2d9cc;
  border-radius: 10px; font-family: inherit;
  font-size: .82rem; font-weight: 700;
  color: #374151; text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; transition: all var(--transition); text-align: left;
}
.spec-accordion-btn i:first-child { color: #b08a4e; }
.spec-accordion-btn:hover {
  background: #f0ebe2;
  border-color: #b08a4e; color: #8a6830;
}
.spec-arrow { margin-left: auto; transition: transform .25s ease; font-size: .8rem; color: #b08a4e; }
.spec-accordion-body { display: none; padding: 16px 4px 4px; }
.spec-accordion-body.open { display: block; }

.spec-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gray-100); color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: 6px; padding: 3px 8px;
  font-size: .78rem; font-weight: 500;
}
.spec-pill b { color: var(--night); font-weight: 700; }
.spec-pill.si { background: var(--success-bg); color: #145a30; border-color: var(--success-border); font-weight: 700; }

/* Riepilogo tessuto */
.riepilogo-tessuto {
  border: 1.5px solid var(--gray-200);
  border-radius: 12px; padding: 14px; margin-bottom: 10px;
  background: var(--gray-50);
}
.riepilogo-tessuto-header {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 6px;
}

/* Info value */
.info-value { font-size: 13px; font-weight: 600; color: var(--night); }
.info-value.big { font-size: 22px; font-weight: 900; color: var(--bronze-dark); }

/* Topbar profile/logout buttons */
#topbarProfiloBtn:hover {
  background: var(--bronze-subtle);
  border-color: var(--bronze);
  transform: scale(1.08);
}
#topbarLogoutBtn:hover {
  background: rgba(185,28,28,.18);
  border-color: rgba(185,28,28,.5);
  transform: scale(1.08);
}
@media (min-width: 769px) {
  #topbarProfiloBtn, #topbarLogoutBtn { width: 32px; height: 32px; font-size: 13px; }
  .topbar-user { display: inline-block; }
}

/* ============================================================
   6. TOAST
   ============================================================ */
#toastContainer {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--night); color: white;
  padding: 14px 20px; border-radius: 12px;
  font-size: .875rem; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  animation: slideInRight .3s ease;
  border: 1px solid rgba(255,255,255,.06);
}
.toast.success { border-left: 4px solid #4ade80; }
.toast.error   { border-left: 4px solid #f87171; }
.toast.info    { border-left: 4px solid var(--bronze-light); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   7. CATALOGO TESSUTI
   ============================================================ */
.cat-wrap { display: flex; gap: 16px; align-items: flex-start; padding: 0 0 24px; }

.cat-sidebar {
  flex-shrink: 0; width: 220px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px; overflow: hidden;
  position: sticky; top: 80px;
}
.cat-sidebar-header {
  background: var(--bronze-subtle);
  padding: 10px 14px; font-size: .75rem; font-weight: 700;
  color: var(--bronze);
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--bronze-light);
}
.cat-reset-btn {
  margin-left: auto; background: none;
  border: 1px solid var(--bronze-light); color: var(--bronze);
  font-size: .65rem; padding: 2px 7px; border-radius: 4px; cursor: pointer;
}
.cat-reset-btn:hover { background: var(--bronze-light); color: white; }

.cat-filter-group { padding: 8px 12px 4px; border-bottom: 1px solid var(--gray-100); }
.cat-filter-group:last-child { border-bottom: none; }
.cat-filter-lbl { display: block; font-size: .62rem; font-weight: 700; color: var(--bronze); text-transform: uppercase; margin-bottom: 4px; }
.cat-filter-sel, .cat-filter-inp {
  width: 100%; font-size: .75rem;
  border: 1px solid var(--gray-200); border-radius: 5px;
  padding: 4px 6px; color: var(--gray-700); background: var(--gray-50);
}
.cat-filter-sel:focus, .cat-filter-inp:focus {
  border-color: var(--bronze); outline: none; background: var(--white);
}

.cat-main { flex: 1; min-width: 0; }

.cat-searchbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cat-search-input-wrap { position: relative; flex: 1; }
.cat-search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); color: var(--gray-400); font-size: .85rem;
}
#catSearchInput {
  width: 100%; padding: 8px 32px 8px 32px;
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: .85rem; background: var(--white);
}
#catSearchInput:focus { border-color: var(--bronze); outline: none; }
.cat-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--gray-400); cursor: pointer;
  display: flex; align-items: center; padding: 2px;
}
.cat-totale { font-size: .75rem; color: var(--gray-500); white-space: nowrap; font-weight: 600; }

.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
}

.cat-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.cat-card:hover {
  box-shadow: 0 4px 16px rgba(176,138,78,.18); transform: translateY(-2px);
  border-color: var(--bronze-light);
}
.cat-card-header {
  background: var(--bronze-subtle); padding: 10px 12px 8px;
  border-bottom: 1px solid var(--bronze-bg);
}
.cat-card-nome { font-size: .95rem; font-weight: 700; color: var(--night); letter-spacing: .02em; }
.cat-card-art  { font-size: .65rem; color: var(--bronze); font-weight: 600; margin-top: 1px; }
.cat-card-body { padding: 8px 12px 6px; }
.cat-card-peso { font-size: .75rem; color: var(--gray-500); margin-bottom: 6px; }
.cat-card-peso i { margin-right: 3px; color: var(--bronze); }
.cat-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-badge {
  display: inline-block; font-size: .58rem; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em;
}
.cat-badge-str  { background: #e8f4fd; color: #1a6fa8; border: 1px solid #b3d8f0; }
.cat-badge-comp { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.cat-badge-fin  { background: var(--warning-bg); color: #92400e; border: 1px solid var(--warning-border); }
.cat-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--gray-50);
  border-top: 1px solid var(--gray-100); font-size: .65rem;
}
.cat-card-fin-lbl { color: var(--gray-500); }
.cat-card-cta { color: var(--bronze); font-weight: 700; }

/* Paginazione */
.cat-pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 12px 8px; }
.cat-pag-btn {
  min-width: 36px !important; height: 36px !important;
  border: 1px solid var(--gray-200); background: var(--white);
  border-radius: 6px; cursor: pointer; font-size: .85rem !important;
  color: var(--gray-600); padding: 0 8px !important; transition: all .1s;
}
.cat-pag-btn:hover:not([disabled]) { border-color: var(--bronze); color: var(--bronze); }
.cat-pag-btn.active { background: var(--bronze); color: var(--white); border-color: var(--bronze); }
.cat-pag-btn[disabled] { opacity: .4; cursor: not-allowed; }
.cat-pag-dots { display: flex; align-items: center; font-size: .8rem; color: var(--gray-400); padding: 0 4px; }

/* Scheda tessuto */
.scheda-wrap { max-width: 900px; }
.scheda-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--gray-200); color: var(--gray-500);
  font-size: .8rem; padding: 6px 12px; border-radius: 6px; cursor: pointer; margin-bottom: 16px;
}
.scheda-back-btn:hover { border-color: var(--bronze); color: var(--bronze); }
.scheda-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--bronze-subtle); border: 1.5px solid var(--bronze-light);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 20px;
}
.scheda-nome { font-size: 1.5rem; font-weight: 800; color: var(--night); }
.scheda-art { font-size: .8rem; color: var(--bronze); margin-top: 3px; }
.scheda-azienda { font-size: .75rem; color: var(--gray-500); margin-top: 4px; }
.scheda-hdr-right { text-align: right; }
.scheda-prezzo-lbl { font-size: .65rem; text-transform: uppercase; color: var(--bronze); font-weight: 700; }
.scheda-prezzo-val { font-size: 1.4rem; font-weight: 800; color: var(--night); }
.scheda-varianti-cnt { font-size: .7rem; color: var(--gray-500); margin-top: 2px; }
.scheda-section-title {
  font-size: .8rem; font-weight: 800; color: var(--bronze);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.scheda-section-title::after { content: ''; flex: 1; height: 1px; background: var(--bronze-light); }
.scheda-specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 8px; }
.scheda-spec-item { background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 14px; }
.scheda-spec-lbl { font-size: .62rem; text-transform: uppercase; color: var(--bronze); font-weight: 700; margin-bottom: 3px; }
.scheda-spec-val { font-size: .88rem; color: var(--night); font-weight: 600; }
.scheda-var-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.scheda-var-item {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px;
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.scheda-var-item:hover { border-color: var(--bronze); box-shadow: 0 2px 8px rgba(176,138,78,.18); }
.scheda-var-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; margin-bottom: 6px;
  cursor: zoom-in; display: block; border: 1px solid var(--gray-200);
  transition: transform .15s ease, box-shadow .15s ease;
}
.scheda-var-img:hover { transform: scale(1.03); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.scheda-var-nome { font-size: .82rem; font-weight: 700; color: var(--night); margin-bottom: 3px; }
.scheda-var-details { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.scheda-var-art  { font-size: .6rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; background: var(--gray-100); color: var(--gray-500); }
.scheda-var-book { font-size: .6rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; background: var(--bronze-subtle); color: var(--bronze); border: 1px solid var(--bronze-light); }
.scheda-var-prezzo { font-size: .88rem; font-weight: 800; color: var(--bronze); }
.scheda-usa-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bronze); color: var(--white); border: none;
  font-size: .85rem; font-weight: 700; padding: 8px 16px; border-radius: 8px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.scheda-usa-btn:hover { background: var(--bronze-dark); transform: translateY(-1px); }
.scheda-var-usa-btn {
  font-size: .65rem; font-weight: 700; color: var(--bronze);
  display: inline-flex; align-items: center; gap: 3px;
}

/* Cerca tessuto item nel wizard */
.cerca-tessuto-item {
  padding: 12px 14px; border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background .12s; border-radius: 6px; margin-bottom: 2px;
}
.cerca-tessuto-item:hover { background: var(--bronze-subtle); }
.cerca-tessuto-item:last-child { border-bottom: none; }

/* Permessi book */
.modal-perm-book { max-width: 540px; }
.perm-book-grid {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 420px; overflow-y: auto; padding-right: 4px;
}
.perm-book-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border-radius: 8px; border: 1.5px solid var(--gray-200); background: var(--gray-50);
  transition: border-color .15s, background .15s;
}
.perm-book-item.perm-on  { border-color: #86efac; background: var(--success-bg); }
.perm-book-item.perm-off { border-color: var(--gray-200); background: var(--gray-50); }
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-top: 1px solid rgba(0,0,0,.06);
}
.perm-row:first-of-type { border-top: none; }
.perm-row-label { font-size: .8rem; font-weight: 600; color: var(--gray-700); display: flex; align-items: center; gap: 6px; }
.perm-row-label i { color: var(--gray-400); font-size: .75rem; }
.perm-row-disabled { opacity: .4; pointer-events: none; }
.perm-book-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; color: var(--night); }
.perm-azienda { font-size: .7rem; font-weight: 400; color: var(--gray-400); margin-left: 4px; }
.text-green { color: #16a34a; }
.text-gray  { color: var(--gray-400); }
.perm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.perm-toggle input { opacity: 0; width: 0; height: 0; }
.perm-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gray-300); border-radius: 22px; transition: .2s;
}
.perm-toggle-slider::before {
  content: ''; position: absolute;
  height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: var(--white); border-radius: 50%; transition: .2s;
}
.perm-toggle input:checked + .perm-toggle-slider { background: #16a34a; }
.perm-toggle input:checked + .perm-toggle-slider::before { transform: translateX(18px); }

/* Canclini scheda topbar */
.canclini-scheda-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  background: var(--white);
  border-bottom: 2px solid rgba(13,27,46,.12);
  padding: 10px 12px; border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
/* Varianti scheda */
.scheda-varianti-section { margin-top: 20px; }
.scheda-varianti-title {
  font-size: .9rem; font-weight: 800; color: var(--night); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px; border-bottom: 2px solid var(--gray-200);
}
.scheda-var-book-section { margin-bottom: 20px; }
.scheda-var-book-title {
  font-size: .78rem; font-weight: 700; color: var(--night-3);
  background: var(--info-bg); border: 1px solid var(--info-border);
  border-radius: 6px; padding: 6px 12px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* Thumb scheda */
.scheda-thumb-wrap { flex-shrink: 0; width: 200px; min-width: 140px; max-width: 220px; }
.scheda-thumb {
  width: 100%; height: 200px; object-fit: cover; border-radius: 10px; display: block;
  border: 1.5px solid var(--gray-200); box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.scheda-info { flex: 1; min-width: 0; }
.scheda-props-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .82rem; }
.scheda-props-table td { padding: 4px 8px 4px 0; vertical-align: top; color: var(--gray-600); }
.scheda-props-table td:first-child {
  font-weight: 700; color: var(--night-3); white-space: nowrap; width: 110px;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .03em;
}

/* ============================================================
   8. SU MISURA FORM — restyling night/bronze
   ============================================================ */

/* Modal header elegante */
#modalOrdineSmForm .modal-header {
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
}
#modalOrdineSmForm .modal-header h3 {
  color: #f4efe8; font-size: 1.05rem; font-weight: 800; letter-spacing: .02em;
}
#modalOrdineSmForm .modal-header h3 i { color: #b08a4e !important; }
#modalOrdineSmForm .modal-close {
  color: #b08a4e; background: rgba(176,138,78,.12);
  border: 1px solid rgba(176,138,78,.3); border-radius: 8px;
  width: 34px; height: 34px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition: all .2s;
}
#modalOrdineSmForm .modal-close:hover { background: rgba(176,138,78,.25); color: #f4efe8; }

/* Sezione blocco */
.sm-section {
  background: #fff;
  border: 1.5px solid #e2d9cc;
  border-radius: 14px;
  padding: 0;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(13,27,46,.06);
}

/* Header sezione con titolo + action a destra */
.sm-section-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
  padding: 12px 16px 12px 18px;
}

/* Header sezione (titolo) */
.sm-section-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: #f4efe8;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 0;
}
/* Titolo dentro sm-section-header: no doppio sfondo */
.sm-section-header .sm-section-title {
  background: none; border: none; padding: 0; margin: 0;
}
.sm-section-title i { color: #b08a4e; font-size: .85rem; }

/* Badge contatore nel titolo */
.sm-section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: rgba(176,138,78,.2);
  border: 1px solid rgba(176,138,78,.4);
  border-radius: 20px;
  font-size: .7rem; font-weight: 800; color: #c9a55a;
  margin-left: 2px;
}

/* Contenuto interno sezione */
.sm-section-body {
  padding: 18px;
}

/* Griglia misure */
.sm-misure-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px;
}

/* Riga misura */
.sm-misura-row {
  background: #f8f5f0;
  border: 1px solid #e2d9cc;
  border-radius: 10px;
  padding: 10px 12px;
}
.sm-misura-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: #b08a4e; margin-bottom: 8px;
  display: flex; align-items: center; gap: 5px;
}
.sm-misura-label::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: #b08a4e; flex-shrink: 0;
}
.sm-misura-inputs { display: flex; gap: 8px; align-items: flex-end; }

/* Opzioni grid */
.sm-opzioni-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.sm-opzione-item {
  background: #f8f5f0;
  border: 1.5px solid #e2d9cc;
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .2s, box-shadow .2s;
}
.sm-opzione-item:hover {
  border-color: #b08a4e;
  box-shadow: 0 2px 8px rgba(176,138,78,.15);
}
.sm-opzione-item label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: #0d1b2e; margin-bottom: 8px;
  display: block;
}
.sm-opzione-item select,
.sm-opzione-item input[type="date"],
.sm-opzione-item input[type="text"] {
  width: 100%; border: 1.5px solid #d4c9b8;
  border-radius: 8px; padding: 8px 10px;
  font-size: .85rem; color: #0d1b2e;
  background: #fff;
  transition: border-color .2s;
}
.sm-opzione-item select:focus,
.sm-opzione-item input:focus {
  outline: none; border-color: #b08a4e;
  box-shadow: 0 0 0 3px rgba(176,138,78,.15);
}

/* Campo iniziali ricamo — appare solo quando sì */
.sm-iniziali-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fdf8f0 0%, #f4efe8 100%);
  border: 1.5px solid #b08a4e;
  border-radius: 8px;
  animation: fadeSlideDown .2s ease;
}
.sm-iniziali-box label {
  font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  color: #7a6030; text-transform: uppercase; margin-bottom: 6px;
}
.sm-iniziali-box input {
  width: 100%; border: 1.5px solid #b08a4e;
  border-radius: 8px; padding: 8px 10px;
  font-size: 1rem; font-weight: 700; letter-spacing: .15em;
  color: #0d1b2e; background: #fff;
  text-transform: uppercase;
}
.sm-iniziali-box input:focus {
  outline: none; border-color: #8a6a30;
  box-shadow: 0 0 0 3px rgba(176,138,78,.2);
}

/* Urgenza attiva — highlight rosso */
.sm-opzione-item.urgenza-attiva {
  border-color: #dc2626;
  background: #fff5f5;
  box-shadow: 0 2px 8px rgba(220,38,38,.12);
}
.sm-opzione-item.urgenza-attiva label { color: #b91c1c; }

/* Select con sì attivo — highlight verde */
.sm-opzione-item.opzione-si {
  border-color: #16a34a;
  background: #f0fdf4;
}
.sm-opzione-item.opzione-si label { color: #15803d; }

/* Form inputs nel body sezione */
.sm-section-body .form-group label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: #4b5563;
}
.sm-section-body input,
.sm-section-body select,
.sm-section-body textarea {
  border: 1.5px solid #d4c9b8;
  border-radius: 8px; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.sm-section-body input:focus,
.sm-section-body select:focus,
.sm-section-body textarea:focus {
  border-color: #b08a4e;
  box-shadow: 0 0 0 3px rgba(176,138,78,.15);
}

/* Pulsanti footer form */
#formOrdineSmInner .btn-primary {
  background: linear-gradient(135deg, #b08a4e, #8a6a30);
  border: none; color: #fff; font-weight: 700;
}
#formOrdineSmInner .btn-primary:hover {
  background: linear-gradient(135deg, #8a6a30, #6d5025);
}
#formOrdineSmInner .btn-outline {
  border: 1.5px solid #b08a4e; color: #b08a4e;
  background: transparent; font-weight: 600;
}
#formOrdineSmInner .btn-outline:hover {
  background: rgba(176,138,78,.08);
}

/* Footer form separatore */
.sm-form-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 20px; border-top: 2px solid #e2d9cc;
  margin-top: 0; background: #f8f5f0;
  border-radius: 0 0 12px 12px;
  flex-wrap: wrap;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .sm-misure-grid  { grid-template-columns: 1fr; }
  .sm-opzioni-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   9. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 260px; }
  .page-content { padding: 20px; }
  .stats-grid  { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .cat-wrap { flex-direction: column; }
  .cat-sidebar { width: 100%; position: static; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .scheda-specs-grid { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════
   CARD OPERATORI — Gestione Operatori Admin
══════════════════════════════════════════════════ */
.op-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 16px 20px;
  border-bottom: 1.5px solid #f0ebe2;
  transition: background .18s ease;
}
.op-card:last-child { border-bottom: none; }
.op-card:hover { background: #faf8f5; }

.op-card-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }

.op-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #0d1b2e, #162540);
  border: 2px solid #b08a4e;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; color: #c9a96e;
  letter-spacing: .04em;
}

.op-info { min-width: 0; }
.op-nome {
  font-weight: 700; font-size: .95rem; color: #0d1b2e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.op-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.op-meta span {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; color: #6b7280;
}
.op-meta span i { color: #b08a4e; font-size: .7rem; }
.op-username {
  background: #f0ebe2; border-radius: 6px;
  padding: 2px 8px; color: #374151 !important; font-weight: 600 !important;
}

.op-card-right {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  flex-wrap: wrap; justify-content: flex-end;
}

.op-stato-wrap { display: flex; }
.op-badge-attivo {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f0fdf4; border: 1.5px solid #16a34a;
  color: #16a34a; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.op-badge-attivo i { font-size: .5rem; }
.op-badge-off {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fef2f2; border: 1.5px solid #dc2626;
  color: #dc2626; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.op-badge-off i { font-size: .5rem; }

.op-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn-op-perm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px;
  background: #f8f5f0; border: 1.5px solid #e2d9cc;
  color: #4b5563; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: all .18s ease; white-space: nowrap;
}
.btn-op-perm:hover {
  background: #f0ebe2; border-color: #b08a4e; color: #8a6830;
}
.btn-op-perm i { color: #b08a4e; font-size: .78rem; }

.btn-op-ico {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f8f5f0; border: 1.5px solid #e2d9cc;
  color: #6b7280; font-size: .82rem;
  cursor: pointer; transition: all .18s ease;
}
.btn-op-ico:hover { background: #f0ebe2; border-color: #b08a4e; color: #8a6830; }
.btn-op-warn { background: #fffbeb; border-color: #f59e0b; color: #d97706; }
.btn-op-warn:hover { background: #fef3c7; border-color: #d97706; color: #92400e; }
.btn-op-ok  { background: #f0fdf4; border-color: #16a34a; color: #16a34a; }
.btn-op-ok:hover  { background: #dcfce7; border-color: #15803d; }
.btn-op-del { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.btn-op-del:hover { background: #fee2e2; border-color: #dc2626; }

/* ── BLOCCO INFO CHAT ── */
.op-chat-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
}
.op-chat-item {
  border-radius: 10px; padding: 14px 16px;
  border: 1.5px solid transparent;
}
.op-chat-green  { background: #f0fdf4; border-color: #bbf7d0; }
.op-chat-blue   { background: #eff6ff; border-color: #bfdbfe; }
.op-chat-bronze { background: #faf8f5; border-color: #e2d9cc; }

.op-chat-item-title {
  font-weight: 700; font-size: .82rem; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.op-chat-green  .op-chat-item-title { color: #059669; }
.op-chat-blue   .op-chat-item-title { color: #1d4ed8; }
.op-chat-bronze .op-chat-item-title { color: #8a6830; }

.op-chat-item-desc { font-size: .78rem; line-height: 1.6; color: #4b5563; }
.op-chat-green  .op-chat-item-desc { color: #065f46; }
.op-chat-blue   .op-chat-item-desc { color: #1e3a8a; }
.op-chat-bronze .op-chat-item-desc { color: #6b5a3e; }

/* ── RESPONSIVE OPERATORI ── */
@media (max-width: 767px) {
  .op-card { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 16px; }
  .op-card-right { width: 100%; justify-content: flex-start; }
  .op-actions { flex-wrap: wrap; }
  .op-chat-grid { grid-template-columns: 1fr; }
  .op-meta { gap: 6px; }
  .op-email { display: none; }
}
@media (max-width: 480px) {
  .btn-op-perm span { display: none; }
  .btn-op-perm { padding: 6px 9px; }
}

/* ══════════════════════════════════════════════════
   ANAGRAFICA NEGOZI — Admin
══════════════════════════════════════════════════ */

/* Filtro select nell'header sm-section */
.neg-filtro-select {
  padding: 7px 12px;
  border: 1.5px solid rgba(176,138,78,.5);
  border-radius: 8px;
  background: rgba(13,27,46,.5);
  color: #f4efe8;
  font-size: .82rem; font-weight: 600;
  min-width: 170px;
  cursor: pointer;
  outline: none;
}
.neg-filtro-select:focus { border-color: #b08a4e; }
.neg-filtro-select option { background: #1a2a45; color: #f4efe8; }

/* Gruppo per operatore */
.neg-gruppo { margin-bottom: 24px; }
.neg-gruppo:last-child { margin-bottom: 0; }

.neg-gruppo-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.neg-op-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #0d1b2e, #162540);
  border: 2px solid #b08a4e;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .72rem; color: #c9a96e;
}
.neg-op-avatar.neg-op-warn {
  background: #fffbeb; border-color: #f59e0b; color: #d97706;
}
.neg-op-nome {
  font-weight: 700; font-size: .88rem; color: #0d1b2e;
}
.neg-op-nome-warn { color: #b45309; }
.neg-op-count {
  font-size: .75rem; color: #9ca3af; font-weight: 500;
  background: #f8f5f0; border: 1px solid #e2d9cc;
  border-radius: 12px; padding: 2px 10px;
}
.neg-warn-label {
  font-size: .72rem; font-weight: 600; color: #d97706;
  display: flex; align-items: center; gap: 4px;
}

/* ══════════════════════════════════════════════════
   CARD NEGOZI — Operatore (night/bronze)
══════════════════════════════════════════════════ */

/* Grid negozi */
.neg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 4px 2px;
}

/* Card singolo negozio — night/bronze */
.neg-card {
  background: #fff;
  border: 1.5px solid #e2d9cc;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(13,27,46,.07);
  transition: box-shadow .2s, border-color .2s, transform .15s;
}
.neg-card:hover {
  box-shadow: 0 6px 24px rgba(13,27,46,.13);
  border-color: #b08a4e;
  transform: translateY(-2px);
}

/* Intestazione card: sfondo notte + bordo bronzo in basso */
.neg-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
}
.neg-card-name-wrap {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;
}
.neg-card-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: rgba(176,138,78,.15);
  border: 1.5px solid rgba(176,138,78,.35);
  display: flex; align-items: center; justify-content: center;
  color: #b08a4e; font-size: .88rem;
}
.neg-card-name {
  font-weight: 800; font-size: .95rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.neg-card-city {
  font-size: .73rem; color: rgba(255,255,255,.55);
  display: flex; align-items: center; gap: 3px; margin-top: 2px;
}
.neg-card-city i { color: #b08a4e; font-size: .65rem; }

/* Azioni modifica/elimina nella card */
.neg-card-actions {
  display: flex; gap: 5px; flex-shrink: 0;
}
.btn-ico-edit {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(176,138,78,.12);
  border: 1.5px solid rgba(176,138,78,.3);
  color: #c9a55a; font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, color .2s;
}
.btn-ico-edit:hover { background: rgba(176,138,78,.28); color: #fff; }
.btn-ico-del {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(220,38,38,.1);
  border: 1.5px solid rgba(220,38,38,.25);
  color: #ef4444; font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, color .2s;
}
.btn-ico-del:hover { background: rgba(220,38,38,.25); color: #fff; }

/* Info negozio: griglia a 2 colonne */
.neg-card-info {
  padding: 12px 16px;
  display: flex; flex-wrap: wrap; gap: 6px 0;
}
.neg-info-item {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; color: #374151;
  flex: 1 1 50%; min-width: 140px;
  padding: 3px 0;
}
.neg-info-item.neg-info-full { flex: 1 1 100%; }
.neg-info-item i {
  color: #b08a4e; font-size: .72rem;
  width: 14px; text-align: center; flex-shrink: 0;
}
.neg-info-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Nota in fondo alla card */
.neg-card-note {
  margin: 0 14px 12px;
  padding: 7px 10px;
  background: #faf8f5;
  border: 1px solid #e2d9cc;
  border-radius: 8px;
  font-size: .75rem; color: #6b7280; font-style: italic;
}
.neg-card-note i { color: #b08a4e; margin-right: 4px; }

/* Stato vuoto */
.neg-empty {
  padding: 56px 24px;
  text-align: center;
  color: #9ca3af;
}
.neg-empty i { font-size: 2.5rem; display: block; margin-bottom: 12px; color: #d1c4ae; }
.neg-empty p { font-size: .9rem; margin-bottom: 20px; }

/* ══════════════════════════════════════════════════
   FORM NEGOZIO — modale night/bronze
══════════════════════════════════════════════════ */

/* Modale con header notte */
.modal-night { overflow: hidden; border-top: none; }

/* Header notte — specificità rafforzata per sovrascrivere .modal-header */
.modal-night .modal-header,
.modal-header-night {
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%) !important;
  border-bottom: 2.5px solid #b08a4e !important;
  border-top: none;
  color: #fff !important;
  padding: 16px 22px;
}
.modal-night .modal-header h3,
.modal-header-night h3 { color: #fff !important; font-size: 1rem; }
.modal-night .modal-header .modal-close,
.modal-header-night .modal-close {
  color: rgba(255,255,255,.55) !important;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
}
.modal-night .modal-header .modal-close:hover,
.modal-header-night .modal-close:hover { color: #fff !important; background: rgba(255,255,255,.15) !important; }

/* Body del modal notte: sfondo leggermente caldo */
.modal-night .modal-body { background: #faf9f7; padding: 0; }

/* Wrapper form negozio */
.neg-form {}

/* Sezione interna con titolo bronzo */
.neg-form-section {
  padding: 14px 20px 16px;
  border-bottom: 1px solid #ede8e0;
  background: #fff;
}
.neg-form-section:last-of-type { border-bottom: none; }

/* Titolo sezione — riga bronzo con sfondo notte-micro */
.neg-form-section-title {
  font-size: .68rem;
  font-weight: 900;
  color: #b08a4e;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: linear-gradient(135deg, rgba(13,27,46,.04) 0%, rgba(176,138,78,.06) 100%);
  border-left: 3px solid #b08a4e;
  border-radius: 0 6px 6px 0;
  display: flex; align-items: center; gap: 6px;
}
.neg-form-section-title i { font-size: .75rem; color: #b08a4e; }

/* Footer pulsanti form */
.neg-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 16px;
  border-top: 2px solid #ede8e0;
  background: linear-gradient(135deg, #f5f2ee 0%, #faf8f5 100%);
  position: sticky; bottom: 0;
}

/* ── RESPONSIVE NEGOZI ── */
@media (max-width: 767px) {
  .neg-grid { grid-template-columns: 1fr; gap: 10px; }
  .neg-filtro-select { min-width: 140px; font-size: .78rem; }
  .neg-card-info { flex-direction: column; }
  .neg-info-item { flex: 1 1 100%; }
}

/* Legacy — mantieni compatibilità con .neg-card-header usata altrove */
.neg-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 14px 16px 10px;
  border-bottom: 1.5px solid #f0ebe2;
}
.neg-card-citta {
  font-size: .75rem; color: #6b7280;
  display: flex; align-items: center; gap: 4px;
}
.neg-card-citta i { color: #b08a4e; font-size: .7rem; }
.neg-card-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 5px; }
.neg-info-row { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: #4b5563; }
.neg-info-row i { color: #b08a4e; font-size: .75rem; width: 14px; text-align: center; flex-shrink: 0; }
.neg-info-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neg-note { margin-top: 6px; padding: 7px 10px; background: #faf8f5; border: 1px solid #e2d9cc; border-radius: 7px; font-size: .75rem; color: #6b7280; font-style: italic; }

/* ══════════════════════════════════════════════════
   CARD LABORATORI — Gestione Laboratori Admin
══════════════════════════════════════════════════ */

/* Header card laboratorio (con avatar grande + info) */
.lab-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border-bottom: 2px solid #b08a4e;
}
.lab-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #8a6830, #c9a96e);
  color: white; font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .04em;
  border: 2px solid rgba(176,138,78,.5);
}
.lab-header-info {
  flex: 1; min-width: 0;
}
.lab-header-info .neg-card-name {
  color: rgba(255,255,255,.95);
  font-size: .92rem;
}
.lab-referente {
  font-size: .72rem; color: rgba(244,239,232,.6);
  margin-top: 2px; display: flex; align-items: center; gap: 4px;
}
.lab-referente i { color: #b08a4e; font-size: .68rem; }

/* Badge stato in card body */
.lab-badge-attivo {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f0fdf4; border: 1.5px solid #16a34a;
  color: #16a34a; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 4px;
}
.lab-badge-sospeso {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fffbeb; border: 1.5px solid #f59e0b;
  color: #d97706; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 4px;
}

/* Variante card sospesa */
.lab-card-sospeso {
  border-color: #fde68a !important;
  background: #fffdf5 !important;
}
.lab-card-sospeso .lab-card-header {
  background: linear-gradient(135deg, #1c1a00 0%, #2a2500 100%) !important;
}
.lab-card-sospeso .lab-avatar {
  background: linear-gradient(135deg, #92400e, #d97706) !important;
}

@media (max-width: 767px) {
  /* Sidebar off-canvas */
  .sidebar { transform: translateX(-100%); width: 280px; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,.45); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; width: 100%; }
  .hamburger { display: flex; }

  .page-content { padding: 12px; max-width: 100%; margin: 0; overflow-x: hidden; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h2 { font-size: .9rem; }
  .topbar-user { font-size: .72rem; padding: 5px 10px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon  { width: 42px; height: 42px; font-size: 1.1rem; }

  .card-header { padding: 14px 16px; gap: 8px; }
  .card-body   { padding: 16px; }

  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .riepilogo-grid { grid-template-columns: 1fr; }

  .taglie-grid    { grid-template-columns: repeat(4, 1fr); }
  .taglie-grid-sm { grid-template-columns: repeat(5, 1fr); }

  .wizard-steps { gap: 0; padding: 18px 16px 16px; }
  .wizard-step .step-circle { width: 36px; height: 36px; font-size: .8rem; }
  .wizard-step .step-label  { font-size: .58rem; }
  .wizard-steps::before { top: 18px; left: 15%; right: 15%; }

  .table-wrapper { -webkit-overflow-scrolling: touch; }
  table { font-size: .8rem; }
  thead th { padding: 10px 10px; font-size: .65rem; }
  tbody td  { padding: 10px 10px; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-lg, .modal-xl { max-width: 100%; }
  .modal-header { padding: 16px 18px 14px; }
  .modal-body   { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px 20px; gap: 10px; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  .oa-btn span { display: none; }
  .oa-btn { padding: 8px 10px; min-width: 36px; }

  #toastContainer { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; font-size: .82rem; padding: 12px 16px; }

  .profilo-wrap { max-width: 100%; padding: 0; }
  .profilo-header-card { padding: 16px; }

  .sidebar-footer { padding: 12px; padding-bottom: env(safe-area-inset-bottom, 12px); }
  .btn-logout { padding: 13px; font-size: .875rem; }

  .scheda-header { flex-direction: column; gap: 10px; }
  .scheda-thumb-wrap { width: 100%; max-width: 100%; }
  .scheda-thumb { width: 100%; height: 200px; }
  .scheda-hdr-right { text-align: left; }
}

@media (max-width: 480px) {
  body, .main-content, .page-content { overflow-x: hidden; width: 100%; max-width: 100vw; }

  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .stat-card  { padding: 14px 16px; }
  .stat-value { font-size: 1.4rem; }

  .taglie-grid    { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .taglie-grid-sm { grid-template-columns: repeat(5, 1fr); gap: 3px; }
  .taglia-label   { font-size: .85rem; }
  .taglia-item    { padding: 10px 4px; }
  .taglia-item input { font-size: .85rem; padding: 6px 2px; }

  .topbar-user { display: none; }
  .topbar h2   { font-size: .82rem; }

  .wizard-step .step-circle { width: 30px; height: 30px; font-size: .72rem; }
  .wizard-step .step-label  { font-size: .52rem; }
  .wizard-steps::before { top: 15px; }
  .wizard-nav { flex-direction: column; gap: 10px; border-radius: 0; }
  .wizard-nav .btn { width: 100%; justify-content: center; }
  .btn-wiz-next, .btn-wiz-back, .btn-wiz-confirm { width: 100%; justify-content: center; }
  .step-panel.active { padding: 14px 14px 4px; }
  .wiz-card-header { padding: 14px 16px; font-size: .92rem; }

  .btn    { font-size: .82rem; padding: 9px 14px; }
  .btn-sm { font-size: .75rem; padding: 6px 10px; }

  .card-header { padding: 12px 14px; }
  .card-body   { padding: 14px; }

  .modal-header h3 { font-size: .95rem; }
  .modal-body { padding: 14px 14px; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  thead th { padding: 8px 8px; font-size: .6rem; }
  tbody td  { padding: 8px 8px; font-size: .78rem; }

  .tessuto-block-header { padding: 10px 12px; }
  .tessuto-block-body   { padding: 12px; }

  #toastContainer { bottom: 12px; right: 8px; left: 8px; }
  .toast { font-size: .78rem; padding: 10px 14px; gap: 8px; }

  .profilo-wrap { padding: 0; }
  #profiloBtn   { position: sticky; bottom: 0; z-index: 10; border-radius: 0 0 12px 12px; box-shadow: 0 -4px 20px rgba(0,0,0,.12); }

  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .scheda-specs-grid { grid-template-columns: 1fr; }
  .scheda-var-grid { grid-template-columns: repeat(2, 1fr); }
  .scheda-thumb { height: 160px; }
  .cat-pag-btn { min-width: 34px !important; height: 34px !important; font-size: .8rem !important; padding: 0 8px !important; }
}

@media (max-width: 375px) {
  .taglie-grid-sm { grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .taglia-label-sm { font-size: .6rem; }
  .taglia-inp-sm   { font-size: .7rem; padding: 3px 1px; }
  .stats-grid  { gap: 6px; }
  .page-content { padding: 8px; }
  .topbar { padding: 0 10px; }
  .topbar h2 { font-size: .78rem; }
}

/* ============================================================
   10. GRIGLIA CARD ORDINI – responsive (admin.js e su_misura.js)
   ============================================================ */

/* ── Griglia: 3 col desktop → 2 tablet → 1 mobile ── */
.ord-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

/* ── Card base ── */
.card-ord {
  border: 1.5px solid #e5e7eb;
  border-radius: 16px;
  background: #fafafa;
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.card-ord:hover { box-shadow: 0 6px 24px rgba(0,0,0,.12); border-color: #b08a4e; }

/* ── Header navy/gold ── */
.card-ord-header {
  background: linear-gradient(135deg, #0d1b2e, #1a2f4a);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: 0;
}

/* Avatar iniziale */
.card-ord-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b08a4e, #d4aa6e);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(176,138,78,.4);
}

/* Testo header: nome cliente/riferimento */
.card-ord-header > div[style*="flex:1"],
.card-ord-nome-wrap {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}
/* Testo nominativo: sempre visibile con ellipsis */
.card-ord-nome {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
  max-width: 100%;
  display: block;
}

/* Badge stato: colonna destra header */
.card-ord-stato-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  max-width: 120px;
}
.card-ord-stato-wrap span {
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Body ── */
.card-ord-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

/* ── Footer azioni ── */
.card-ord-footer {
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  background: #f9fafb;
  border-top: 1px solid #f1f5f9;
}

/* Gruppo icone secondarie (email/wa/reminder/elimina) */
.card-ord-footer-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-left: auto;
  flex-shrink: 0;
  align-items: center;
}

/* ── Bottone icona quadrato ── */
.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  font-size: 1.05rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid #d1d5db;
  background: #fff;
  color: #374151;
  transition: opacity .15s, transform .1s;
  flex-shrink: 0;
}
.btn-ico:hover { opacity: .8; transform: scale(1.05); }

/* Bottone primario (Dettaglio/Apri) */
.btn-ico-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: .82rem;
  font-weight: 700;
  background: #0d1b2e;
  color: #b08a4e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn-ico-primary:hover { opacity: .85; }

/* Box tessuto con bordo gold */
.card-tessuto-box {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 10px 12px;
  border-left: 3px solid #b08a4e;
}

/* Mini-card lab/data/consegna */
.card-info-mini {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px 10px;
}

/* Label/value mini dentro card-info-mini */
.card-info-label {
  font-size: .63rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9ca3af;
  margin-bottom: 3px;
}
.card-info-val {
  font-size: .82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Label/value/sub dentro card-tessuto-box */
.card-box-label {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #9ca3af;
  margin-bottom: 5px;
}
.card-box-value {
  font-size: .92rem;
  font-weight: 700;
  color: #0d1b2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-box-sub {
  font-size: .72rem;
  color: #6b7280;
  margin-top: 3px;
}

/* Testo specifica (sotto il riferimento nell'header card) */
.card-ord-specifica {
  font-size: .7rem;
  color: #6b7280;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* Nome operatore nell'header card (solo admin) */
.card-ord-op {
  color: #94a3b8;
  font-size: .75rem;
  margin-top: 3px;
}

/* Pill badge stato nel header card */
.card-ord-stato-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.card-ord-stato-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Badges invio compatti nell'header card */
.card-ord-invio-badges {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.invio-badge-email {
  display: inline-flex; align-items: center; gap: 3px;
  background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd;
  border-radius: 20px; padding: 2px 8px; font-size: .68rem; font-weight: 600;
}
.invio-badge-wa {
  display: inline-flex; align-items: center; gap: 3px;
  background: #dcfce7; color: #166534; border: 1px solid #86efac;
  border-radius: 20px; padding: 2px 8px; font-size: .68rem; font-weight: 600;
}

/* Select cambio stato dentro il body card */
.card-cambia-stato-wrap { }
.card-cambia-stato-sel {
  font-size: .76rem;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  width: 100%;
  border: 1.5px solid;
  font-family: inherit;
  outline: none;
  transition: opacity .15s;
}
.card-cambia-stato-sel:hover { opacity: .85; }

/* ── STATO-GROUP: Header night/bronze ── */
.stato-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: linear-gradient(135deg, #0d1b2e 0%, #162540 100%);
  border: 1.5px solid #b08a4e;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: all .18s;
  margin-bottom: 0;
}
.stato-group-header:hover {
  background: linear-gradient(135deg, #0f2035 0%, #1c2f50 100%);
  border-color: #d4aa6e;
}
.stato-group.is-open .stato-group-header {
  border-radius: 12px 12px 0 0;
  border-bottom-color: rgba(176,138,78,.35);
  margin-bottom: 0;
}
.sg-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(255,255,255,.25);
}
.sg-icon {
  color: #b08a4e;
  font-size: .85rem;
  flex-shrink: 0;
}
.sg-label {
  font-weight: 800;
  font-size: .92rem;
  color: #fff;
  flex: 1;
  letter-spacing: .01em;
}
.sg-count {
  font-size: .75rem;
  font-weight: 700;
  color: #0d1b2e;
  background: linear-gradient(135deg, #b08a4e, #d4aa6e);
  padding: 3px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}
.sg-chevron {
  font-size: .78rem;
  color: #b08a4e;
  flex-shrink: 0;
  transition: transform .18s;
}
/* Body gruppo: bordo laterale bronzo quando aperto */
.stato-group.is-open .stato-group-body {
  border: 1.5px solid #b08a4e;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 16px;
  background: #faf8f5;
  margin-bottom: 0;
}

/* Bottoni icona varianti colore card footer */
.btn-ico-pdf   { color: #dc2626 !important; border-color: #fca5a5 !important; }
.btn-ico-email { color: #1e40af !important; border-color: #93c5fd !important; }
.btn-ico-wa    { color: #16a34a !important; border-color: #86efac !important; }
.btn-ico-rem   { color: #92400e !important; border-color: #fcd34d !important; }
.btn-ico-del   { color: #dc2626 !important; border-color: #fca5a5 !important; }

/* Contenitori lista ordini: no overflow orizzontale */
#ordiniList,
#ordiniSmList,
#mieiOrdiniList {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
.stato-group-body,
[id^="osm-group-body-"] {
  width: 100%;
  box-sizing: border-box;
}

/* ── TABLET (≤ 1024px): 2 colonne ── */
@media (max-width: 1024px) {
  .ord-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .card-ord-avatar { width: 42px; height: 42px; font-size: .95rem; }
  .card-ord-header { padding: 12px 14px; gap: 10px; }
  .card-ord-body   { padding: 11px 13px; gap: 9px; }
  .card-ord-footer { padding: 9px 11px; gap: 5px; }
  .btn-ico { width: 35px; height: 35px; font-size: .95rem; }
  /* Riduci badge stato per dare spazio al nominativo */
  .card-ord-stato-wrap { max-width: 90px; }
  .card-ord-stato-wrap span { font-size: .66rem !important; padding: 2px 7px !important; }
  /* Assicura che il titolo (nominativo) sia visibile */
  .card-ord-header > div { min-width: 0; overflow: hidden; }
  .card-ord-nome-wrap { min-width: 0; overflow: hidden; flex: 1; }
  /* Font nominativo leggermente ridotto su tablet per non essere troncato */
  .card-ord-nome { font-size: .9rem !important; }
}

/* ── SMARTPHONE (≤ 768px): 1 colonna, footer ordinato ── */
@media (max-width: 767px) {
  .ord-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card-ord-avatar { width: 46px; height: 46px; font-size: 1.05rem; }
  .card-ord-header { padding: 14px 16px; gap: 12px; }
  .card-ord-body   { padding: 12px 14px; gap: 8px; }
  .card-ord-footer {
    padding: 11px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  /* Bottone Apri/Dettaglio: abbastanza largo */
  .btn-ico-primary {
    padding: 9px 16px;
    font-size: .82rem;
  }
  /* Icone: grandi e ben spaziata */
  .btn-ico {
    width: 40px; height: 40px;
    font-size: 1.08rem;
    border-radius: 10px;
  }
  /* Gruppo dx: resta in fila senza wrap */
  .card-ord-footer-actions {
    gap: 7px;
    margin-left: auto;
  }
  /* Badge stato: compatto ma leggibile */
  .card-ord-stato-wrap {
    max-width: 105px;
  }
  /* Dashboard stats: 2 colonne su small */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  /* Topbar: nascondi testo utente */
  .topbar-user-name { display: none; }
  /* Accordion header stato */
  .stato-group-header .sg-label { font-size: .82rem; }
  .stato-group-header .sg-count { font-size: .7rem; }
}

/* ── EXTRA SMALL (≤ 400px) ── */
@media (max-width: 400px) {
  .ord-grid { gap: 10px; }
  .card-ord-avatar { width: 42px; height: 42px; font-size: .98rem; }
  .btn-ico { width: 38px; height: 38px; font-size: 1rem; border-radius: 9px; }
  .btn-ico-primary { padding: 8px 13px; font-size: .8rem; }
  .card-ord-stato-wrap { max-width: 95px; }
}

/* ============================================================
   11. SAFE AREA iPhone notch / home bar
   ============================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sidebar-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-overlay  { padding-bottom: env(safe-area-inset-bottom); }
  #toastContainer { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   12. TOOLBAR ORDINI + SEARCH BAR PAGINE
   ============================================================ */

/* Toolbar sopra la griglia ordini (search + contatore) */
.ordini-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ordini-toolbar input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: .875rem;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.ordini-toolbar input:focus { border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(176,138,78,.1); }
.toolbar-count {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gray-500);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Barra filtri rapidi per stato (bottoni pill) */
.filtri-stato-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.filtro-stato-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 700;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filtro-stato-btn.active,
.filtro-stato-btn:hover { opacity: .85; }

/* Griglia misure su misura form (2 col → 1 col mobile) */
.sm-misure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }

/* Header sezioni con titolo + azione a dx */
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.section-hdr h3, .section-hdr h4 { margin: 0; }

/* Griglia 2 colonne generica → 1 su mobile */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── TABLET (≤ 1024px) ── */
@media (max-width: 1024px) {
  .ordini-toolbar input { min-width: 160px; }
  .sm-misure-grid { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
}

/* ── SMARTPHONE (≤ 767px) ── */
@media (max-width: 767px) {
  .grid-2col { grid-template-columns: 1fr; gap: 8px; }
  .ordini-toolbar { gap: 8px; margin-bottom: 14px; }
  .ordini-toolbar input { min-width: 0; width: 100%; }
  .toolbar-count { width: 100%; text-align: right; }

  .filtri-stato-bar { gap: 5px; margin-bottom: 14px; }
  .filtro-stato-btn { padding: 4px 10px; font-size: .72rem; }

  .sm-misure-grid { grid-template-columns: 1fr 1fr; gap: 7px 10px; }

  /* Accordion header stato: meno padding su mobile */
  .stato-group-header { padding: 9px 14px; border-radius: 10px; }
  .stato-group.is-open .stato-group-header { border-radius: 10px 10px 0 0; }

  /* Sezione negozi admin: bottone azione full-width */
  .section-hdr { gap: 8px; }
  .section-hdr .btn { font-size: .8rem; padding: 8px 12px; }
}

/* ── SMARTPHONE SMALL (≤ 640px) ── */
@media (max-width: 640px) {
  .sm-misure-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Tabelle ordini: scroll orizzontale */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Topbar: compatta su smartphone */
  .topbar-user-name { display: none; }
  .topbar h2 { font-size: .85rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Tab su misura responsive */
.sm-tab-nav { width: 100%; }
.sm-tab-nav button { white-space: nowrap; }

@media (max-width: 480px) {
  .sm-tab-nav button { font-size: .78rem; padding: 7px 10px !important; }
  .sm-tab-nav button i { margin-right: 4px !important; }
}

/* ── EXTRA SMALL (≤ 480px) ── */
@media (max-width: 480px) {
  .ordini-toolbar { margin-bottom: 10px; }
  .filtri-stato-bar { gap: 4px; margin-bottom: 10px; }
  .filtro-stato-btn { padding: 3px 8px; font-size: .68rem; }

  /* Accordion gruppo stato: testo ridotto */
  .stato-group-header { padding: 8px 11px; border-radius: 9px; }
  .stato-group.is-open .stato-group-header { border-radius: 9px 9px 0 0; }
  .sg-label { font-size: .85rem; }
  .sg-count { font-size: .7rem; padding: 2px 9px; }
  
  /* Grid 2 colonne → 1 colonna su extra small */
  .grid-2col { grid-template-columns: 1fr; gap: 8px; }
}

/* ============================================================
   14. BOOK CATALOGO TESSUTI – sm-book-card
   ============================================================ */

/* Griglia book: 3 colonne su desktop, si adatta su tablet/mobile */
.sm-book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}
/* Tablet (768-1024px): mantieni 3 colonne ma con gap ridotto */
@media (min-width: 641px) and (max-width: 1024px) {
  .sm-book-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

/* Card tessuto nel book */
.sm-book-card {
  background: #fff;
  border: 1.5px solid #e8d5a8;
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow .18s, border-color .18s;
  min-width: 0;
}
.sm-book-card:hover {
  box-shadow: 0 4px 18px rgba(160,120,64,.15);
  border-color: #c9a05a;
}

/* Header card: badge book + azienda */
.sm-book-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}

/* Badge libro */
.sm-book-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  background: linear-gradient(135deg, #b08a4e, #d4aa6e);
  color: #fff;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nome tessuto */
.sm-book-card-nome {
  font-size: .95rem;
  font-weight: 800;
  color: #0d1b2e;
  line-height: 1.2;
  letter-spacing: .01em;
}

/* Informazioni tessuto (struttura, composizione) */
.sm-book-card-info {
  font-size: .74rem;
  color: #6b7280;
  line-height: 1.3;
}

/* Peso g/m² */
.sm-book-card-peso {
  font-size: .72rem;
  font-weight: 700;
  color: #a07840;
  background: rgba(176,138,78,.1);
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  width: fit-content;
}

/* Bottone "Scegli" singolo (nessuna variante) */
.sm-book-card-scegli {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #0d1b2e, #1a2f4a);
  color: #b08a4e;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 4px;
}
.sm-book-card-scegli:hover { opacity: .85; }

/* Separatore varianti dentro card */
.sm-book-varianti-lbl {
  font-size: .65rem;
  font-weight: 800;
  color: #a07840;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
  margin-top: 8px;
}

/* Riga variante selezionabile */
.sm-book-variante-row {
  padding: 5px 9px;
  margin-bottom: 3px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  background: #fdf6ec;
  border: 1px solid #e8d5a8;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}
.sm-book-variante-row:hover { background: #f5e6c8; }
.sm-book-variante-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c9a05a;
  flex-shrink: 0;
}
.sm-book-variante-nome { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-book-variante-scegli { color: #a07840; font-size: .68rem; font-weight: 700; flex-shrink: 0; }

/* ── Responsive book ── */
/* Tablet (≤ 1024px): mantieni 3 colonne */
@media (max-width: 1024px) {
  .sm-book-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
/* Smartphone (≤ 600px): 2 colonne */
@media (max-width: 600px) {
  .sm-book-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .sm-book-card { padding: 10px 10px 8px; border-radius: 10px; }
  .sm-book-card-nome { font-size: .82rem; }
  .sm-book-badge { font-size: .55rem; }
}
/* Extra small (≤ 380px): 1 colonna */
@media (max-width: 380px) {
  .sm-book-grid { grid-template-columns: 1fr; gap: 8px; }
}

/* ============================================================
   16. MODAL BOOK TESSUTI – layout ottimizzato
   ============================================================ */

/* Il modal book su tablet/desktop: più ampio */
#modalAdminBook .modal,
#modalSmBook .modal,
#modalOpBook .modal,
#cercaTessutoModal .modal {
  max-width: 1100px !important;
  width: 97% !important;
}

/* Su smartphone: full screen */
@media (max-width: 767px) {
  #modalAdminBook .modal,
  #modalSmBook .modal,
  #modalOpBook .modal,
  #cercaTessutoModal .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh !important;
  }
  
  /* Il body del modal (griglia tessuti) */
  #adminBookGriglia,
  #smBookGriglia,
  #opBookGriglia,
  #cercaTessutoRisultati {
    padding: 12px 14px !important;
  }
  
  /* Header e filtri del modal */
  #modalAdminBook .modal-header,
  #modalSmBook .modal-header,
  #cercaTessutoModal .modal-header {
    padding: 14px 16px 12px !important;
  }
}

/* ── Contenitori book: no overflow laterale ── */
#adminBookGriglia,
#smBookGriglia,
#opBookGriglia,
#cercaTessutoRisultati {
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
}

/* ============================================================
   RESPONSIVE PATCH — fix grid inline e tabelle scrollabili
   ============================================================ */

/* Tutte le tabelle nel pageContent scorrono orizzontalmente su mobile */
@media (max-width: 767px) {
  /* Ogni tabella non gestita da .table-wrapper ottiene scroll */
  .page-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Registro Invii operator: header wrappabile */
  .page-content .registro-invii-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Grid 2-colonne inline usate nei form su_misura e nei dettagli
     Vengono portate a colonna singola su schermi <480px via classe helper */
  .grid-2col-inline {
    grid-template-columns: 1fr !important;
  }

  /* Card ordini: azioni non si sovrappongano */
  .card-ord-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Dashboard admin: stat-grid già coperta, qui forziamo anche i totali */
  .dash-totali-row {
    flex-direction: column;
    gap: 8px;
  }

  /* Operatore — sezione "Miei Ordini": pulsanti azione in riga */
  .oa-actions-wrap {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  /* Grid inline 2-colonne → colonna singola su smartphone */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Grid inline 3-colonne → colonna singola su smartphone */
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Tabella storico reminder / invii: font più piccolo */
  .page-content table th,
  .page-content table td {
    font-size: .72rem !important;
    padding: 6px 8px !important;
  }

  /* Header card laboratori: testo su 2 righe se necessario */
  .lab-card-header-name {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Modali: pulsanti comunicazione (WA/Email) in colonna */
  .comunica-btns-wrap {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .comunica-btns-wrap button,
  .comunica-btns-wrap a {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Filtri pagina ordini: select + input affiancati → colonna */
  .filtri-ordini-wrap {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .filtri-ordini-wrap select,
  .filtri-ordini-wrap input {
    width: 100% !important;
  }
}

/* ── Griglia book: forza 3 colonne su tablet dentro qualsiasi modal ── */
#cercaTessutoRisultati .sm-book-grid,
#adminBookGriglia .sm-book-grid,
#smBookGriglia .sm-book-grid,
#opBookGriglia .sm-book-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  #cercaTessutoRisultati .sm-book-grid,
  #adminBookGriglia .sm-book-grid,
  #smBookGriglia .sm-book-grid,
  #opBookGriglia .sm-book-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 380px) {
  #cercaTessutoRisultati .sm-book-grid,
  #adminBookGriglia .sm-book-grid,
  #smBookGriglia .sm-book-grid,
  #opBookGriglia .sm-book-grid {
    grid-template-columns: 1fr !important;
  }
}
