/* Campanellina notifiche (desktop e mobile) */
.notifiche-bell-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    position: static;
    margin-left: 8px;
    margin-right: 0;
    transition: color 0.2s, background 0.15s;
    z-index: 2;
    box-shadow: none;
    flex-shrink: 0;
    outline: none;
}
@media (min-width: 900px) {
    .top-brand-card .notifiche-bell-btn {
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }
}
.notifiche-bell-btn:active, .notifiche-bell-btn:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}
/* Mobile: campanellina su sfondo chiaro */
.mobile-topbar .notifiche-bell-btn {
    color: #374151;
}
.mobile-topbar .notifiche-bell-btn:hover,
.mobile-topbar .notifiche-bell-btn:active {
    color: #242424;
    background: rgba(0,0,0,0.07);
}
.notifiche-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 1.5px solid #1e293b;
    box-shadow: 0 1px 4px rgba(0,0,0,0.13);
    z-index: 2;
    pointer-events: none;
    letter-spacing: 0.01em;
}

.btn-sos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 15px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sos-small {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    min-width: 140px;  /* Forza i tasti ad avere la stessa larghezza */
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

.badge-count {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    min-width: 80px;   /* Allinea anche il badge finale */
    text-align: center;
}

/* Modal notifiche push */
#modal-notifiche {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
#modal-notifiche.is-open {
    display: flex !important;
}
.notifiche-modal-content {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 28px 56px -8px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
    max-width: 380px;
    width: 92vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 80vh;
    animation: modalSpring 0.26s;
}
.notifiche-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}
.notifiche-modal-title {
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.notifiche-modal-title i {
    color: #64748b;
    font-size: 15px;
}
.notifiche-modal-close {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 15px;
    cursor: pointer;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.notifiche-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.notifiche-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
}
.notifica-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    padding-right: 34px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    transition: background 0.15s;
    position: relative;
}
.notifica-item:hover { background: #f1f5f9; }
.notifica-item.notif-removing {
    opacity: 0;
    transform: translateX(10px) scale(0.98);
    filter: blur(0.6px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, filter .18s ease;
}
.notif-del-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    font-size: 13px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: transform .12s, background .12s, color .12s;
}
.notif-del-btn:hover {
    background: #fecaca;
    color: #b91c1c;
    transform: scale(1.08);
}
.notifica-icon-badge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 1px;
}
.notifica-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.notifica-titolo {
    font-weight: 700;
    color: #0f172a;
    font-size: 12px;
    letter-spacing: 0.01em;
    line-height: 1.35;
}
.notifica-corpo {
    color: #475569;
    font-size: 11.5px;
    line-height: 1.45;
    word-break: break-word;
}
.notifica-ts {
    margin-top: 3px;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}
/* Pulsanti inline per risposta accesso fuori orario */
.notif-azioni-accesso {
    display: flex;
    gap: 8px;
    margin-top: 7px;
}
.notif-btn-consenti,
.notif-btn-nega {
    flex: 1;
    padding: 5px 8px;
    border: none;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.notif-btn-consenti { background: #22c55e; color: #fff; }
.notif-btn-nega     { background: #ef4444; color: #fff; }
.notif-btn-consenti:disabled,
.notif-btn-nega:disabled    { opacity: .5; cursor: default; }
.notif-risposta-ok  { color: #22c55e; font-size: 11.5px; font-weight: 600; }
.notif-risposta-err { color: #ef4444; font-size: 11.5px; font-weight: 600; }
.notif-risposta-wait { color: #64748b; font-size: 11.5px; font-style: italic; }
.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    color: #94a3b8;
    gap: 8px;
    font-size: 12px;
}
.notif-empty i {
    font-size: 24px;
    opacity: 0.5;
}
.notif-empty p { margin: 0; }
.notifiche-modal-footer {
    padding: 10px 16px 14px 16px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #f1f5f9;
}
.notifiche-btn-chiudi {
    background: #242424;
    border: none;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.notifiche-btn-chiudi:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* ============================================================
   1. VARIABILI GLOBALI E FONDAMENTA
   ============================================================ */
:root {
    --primary: #242424;
    --sidebar-bg: #242424;
    --sidebar-text: #9ca3af;
    --bg-body: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #242424;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    font-size: 12px; /* Ridotto da 16px */
    line-height: 1.5;
    background-color: #f8fafc;
    color: #1e293b;
}

/*Â Global smooth scrolling for internal anchors */
html {
    scroll-behavior: smooth;
}

/* Utility for fade-in when content is replaced */
.fade-in {
    animation: pageEnter 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* â”€â”€ Animazioni moderne 3D â”€â”€ */
@keyframes pageEnter {
    from { opacity: 0; transform: translateX(16px) scale(0.99); filter: blur(1px); }
    to   { opacity: 1; transform: translateX(0) scale(1);   filter: blur(0); }
}
@keyframes modalSpring {
    0%   { opacity: 0; transform: scale(0.84) translateY(22px); }
    60%  { opacity: 1; transform: scale(1.025) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes toastSlide {
    from { opacity: 0; transform: translateX(28px) scale(0.93); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes popIn {
    0%   { transform: scale(0.8); opacity: 0; }
    70%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* quick transition variable */
:root {
    --transition-fast: 0.2s;
}

/* apply to buttons and interactive elements */
button, .menu-item, .btn-sos, .btn-login, .btn-modal-send {
    transition: background-color 0.22s ease, color 0.22s ease, opacity 0.22s ease,
                transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}
/* Click feedback su tutti i pulsanti primari */
.btn-login:active, .btn-modal-send:active, .btn-primary:active, .btn-sos:active {
    transform: scale(0.95) !important;
    transition: transform 0.08s ease !important;
}
.menu-item:active { transform: scale(0.97) !important; }













/* ============================================================
   2. PAGINA DEL LOGIN
   ============================================================ */

/* SFONDO LOGIN - EFFETTO VETRO APPANNATO */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Colore scuro semi-trasparente */
    background-color: rgba(15, 23, 42, 0.7);
    /* L'effetto "appannato" magico */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Per Safari */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200000; /* sopra a tutto, modal-carrello incluso */
}

/* Mostra il login solo quando richiesto (classe impostata inline in index.html) */
.needs-login #login-overlay {
    display: flex;
}

/* CARD DI LOGIN */
.login-card {
    background: #252525; /* Il tuo esadecimale */
    padding: 45px;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1); /* Bordino sottile per dare profonditÃ  */
}

/* LOGO NEL LOGIN - PIÃ™ GRANDE */
.login-logo-container {
    margin-bottom: 30px;
}

.login-logo-img {
    width: 200px; /* Aumentato da 160px a 200px */
    height: auto;
    filter: none !important;
    display: block;
    margin: 0 auto;
    /* Ombra esterna al logo per farlo staccare dal fondo scuro */
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) !important;
}

/* TESTI BIANCHI PER LEGGIBILITÃ€ */
.login-card h2 {
    color: #ffffff !important; /* Forza il bianco */
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
}

.login-card p {
    color: #cbd5e1 !important; /* Grigio chiarissimo quasi bianco */
    font-size: 15px;
    margin-bottom: 30px;
}

/* BOTTONE LOGIN */
.btn-login {
    width: 100%;
    background: #242424;
    color: #ffffff;
    padding: 16px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* INPUT FIELD - Ritocco per sfondo scuro */
.input-field-modern {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border-radius: 12px;
    border: 1px solid #475569;
    background: #1e293b;
    color: white;
    font-family: inherit;
    box-sizing: border-box;
}

.input-field-modern::placeholder {
    color: #94a3b8;
}

.login-error-msg {
    color: #fb7185; /* Rosso pastello piÃ¹ leggibile */
    font-size: 13px;
    font-weight: 600;
    margin-top: 20px;
}

/* STILE PULSANTE LOGOUT ELEGANTE (POSIZIONE TOP) */

/* Top float bar: nascosta su mobile, visibile su desktop */
.top-float-bar {
    display: none;
}

/* ============================================================
   SIDEBAR COLLASSABILE
   ============================================================ */

/* --- Toggle button --- */
.sidebar-toggle-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
    padding: 8px 10px 4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    outline: none !important;
    color: #6b7280 !important;
    transition: color 0.2s !important;
    flex-shrink: 0 !important;
}
.sidebar-toggle-btn:hover {
    color: #ffffff !important;
}
.sidebar-toggle-icon {
    font-size: 18px !important;
    line-height: 1 !important;
    pointer-events: none !important;
    transition: transform 0.3s ease !important;
}

/* --- Sidebar expanded (default) --- */
.sidebar {
    transition: width 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    overflow: visible !important;
    z-index: 200 !important;
}

/* --- Sidebar COLLAPSED --- */
.sidebar.collapsed {
    width: 62px !important;
    padding: 20px 8px !important;
}

/* Nascondi testi sidebar quando collapsed */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed #user-info-top,
.sidebar.collapsed .menu-item .menu-label {
    display: none !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Menu item centrato su emoji quando collapsed */
.sidebar.collapsed .menu-item {
    justify-content: center !important;
    padding: 12px 0 !important;
}
.sidebar.collapsed .menu-content {
    gap: 0 !important;
    justify-content: center !important;
}

/* Brand home button quando collapsed: solo icona centrata */
.sidebar.collapsed .sidebar-brand-home-btn {
    justify-content: center !important;
    padding: 10px 0 !important;
}

/* Avatar centrato quando collapsed */
.sidebar.collapsed .sidebar-user-section {
    justify-content: center !important;
    padding: 12px 0 !important;
}
.sidebar.collapsed .sidebar-toggle-btn {
    justify-content: center !important;
}
/* Nascondi badge inline quando collapsed */
.sidebar.collapsed .badge-sidebar-inline {
    display: none !important;
}

/* Emoji nelle voci menu: 5px piÃ¹ grandi del testo */
.menu-content > span:first-child {
    font-size: 18px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* Toggle icon ruotata quando collapsed */
.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(0deg) !important;
}
.sidebar:not(.collapsed) .sidebar-toggle-icon {
    transform: rotate(0deg) !important;
}

/* main-content si sposta a seconda dello stato --- */
/* (gestito via JS con classe su body) */
body.sidebar-collapsed .main-content {
    margin-left: 82px !important;
    width: calc(100% - 92px) !important;
}

/* ---- FINE SIDEBAR COLLASSABILE ---- */
.user-avatar-btn {
    position: relative !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: var(--avatar-user-color, #8fe45e) !important;
    border: 2.5px solid rgba(255,255,255,0.25) !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s !important;
    padding: 0 !important;
    outline: none !important;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--avatar-user-color, #8fe45e) 40%, transparent) !important;
}
.user-avatar-btn:hover {
    border-color: rgba(255,255,255,0.55) !important;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--avatar-user-color, #8fe45e) 65%, transparent) !important;
    transform: scale(1.06) !important;
}
.user-avatar-btn:active {
    transform: scale(0.97) !important;
}

/* Indicatore presenza utenti online */
#online-indicator,
#online-indicator-mob {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    border: 1.5px solid var(--color-background-primary, #1a2030);
    pointer-events: none;
    z-index: 10;
}

/* ---- ACCOUNT DROPDOWN ----  */
.sidebar-user-section {
    position: relative !important;
}
.account-dropdown {
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 0 !important;
    width: 240px !important;
    background: #1c1c1e !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    border-radius: 14px !important;
    box-shadow: 0 -8px 36px rgba(0,0,0,0.55) !important;
    z-index: 9999 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(6px) !important;
    transition: opacity 0.18s ease, transform 0.18s ease !important;
}
.account-dropdown.open {
    opacity: 1 !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}
/* Quando collapsed: dropdown si apre a destra della sidebar */
.sidebar.collapsed .account-dropdown {
    bottom: 0 !important;
    left: calc(100% + 10px) !important;
    transform: translateX(-6px) !important;
}
.sidebar.collapsed .account-dropdown.open {
    transform: translateX(0) !important;
}
.account-dropdown-header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px 16px 14px !important;
}
.account-ddrop-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: #8fe45e !important;
    color: #ffffff !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}
.account-ddrop-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    overflow: hidden !important;
}
.account-ddrop-name {
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.account-ddrop-role {
    color: #6b7280 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}
.account-dropdown-divider {
    height: 1px !important;
    background: rgba(255,255,255,0.07) !important;
    margin: 0 !important;
}
.account-menu-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 12px 16px !important;
    background: transparent !important;
    border: none !important;
    color: #d1d5db !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-align: left !important;
    transition: background 0.15s, color 0.15s !important;
}
.account-menu-item:hover {
    background: rgba(255,255,255,0.07) !important;
    color: #ffffff !important;
}
.account-menu-item i {
    width: 16px !important;
    text-align: center !important;
    font-size: 14px !important;
    opacity: 0.75 !important;
}
.account-menu-logout {
    color: #f87171 !important;
}
.account-menu-logout:hover {
    background: rgba(244,63,94,0.12) !important;
    color: #fb7185 !important;
}
/* ---- AVATAR COLOR PICKER ---- */
.avatar-color-section {
    padding: 10px 16px 12px !important;
    border-top: 1px solid rgba(255,255,255,0.07) !important;
}
.avatar-color-label {
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #6b7280 !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    margin-bottom: 8px !important;
    display: block !important;
}
.avatar-color-swatches {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
}
#avatar-custom-swatches,
#avatar-predefined-swatches {
    display: contents !important;
}
.avatar-color-swatch {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    border: 2px solid transparent !important;
    cursor: pointer !important;
    transition: transform 0.15s, border-color 0.15s !important;
    flex-shrink: 0 !important;
    outline: none !important;
}
.avatar-color-swatch:hover {
    transform: scale(1.18) !important;
}
.avatar-color-swatch.active {
    border-color: #ffffff !important;
    transform: scale(1.14) !important;
}
/* Pulsante aggiungi colore custom */
.avatar-color-add-btn {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    border: 2px dashed #4b5563 !important;
    background: transparent !important;
    color: #6b7280 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    outline: none !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: border-color 0.15s, color 0.15s !important;
}
.avatar-color-add-btn:hover {
    border-color: #9ca3af !important;
    color: #d1d5db !important;
}
/* Editor inline colore */
.avatar-color-editor {
    display: none;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 0 2px !important;
}
.avatar-color-editor input[type=color] {
    width: 36px !important;
    height: 28px !important;
    border: 2px solid rgba(255,255,255,0.15) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    background: transparent !important;
    padding: 2px !important;
    outline: none !important;
}
.avatar-editor-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s !important;
    outline: none !important;
}
.avatar-editor-ok  { background: #22c55e !important; color: #fff !important; }
.avatar-editor-ok:hover { background: #16a34a !important; }
.avatar-editor-cancel { background: rgba(255,255,255,0.10) !important; color: #d1d5db !important; }
.avatar-editor-cancel:hover { background: rgba(255,255,255,0.18) !important; }
/* Link ripristina predefiniti */
.avatar-ripristina-btn {
    background: none !important;
    border: none !important;
    color: #4b5563 !important;
    font-size: 10px !important;
    cursor: pointer !important;
    padding: 4px 0 0 !important;
    display: block !important;
    text-align: left !important;
    font-family: inherit !important;
    transition: color 0.15s !important;
    outline: none !important;
}
.avatar-ripristina-btn:hover { color: #9ca3af !important; }














/* ============================================================
   3. PAGINA PRINCIPALE: SIDEBAR
   ============================================================ */

   /* --- SIDEBAR PRINCIPALE --- */
   /* 1. Forza la Sidebar a essere il punto di riferimento */
.sidebar {
    width: 240px;
    height: 100vh !important;
    position: fixed !important;
    top: 0;
    left: 0;
    background: #242424;
    box-sizing: border-box;
    padding: 15px;
}

/* 2. Posizionamento ASSOLUTO per il footer */
/* 1. SEZIONE UTENTE (IN BASSO nel footer) */
.sidebar-user-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 10px;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 0;
}

.user-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-avatar-top {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--avatar-user-color, #8fe45e);
}

.user-info-top, #user-info-top {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-grow: 1;
}

.user-name { font-size: 13px; font-weight: 700; color: white; }

#user-name-display {
    color: white;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.user-role { font-size: 10px; color: #9ca3af; text-transform: uppercase; }

/* 2. MENU CENTRALE [cite: 40] */

#badge-carrello-count {
    background: #f59e0b;
}
.menu-section-label {
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    margin: 10px 0 5px 10px;
    text-transform: uppercase;
    margin-top: 20px;
    letter-spacing: 0.05em;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Spinge il badge a destra */
    padding: 10px 12px;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

button.menu-item {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    width: 100%;
}

.menu-item:hover { background: #1f2937; color: white; transform: translateX(5px); }

.menu-item.active {
    background: #fff !important;
    color: #11101d !important;
    border-radius: 12px;
}

.menu-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
}

/* Il testo delle label del menu (da nascondere in collapsed) */
.menu-label {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s, width 0.2s;
}

/* Badge rosso accanto a Richieste [cite: 44] */
.badge-sidebar-inline {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 0 7px;
    border-radius: 99px;
    border: 1.5px solid #1e293b;
    display: none; /* Si mostra solo se > 0 [cite: 45] */
    transition: background 0.3s, color 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.13);
    letter-spacing: 0.01em;
}
/* Sollecito: il badge diventa arancione e lampeggia */
@keyframes badge-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.2); opacity: 0.75; }
}
.badge-sidebar-inline.badge-sollecito-attivo {
    background: #f97316;
    animation: badge-pulse 1.4s ease-in-out infinite;
}

/* FOOTER [cite: 45] */
/* Assicuriamoci che la sidebar sia un contenitore flex alto tutto lo schermo */
.sidebar {
    width: 260px;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    background: #242424;
    padding: 20px 15px !important;
    box-sizing: border-box;
    overflow: visible;
}

/* FOOTER SIDEBAR â€” brand block stile Linear/Notion */
.sidebar-footer {
    margin-top: auto !important;
    width: 100% !important;
    padding: 0 0 6px 0;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* ---- BRAND HOME BUTTON (in cima alla sidebar) ---- */
.sidebar-brand-home-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 11px !important;
    padding: 14px 10px !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    margin-bottom: 12px !important;
    cursor: pointer !important;
    outline: none !important;
    text-decoration: none !important;
}
.sidebar-brand-home-btn:hover,
.sidebar-brand-home-btn:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

/* La sidebar-footer ora contiene l'account */
.sidebar-footer-brand {
    display: none !important;
}

.sidebar-brand-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
}

.sidebar-brand-img {
    width: 36px !important;
    height: 36px !important;
    object-fit: contain !important;
}

.sidebar-brand-text {
    display: flex !important;
    align-items: center !important;
    overflow: hidden !important;
}

.sidebar-brand-name {
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    letter-spacing: 0.12em !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}
















/* ============================================================
   4. AREA CONTENUTO PRINCIPALE (MAIN CONTENT)
   ============================================================ */

/* search bar previously styled inline */
.search-container {
    position: relative;
    margin-bottom: 20px;
    max-width: 450px;
}
.search-container > i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}
.search-container input {
    width: 100%;
    padding: 10px 42px 10px 40px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 13px;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}
/* Pulsante filtro articoli mobile â€” posizionato a destra nell'input */
.btn-filtro-articoli-mobile {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1.5px solid #e2e8f0;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-filtro-articoli-mobile:hover {
    background: #f1f5ff;
    color: #2563eb;
    border-color: #2563eb;
}
.btn-filtro-articoli-mobile.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    padding: 40px 60px;
    overflow-y: auto;
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    border-bottom: 1px solid #f0f4f8;
    padding-bottom: 16px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.03em;
}















/* ============================================================
   5. PAGINA PROGRAMMA PRODUZIONE
   ============================================================ */

/* --- CARD ORDINE --- */
.riga-ordine {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 12px;
    position: relative;
}
.riga-ordine b,
.riga-ordine span[style*="font-weight:800"] {
    font-size: 0.95rem !important; /* Non troppo grande */
}

.riga-ordine:hover {
    transform: translateY(-3px) scale(1.003);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: var(--border-color);
}
.riga-ordine.op-aperto-ord:hover,
.riga-ordine.stato-aperto-ord:hover,
.riga-ordine.azioni-aperto-ord:hover {
    transform: none;
}

.riga-ordine.open {
    border-left: 6px solid #242424;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
    background: #fafafa;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.dettagli-container {
    display: none;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    padding: 20px 30px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
    overflow: visible; /* permette ai popup dei dropdown di uscire dal contenitore */
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.item-card {
    display: grid;
    grid-template-columns: 2fr 0.8fr 1.6fr 1.6fr auto;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow var(--transition-fast) ease, transform var(--transition-fast) ease;
    min-width: 0;
    position: relative; /* necessario per z-index */
    z-index: 0;         /* stacking context esplicito e neutro */
}

/* Quando un dropdown Ã¨ aperto, porta la card in primo piano sopra le sorelle */
.item-card.stato-aperto, .item-card.op-aperto {
    z-index: 50 !important;
}

/* Stesso per il dropdown nelle righe header ordine */
.riga-ordine.op-aperto-ord,
.riga-ordine.stato-aperto-ord,
.riga-ordine.azioni-aperto-ord {
    z-index: 50;
    transform: none !important;
}

.item-card:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 10px 26px -4px rgba(0,0,0,0.11);
}





















/* ============================================================
   6. PAGINA ARCHIVIO ORDINI
   ============================================================ */

/* Griglia specifica per le card dell'archivio */
.item-card.archivio-layout {
    display: grid !important;
    grid-template-columns: 1.5fr 0.8fr 1.2fr 1.2fr 180px;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

/* Miglioriamo le etichette per farle stare sopra il valore */
.label-sm {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

/* Forza i bottoni dell'archivio a non allargarsi troppo */
.btn-archive-action {
    width: 100%;
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
}

/* utility per card archivio */
.archivio-codice {
    color: #1e293b;
}
.archivio-qty {
    text-align: center;
}
.archivio-qty-val {
    font-size: 16px;
}
.archivio-stato {
    color: #64748b;
    font-weight: 700;
}
.archivio-operatore {
    color: #64748b;
    font-weight: 600;
}


/* ============================================================
   SELECT STATO CUSTOM DROPDOWN
   ============================================================ */

/* Manteniamo select-interattivo per retrocompatibilitÃ  mobile */
.select-interattivo {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    padding: 8px 35px 8px 15px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

/* Wrapper relativo */
.stato-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Pill trigger â€” nessun color-mix, colori statici stabili */
.stato-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 12px 7px 10px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #334155;
    white-space: nowrap;
    box-sizing: border-box;
    /* nessuna transition sul trigger stesso: il dot fornisce il colore */
}
.stato-trigger:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.stato-dropdown.open .stato-trigger {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Dot colorato â€” il colore viene impostato via style inline JS */
.stato-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8; /* sovrascritta da style="background:â€¦" inline */
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.9);
    box-sizing: content-box;
}

/* Testo stato */
.stato-label-txt {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chevron */
.stato-chevron {
    font-size: 9px;
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.2s ease;
}
.stato-dropdown.open .stato-chevron {
    transform: rotate(180deg);
}

/* Popup */
.stato-popup {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 210px;
    width: max-content;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 10002;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    pointer-events: none;
}
.stato-dropdown.open .stato-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

/* Singola opzione â€” hover semplice senza color-mix */
.stato-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #334155;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.stato-option:hover {
    background: #f1f5f9;
}
.stato-option.is-selected {
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 700;
}

/* Dot opzione â€” colore da style inline */
.stato-opt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8; /* sovrascritta da style inline */
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.85);
    box-sizing: content-box;
}

/* Check sull'opzione selezionata */
.stato-check-icon {
    margin-left: auto;
    font-size: 10px;
    color: #0369a1;
}

/* â”€â”€ Variante header-ordine del dropdown stato â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.stato-dropdown-ord {
    width: 160px;
    flex-shrink: 0;
}
.stato-dropdown-ord .stato-trigger {
    width: 100%;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
}
/* Popup della variante ordine: ancorato a destra per non uscire dallo schermo */
.stato-dropdown-ord .stato-popup {
    left: auto;
    right: 0;
}
/* â”€â”€ z-index: eleva il wrapper quando qualsiasi dropdown Ã¨ aperto â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.ordine-wrapper:has(.stato-dropdown.open),
.ordine-wrapper:has(.op-dropdown.open),
.ordine-wrapper:has(.ord-azioni-menu.open) {
    position: relative;
    z-index: 20;
}

.scroll-wrapper { text-align: right; margin: 10px 0; }
.scroll-btn {
    background: #242424;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background 0.2s, color 0.2s;
}
.scroll-btn:hover { background: #ffffff; color: #242424; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }

/* Step 2: Chiedi/Assegna e Archivia - palette nero/bianco */
.btn-chiedi-assegna {
    background: #242424!important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
}
.btn-chiedi-assegna:hover {
    background: #ffffff !important;
    color: #242424!important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}
.btn-archivia-prod {
    background: #242424!important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
}
.btn-archivia-prod:hover {
    background: #ffffff !important;
    color: #242424!important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}

/* â”€â”€ QuantitÃ  evasa / parziale â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.qty-cell { display: flex; flex-direction: column; gap: 3px; }
.qty-row  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-qty-evasa-toggle {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 2px 5px;
    cursor: pointer;
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-qty-evasa-toggle:hover,
.btn-qty-evasa-toggle.active {
    background: #f59e0b22;
    border-color: #f59e0b;
    color: #f59e0b;
}
.qty-evasa-block {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}
.qty-evasa-input {
    width: 62px;
    padding: 3px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    background: #f8fafc;
    color: #1e293b;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}
.qty-evasa-input:focus { border-color: #f59e0b; background: #fff; }
.qty-rimanente-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.78rem;
    background: #f1f5f9;
    border-radius: 5px;
    padding: 2px 7px;
    white-space: nowrap;
}
.qty-rim-lbl { color: #94a3b8; font-size: 0.72rem; }
.qty-rimanente { color: #0f172a; font-size: 0.82rem; font-weight: 700; }
/* Tasto Sollecita (commerciali) */
.btn-sollecita {
    background: #d97706 !important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px !important;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sollecita:hover { background: #b45309 !important; }
/* Tasto Ripristina (archivio ordine) */
.btn-ripristina {
    background: #242424!important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
}
.btn-ripristina:hover {
    background: #ffffff !important;
    color: #242424!important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}

/* â”€â”€ Helper visibilitÃ  desktop/mobile â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.hide-mobile  { /* visibile di default, nascosto da @media â‰¤600 */ }
.show-mobile-flex { display: none; } /* mostrato da @media â‰¤600 */

/* â”€â”€ Menu azioni (tre puntini) â€“ visibile sempre â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.ord-azioni-menu {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.ord-azioni-trigger {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.ord-azioni-trigger:hover {
    background: #f1f5f9;
    color: #334155;
}
.ord-azioni-menu.open .ord-azioni-trigger {
    background: #f1f5f9;
    color: #334155;
}
.ord-azioni-popup {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 10001;
    min-width: 160px;
    overflow: hidden;
    flex-direction: column;
    padding: 4px;
}
.ord-azioni-menu.open .ord-azioni-popup { display: flex; }
.ord-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-align: left;
    border-radius: 8px;
    transition: background 0.12s;
    font-family: inherit;
    box-sizing: border-box;
}
.ord-menu-item i { width: 14px; text-align: center; flex-shrink: 0; color: #64748b; }
.ord-menu-item:hover { background: #f1f5f9; }
.ord-menu-item + .ord-menu-item { border-top: none; }
.ord-menu-item--danger { color: #dc2626; }
.ord-menu-item--danger i { color: #dc2626; }
.ord-menu-item--danger:hover { background: #fef2f2; }
.ord-menu-item--warn { color: #d97706; }
.ord-menu-item--warn i { color: #d97706; }
.ord-menu-item--warn:hover { background: #fffbeb; }




















/* ============================================================
   7. BOTTONI SUPPORTO E AZIONI (SOS)
   ============================================================ */

.btn-sos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 15px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sos:hover {
    background: #fef2f2;
}

.btn-sos-small {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    min-width: 140px;  /* Forza i tasti ad avere la stessa larghezza */
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

.badge-count {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    min-width: 80px;   /* Allinea anche il badge finale */
    text-align: center;
}

















/* ============================================================
   8. MODAL SUPPORTO (FINESTRA DI DIALOGO)
   ============================================================ */

/* ============================================================
   AUTOCOMPLETE ORDINE (modal nuova richiesta)
   ============================================================ */
.modal-ordine-row { margin-bottom: 14px; }
.ordine-autocomplete-wrapper {
    position: relative;
}
.ordine-autocomplete-wrapper .input-field-modern {
    width: 100%;
    box-sizing: border-box;
}
.ordine-autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 99999;
    overflow: hidden;
    max-height: 240px;
    overflow-y: auto;
}
.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    gap: 10px;
    transition: background 0.12s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f0f9ff; }
.ac-ordine { font-weight: 700; font-size: 13px; color: #1e293b; white-space: nowrap; }
.ac-cliente { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

.modal-ordine-row .input-field-modern {
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 28px 56px -8px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
    opacity: 0;
    transform: scale(0.84) translateY(22px);
}

.modal-overlay.active .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: modalSpring 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn-tipo {
    flex: 1;
    padding: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: all 0.2s;
    text-transform: uppercase;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.btn-tipo.active {
    background: #242424;
    color: white;
    border-color: #242424;
}

#wrapper-operatori {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 10px 0;
}

.op-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 13px;
}

.op-label:hover {
    background: #f8fafc;
}














/* ============================================================
   9. GESTIONE MESSAGGI (INBOX) E STATISTICHE
   ============================================================ */

.inbox-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.messaggio-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.border-assegna {
    border-left: 5px solid #242424;
}

.border-domanda {
    border-left: 5px solid #f59e0b;
}

.badge-tipo {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

.card-stat {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}















/* ============================================================
   10. STILE CHAT MODERNA
   ============================================================ */

/* utility classes moved from inline templates */
.empty-msg {
    padding: 20px;
    color: #94a3b8;
    text-align: center;
}
.hidden-search { display: none !important; }

/* Risultati secondari (contengono il termine ma non iniziano con esso) */
.search-secondary {
    opacity: 0.62;
    border-style: dashed !important;
}
.separatore-archivio {
    margin: 60px 0 30px 0;
    text-align: center;
    border-top: 2px dashed #e2e8f0;
    position: relative;
}
.separatore-archivio span {
    background: #f8fafc;
    color: #94a3b8;
    padding: 5px 20px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #e2e8f0;
}
.sezione-archiviata { opacity: 0.9; }
.slim { display: inline-block; }
.flex-grow { flex-grow: 1; min-width: 0; overflow: hidden; }
.order-info { display: flex; align-items: center; gap: 10px; }
.order-number { color: #94a3b8; margin-left: 15px; }
.order-title { font-weight: 800; font-size: 0.92rem; color: var(--order-color, inherit); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
/* Badge con ordine + articoli combinati */
.badge-ord-num { font-weight: 800; opacity: 0.85; margin-right: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; display: inline-block; vertical-align: middle; }
.badge-sep { margin: 0 5px; opacity: 0.4; font-size: 10px; }
.dettagli-container.hidden { display: none; padding: 10px; background: #f1f5f9; }

/* sos button variants */
.btn-sos-small.warning {
    background: #f97316;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.btn-sos-small.success {
    background: #22c55e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}


.chat-card {
    background: #ffffff;
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
}
/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ TAB BAR ACQUISTI â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#acq-tab-bar {
    display: none;
    gap: 4px;
    padding: 8px 16px 0;
    background: transparent;
    flex-shrink: 0;
}
.acq-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 10px 10px 0 0;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background 0.18s, color 0.18s;
    position: relative;
}
.acq-tab:hover { background: #e2e8f0; color: #334155; }
.acq-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 -2px 0 0 #6366f1 inset;
}
.badge-acq-tab {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.4;
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ PAGINA ORDINI ACQUISTI â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.ordini-acq-page { padding-bottom: 40px; }
.ordini-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.ordine-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.ordine-group.all-done { opacity: 0.7; }
.ordine-group[open] { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.ordine-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    list-style: none;
    transition: background 0.15s;
}
.ordine-group-summary::-webkit-details-marker { display: none; }
.ordine-group[open] .ordine-group-summary { background: #f1f5f9; border-bottom-color: #e2e8f0; }
.ordine-group-summary:hover { background: #eff3f7; }

.og-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.og-operatore { font-size: 13px; font-weight: 800; color: #1e293b; }
.og-data { font-size: 12px; color: #64748b; }
.og-progress { font-size: 11px; font-weight: 700; background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 20px; }
.og-done-badge { font-size: 11px; font-weight: 700; color: #15803d; background: #dcfce7; padding: 2px 8px; border-radius: 20px; }
.og-done-badge i { margin-right: 3px; }
.og-chevron { font-size: 11px; color: #94a3b8; transition: transform 0.25s; }
.ordine-group[open] .og-chevron { transform: rotate(180deg); }

.ordine-items { display: flex; flex-direction: column; gap: 0; }

.ordine-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.ordine-item:last-child { border-bottom: none; }
.ordine-item.is-ordinato { background: #f0fdf4; }
.ordine-item:hover { background: #f8fafc; }
.ordine-item.is-ordinato:hover { background: #ecfdf5; }

.oi-check-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}
.oi-check-btn:hover { border-color: #22c55e; color: #22c55e; }
.oi-check-btn.checked { border-color: #22c55e; color: #22c55e; background: #dcfce7; }
.oi-check-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.oi-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.ordine-item.is-ordinato .oi-thumb { opacity: 0.45; }


    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-ordinato { background: #22c55e; }
.dot-attesa   { background: #94a3b8; }

.oi-info { flex: 1; min-width: 0; }
.oi-nome { display: block; font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ordine-item.is-ordinato .oi-nome { text-decoration: line-through; color: #64748b; }
.oi-details { font-size: 12px; color: #94a3b8; }

.oi-stato-badge { flex-shrink: 0; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 20px; letter-spacing: 0.3px; white-space: nowrap; }
.badge-ordinato-sm { background: #dcfce7; color: #15803d; }
.badge-attesa-sm   { background: #f1f5f9; color: #64748b; }
.badge-ordinato-sm i { margin-right: 3px; }
/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ fine ordini acquisti â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

/* â”€â”€â”€ GRUPPI RICHIESTE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.req-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}
.req-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.req-group[open] { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.req-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
    list-style: none;
}
.req-group-summary::-webkit-details-marker { display: none; }
.req-group[open] .req-group-summary { border-bottom-color: #e2e8f0; background: #f1f5f9; }
.req-group-summary:hover { background: #eff3f7; }
.rg-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rg-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    flex-shrink: 0;
}
.rg-icon-assegna { background: #dcfce7; color: #16a34a; }
.rg-icon-domanda  { background: #fee2e2; color: #dc2626; }
.rg-icon-scadenza { background: #fef3c7; color: #d97706; }
.rg-icon-fabbisogno { background: #dbeafe; color: #1d4ed8; }
.rg-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #374151;
    text-transform: uppercase;
}
.rg-count, .rg-count-dom {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: #dcfce7;
    color: #15803d;
}
.rg-count-dom   { background: #fee2e2; color: #b91c1c; }
.rg-count-scad  { background: #fef3c7; color: #b45309; }
.rg-count-fabb  { background: #dbeafe; color: #1d4ed8; }
.rg-chevron {
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.25s ease;
}
.req-group[open] .rg-chevron { transform: rotate(180deg); }
.req-group .chat-inbox {
    padding: 12px 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}
.fabprod-list {
    padding: 8px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fabprod-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe7f5;
    border-radius: 10px;
    padding: 8px 11px;
    box-shadow: 0 2px 8px rgba(29,78,216,0.05);
}
.fabprod-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}
.fabprod-name {
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
}
.fabprod-code {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    margin-right: 6px;
}
.fabprod-qty {
    flex-shrink: 0;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}
.fabprod-orders {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.fabprod-order-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    border-radius: 999px;
    background: #eff6ff;
    color: #475569;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.fabprod-order-pill--click {
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.fabprod-order-pill--click:hover {
    background: #dbeafe;
    color: #1d4ed8;
}
.fabprod-pill-cliente {
    font-weight: 500;
    opacity: 0.72;
}

/* Mobile: card compatta (solo codice + qty), tocco apre modal */
@media (max-width: 768px) {
    .fabprod-orders { display: none; }
    .fabprod-card { cursor: pointer; }
}

/* â”€â”€â”€ FABBISOGNO MODALS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.fabprod-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.fabprod-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 22px 20px 18px;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    position: relative;
}
.fabprod-modal-box--art { max-width: 400px; }
.fabprod-modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.fabprod-modal-body {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 20px;
    line-height: 1.4;
}
.fabprod-modal-sub {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 5px;
    font-weight: 400;
}
.fabprod-modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.fabprod-btn-cancel {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}
.fabprod-btn-confirm {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    background: #1d4ed8;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.fabprod-btn-confirm:active { opacity: 0.85; }
.fabprod-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 0.75rem;
}
.fabprod-modal-art-code {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 3px;
    letter-spacing: 0.03em;
}
.fabprod-modal-art-name {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.3;
}
.fabprod-modal-art-qty {
    font-size: 0.82rem;
    color: #1d4ed8;
    font-weight: 700;
    background: #dbeafe;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.fabprod-modal-art-orders {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* â”€â”€â”€ CARD QUADRATE RICHIESTE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.req-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 13px 14px 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: calc(50% - 5px);
    min-width: 150px;
    box-sizing: border-box;
    transition: box-shadow 0.18s, border-color 0.18s;
}
.req-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.09); border-color: #c7d2fe; }
.req-card.archiviata { opacity: 0.75; border-color: #f1f5f9; }

@keyframes sollecito-pulse-rc {
    0%   { border-color: #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
    50%  { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
    100% { border-color: #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
}
.req-card.sollecitata { animation: sollecito-pulse-rc 2s ease-in-out infinite; border-color: #fca5a5; }

/* Top: ordine + badge */
.rc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.rc-ordine-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}
.rc-ordine {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.rc-tipo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 900;
    flex-shrink: 0;
}
.rc-tipo-assegna  { background: #dcfce7; color: #16a34a; }
.rc-tipo-scadenza { background: #fef3c7; color: #d97706; }

/* ---- SCADENZE CARD ---- */
.scad-card {
    background: #ffffff;
    border: 1.5px solid #fde68a;
    border-radius: 16px;
    padding: 13px 14px 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: calc(50% - 5px);
    min-width: 150px;
    box-sizing: border-box;
    transition: box-shadow 0.18s, border-color 0.18s;
}
.scad-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.09); }
.scad-card.scad-urgente { border-color: #fca5a5; background: #fff5f5; }
.scad-card.scad-scaduta { border-color: #ef4444; background: #fff1f2; opacity: 0.85; }
.scad-card.scad-vicina  { border-color: #fdba74; background: #fffbeb; }
.scad-card.scad-ok      { border-color: #fde68a; }

.scad-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.scad-ordine-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.scad-art {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.scad-int-ord { opacity: 0.5; font-style: italic; }
.scad-date-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.scad-date-badge.scad-ok       { background: #fef9c3; color: #92400e; }
.scad-date-badge.scad-vicina   { background: #fed7aa; color: #9a3412; }
.scad-date-badge.scad-urgente  { background: #fecaca; color: #991b1b; }
.scad-date-badge.scad-scaduta  { background: #fca5a5; color: #7f1d1d; }
.scad-nota {
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
    word-break: break-word;
}
.scad-no-nota { opacity: 0.4; font-style: italic; }
/* ---- FINE SCADENZE CARD ---- */
.rc-tipo-domanda  { background: #fee2e2; color: #dc2626; }
.rc-arch-badge {
    font-size: 10px;
    font-weight: 800;
    color: #16a34a;
    background: #dcfce7;
    padding: 1px 7px;
    border-radius: 20px;
}
.badge-sollecito-sm {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    background: #fee2e2;
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

/* Cliente */
.rc-cliente {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.rc-no-val { color: #94a3b8; }

/* Info rows: Da / A */
.rc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.rc-info-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 12px;
    min-width: 0;
}
.rc-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    width: 16px;
}
.rc-vals-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
    min-width: 0;
    align-items: center;
}
.rc-val {
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.rc-val-a { color: #4f46e5; }

/* Footer: data + conteggio msg */
.rc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}
.rc-date {
    font-size: 10px;
    color: #94a3b8;
}
.rc-msgcount {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Pulsanti azione icona */
.rc-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
}
.rc-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.rc-btn-reply  { background: #eff6ff; color: #3b82f6; }
.rc-btn-reply:hover  { background: #dbeafe; color: #1d4ed8; }
.rc-btn-cal    { background: #fff7ed; color: #f59e0b; }
.rc-btn-cal:hover    { background: #fef3c7; color: #d97706; }
.rc-btn-sol    { background: #fef3c7; color: #d97706; }
.rc-btn-sol:hover    { background: #fde68a; color: #b45309; }
.rc-btn-arch   { background: #f0fdf4; color: #16a34a; }
.rc-btn-arch:hover   { background: #dcfce7; color: #15803d; }

/* Su schermi grandi: 3 card per riga */
@media (min-width: 768px) {
    .req-card { width: calc(33.333% - 7px); }
}
@media (min-width: 1200px) {
    .req-card { width: calc(25% - 8px); }
}

/* â”€â”€â”€ Reply / conferma DENTRO req-card (layout compatto) â”€â”€â”€â”€ */
/* Il box risposta non ha padding desktop pesante dentro la card stretta */
.req-card .box-risposta {
    padding: 10px 8px 12px;
    border-radius: 12px;
    border-top: 1.5px solid #e2e8f0;
    background: #f8fafc;
}
/* Footer risposta: stack verticale cosÃ¬ hint e pulsante non traboccano */
.req-card .reply-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.req-card .btn-reply-send {
    justify-content: center;
    width: 100%;
}
/* Textarea piÃ¹ compatta */
.req-card .reply-input {
    min-height: 64px;
    font-size: 13px;
    padding: 8px 10px;
}
/* Bubble dentro card: evita overflow laterale */
.req-card .chat-bubble {
    max-width: 100%;
    word-break: break-word;
}
.req-card .chat-bubble-text {
    word-break: break-word;
    overflow-wrap: anywhere;
}
/* Su telefoni molto stretti: singola colonna */
@media (max-width: 400px) {
    .req-card { width: 100%; }
}
/* Expand button */
.rc-expand-btn {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 0;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.15s, color 0.15s;
}
.rc-expand-btn:hover { background: #eff6ff; color: #3b82f6; border-color: #bfdbfe; }
.rc-expand-btn .fa-chevron-down { transition: transform 0.22s; font-size: 10px; }
.rc-expand-btn.open { background: #eff6ff; color: #3b82f6; border-color: #bfdbfe; }
.rc-expand-btn.open .fa-chevron-down { transform: rotate(180deg); }

/* Body messaggi nascosto */
.rc-body {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0 4px;
    border-top: 1px solid #f1f5f9;
    margin-top: 2px;
    animation: rc-body-in 0.18s ease;
}
.rc-body.open { display: flex; }
@keyframes rc-body-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* â”€â”€â”€ fine card richieste â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* â”€â”€â”€ fine gruppi â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.chat-card.archiviata { opacity: 0.8; }
.chat-card.archiviata.sollecitata { animation: none !important; border-color: #f1f5f9 !important; }
.chat-card.archiviata .badge-sollecito { display: none !important; }

/* --- SOLLECITO: lampeggio card + badge --- */
@keyframes sollecito-pulse {
    0%   { box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: #f1f5f9; }
    50%  { box-shadow: 0 0 0 4px rgba(239,68,68,0.18), 0 4px 20px rgba(239,68,68,0.15); border-color: #ef4444; }
    100% { box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: #f1f5f9; }
}
.chat-card.sollecitata {
    animation: sollecito-pulse 2s ease-in-out infinite;
    border-color: #fca5a5;
}
.badge-sollecito {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    color: #dc2626;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 6px;
    vertical-align: middle;
}
/* --- fine sollecito --- */

.chat-header { background: transparent; padding: 10px 14px; }
.chat-header.archiviata { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.chat-badge-type { font-size: 10px; font-weight: 800; color: #475569; text-transform: uppercase; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
/* Dot icona tipo (sostituisce badge testuale) */
.chat-tipo-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    vertical-align: middle;
    flex-shrink: 0;
}
.chat-tipo-assegna { background: #dcfce7; color: #16a34a; }
.chat-tipo-domanda { background: #fee2e2; color: #dc2626; }
/* Pulsanti solo icona nelle chat-actions */
.btn-icon-only {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
}
.chat-order-label { font-size: 13px; font-weight: 800; margin-left: 8px; }
.chat-date { font-size: 11px; color: #94a3b8; }
.chat-body { padding: 10px 14px; background: #fcfcfc; display: flex; flex-direction: column; gap: 8px; }
.box-hidden { display: none; opacity: 0; transform: translateY(-10px); transition: all 0.3s ease; }
.box-conferma { background: #fff7ed; border-top: 1px solid #ffedd5; text-align: center; }
.box-risposta {
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
    padding: 16px 20px 18px;
    border-radius: 0 0 16px 16px;
}
.reply-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.reply-input {
    width: 100%;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    padding: 12px 16px;
    font-size: 14px;
    min-height: 80px;
    max-height: 200px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}
.reply-input:focus {
    border-color: #242424;
    box-shadow: 0 0 0 3px rgba(36,36,36,0.10);
}
.reply-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.reply-hint {
    font-size: 12px;
    color: #94a3b8;
}
.reply-hint b { color: #475569; font-weight: 700; }
.btn-reply-send {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: #242424;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}
.btn-reply-send:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.btn-reply-send:active {
    transform: scale(0.97);
}
.box-message { font-size: 13px; font-weight: 700; color: #9a3412; margin-bottom: 10px; }
.box-actions { display: flex; gap: 10px; justify-content: center; }
.button-small { padding: 6px 15px; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.btn-cancel { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
.btn-cancel:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.btn-archive-action { background: #242424; color: #ffffff; border: none; transition: background 0.2s, color 0.2s; }
.btn-archive-action:hover { background: #ffffff; color: #242424; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.btn-reply { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
.btn-reply:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.btn-alert { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
.btn-alert:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.btn-archive { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
.btn-archive:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.chat-to { font-size: 10px; color: #94a3b8; margin-left: auto; }
.chat-archiviata-note { padding: 10px 20px; border-top: 1px solid #f1f5f9; background: #f8fafc; text-align: right; }
.chat-archiviata-label { font-size: 11px; color: #242424; font-weight: 700; }


.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.info-ordine b {
    color: #1e293b;
    font-size: 15px;
    margin-left: 5px;
}

.badge-tipo-chat {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.5px;
}

.chat-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f0f2f5; /* Grigio chiaro tipo sfondo WhatsApp */
    padding: 20px;
    border-radius: 12px;
}

/* --- BOLLE MESSAGGIO --- */
.chat-bubble-wrapper {
    display: flex;
    width: 100%;
}

/* Ricevuto (Operatore) - Allineato a SINISTRA */
.chat-bubble-wrapper.received {
    justify-content: flex-start;
}

.chat-bubble-wrapper.received .chat-bubble {
    background: white;
    color: #333;
    border-radius: 0px 15px 15px 15px; /* Angolo tagliato in alto a sx */
    border: 1px solid #e2e8f0;
}

/* Inviato (Master/Ufficio) - Allineato a DESTRA */
.chat-bubble-wrapper.sent {
    justify-content: flex-end;
}

.chat-bubble-wrapper.sent .chat-bubble {
    background: #242424;
    color: white;
    border-radius: 15px 15px 0px 15px; /* Angolo tagliato in basso a dx */
}

.chat-bubble {
    max-width: 75%;
    padding: 10px 15px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Nome Autore dentro la bolla */
.chat-bubble-name {
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 3px;
    text-transform: uppercase;
    display: block;
}

.chat-bubble-text {
    font-size: 14px;
    line-height: 1.4;
}

.received .chat-bubble-name { color: #242424; text-align: left; }
.sent .chat-bubble-name { color: #9ca3af; text-align: right; }

.chat-bubble-time {
    font-size: 10px;
    opacity: 0.55;
    margin-top: 5px;
    display: block;
    text-align: right;
    letter-spacing: 0.02em;
}
.received .chat-bubble-time { color: #64748b; }
.sent .chat-bubble-time { color: #cbd5e1; }













/* ============================================================
   11. AZIONI CHAT E NOTIFICHE
   ============================================================ */

.chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}
.chat-to-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-to-dest {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
}
.chat-to-ord {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.chat-action-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}
.chat-cliente-label {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.btn-chat-action {
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-chat-action.reply { background: #242424; color: #ffffff; }
.btn-chat-action.reply:hover { background: #ffffff; color: #242424; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.btn-chat-action.alert { background: #242424; color: #ffffff; }
.btn-chat-action.alert:hover { background: #ffffff; color: #242424; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.btn-chat-action.done { background: #242424; color: #ffffff; }
.btn-chat-action.done:hover { background: #ffffff; color: #242424; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }

.reply-input-wrapper {
    display: flex;
    background: #ffffff;
    padding: 8px;
    border-radius: 25px;
    border: 1px solid #e2e8f0;
    margin-top: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.reply-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    padding: 5px 15px;
    outline: none;
    font-size: 14px;
}

.reply-input-wrapper button {
    background: #242424;
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.reply-input-wrapper button:hover {
    transform: scale(1.05);
    background: #3f3f3f;
}

.notification-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    padding: 10px;
}

.notification-bell {
    font-size: 24px;
    color: #64748b;
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #ef4444; /* Rosso notifica */
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    display: none; /* Nascosto se 0 */
}















/* --- ANIMAZIONI --- */

/* Animazione per il sollecito */
.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pulse-new {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(36, 36, 36, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(36, 36, 36, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(36, 36, 36, 0); }
}

.badge-new-anim {
    animation: pulse-new 2s infinite;
    background: #242424 !important;
}

.loader-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #242424;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



















/* ============================================================
   12. IMPOSTAZIONI PREMIUM OPTIMIZED
   ============================================================ */

/* ============================================================
   IMPOSTAZIONI: Accordion
   ============================================================ */
.settings-accordion {
    background: white;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    max-width: 680px;
    margin: 0 auto;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    user-select: none;
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row:hover { background: #f8fafc; }
.settings-row.open { background: #f0f9ff; }
.settings-row.open .settings-row-arrow { transform: rotate(180deg); }
.settings-row-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.settings-row-icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #242424;
    font-size: 16px;
    flex-shrink: 0;
}
.settings-row.open .settings-row-icon { background: #e2e8f0; color: #242424; }
.settings-row-title { font-weight: 700; font-size: 15px; color: #1e293b; }
.settings-row-sub { font-size: 12px; color: #94a3b8; margin-top: 1px; }
.settings-row-arrow { color: #94a3b8; font-size: 13px; transition: transform 0.2s; flex-shrink: 0; }

.settings-section-body { border-bottom: 1px solid #f1f5f9; }
.settings-section-body .card-settings {
    border-radius: 0;
    border: none;
    box-shadow: none;
    border-top: 1px solid #e2e8f0;
    background: #fafbfc;
}

.settings-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.card-settings {
    background: white;
    flex: 1;
    min-width: 320px;
    max-width: 100%;
    padding: 24px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
}

.card-settings h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-row-modern {
    background: #f8fafc;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
    width: 100%;
}

.input-flat {
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 11px;
    color: #334155;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
    min-width: 0;
    font-family: inherit;
}

.input-field-modern {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: #475569;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.input-field-modern:focus {
    border-color: var(--primary);
    outline: none;
}

.status-dot-custom {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    cursor: pointer;
    background: var(--bg-color, #e2e8f0);
    flex-shrink: 0;
    box-sizing: content-box;
}

/* additional classes for script refactor */
.archivio-wrapper { border-color: #cbd5e1; margin-bottom: 15px; }
.archivio-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.order-info-col { text-align: right; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.btn-archive-action.primary { background:#242424!important; color:#ffffff !important; border:none !important; }
.btn-archive-action.primary:hover { background:#ffffff !important; color:#242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.btn-archive-action.warning { background:#242424!important; color:#ffffff !important; border:none !important; }
.btn-archive-action.warning:hover { background:#ffffff !important; color:#242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.color-picker-wrapper { position: relative; width: 16px; height: 16px; }
.color-overlay { position: absolute; opacity:0; width:100%; height:100%; cursor:pointer; z-index:2; }

.status-select { border-left: 5px solid var(--border-color); }
.config-row-modern.row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 7px 12px 7px 10px;
    margin-bottom: 8px;
}
.settings-actions-row { display: flex; align-items: center; justify-content: space-between; }
.settings-options-row { display: flex; align-items: center; gap: 10px; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; }
.gap-8 { gap: 8px; }
.centered-fullwidth { width:100%; text-align:center; }
.my-30 { margin: 30px 0; }
.acquisti-header.header-flex { margin-bottom:20px; display:flex; justify-content:space-between; align-items:center; padding:0 10px; }
.acquisti-actions-wrapper { display: flex; align-items: center; gap: 8px; }
.acquisti-title { margin:0; font-size:22px; font-weight:800; color:#242424; letter-spacing:-0.02em; }
.acquisti-subtitle { color:#94a3b8; font-size:13px; margin:4px 0 0; }

/* nuovo: acquisition page utilities */
.hidden { display: none; }
.acquisti-actions-row { display:flex; gap:10px; align-items:center; }
.materiali-grid { display:grid; gap:18px; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); }


/* utility helpers introduced in script */
.position-relative { position: relative; }
.text-danger { color: #ef4444; }
.scale-120 { transform: scale(1.2); }
.mr-5 { margin-right: 5px; }
.img-reset-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(239,68,68,0.92);
    color: white;
    border-radius: 20px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    z-index: 20;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(239,68,68,0.4);
    border: none;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.img-reset-btn::before { content: 'Ã—'; font-size: 14px; font-weight: 400; line-height: 1; }
.img-reset-btn::after { content: 'Rimuovi'; }
.img-reset-btn
.img-reset-btn::after { content: 'Rimuovi'; }
.img-reset-btn:hover {
    background: rgba(220,38,38,0.97);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(239,68,68,0.5);
}
.cart-item-row { display:flex; align-items:center; gap:10px; padding:10px; border-bottom:1px solid #f1f5f9; }
.cart-item-photo { width:40px; height:40px; object-fit:cover; border-radius:5px; }
.cart-item-placeholder { width:40px; height:40px; background:#f8fafc; border-radius:5px; display:flex; align-items:center; justify-content:center; }
.cart-item-icon { color:#cbd5e1; font-size:12px; }
.cart-item-name { font-weight:700; font-size:13px; }
.cart-item-details { font-size:11px; color:#64748b; }
.btn-inline-trash { background:none; border:none; color:#ef4444; cursor:pointer; }
.empty-cart-msg { text-align:center; padding:20px; color:#64748b; }

/* === ModalitÃ  selezione multipla: toggle via classe sul grid === */
/* Nasconde bottone â‹®, mostra checkbox */
.grid-sel-mode .btn-opt-trigger { display: none !important; }
.grid-sel-mode .mat-sel-chk {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer !important;
    accent-color: #242424 !important;
}

/* === Wobble mode Sposta (iPhone-style) === */
@keyframes mat-jiggle {
    0%   { transform: rotate(0deg) scale(1); }
    25%  { transform: rotate(-1.2deg) scale(1.01); }
    75%  { transform: rotate(1.2deg) scale(1.01); }
    100% { transform: rotate(0deg) scale(1); }
}
.mat-wobble {
    animation: mat-jiggle 0.45s ease-in-out infinite;
    transform-origin: center center;
    cursor: grab !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18) !important;
    border-color: #cbd5e1 !important;
    user-select: none;
}
.mat-wobble:nth-child(even) {
    animation-delay: 0.2s;
    animation-direction: alternate-reverse;
}
.mat-wobble:nth-child(3n) { animation-delay: 0.1s; }
.mat-wobble:active { cursor: grabbing !important; animation: none !important; }

/* Bottone Sposta attivo */
.btn-active-sposta {
    background: #242424 !important;
    color: white !important;
    border-color: #242424 !important;
}
.btn-active-sposta:hover {
    background: #3f3f3f !important;
}

/* Drag and Drop */
.dnd-dragging {
    opacity: 0.35;
    transform: scale(0.98);
    box-shadow: 0 8px 25px rgba(0,0,0,0.18) !important;
    position: relative;
    z-index: 50;
}
.dnd-handle, .drag-handle {
    color: #cbd5e1;
    cursor: grab;
    flex-shrink: 0;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.dnd-handle:hover, .drag-handle:hover { color: #94a3b8; }
.dnd-handle:active, .drag-handle:active { cursor: grabbing; }

/* additional utilities used after refactor */
.icon-muted { color:#94a3b8; }
.overlay-img { max-width:90%; max-height:90%; border-radius:10px; box-shadow:0 0 20px rgba(0,0,0,0.5); }
.align-end { align-items: flex-end; }
.gap-5 { gap: 5px; }

/* message utility classes */
.inline-msg { padding:20px; color:#64748b; }
.inline-error { padding:20px; color:red; }
.centered-msg { text-align:center; padding:50px; color:#94a3b8; }
.centered-error-bold { text-align:center; padding:50px; color:#ef4444; font-weight:bold; }



/* img-preview generico (modale, ecc.) */
.img-preview-container {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
}
.img-preview-container i {
    color: #94a3b8;
    font-size: 18px;
    pointer-events: none;
}

/* img-preview container modifiers */
.img-preview-container.dashed { border:1px dashed #cbd5e1; }
.img-preview-container.large { width:60px; height:60px; }

.avatar-circle {
    width: 34px;
    height: 34px;
    background: #8fe45e;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
}

.btn-trash-modern {
    background: transparent;
    color: #94a3b8;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-trash-modern:hover {
    background: #fff1f2;
    color: #f43f5e;
}

/* Kanban visibility checkbox in stati settings */
.kanban-check-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    color: #94a3b8;
    font-size: 13px;
    transition: all 0.15s;
    white-space: nowrap;
    user-select: none;
}
.kanban-check-label:has(input:checked) {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}
.kanban-check-label input[type="checkbox"] {
    display: none;
}

.btn-add-dashed {
    width: 100%;
    margin-top: 5px;
    padding: 12px;
    font-size: 13px;
    border: 2px dashed #e2e8f0;
    background: transparent;
    border-radius: 14px;
    color: #94a3b8;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add-dashed:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f7ff;
}

.visualizza-operatori {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 30px;
    align-items: center;
}

/* ---- OPERATORE DROPDOWN (stessa struttura del stato-dropdown) ---- */
.op-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}
.op-dropdown.op-dropdown-ord {
    width: 160px;
}
.op-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px 7px 10px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #334155;
    white-space: nowrap;
    box-sizing: border-box;
}
.op-trigger:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.op-trigger-ord {
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 10px;
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.18);
    color: #1e293b;
}
.op-trigger-ord:hover {
    background: rgba(255,255,255,0.97);
    border-color: rgba(0,0,0,0.32);
    color: #0f172a;
}
.op-dropdown.open .op-trigger    { background: #f1f5f9; border-color: #94a3b8; }
.op-dropdown.open .op-trigger-ord { background: #fff; border-color: #94a3b8; color: #0f172a; }
.op-icon { font-size: 11px; flex-shrink: 0; color: #64748b; }
.op-trigger-ord .op-icon { color: #64748b; }
.op-trigger-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.op-chevron { font-size: 9px; flex-shrink: 0; color: #94a3b8; transition: transform 0.2s ease; }
.op-dropdown.open .op-chevron { transform: rotate(180deg); }
.op-popup {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 180px;
    width: max-content;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 9999;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    pointer-events: none;
}
.op-dropdown.open .op-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0s;
    pointer-events: auto;
}
.op-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #334155;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.op-option:hover    { background: #f1f5f9; }
.op-option.is-selected { background: #f0fdf4; color: #166534; font-weight: 700; }
.op-opt-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #94a3b8; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.85); box-sizing: content-box;
}
.op-check-icon { margin-left: auto; font-size: 10px; color: #166534; }

/* stato-dropdown-ord specific overrides are in the earlier section */

/* Pulsante Assegnami per operatori */
.btn-assegnami {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #1e40af;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-assegnami:hover { background: #1d4ed8; }
.btn-assegnami-ord {
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 11px;
    gap: 4px;
    background: rgba(30,64,175,0.85);
    border: 1.5px solid rgba(255,255,255,0.25);
    margin-top: 0;
}
.btn-assegnami-ord:hover { background: #1d4ed8; }
/* ---- FINE OPERATORE DROPDOWN ---- */

/* Pulsante lazy-render "Carica altri N ordini" */
.btn-carica-altri-prod {
    display: block;
    width: 100%;
    margin: 16px 0 8px;
    padding: 10px 0;
    background: #f1f5f9;
    color: #334155;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.btn-carica-altri-prod:hover { background: #e2e8f0; border-color: #94a3b8; }
.btn-carica-altri-prod i { margin-right: 6px; }

.badge-operatore {
    background: #242424;
    color: #ffffff;
    padding: 2px 6px 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid #242424;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-rimuovi-op {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin: 0;
    font-weight: 700;
    transition: color 0.15s;
    flex-shrink: 0;
}

.btn-rimuovi-op:hover {
    color: #ffffff;
}

.btn-chiedi-assegna {
    background: #242424;
    color: white;
    border: none;
    padding: 6px 12px !important;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 140px;  /* Forza i tasti ad avere la stessa larghezza */
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-chiedi-assegna:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}








/* additional rules moved from index.html inline styles */
#modal-titolo {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #1e293b;
}

/* reset headings inside modals to remove default margins */
#modal-carrello h3,
.modal-articoli-box h3 {
    margin: 0;
}
.modal-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.modal-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 5px;
}
#messaggio-aiuto {
    width: 100%;
    height: 80px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}
.btn-modal-cancel {
    background: #242424;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.btn-modal-cancel:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.btn-modal-send {
    background: #242424;
    color: #ffffff;
    border: none;
    padding: 10px 25px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-modal-send:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

#floating-cart-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #242424;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid rgba(255,255,255,0.15);
    pointer-events: auto !important;
    transition: background 0.18s, box-shadow 0.18s;
}
#floating-cart-btn:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    border-color: #242424;
}
/* === MODAL CARRELLO â€” fade overlay + slide-up box === */
#modal-carrello {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    backdrop-filter: blur(0px);
    transition: opacity 0.28s ease, backdrop-filter 0.28s ease;
    pointer-events: none;
}
#modal-carrello.cart-open {
    opacity: 1;
    backdrop-filter: blur(3px);
    pointer-events: auto;
}
#modal-carrello > div {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 28px 60px rgba(0,0,0,0.3);
    transform: translateY(36px) scale(0.92);
    transition: transform 0.44s cubic-bezier(0.22, 1, 0.36, 1);
}
#modal-carrello.cart-open > div {
    transform: translateY(0) scale(1);
}
#modal-carrello .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
#modal-carrello .btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}
#modal-carrello .modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* gestione articolo modal */
.modal-articoli-box h3 {
    margin-top: 0;
    color: #1e293b;
    font-size: 18px;
}
.modal-articolo-field {
    margin-bottom: 12px;
}
.modal-articolo-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}
.modal-articolo-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.modal-articolo-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-modal-art-cancel {
    background: #242424;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-modal-art-cancel:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.btn-modal-art-send {
    background: #242424;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-modal-art-send:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* mobile header adjustments */
.mobile-header {
    display: none; /* nascosto su desktop, visibile via @media */
    align-items: center;
    background: #242424;
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    z-index: 9000;
    box-sizing: border-box;
    padding: 0 16px;
    gap: 12px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}
.mobile-menu-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mobile-menu-btn i { font-size: 20px; }
.mobile-header-title {
    flex: 1;
    text-align: center;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: white;
}
.mobile-header-right {
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}
.badge-mobile-notif {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* ============================================================
   MOBILE TAB BAR - RIMOSSO
   ============================================================ */

/* user avatar icon rules */
#user-avatar-icon {
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
}

/* end inline-to-css additions */

/*PAGINA ACQUISTI*/

/* Card Materiale - Layout Principale */
/* ============================================================
   ACQUISTI â€“ Card e-commerce verticale (desktop)
   ============================================================ */
.materiale-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    border: 1px solid #e8edf3;
    position: relative !important;
    overflow: visible !important;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s ease;
    will-change: transform;
    padding: 0;
    gap: 0;
    min-height: 0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.materiale-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.10);
    border-color: #cbd5e1;
}

.materiale-card:has(.menu-popup-opzioni.open) {
    z-index: 100 !important;
    border-color: #242424;
}

/* DnD handle â€“ appare solo su hover */
.dnd-handle {
    position: absolute;
    top: 10px;
    left: 8px;
    color: #cbd5e1;
    font-size: 13px;
    cursor: grab;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.2s;
}
.materiale-card:hover .dnd-handle { opacity: 1; }

/* Checkbox selezione multipla: nascosta di default, dentro mat-card-opts */
.mat-sel-chk {
    display: none; /* mostrata da .grid-sel-mode */
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #242424;
    flex-shrink: 0;
}

/* === AREA IMMAGINE === */
.mat-card-img {
    width: 100% !important;
    height: 150px !important;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 14px 14px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    border-bottom: 1px solid #e8edf3 !important;
    transition: background 0.2s !important;
    border: none !important;
}
.mat-card-img:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
}
.mat-card-img .mat-img-icon {
    font-size: 32px;
    color: #cbd5e1;
    transition: all 0.25s;
    pointer-events: none;
}
.mat-card-img:hover .mat-img-icon {
    color: #242424;
    transform: scale(1.18);
}
/* Hint "Scatta foto" appare sull'hover */
.mat-img-hint {
    position: absolute;
    bottom: 10px;
    left: 0; right: 0;
    text-align: center;
    font-size: 11px;
    color: #242424;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.2s;
    pointer-events: none;
}
.mat-card-img:hover .mat-img-hint {
    opacity: 1;
    transform: translateY(0);
}
/* Badge fornitore â€“ overlay top-left sull'immagine */
.mat-badge-fornitore {
    position: absolute;
    top: 10px; left: 10px;
    background: rgba(255,255,255,0.92);
    color: #475569;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(4px);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

/* Foto caricata nell'area immagine card */
.mat-card-img img.modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
    display: block;
}

/* === BODY: nome + codice === */
.materiale-info {
    flex: 1;
    padding: 12px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.materiale-fornitore.mat-fornitore-mobile {
    display: none; /* visibile solo su mobile */
}
.materiale-name, .materiale-nome {
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.materiale-codice {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
}

/* === FOOTER: qty stepper + bottone Aggiungi === */
.materiale-actions {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    justify-content: flex-start;
}
.qty-order-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.materiale-card input[type="number"] {
    width: 36px;
    height: 28px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-weight: 800;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    padding: 0;
    line-height: 28px;
    vertical-align: middle;
    -moz-appearance: textfield;
    appearance: textfield;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.materiale-card input[type="number"]::-webkit-inner-spin-button,
.materiale-card input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.btn-qty-step {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #374151;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-qty-step:hover { background: #e2e8f0; }

.btn-add-cart {
    flex: 1;
    background: #242424;
    color: #ffffff;
    border: none;
    height: 32px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    padding: 0 10px;
}
.btn-add-cart:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}


/* === MENU OPZIONI â‹® === */
.mat-card-opts {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 6;
}
.btn-opt-trigger {
    background: rgba(255,255,255,0.88);
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    transition: all 0.15s;
    line-height: 1;
}
.btn-opt-trigger:hover {
    background: white;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Popup menu â€” fade + scale */
.menu-popup-opzioni {
    display: block !important; /* sempre nel DOM, visibilitÃ  via opacity */
    position: absolute;
    right: 0;
    top: 36px;
    background: white !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    z-index: 999999 !important;
    min-width: 150px;
    padding: 5px 0;
    /* animazione */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.94) translateY(-6px);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.3, 0.64, 1), visibility 0s linear 0.18s;
    pointer-events: none;
}
.menu-popup-opzioni.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.3, 0.64, 1), visibility 0s linear 0s;
    pointer-events: auto;
}

.menu-item-opt {
    padding: 10px 15px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

button.menu-item-opt {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    width: 100%;
}

.menu-item-opt:hover { background: #f8fafc; }
.menu-item-opt i { width: 14px; color: #94a3b8; }
.menu-item-opt.text-danger { color: #dc2626; }
.menu-item-opt.text-danger i { color: #dc2626; }

/* MODAL GESTIONE ARTICOLI */
.modal-articoli-overlay {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw; height: 100dvh;
    background: rgba(15, 23, 42, 0.7) !important; /* Più scuro ed elegante */
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999 !important;
    backdrop-filter: blur(4px); /* Effetto sfocato moderno */
}

.modal-articoli-box {
    background: white;
    padding: 25px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

















/* ============================================================
   ACQUISTI â€” Sezioni
   ============================================================ */
.sezione-materiali-wrapper { margin-bottom: 18px; }

.sezione-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 10px;
    transition: background 0.15s;
}
.sezione-header:hover { background: #f1f5f9; border-color: #cbd5e1; }
.sezione-header-left { display: flex; align-items: center; gap: 10px; }
.sezione-header-right { display: flex; align-items: center; gap: 8px; }
.btn-sezione-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.btn-sezione-edit:hover {
    background: #242424;
    color: #ffffff;
    border-color: #242424;
}
.sezione-icon { color: #242424; font-size: 14px; }
.sezione-nome  { font-weight: 700; font-size: 14px; color: #1e293b; }
.sezione-count {
    background: #242424;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}
.sezione-arrow { color: #94a3b8; font-size: 12px; transition: transform 0.25s ease; }
.sezione-grid  { margin-bottom: 6px; }

/* === MODALITÃ€ RICERCA ATTIVA: appiattisce sezioni ========= */
#lista-materiali-grid.search-active .sezione-header { display: none !important; }
#lista-materiali-grid.search-active .sezione-materiali-wrapper { display: contents; margin: 0; }
#lista-materiali-grid.search-active .sezione-materiali-wrapper.sez-no-results { display: none !important; }
#lista-materiali-grid.search-active .sezione-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 18px;
    margin-bottom: 8px;
}
@media (max-width: 768px) {
    #lista-materiali-grid.search-active .sezione-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
}
/* === TASTIERA APERTA: regole da aggiornare una volta definita una nuova barra === */

/* compensa il padding safe-area nel calcolo dello spazio sotto il contenuto */
/* NESSUN override su html: evita flash scuro in cima al caricamento */
.sezione-empty {
    text-align: center;
    padding: 18px 12px;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
    margin: 4px 0 10px;
}
.sezione-empty b { color: #64748b; font-style: normal; }
/* Pulsanti header acquisti - palette #242424*/
#btn-mode-select { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
#btn-mode-select:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
#btn-delete-selected { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
#btn-delete-selected:hover { background: #ffffff !important; color: #242424!important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }
.btn-nuovo-fisso { background: #242424!important; color: #ffffff !important; border: none !important; transition: background 0.2s, color 0.2s !important; }
.btn-nuovo-fisso:hover { background: #ffffff !important; color: #242424 !important; box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important; }

.btn-sezione-new { color: #ffffff !important; }

/* ── Bottoni semantici (acquisti, manuali, form) ─────────────────────────── */
.ui-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    line-height: 1.2; transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.ui-btn-sm { padding: 6px 11px; font-size: 0.78rem; }
.ui-btn-lg { padding: 10px 20px; font-size: 0.9rem; font-weight: 700; border-radius: 10px; }

.ui-btn-ghost {
    background: #fff; color: #374151; border-color: #e2e8f0;
}
.ui-btn-ghost:hover { background: #f8fafc; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.ui-btn-primary {
    background: #242424; color: #fff; border-color: #242424;
}
.ui-btn-primary:hover { background: #444; border-color: #444; }

.ui-btn-success {
    background: #ecfdf5; color: #065f46; border-color: #a7f3d0;
}
.ui-btn-success:hover { background: #d1fae5; }

.ui-btn-warning {
    background: #fffbeb; color: #92400e; border-color: #fcd34d;
}
.ui-btn-warning:hover { background: #fef3c7; }

.ui-btn-danger {
    background: #fef2f2; color: #b91c1c; border-color: #fca5a5;
}
.ui-btn-danger:hover { background: #fee2e2; }

.ui-btn-purple {
    background: #7c3aed; color: #fff; border-color: #7c3aed;
}
.ui-btn-purple:hover { background: #6d28d9; border-color: #6d28d9; }

.ui-btn-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700;
    background: #f1f5f9; color: #475569; border: none;
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* Mobile-only structural bars: hidden by default */
.mobile-topbar,
.mobile-tab-bar {
    display: none;
}

/* ============================================================
   13. AREA MOBILE - SMARTPHONE (MAX 768px)
   ============================================================ */

@media (max-width: 768px) {
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        overflow: hidden !important;
        background: #f8fafc !important;
    }

    body {
        position: fixed !important;
        inset: 0 !important;
    }

    .mobile-header,
    .sidebar,
    .menu-section-label,
    .sidebar-footer-brand {
        display: none !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    .main-content {
        position: fixed !important;
        inset: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: #f8fafc !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .mobile-topbar {
        display: block !important;
        position: relative !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        height: auto !important;
        box-sizing: border-box !important;
        padding: 10px 12px 8px !important;
        background: #f8fafc !important;
        z-index: 20 !important;
    }

    .top-bar {
        margin-bottom: 6px !important;
        padding: 10px 0 8px !important;
        border-bottom: none !important;
        position: relative;
    }

    .top-bar::after {
        content: '';
        display: block;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 40px;
        height: 3px;
        background: #242424;
        border-radius: 2px;
    }

    h1 {
        font-size: 1.32rem !important;
        font-weight: 900 !important;
        letter-spacing: -0.03em !important;
        color: #0f172a !important;
        line-height: 1.15 !important;
    }

    .search-container {
        max-width: 100% !important;
        margin-bottom: 2px !important;
    }

    .search-container input {
        font-size: 16px !important;
        padding: 9px 12px 9px 38px !important;
        border-radius: 12px !important;
    }

    input, textarea, select {
        font-size: 16px !important;
    }

    #contenitore-dati {
        flex: 1 1 0 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        padding: 4px 12px 12px 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
        background: #f8fafc !important;
        min-height: 0 !important;
    }

    .mobile-tab-bar {
        display: flex !important;
        position: relative !important;
        flex-shrink: 0 !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        height: 100px !important;
        padding: 0 8px 4px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        background: #242424!important;
        border-top: 1px solid rgba(255,255,255,0.08) !important;
        z-index: 30 !important;
    }

    .tab-item {
        flex: 1 !important;
        height: 52px !important;
        border: 0 !important;
        background: transparent !important;
        color: #6b7280 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        position: relative !important;
        border-radius: 12px !important;
        padding: 0 4px !important;
        transition: background 0.18s, color 0.18s !important;
    }

    .tab-item i { font-size: 17px !important; }
    .tab-item span { font-size: 10px !important; line-height: 1.1 !important; font-weight: 600 !important; }

    .tab-item.active {
        background: rgba(255,255,255,0.12) !important;
        color: #ffffff !important;
    }
    .tab-item.active i {
        color: #ffffff !important;
    }

    .tab-fab {
        width: 54px !important;
        height: 54px !important;
        border-radius: 50% !important;
        border: 0 !important;
        color: #242424!important;
        background: #ffffff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        box-shadow: 0 4px 14px rgba(0,0,0,0.5) !important;
        font-size: 20px !important;
        margin: 0 8px !important;
        touch-action: manipulation !important;  /* elimina 300ms tap delay iOS/Android */
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }
    .tab-fab:active {
        transform: scale(0.95) !important;
    }

    .badge-bottom {
        position: absolute;
        top: 7px;
        right: calc(50% - 16px);
        background: #ef4444;
        color: white;
        font-size: 9px;
        font-weight: 900;
        padding: 1px 5px;
        border-radius: 10px;
        min-width: 16px;
        text-align: center;
        border: 1.5px solid #242424;
    }

    .riga-ordine {
        flex-wrap: wrap !important;
        gap: 6px 6px !important;
        padding: 10px 12px !important;
        margin-bottom: 9px !important;
        align-items: center !important;
    }
    .riga-ordine > .flex-grow {
        width: 100%;
        order: 1;
        min-width: 0;
    }
    .flex-grow .order-title {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
    .riga-ordine > .order-info {
        order: 2;
        width: 100% !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        align-items: center !important;
        justify-content: flex-start !important;
        min-width: 0;
        overflow: visible !important;
    }
    /* Badge, dropdown operatore e dropdown stato: stessa larghezza (1/3 dello spazio) */
    .riga-ordine > .order-info > .badge-count {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        max-width: none !important;
        white-space: nowrap !important;
        justify-content: center !important;
    }
    .badge-count .badge-ord-num {
        max-width: 55px;
    }
    .riga-ordine > .order-info > .op-dropdown.op-dropdown-ord {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    .riga-ordine > .order-info > .stato-dropdown-ord {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    .op-trigger-ord {
        padding: 5px 8px !important;
        font-size: 9px !important;
        gap: 4px !important;
        width: 100% !important;
        justify-content: center !important;
    }
    .stato-dropdown-ord .stato-trigger {
        padding: 5px 8px !important;
        font-size: 9px !important;
        gap: 4px !important;
        width: 100% !important;
        justify-content: center !important;
    }
    .op-trigger-label {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        flex: 0 1 auto !important;
    }
    .stato-label-txt {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        flex: 0 1 auto !important;
    }
    /* Menu tre puntini: fisso a destra, non cresce */
    .riga-ordine > .order-info > .ord-azioni-menu {
        flex: 0 0 32px !important;
        margin-left: 0 !important;
    }
    .btn-txt { display: none !important; }

    /* Su mobile: nascondi bottoni desktop, mostra menu tre puntini */
    .hide-mobile  { display: none !important; }
    .show-mobile-flex { display: flex !important; }
    .ord-azioni-menu { display: flex !important; }

    /* Popup aperto: rimane nell'ordine-wrapper senza uscire dallo schermo */
    .ord-azioni-popup { right: 0; }

    /* Bottoni header ordine: quadrati, fissi a destra, mai a capo */
    .riga-ordine .btn-chiedi-assegna,
    .riga-ordine .btn-archivia-prod,
    .riga-ordine .btn-ripristina {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        padding: 0 !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        flex-basis: 44px !important;
        border-radius: 10px !important;
    }

    .item-card {
        grid-template-columns: 1fr 1fr !important;
        gap: 7px 8px !important;
        padding: 10px !important;
    }
    .item-card > div:nth-child(1) { grid-column: 1 !important; }
    .item-card > div:nth-child(2) { grid-column: 2 !important; }
    .item-card > div:nth-child(3),
    .item-card > div:nth-child(4),
    .item-card > div:last-child { grid-column: 1 / -1 !important; }
    .item-card > div:last-child {
        display: flex !important;
        justify-content: stretch !important;
    }
    .item-card > div:last-child .btn-chiedi-assegna {
        width: 100% !important;
        justify-content: center !important;
    }
    .item-card .label-sm {
        font-size: 9px !important;
        margin-bottom: 2px !important;
    }
    .item-card b, .item-card .value { font-size: 11px !important; }

    .item-card .select-interattivo,
    .select-interattivo {
        width: 100% !important;
        font-size: 13px !important;
        padding: 8px 10px !important;
        box-sizing: border-box !important;
    }

    .badge-operatore {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    .item-card.archivio-layout {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 14px !important;
    }
    .item-card.archivio-layout > .item-actions {
        grid-column: 1 / -1 !important;
        flex-direction: row !important;
        gap: 8px !important;
    }
    .item-card.archivio-layout > .item-actions > button {
        flex: 1 !important;
        justify-content: center !important;
        font-size: 11px !important;
    }

    .modal-overlay {
        align-items: flex-end !important;
        background: rgba(0,0,0,0.5) !important;
    }
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92dvh !important;
        overflow-y: auto !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 8px 16px 28px !important;
        transform: translateY(100%) !important;
        transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1) !important;
        opacity: 1 !important;
    }
    .modal-overlay.active .modal-content {
        transform: translateY(0) !important;
        animation: none !important;  /* disabilita modalSpring su mobile: conflitta con la transition slide-up */
    }
    .modal-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 2px;
        margin: 10px auto 18px;
    }

    .acquisti-header.header-flex {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0 !important;
        padding: 0 2px !important;
        margin-bottom: 14px !important;
    }

    /* Acquisti mobile: nascondi titolo/sottotitolo */
    .acquisti-title,
    .acquisti-subtitle { display: none !important; }

    /* Tutti i bottoni nella wrapper: allineati a destra, compatti */
    .acquisti-actions-wrapper {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 7px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }

    /* Seleziona: solo icona, quadrato */
    #btn-mode-select .btn-sel-txt { display: none !important; }
    #btn-mode-select {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Cestino elimina: solo icona, rosso, quadrato */
    #btn-delete-selected .btn-elimina-label { display: none !important; }
    #btn-delete-selected {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ef4444 !important;
        color: #ffffff !important;
        border: none !important;
    }
    #btn-delete-selected:hover {
        background: #dc2626 !important;
        color: #ffffff !important;
    }
    .btn-nuovo-fisso {
        flex-shrink: 0 !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important;
    }
    .btn-label-nuovo { display: none !important; }

    .materiali-grid {
        gap: 8px !important;
        grid-template-columns: 1fr !important;
    }

    .materiale-card {
        display: grid !important;
        grid-template-columns: 72px 1fr auto !important;
        grid-template-rows: auto auto !important;
        grid-template-areas:
            "img  info  opts"
            "foot foot  foot" !important;
        align-items: start !important;
        padding: 10px 10px 0 10px !important;
        gap: 0 10px !important;
        border-radius: 14px !important;
        overflow: visible !important;
        box-shadow: 0 1px 5px rgba(0,0,0,0.07) !important;
        border: 1px solid #e8edf3 !important;
        flex-direction: unset !important;
    }
    .materiale-card:hover {
        transform: none !important;
        box-shadow: 0 1px 5px rgba(0,0,0,0.07) !important;
    }

    .mat-card-img {
        grid-area: img !important;
        width: 72px !important;
        height: 72px !important;
        border-radius: 12px !important;
        flex-shrink: 0 !important;
        border: 1px solid #e2eaf3 !important;
        border-bottom: 1px solid #e2eaf3 !important;
        background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
        cursor: pointer !important;
        align-self: center !important;
        margin-bottom: 12px !important;
    }
    .mat-card-img .mat-img-icon { font-size: 24px !important; color: #cbd5e1 !important; }
    .mat-card-img img.modal-img { border-radius: 12px !important; }
    .mat-badge-fornitore, .mat-img-hint { display: none !important; }

    .materiale-info {
        grid-area: info !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        padding: 2px 0 12px 0 !important;
        min-width: 0 !important;
        flex: unset !important;
        align-self: center !important;
    }
    .materiale-nome {
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        line-height: 1.4 !important;
    }
    .materiale-codice {
        font-size: 10px !important;
        color: #475569 !important;
        font-weight: 700 !important;
        letter-spacing: 0.2px !important;
    }
    .mat-fornitore-mobile {
        display: block !important;
        font-size: 10px !important;
        color: #94a3b8 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.4px !important;
        font-weight: 600 !important;
    }

    .mat-card-opts {
        grid-area: opts !important;
        position: static !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: flex-end !important;
        padding-top: 2px !important;
        padding-bottom: 12px !important;
        flex-shrink: 0 !important;
        align-self: center !important;
    }
    .btn-opt-trigger {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }
    .menu-popup-opzioni {
        right: 0 !important;
        left: auto !important;
        top: 34px !important;
        min-width: 165px !important;
    }
    .menu-item-opt { padding: 11px 15px !important; font-size: 13px !important; }

    .materiale-actions {
        grid-area: foot !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 0 10px !important;
        border-top: 1px solid #f0f4f8 !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
    .qty-order-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
    }
    .btn-qty-step {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
        font-size: 12px !important;
        background: #f1f5f9 !important;
        border: 1px solid #e2e8f0 !important;
    }
    .materiale-card input[type="number"] {
        width: 38px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        border-radius: 7px !important;
        text-align: center !important;
    }
    .btn-cart-txt { display: none !important; }
    .btn-add-cart {
        flex: 0 0 42px !important;
        width: 42px !important;
        height: 38px !important;
        padding: 0 !important;
        font-size: 16px !important;
        border-radius: 10px !important;
        box-shadow: 0 2px 8px rgba(29,78,216,0.22) !important;
        gap: 0 !important;
    }

    .grid-sel-mode .mat-sel-chk { display: inline-block !important; }
    .dnd-handle, .drag-handle { display: none !important; }

    .modal-articoli-overlay { align-items: flex-end !important; }
    .modal-articoli-box {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
        max-height: 75dvh !important;
        overflow-y: auto !important;
    }

    .chat-card { padding: 14px !important; border-radius: 12px !important; margin-bottom: 12px !important; }
    .chat-actions { flex-wrap: wrap !important; gap: 6px !important; }
    .chat-bubble-text { font-size: 13px !important; }

    .settings-container { flex-direction: column !important; gap: 16px !important; }
    .card-settings { padding: 16px !important; }

    .login-card {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 20px 20px 36px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        max-height: 92dvh !important;
        overflow-y: auto !important;
    }
    .login-logo-img { width: 110px !important; }
    .login-logo-container { margin-bottom: 16px !important; }
    .login-card h2 { font-size: 20px !important; margin-bottom: 6px !important; }
    .login-card p { font-size: 13px !important; margin-bottom: 18px !important; }
    #login-overlay { align-items: flex-end !important; padding: 0 !important; }

    .scroll-btn { font-size: 12px !important; padding: 8px 14px !important; }
    .riga-ordine:hover, .item-card:hover, .materiale-card:hover, .chat-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    .btn-tipo, .btn-modal-cancel, .btn-modal-send, .btn-login { min-height: 44px; }

    body.keyboard-open .mobile-tab-bar {
        display: none !important;
    }

    #floating-cart-btn {
        right: 14px !important;
        bottom: 110px !important;
    }
}

/* ============================================================
   14. AREA DESKTOP - PC E TABLET (MIN 769px)
   ============================================================ */

@media (min-width: 769px) {
    .mobile-header {
        display: none !important;
    }

    .mobile-topbar,
    .mobile-tab-bar {
        display: none !important;
    }

    /* TOP FLOAT BAR */
    .top-float-bar {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        height: 56px !important;
        display: flex !important;
        gap: 10px !important;
        z-index: 200 !important;
    }

    /* Card brand â€” larghezza FISSA, non si muove mai */
    .top-brand-card {
        width: 248px !important;
        flex-shrink: 0 !important;
        height: 56px !important;
        background: #242424 !important;
        border-radius: 20px !important;
        box-shadow: 0 4px 18px rgba(0,0,0,0.22) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        position: relative !important;
        padding: 0 !important;
    }
    /* Hamburger assoluto a sinistra: non toglie spazio al centering del logo */
    .top-hamburger-btn {
        position: absolute !important;
        left: 6px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 38px !important;
        height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        color: #9ca3af !important;
        font-size: 16px !important;
        cursor: pointer !important;
        outline: none !important;
        z-index: 2 !important;
        transition: color 0.2s, background 0.15s !important;
    }
    .top-hamburger-btn:hover {
        color: #ffffff !important;
        background: rgba(255,255,255,0.08) !important;
    }
    /* Logo+testo centrati nella card intera */
    .top-brand-home-btn {
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        outline: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 11px !important;
        padding: 0 !important;
        border-radius: 20px !important;
    }
    .top-brand-home-btn:hover {
        background: transparent !important;
    }

    /* Card search */
    .top-search-card {
        flex: 1 !important;
        height: 56px !important;
        background: #ffffff !important;
        border-radius: 20px !important;
        box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 0 22px !important;
        transition: box-shadow 0.18s !important;
    }
    .top-search-card:focus-within {
        box-shadow: 0 4px 20px rgba(37,99,235,0.13) !important;
    }
    .top-search-icon {
        color: #94a3b8 !important;
        font-size: 14px !important;
        flex-shrink: 0 !important;
    }
    .top-search-input {
        border: none !important;
        background: transparent !important;
        outline: none !important;
        font-size: 14px !important;
        color: #374151 !important;
        width: 100% !important;
        font-family: inherit !important;
    }
    .top-search-input::placeholder { color: #94a3b8 !important; }

    /* â”€â”€ Pulsante filtro articoli (desktop) â”€â”€ */
    .btn-filtro-articoli {
        flex-shrink: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
        border: 1.5px solid #e2e8f0 !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-size: 13px !important;
        cursor: pointer !important;
        transition: background 0.15s, color 0.15s, border-color 0.15s !important;
    }
    .btn-filtro-articoli:hover {
        background: #f1f5ff !important;
        color: #2563eb !important;
        border-color: #2563eb !important;
    }
    .btn-filtro-articoli.active {
        background: #2563eb !important;
        color: #fff !important;
        border-color: #2563eb !important;
        box-shadow: 0 2px 8px rgba(37,99,235,0.25) !important;
    }

    /* Sfondo leggermente piÃ¹ scuro per far risaltare i pannelli */
    body {
        background: #e5eaf0 !important;
    }

    /* Sidebar flottante stondato â€” parte sotto la top bar */
    .sidebar {
        position: fixed !important;
        left: 10px !important;
        top: 76px !important;
        width: 248px !important;
        height: calc(100vh - 86px) !important;
        border-radius: 20px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.22) !important;
        transform: translateX(0) !important;
        visibility: visible !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        transition: width 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    }

    /* Sidebar COLLAPSED su desktop */
    .sidebar.collapsed {
        width: 62px !important;
        overflow: visible !important;
    }

    /* Main panel: sotto la top bar */
    .main-content {
        margin: 76px 10px 10px 272px !important;
        width: calc(100% - 282px) !important;
        height: calc(100vh - 86px) !important;
        background: #ffffff !important;
        border-radius: 20px !important;
        box-shadow: 0 2px 16px rgba(0,0,0,0.07) !important;
        padding: 28px 44px !important;
        overflow-y: auto !important;
        display: block !important;
        transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1), width 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    }

    /* Main content quando sidebar Ã¨ collapsed su desktop */
    body.sidebar-collapsed .main-content {
        margin: 76px 10px 10px 86px !important;
        width: calc(100% - 96px) !important;
    }

    /* Nasconde elementi non usati su desktop */
    #desk-main-header { display: none !important; }

    /* Toolbar Acquisti sticky dentro main-content scrollabile */
    .acquisti-header.header-flex {
        position: sticky !important;
        top: -28px !important;
        z-index: 6 !important;
        background: #fff !important;
        padding: 8px 0 12px !important;
        margin: -8px 0 16px !important;
        border-bottom: 1.5px solid #f1f5f9 !important;
    }

    .menu-section-label, .user-info-top {
        display: block !important;
    }
}

/* --- PULL TO REFRESH --- */
#ptr-indicator {
    display: none;
    position: absolute;
    top: 128px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    align-items: center;
    gap: 8px;
    background: #242424;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s;
}
#ptr-indicator.ptr-visible { display: flex; }
#ptr-indicator.ptr-loading .ptr-arrow { display: none; }
#ptr-indicator.ptr-loading .ptr-spinner { display: inline-block; }
#ptr-indicator:not(.ptr-loading) .ptr-spinner { display: none; }
.ptr-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ptr-spin 0.7s linear infinite;
}
.ptr-arrow {
    font-size: 13px;
    transition: transform 0.2s;
}
.ptr-arrow.rotated { transform: rotate(180deg); }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* --- EFFETTI FINALI --- */

/* Mobile sidebar backdrop */
body.sidebar-is-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9998;
    animation: fadeIn 0.2s ease;
}
/* Blocca scroll del body quando la sidebar Ã¨ aperta su mobile */
@media (max-width: 768px) {
    body.sidebar-is-open {
        overflow: hidden !important;
    }
}

button:active {
    transform: scale(0.96);
    filter: brightness(0.9);
}

.btn-tipo, .btn-primary, .btn-login {
    transition: all 0.2s ease;
}

/* ============================================================
   15. FIX Z-INDEX â€” modals sopra sidebar e bottom-nav
   ============================================================ */
.modal-overlay {
    z-index: 10200 !important;
}

/* Il carrello flottante deve stare SOTTO i modal */
#floating-cart-btn {
    z-index: 8000 !important;
}

/* === MODAL ARTICOLI - animazione active === */
.modal-articoli-overlay {
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-articoli-overlay.active {
    opacity: 1;
}
.modal-articoli-box {
    transform: translateY(44px) scale(0.96);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-articoli-overlay.active .modal-articoli-box {
    transform: translateY(0) scale(1);
}

/* === Wobble mode Sposta (iPhone-style) === */
.btn-fade-action {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.2s ease;
    transform: scale(0.9);
}
.btn-fade-action.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}
/* Arrow impostazioni */
.settings-row-arrow {
    transition: transform 0.3s ease;
}
.settings-row-active .settings-row-arrow {
    transform: rotate(180deg);
}

/* === TOAST NOTIFICA === */
.toast-notifica {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #1e293b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 14px 36px rgba(0,0,0,0.35);
    z-index: 99999;
    opacity: 0;
    transform: translateX(28px) scale(0.93);
    transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    max-width: 320px;
}
.toast-notifica.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}
.toast-notifica.toast-error {
    background: #dc2626;
}

/* === MODAL CONFERMA === */
.modal-conferma-box {
    max-width: 360px !important;
    text-align: center;
}
.modal-conferma-titolo {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1e293b;
}
.modal-conferma-msg {
    color: #475569;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Link accesso admin / torna indietro */
.btn-login-admin-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    width: 100%;
    padding: 6px;
}
.btn-login-admin-link:hover { color: #94a3b8; }

/* PIN input centrato e grande */
.login-pin-input {
    text-align: center !important;
    font-size: 28px !important;
    letter-spacing: 12px !important;
    font-weight: 700 !important;
    padding: 16px 20px !important;
}

/* ============================================================
   16. LOGIN â€” nuovi elementi (modalitÃ  tabs + password toggle)
   ============================================================ */
.login-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 4px;
}
.login-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    color: #94a3b8;
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.login-tab.active {
    background: #242424;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.login-password-row {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.login-password-row .input-field-modern {
    margin-bottom: 0;
    padding-right: 48px;
    flex: 1;
}
.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
}
.btn-toggle-pwd:hover { color: #fff; }

/* ============================================================
   17. GESTIONE UTENTI â€” sezione impostazioni
   ============================================================ */
.utente-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px !important;
}
.utente-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.utente-nome {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}
.utente-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}
.utente-max {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}
.badge-ruolo {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-operatore { background: #242424; color: #ffffff; border: 1px solid #242424; }
.badge-master    { background: #fee2e2; color: #dc2626; }

/* Form nuovo utente */
.form-nuovo-utente {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}
.form-utente-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.form-utente-grid .input-field-modern {
    background: #fff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    margin-bottom: 0 !important;
}
.form-utente-grid .input-field-modern::placeholder {
    color: #94a3b8 !important;
}
.form-utente-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
@media (max-width: 480px) {
    .form-utente-grid { grid-template-columns: 1fr !important; }
}

/* â”€â”€ Card espandibili (click per aprire dettaglio) â”€â”€ */
.riepilogo-card {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.riepilogo-card-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease, opacity .28s ease;
    opacity: 0;
}
.riepilogo-card.riepilogo-card-open .riepilogo-card-expand {
    max-height: 200px;
    opacity: 1;
}
.riepilogo-card-chevron {
    margin-left: auto;
    font-size: 0.70rem;
    color: #475569;
    transition: transform .25s ease;
    flex-shrink: 0;
}
.riepilogo-card.riepilogo-card-open .riepilogo-card-chevron {
    transform: rotate(180deg);
}

/* â”€â”€ Archivio collassabile â”€â”€ */
.archivio-details { display: block; }
.archivio-details > summary { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.archivio-details > summary::-webkit-details-marker { display: none; }
.archivio-details > summary:focus { outline: none; }
.archivio-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    user-select: none;
}
.archivio-chevron {
    font-size: 0.72rem;
    color: #64748b;
    transition: transform .22s ease;
}
.archivio-details[open] .archivio-chevron { transform: rotate(180deg); }

/* â”€â”€ Placeholder caricamento lazy overview â”€â”€ */
.ov-lazy-placeholder {
    display: flex;
    justify-content: center;
    padding: 18px 0;
    color: #475569;
    font-size: 1rem;
}

/* â”€â”€ Accordion overview nella pagina produzione â”€â”€ */
.ov-accordion {
    background: #242424;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    overflow: hidden;
}
.ov-accordion[open] .ov-summary-chevron { transform: rotate(180deg); }
.ov-accordion-summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.80rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
}
.ov-accordion-summary::-webkit-details-marker { display: none; }
.ov-accordion-summary:focus { outline: none; }
.ov-summary-label i { color: #64748b; margin-right: 4px; }
.ov-summary-meta {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 500;
    color: #475569;
    text-transform: none;
    letter-spacing: 0;
}
.ov-summary-chevron {
    font-size: 0.72rem;
    color: #475569;
    transition: transform .25s ease;
    flex-shrink: 0;
}
.ov-accordion .riepilogo-page {
    padding: 0 14px 16px;
}

/* Wrapper board kanban: 4 colonne, stati col1-3, operatori col4 */
.ov-board-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: dense;
    gap: 12px;
    align-items: start;
}
/* Trasparenti al layout: i figli diventano diretti del grid esterno */
.ov-stati-grid,
.ov-operatori-panel {
    display: contents;
}
/* Corpo card operatori: stessa altezza esplicita */
.ov-op-card-body {
    height: calc(260px - 37px) !important;
    overflow-y: auto !important;
    flex: none !important;
}
/* Riga operatore (card "chi genere lavorando") */
.ov-op-row {
    padding: 5px 0;
    border-bottom: 1px solid #1e293b;
}
.ov-op-row:last-child { border-bottom: none; }
.ov-op-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.ov-op-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.ov-op-nome {
    font-size: 0.72rem;
    font-weight: 700;
    color: #e2e8f0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ov-op-count {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    flex-shrink: 0;
}
.ov-op-free-badge {
    font-size: 0.62rem;
    font-weight: 600;
    color: #475569;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.ov-op-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 28px;
}
.ov-op-item {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.ov-op-item-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ov-op-item-cod {
    font-size: 0.66rem;
    color: #94a3b8;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ov-op-item-qty {
    font-size: 0.63rem;
    color: #64748b;
    flex-shrink: 0;
}
.ov-op-item-free {
    opacity: 0.45;
    font-style: italic;
}
/* Riga riepilogo (card "carico operatori") */
.ov-op-summary-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 0;
    border-bottom: 1px solid #1e293b;
}
.ov-op-summary-row:last-child { border-bottom: none; }
.ov-op-summary-info {
    flex: 1;
    min-width: 0;
}
.ov-op-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 3px;
}
.ov-op-bar-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.07);
    overflow: hidden;
}
.ov-op-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Sub-card: <details> per ogni stato */
.ov-stato-card {
    background: #1c1c1c;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 260px;
}
.ov-stato-card-empty { opacity: 0.4; }
.ov-stato-header {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-left: 3px solid var(--ov-col, #94a3b8);
    background: #2c2c2c;
    flex-shrink: 0;
    /* desktop: non cliccare */
    cursor: default;
    user-select: none;
}
.ov-stato-header::-webkit-details-marker { display: none; }
.ov-stato-header:focus { outline: none; }
.ov-stato-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ov-stato-nome {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #94a3b8;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ov-stato-tot {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}
.ov-sub-chevron {
    font-size: 0.68rem;
    color: #475569;
    transition: transform .22s ease;
    flex-shrink: 0;
    /* nascosto su desktop */
    display: none;
}
.ov-stato-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: calc(260px - 37px);   /* 260 card - ~37px header */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.ov-stato-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    padding: 2px 0;
    border-bottom: 1px solid #1e293b;
}
.ov-stato-row:last-child { border-bottom: none; }
.ov-row-label {
    font-size: 0.73rem;
    color: #cbd5e1;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ov-row-badges {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    align-items: center;
}
.ov-badge-qty {
    font-size: 0.68rem;
    font-weight: 700;
    color: #f1f5f9;
    background: #1e293b;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.ov-badge-ord {
    font-size: 0.63rem;
    color: #64748b;
    white-space: nowrap;
}
.ov-stato-row-art {
    flex-wrap: wrap;
    row-gap: 1px;
}
.ov-row-ordini {
    width: 100%;
    font-size: 0.62rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 3px;
}
.ov-badge-op {
    font-size: 0.63rem;
    font-weight: 600;
    color: #94a3b8;
    background: #2c2c2c;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.ov-empty-lbl {
    font-size: 0.72rem;
    color: #334155;
    padding: 4px 0;
    font-style: italic;
}

/* â”€â”€ Mobile: sub-card collassabili â”€â”€ */
@media (max-width: 600px) {
    .ov-board-wrapper {
        grid-template-columns: 1fr;
    }
    .ov-stato-card { height: auto; grid-column: auto !important; grid-row: auto !important; }
    .ov-accordion .riepilogo-page { padding: 0 10px 12px; }
    .ov-accordion-summary { padding: 11px 12px; font-size: 0.73rem; }
    /* rendi cliccabili le sub-card */
    .ov-stato-header { cursor: pointer; }
    .ov-sub-chevron { display: block; }
    /* quando collassata nascondi il body */
    .ov-stato-card:not([open]) > .ov-stato-body { display: none; }
    .ov-stato-card[open] .ov-sub-chevron { transform: rotate(180deg); }
    .ov-stato-body { height: auto; max-height: 260px; }
    .ov-row-label { font-size: 0.70rem; }
    /* nascondi drag handle su mobile */
    .ov-drag-handle { display: none; }
    .ov-row-main { flex: 1; min-width: 0; }
    /* migliora affidabilitÃ  drag touch: evita che lo scroll rubi il puntatore */
    .ov-kanban-item {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
    }
    .ov-kanban-item.ov-touch-hold-pending {
        transform: scale(0.985);
        filter: brightness(1.04);
    }
    .ov-kanban-item.ov-drag-active { touch-action: none; }
}

/* â”€â”€ Kanban drag & drop dinamico (pointer events, solo desktop â‰¥ 601px) â”€â”€ */
@media (min-width: 601px) {
    /* Header colonna non cliccabile su desktop */
    .ov-stato-header { cursor: default; }
    /* Struttura riga articolo */
    .ov-kanban-item {
        cursor: grab;
        border-radius: 6px;
        padding: 4px 6px;
        touch-action: none;          /* impedisce scroll durante il drag */
        user-select: none;
        -webkit-user-select: none;
        transition: background 0.15s, opacity 0.18s, transform 0.18s;
        align-items: flex-start;
        gap: 6px;
    }
    .ov-kanban-item:hover { background: #1e293b; }
    /* Placeholder opaco lasciato nella colonna sorgente durante il drag */
    .ov-kanban-item.ov-drag-active {
        opacity: 0.22;
        cursor: grabbing;
        border: 1.5px dashed #4f5e78;
        border-radius: 6px;
        background: transparent !important;
    }
    /* Handle */
    .ov-drag-handle {
        color: #475569;
        font-size: 0.68rem;
        flex-shrink: 0;
        cursor: grab;
        padding-top: 3px;
        transition: color 0.15s;
    }
    .ov-kanban-item:hover .ov-drag-handle { color: #94a3b8; }
    /* Testo principale + riga secondaria */
    .ov-row-main {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 1px;
    }
    .ov-row-sub {
        font-size: 0.60rem;
        color: #64748b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Cliente in corsivo, colore leggermente piÃ¹ chiaro */
    .ov-row-sub em {
        font-style: italic;
        color: #7c8fa8;
        font-weight: 400;
    }
    /* Colonna destinazione evidenziata durante il drag-over */
    .ov-stato-body.ov-drop-over {
        background: rgba(36, 36, 36, 0.05);
        outline: 2px dashed #94a3b8;
        outline-offset: -2px;
        border-radius: 0 0 10px 10px;
        transition: background 0.15s;
    }
    /* Impedisci selezione testo durante drag su tutti gli elementi figli */
    .ov-kanban-item.ov-drag-active * {
        user-select: none !important;
        -webkit-user-select: none !important;
    }
}

/* â”€â”€ Override leggibilitÃ : solo pannello Stato Avanzamento â”€â”€ */
.ov-accordion-summary,
.ov-summary-label i,
.ov-summary-meta,
.ov-summary-chevron,
.ov-op-nome,
.ov-op-free-badge,
.ov-op-item-cod,
.ov-op-item-qty,
.ov-stato-nome,
.ov-sub-chevron,
.ov-row-label,
.ov-badge-ord,
.ov-row-ordini,
.ov-badge-op,
.ov-empty-lbl,
.ov-drag-handle,
.ov-row-sub,
.ov-row-sub em {
    color: #ffffff !important;
}

/* ============================================================
   PAGINA RIEPILOGO OPERATORI
   ============================================================ */

.riepilogo-page {
    padding: 18px 14px 100px;
    max-width: 900px;
    margin: 0 auto;
}

/* â”€â”€ Chart section â”€â”€ */
.riepilogo-chart-section {
    background: #1e293b;
    border-radius: 16px;
    padding: 20px 18px;
    margin-bottom: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.riepilogo-chart-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.riepilogo-chart-title i { color: #64748b; }
.riepilogo-totale {
    margin-left: auto;
    font-size: 0.76rem;
    color: #64748b;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.riepilogo-chart-wrap {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.riepilogo-chart-wrap canvas {
    max-width: 180px;
    max-height: 180px;
    flex-shrink: 0;
}
.riepilogo-legenda {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.riepilogo-legenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #cbd5e1;
}
.riepilogo-legenda-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.riepilogo-legenda-label {
    flex: 1;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: .04em;
}
.riepilogo-legenda-val {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 0.78rem;
}

/* â”€â”€ Section title â”€â”€ */
.riepilogo-section-title {
    font-size: 0.80rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.riepilogo-section-title i { color: #64748b; }

/* â”€â”€ Cards grid â”€â”€ */
.riepilogo-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* â”€â”€ Operator card â”€â”€ */
.riepilogo-card {
    background: #1e293b;
    border-radius: 14px;
    padding: 16px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    transition: transform .15s, box-shadow .15s;
}
.riepilogo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.riepilogo-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.riepilogo-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #242424, #475569);
    color: #fff;
    font-weight: 700;
    font-size: 0.90rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .03em;
}
.riepilogo-avatar-libero {
    background: linear-gradient(135deg, #475569, #64748b);
}
.riepilogo-card-info {
    min-width: 0;
    flex: 1;
}
.riepilogo-op-nome {
    font-size: 0.84rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.riepilogo-op-meta {
    display: flex;
    gap: 10px;
    margin-top: 3px;
    font-size: 0.73rem;
    color: #64748b;
}
.riepilogo-op-meta i {
    margin-right: 3px;
    color: #475569;
}
.riepilogo-barre {
    height: 6px;
    border-radius: 99px;
    overflow: hidden;
}
.riepilogo-stati-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}
.riepilogo-stato-badge {
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: #0f172a;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
}
.riepilogo-stato-badge b {
    color: #f1f5f9;
    margin-left: 3px;
}

/* â”€â”€ Mobile tweaks â”€â”€ */
@media (max-width: 480px) {
    .riepilogo-page { padding: 12px 10px 100px; }
    .riepilogo-cards-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .riepilogo-chart-wrap { flex-direction: column; align-items: center; }
    .riepilogo-chart-wrap canvas { max-width: 160px; max-height: 160px; }
    .riepilogo-legenda { width: 100%; }
    .riepilogo-card { padding: 12px 10px; }
    .riepilogo-op-nome { font-size: 0.78rem; }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   SKELETON DI NAVIGAZIONE  â€“  feedback istantaneo
   (appare mentre il fetch Ã¨ in corso, poi viene sostituito)
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.nav-skeleton {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.nav-skel-bar {
    height: 15px;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #1e293b) 25%,
        var(--bg-hover,    #334155) 50%,
        var(--bg-secondary, #1e293b) 75%
    );
    background-size: 200% 100%;
    animation: nav-skel-shimmer 1.3s infinite linear;
}
@keyframes nav-skel-shimmer {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   SKELETON DI PAGINA  â€“  produzione / richieste / acquisti
   Sostituisce il contenuto mentre il fetch GAS Ã¨ in corso.
   Uso: <div class="page-skeleton"> in caricaSezioneConCache
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.page-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    animation: page-skel-fade-in .22s ease;
}
@keyframes page-skel-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.skel-card {
    background: var(--bg-secondary, #1e293b);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.skel-line {
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #1e293b) 25%,
        var(--bg-hover,    #334155) 50%,
        var(--bg-secondary, #1e293b) 75%
    );
    background-size: 200% 100%;
    animation: nav-skel-shimmer 1.3s infinite linear;
}
.skel-line.skel-title  { height: 14px; width: 55%; }
.skel-line.skel-badge  { height: 10px; width: 28%; border-radius: 20px; }
.skel-line.skel-body   { height: 10px; width: 88%; }
.skel-line.skel-body-sm{ height: 10px; width: 65%; }
/* Offset animazione per ogni card */
.page-skeleton .skel-card:nth-child(2) .skel-line { animation-delay: .12s; }
.page-skeleton .skel-card:nth-child(3) .skel-line { animation-delay: .24s; }
.page-skeleton .skel-card:nth-child(4) .skel-line { animation-delay: .36s; }
.page-skeleton .skel-card:nth-child(5) .skel-line { animation-delay: .48s; }

/* Header skeleton (titolo sezione) */
.skel-header {
    height: 18px;
    width: 40%;
    border-radius: 8px;
    margin-bottom: 4px;
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #1e293b) 25%,
        var(--bg-hover,    #334155) 50%,
        var(--bg-secondary, #1e293b) 75%
    );
    background-size: 200% 100%;
    animation: nav-skel-shimmer 1.3s infinite linear;
}


   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.settings-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}
.settings-action-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); }
.settings-action-btn.settings-btn-danger { border-color: #ef444455; color: #fca5a5; }
.settings-action-btn.settings-btn-danger:hover { background: rgba(239,68,68,0.12); }

.notif-pref-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    font-size: 0.88rem;
    color: #cbd5e1;
}
.notif-pref-row:last-child { border-bottom: none; }
.notif-pref-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #242424;
    cursor: pointer;
    flex-shrink: 0;
}

/* ================================================================
   ML - PIPISTRELLO  |  Pianificazione Mensile & Fabbisogno
   Palette: app standard (#242424/ #2563eb / #f8fafc / #1e293b)
   Eccezioni: verde/rosso/azzurro sulle colonne funzionali
   ================================================================ */
.pip-page {
    padding: 8px 4px 60px;
    max-width: 900px;
    margin: 0 auto;
    font-family: inherit;
}

/* --- HEADER --- */
.pip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #242424;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 14px;
    gap: 12px;
}
.pip-header-title { display: flex; align-items: center; gap: 12px; }
.pip-header-icon  { font-size: 2rem; display: flex; align-items: center; }
.pip-header-brand {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
    color: #9ca3af; text-transform: uppercase;
}
.pip-header-product { font-size: 1rem; font-weight: 700; color: #ffffff; }

.pip-reset-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    color: #d1d5db; border-radius: 8px; padding: 7px 14px;
    font-size: 0.82rem; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.15s; white-space: nowrap;
}
.pip-reset-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* --- TASTO SALVA --- */
.pip-save-btn {
    background: #2563eb;
    border: 1px solid #1d4ed8;
    color: #fff; border-radius: 8px; padding: 7px 16px;
    font-size: 0.82rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.15s, opacity 0.15s; white-space: nowrap;
}
.pip-save-btn:hover:not(:disabled) { background: #1d4ed8; }
.pip-save-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.pip-save-btn.pip-save-loading { background: #64748b; border-color: #475569; }
.pip-save-btn.pip-save-ok      { background: #16a34a; border-color: #15803d; }
.pip-save-btn.pip-save-err     { background: #dc2626; border-color: #b91c1c; }

/* --- CARD QTÃ€ --- */
.pip-qty-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.pip-qty-label {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
    color: #64748b; text-transform: uppercase; margin-bottom: 10px;
}
.pip-qty-inputs {
    display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap;
}
.pip-qty-item {
    flex: 1; min-width: 90px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pip-qty-item label {
    font-size: 0.78rem; font-weight: 600; color: #374151;
    text-align: center; line-height: 1.3;
}
.pip-qty-item label small { font-size: 0.7rem; color: #9ca3af; font-weight: 400; }

.pip-qty-input {
    width: 100%; text-align: center;
    font-size: 1.5rem; font-weight: 700;
    color: #1e293b;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px; padding: 8px 4px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.pip-qty-input::-webkit-inner-spin-button,
.pip-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.pip-qty-input:focus {
    border-color: #242424;
    box-shadow: 0 0 0 3px rgba(36,36,36,0.10);
}

.pip-qty-total-box {
    flex: 0 0 auto; min-width: 80px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #242424; border-radius: 10px;
    padding: 8px 16px; gap: 2px;
}
.pip-qty-total-label {
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.1em; color: #9ca3af; text-transform: uppercase;
}
.pip-qty-total-val { font-size: 1.7rem; font-weight: 800; color: #ffffff; line-height: 1; }

/* --- TABELLA BOM --- */
.pip-table-wrap {
    background: #fff; border-radius: 14px;
    overflow: hidden; box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    margin-bottom: 12px; overflow-x: auto;
}
.pip-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.pip-table thead tr { background: #242424; }
.pip-table thead th {
    color: #f9fafb; font-weight: 700; font-size: 0.7rem;
    letter-spacing: 0.06em; text-transform: uppercase;
    padding: 10px; text-align: center; white-space: nowrap;
}
.pip-table thead th:nth-child(2) { text-align: left; }
.pip-table tbody tr { border-bottom: 1px solid #e2e8f0; }
.pip-table tbody tr:last-child { border-bottom: none; }
.pip-table tbody tr:nth-child(even) { background: #f8fafc; }
.pip-table tbody tr:nth-child(odd)  { background: #ffffff; }
.pip-row-sez-start td { border-top: 2px solid #e2e8f0; }

/* Su mobile (portrait) nascondi le colonne xP / xM / xG â€” giÃ  calcolate nel FABBISOGNO */
@media (max-width: 768px) {
    .pip-col-coeff,
    .pip-coeff { display: none !important; }
    .pip-table { font-size: 0.72rem; }
    .pip-table thead th { padding: 6px 4px; font-size: 0.6rem; }
    .pip-sez-cell { padding: 5px 4px; font-size: 0.6rem; letter-spacing: 0; }
    .pip-mat   { padding: 5px 4px; white-space: normal; word-break: break-word; min-width: 80px; max-width: 110px; }
    .pip-fab, .pip-ord-manca, .pip-ord-ok, .pip-ord-zero { padding: 5px 4px; }
    .pip-car-cell { padding: 4px 3px; }
    .pip-car-input { width: 44px; font-size: 0.8rem; padding: 4px 2px; }
    .pip-car-liberi { font-size: 0.58rem; padding: 1px 3px; }
    .pip-qty-inputs { flex-wrap: wrap; gap: 10px; }
    .pip-qty-item { min-width: 80px; }
}

/* Pipistrelli: consenti orientamento landscape (override dell'overlay "ruota") */
body.page-pip #rotate-overlay { display: none !important; }

.pip-sez-cell {
    background: #242424 !important;
    color: #f9fafb; font-weight: 700; font-size: 0.72rem;
    letter-spacing: 0.07em; text-transform: uppercase;
    text-align: center; vertical-align: middle;
    padding: 8px 10px; white-space: nowrap;
}
.pip-mat {
    padding: 8px 10px; text-align: left;
    font-weight: 500; color: #1e293b; white-space: nowrap;
}

.pip-coeff { text-align: center; padding: 8px 6px; font-size: 0.9rem; }
.pip-coeff-on  { font-weight: 700; color: #1e293b; }
.pip-coeff-off { color: #cbd5e1; font-size: 0.85rem; }

/* FABBISOGNO â€” azzurro (funzionale: ok) */
.pip-fab      { text-align: center; padding: 8px 10px; font-weight: 700; color: #374151; background: #f1f5f9; white-space: nowrap; }
.pip-fab-zero { color: #9ca3af !important; background: #f1f5f9 !important; font-weight: 400 !important; }

/* CARICATO â€” verde (funzionale: ok) */
.pip-car-cell {
    text-align: center; padding: 5px 8px; background: #e8f5e9;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.pip-car-input {
    width: 70px; text-align: center;
    font-size: 0.95rem; font-weight: 700; color: #1b5e20;
    background: transparent; border: 1.5px solid #a5d6a7;
    border-radius: 7px; padding: 5px 4px; outline: none;
    -moz-appearance: textfield; transition: border-color 0.15s; box-sizing: border-box;
}
.pip-car-input::-webkit-inner-spin-button,
.pip-car-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.pip-car-input:focus { border-color: #388e3c; box-shadow: 0 0 0 3px rgba(56,142,60,.12); }
/* badge liberi (componenti non impegnati nei pronti) */
.pip-car-liberi {
    font-size: 0.65rem; font-weight: 700;
    color: #92400e; background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px; padding: 1px 5px;
    white-space: nowrap;
}

/* DA ORDINARE â€” rosso/verde (funzionale) */
.pip-ord-manca { text-align: center; padding: 8px 10px; font-weight: 800; font-size: 0.95rem; background: #ffcdd2; color: #b71c1c; }
.pip-ord-ok    { text-align: center; padding: 8px 10px; font-weight: 700; font-size: 0.9rem;  background: #c8e6c9; color: #2e7d32; }
.pip-ord-zero  { text-align: center; padding: 8px 10px; color: #9ca3af; font-size: 0.85rem; background: #f1f5f9; }

/* --- LEGENDA --- */
.pip-legend {
    display: flex; gap: 14px; flex-wrap: wrap;
    font-size: 0.78rem; padding: 0 4px; margin-bottom: 22px; color: #64748b;
}
.pip-leg-item { display: flex; align-items: center; gap: 4px; }

/* ================================================================
   CAPACITÀ DI SPEDIZIONE (widget real-time)
   ================================================================ */
.pip-sped-calc-card { margin-bottom: 20px; }

.pip-sped-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1.5px solid #e2e8f0;
}
.pip-sped-item {
    padding: 13px 14px;
    border-right: 1.5px solid #e2e8f0;
    display: flex; flex-direction: column; gap: 7px;
}
.pip-sped-item:last-child { border-right: none; }
.pip-sped-item-label {
    font-size: 0.78rem; font-weight: 800; color: #1e293b;
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
    margin-bottom: 2px;
}
.pip-sped-comp {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.74rem; color: #475569; padding: 1px 0;
}
.pip-sped-comp--bottleneck { color: #ef4444; font-weight: 700; }
.pip-sped-comp-num { font-weight: 800; font-family: monospace; font-size: 0.85rem; }
.pip-sped-result {
    margin-top: 4px; border-radius: 8px;
    padding: 7px 10px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.pip-sped-result--ok   { background: #dcfce7; color: #15803d; border: 1.5px solid #bbf7d0; }
.pip-sped-result--zero { background: #f1f5f9; color: #94a3b8; border: 1.5px solid #e2e8f0; }
.pip-sped-result-num { font-size: 1.4rem; font-weight: 900; font-family: monospace; line-height: 1; }
.pip-sped-result-lbl { font-size: 0.72rem; font-weight: 600; }

.pip-sped-alim {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 16px; font-size: 0.82rem;
    border-bottom: 1.5px solid #f1f5f9;
}
.pip-sped-alim--ok   { background: #f0fdf4; color: #15803d; }
.pip-sped-alim--warn { background: #fffbeb; color: #92400e; }
.pip-sped-alim-ico   { font-size: 1rem; flex-shrink: 0; }
.pip-sped-alim-label { font-weight: 600; color: #1e293b; }
.pip-sped-alim-status { font-size: 0.78rem; margin-left: auto; display: flex; align-items: center; gap: 5px; }

.pip-sped-total {
    padding: 10px 16px; font-size: 0.84rem; color: #475569; text-align: center;
}
.pip-sped-total-num { color: #1e293b; font-size: 1.05rem; font-weight: 900; }
.pip-sped-total-sub { color: #d97706; font-size: 0.75rem; }
.pip-sped-empty {
    padding: 14px 16px; text-align: center;
    font-size: 0.82rem; color: #94a3b8;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

@media (max-width: 540px) {
    .pip-sped-grid { grid-template-columns: 1fr; }
    .pip-sped-item { border-right: none; border-bottom: 1.5px solid #e2e8f0; }
    .pip-sped-item:last-child { border-bottom: none; }
    .pip-sped-alim-status { margin-left: 0; width: 100%; }
}

/* ================================================================
   SEZIONE MOVIMENTI  (carico / scarico magazzino)
   ================================================================ */
.pip-mov-section {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

/* â”€â”€ Scarico assemblati â”€â”€ */
.pip-assemb-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    padding: 0 0 16px;
}
.pip-assemb-title {
    background: #242424;
    padding: 12px 18px;
    font-size: 0.78rem; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: #f9fafb;
    display: flex; align-items: center; gap: 8px;
}
.pip-assemb-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 8px; align-items: end;
    background: #f8fafc; border-radius: 10px;
    padding: 12px; margin: 12px 16px 0;
    border: 1.5px solid #e2e8f0;
}
.pip-asm-select {
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 8px; padding: 8px 10px;
    font-size: 0.88rem; color: #1e293b; outline: none;
    transition: border-color 0.15s; box-sizing: border-box; width: 100%;
}
.pip-asm-select:focus { border-color: #242424; box-shadow: 0 0 0 3px rgba(36,36,36,0.10); }
.pip-assemb-preview {
    margin: 10px 16px 0;
    font-size: 0.75rem; color: #475569;
    background: #f1f5f9; border-radius: 8px;
    padding: 8px 12px;
    display: flex; flex-wrap: wrap; gap: 6px;
    min-height: 34px;
}
.pip-assemb-preview:empty { display: none; }
.pip-asm-comp-tag {
    background: #e2e8f0; color: #334155;
    border-radius: 5px; padding: 2px 8px;
    font-size: 0.72rem; font-weight: 600;
    white-space: nowrap;
}
.pip-asm-comp-tag.zero { opacity: 0.35; }
.pip-assemb-btn {
    background: #242424; color: #f8fafc;
    border: none; border-radius: 9px;
    padding: 11px 20px; margin: 10px 16px 0;
    font-size: 0.9rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    width: calc(100% - 32px); justify-content: center;
    transition: background 0.15s;
}
.pip-assemb-btn:hover { background: #334155; }

/* â”€â”€ Card PRONTI DA SPEDIRE â”€â”€ */
.pip-pronti-hint {
    font-size: 0.68rem; color: #9ca3af; font-weight: 400;
    text-transform: none; letter-spacing: 0;
}
.pip-pronti-grid {
    display: flex; flex-direction: column; gap: 0;
    padding: 4px 0;
}
/* Sezione con titolo (Teste / Cordoni / Alimentatori) */
.pip-pronti-sezione {
    border-bottom: 2px solid #f1f5f9;
}
.pip-pronti-sezione:last-child { border-bottom: none; }
.pip-pronti-sezione-titolo {
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: #94a3b8;
    padding: 7px 16px 3px;
    background: #f8fafc;
}
.pip-pronti-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.pip-pronti-row:last-child { border-bottom: none; }
.pip-pronti-lbl {
    font-size: 0.84rem; font-weight: 600; color: #1e293b;
    display: flex; align-items: center; gap: 6px;
}
.pip-pronti-ma {
    font-size: 0.72rem; font-weight: 700;
    background: #e2e8f0; color: #374151;
    border-radius: 4px; padding: 1px 6px;
    font-family: monospace;
}
.pip-pronti-ctrl {
    display: flex; align-items: center; gap: 10px;
}
.pip-pronti-btn {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1.5px solid #e2e8f0; background: #f8fafc;
    font-size: 1.1rem; font-weight: 700; color: #374151;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 1; transition: background 0.12s, border-color 0.12s;
}
.pip-pronti-btn:hover { background: #e2e8f0; border-color: #94a3b8; color: #0f172a; }
.pip-pronti-input {
    width: 52px; text-align: center;
    font-size: 1.0rem; font-weight: 800; color: #9ca3af;
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 7px; padding: 4px 2px; outline: none;
    -moz-appearance: textfield; transition: border-color 0.15s, color 0.15s;
    box-sizing: border-box;
}
.pip-pronti-input::-webkit-inner-spin-button,
.pip-pronti-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.pip-pronti-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.pip-pronti-val-on { color: #f59e0b !important; border-color: #fde68a !important; background: #fffbeb !important; }

/* â”€â”€ Footer card Pronti da Spedire â”€â”€ */
.pip-pronti-footer {
    padding: 12px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pip-pronti-nota-input {
    width: 100%; box-sizing: border-box;
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 9px; padding: 9px 12px;
    font-size: 0.86rem; color: #1e293b; outline: none;
    transition: border-color 0.15s;
}
.pip-pronti-nota-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }
.pip-pronti-nota-input::placeholder { color: #9ca3af; }
.pip-spedisci-btn {
    background: #15803d !important;
    margin: 0 !important;
    width: 100% !important;
}
.pip-spedisci-btn:hover { background: #166534 !important; }

/* â”€â”€ Modal conferma spedizione â”€â”€ */
.pip-sped-modal-box {
    max-width: 440px;
    width: 95%;
    padding: 0 0 0;
}
/* â”€â”€ Modal modifica movimento â”€â”€ */
.pip-edit-mov-box, .pip-del-mov-box {
    max-width: 400px;
    width: 95%;
    padding: 0;
}
.pip-edit-mov-mat {
    padding: 0 20px 12px;
    font-size: 0.9rem; color: #1e293b;
    display: flex; align-items: center; gap: 8px;
}
.pip-edit-mov-fields {
    display: flex; flex-direction: column; gap: 10px;
    padding: 0 20px 4px;
}
.pip-edit-mov-label {
    font-size: 0.75rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: -4px;
}
.pip-edit-mov-input {
    width: 100%; box-sizing: border-box;
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 9px; padding: 10px 12px;
    font-size: 0.95rem; color: #1e293b; outline: none;
    transition: border-color 0.15s;
}
.pip-edit-mov-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }
.pip-del-mov-desc {
    padding: 4px 20px 10px;
    font-size: 0.9rem; color: #1e293b;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pip-del-mov-warn {
    margin: 0 20px 8px;
    font-size: 0.82rem; color: #92400e;
    background: #fffbeb; border-radius: 8px;
    padding: 8px 12px; border: 1.5px solid #fde68a;
}
.pip-sped-modal-title {
    font-size: 1rem; font-weight: 800;
    color: #1e293b;
    display: flex; align-items: center; gap: 8px;
    padding: 20px 20px 4px;
    margin: 0;
}
.pip-sped-modal-sub {
    font-size: 0.82rem; color: #64748b;
    padding: 0 20px 10px;
    margin: 0;
}
.pip-sped-warning {
    margin: 0 16px 10px;
    background: #fffbeb; border: 1.5px solid #fde68a;
    border-radius: 9px; padding: 10px 14px;
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.82rem; color: #92400e; font-weight: 600;
}
.pip-sped-warning i { color: #f59e0b; flex-shrink: 0; margin-top: 2px; }
.pip-sped-items-list {
    display: flex; flex-direction: column;
    padding: 0 12px;
    gap: 4px;
    max-height: 280px; overflow-y: auto;
}
.pip-sped-item-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1.5px solid transparent;
}
.pip-sped-item-row:hover { background: #f1f5f9; }
.pip-sped-item-row input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #15803d;
    cursor: pointer; flex-shrink: 0;
}
.pip-sped-item-row:has(input:checked) {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.pip-sped-item-info {
    display: flex; align-items: center; gap: 6px; flex: 1;
}
.pip-sped-item-emoji { font-size: 1.1rem; }
.pip-sped-item-label { font-size: 0.9rem; font-weight: 600; color: #1e293b; flex: 1; }
.pip-sped-item-qty {
    font-size: 1rem; font-weight: 800; color: #15803d;
    background: #dcfce7; border-radius: 6px;
    padding: 2px 9px;
}
.pip-sped-ok-btn {
    background: #15803d !important;
}
.pip-sped-ok-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.pip-sped-ma-pill {
    display: inline-block;
    background: #e2e8f0; color: #374151;
    border-radius: 4px; padding: 1px 6px;
    font-size: 0.7rem; font-weight: 700;
    font-family: monospace;
    margin-left: 3px;
    white-space: nowrap;
}

/* â”€â”€ Badge spedizione nel log â”€â”€ */
.pip-mov-badge.spedizione {
    background: #dcfce7; color: #15803d;
    border: 1px solid #bbf7d0;
}
.pip-sped-items-section {
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 6px;
    margin-bottom: 6px;
}
.pip-sped-item-row .pip-assemb-sub-mat { font-weight: 700; color: #1e293b; }
.pip-sped-bom-divider {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: #94a3b8; padding: 2px 0 6px;
}

@media (max-width: 600px) {
    .pip-assemb-form { grid-template-columns: 1fr 1fr; }
}
.pip-mov-header {
    background: #242424;
    padding: 12px 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pip-mov-header-title {
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: #f9fafb;
    display: flex; align-items: center; gap: 8px;
}
.pip-mov-toggle-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    color: #9ca3af; font-size: 0.78rem; border-radius: 7px;
    padding: 5px 12px; cursor: pointer; transition: background 0.15s;
}
.pip-mov-toggle-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }

.pip-mov-body { padding: 14px 16px; }

/* Form */
.pip-mov-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 8px; align-items: end;
    background: #f8fafc; border-radius: 10px;
    padding: 12px; margin-bottom: 14px;
    border: 1.5px solid #e2e8f0;
}
.pip-mov-form-field { display: flex; flex-direction: column; gap: 4px; }
.pip-mov-form-label { font-size: 0.67rem; font-weight: 700; letter-spacing: 0.07em; color: #64748b; text-transform: uppercase; }
.pip-mov-form select,
.pip-mov-form input[type="number"],
.pip-mov-form input[type="text"] {
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 8px; padding: 8px 10px;
    font-size: 0.88rem; color: #1e293b; outline: none;
    transition: border-color 0.15s; box-sizing: border-box; width: 100%;
}
.pip-mov-form select:focus,
.pip-mov-form input:focus { border-color: #242424; box-shadow: 0 0 0 3px rgba(36,36,36,0.10); }

.pip-mov-btn-carico {
    background: #242424; color: #f9fafb;
    border: none; border-radius: 8px; padding: 9px 14px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; transition: background 0.15s;
}
.pip-mov-btn-carico:hover { background: #333333; }

.pip-mov-btn-scarico {
    background: #f8fafc; color: #374151;
    border: 1.5px solid #cbd5e1; border-radius: 8px; padding: 9px 14px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.pip-mov-btn-scarico:hover { background: #f1f5f9; border-color: #94a3b8; }

/* Log movimenti */
.pip-mov-list { display: flex; flex-direction: column; gap: 6px; }
.pip-mov-empty { color: #9ca3af; font-size: 0.85rem; text-align: center; padding: 18px; }

.pip-mov-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 9px;
    border: 1.5px solid #e2e8f0; background: #fff;
    font-size: 0.85rem;
}
.pip-mov-item.carico  { border-left: 4px solid #242424; }
.pip-mov-item.scarico { border-left: 4px solid #64748b; }

.pip-mov-badge {
    font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em;
    text-transform: uppercase; border-radius: 5px; padding: 2px 7px;
    white-space: nowrap; flex-shrink: 0;
}
.pip-mov-badge.carico  { background: #f1f5f9; color: #1e293b; }
.pip-mov-badge.scarico { background: #f1f5f9; color: #374151; }

.pip-mov-mat  { font-weight: 600; color: #1e293b; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip-mov-qty  { font-weight: 800; color: #1e293b; flex-shrink: 0; }
.pip-mov-qty.carico  { color: #1e293b; }
.pip-mov-qty.scarico { color: #374151; }
.pip-mov-nota { color: #64748b; font-size: 0.8rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip-mov-ts   { color: #9ca3af; font-size: 0.75rem; flex-shrink: 0; white-space: nowrap; }
.pip-mov-del  {
    background: none; border: none; color: #cbd5e1;
    cursor: pointer; padding: 2px 4px; font-size: 0.85rem;
    border-radius: 4px; flex-shrink: 0; line-height: 1;
    transition: color 0.15s;
}
.pip-mov-del:hover { color: #ef4444; }
.pip-mov-edit {
    background: none; border: none; color: #cbd5e1;
    cursor: pointer; padding: 2px 4px; font-size: 0.85rem;
    border-radius: 4px; flex-shrink: 0; line-height: 1;
    transition: color 0.15s;
}
.pip-mov-edit:hover { color: #3b82f6; }

/* â”€â”€ Riga assemb espandibile â”€â”€ */
.pip-mov-assemb-group {
    border: 1.5px solid #e2e8f0;
    border-left: 4px solid #f59e0b;
    border-radius: 9px;
    background: #fff;
    overflow: hidden;
}
.pip-mov-assemb-summary {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.pip-mov-assemb-summary::-webkit-details-marker { display: none; }
.pip-mov-assemb-summary:hover { background: #fefce8; }
.pip-mov-assemb-label { font-weight: 700; color: #1e293b; flex: 1; }
.pip-mov-badge.assemb { background: #fef3c7; color: #b45309; }
.pip-assemb-chev {
    font-size: 0.68rem; color: #9ca3af; flex-shrink: 0;
    transition: transform 0.18s;
}
.pip-mov-assemb-group[open] .pip-assemb-chev { transform: rotate(180deg); }

.pip-assemb-sub-list {
    border-top: 1px solid #f1f5f9;
    padding: 6px 12px 10px 28px;
    display: flex; flex-direction: column; gap: 4px;
    background: #fafafa;
}
.pip-assemb-sub-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.8rem; color: #475569;
}
.pip-assemb-sub-mat { flex: 1; }

/* â”€â”€ Badge + riga reso â”€â”€ */
.pip-mov-badge.reso {
    background: #fef3c7; color: #b45309;
    border: 1px solid #fde68a;
}
.pip-mov-reso-group { border-left-color: #f59e0b; }
.pip-mov-reso-group .pip-mov-assemb-summary:hover { background: #fefce8; }

/* â”€â”€ Bottone Reso nell'header movimenti â”€â”€ */
.pip-reso-open-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.20);
    color: #fde68a;
    font-size: 0.78rem; font-weight: 700; border-radius: 7px;
    padding: 5px 12px; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.15s;
}
.pip-reso-open-btn:hover { background: rgba(245,158,11,0.22); color: #fbbf24; }
.pip-mov-header-actions { display: flex; align-items: center; gap: 8px; }

/* â”€â”€ Modal Reso â”€â”€ */
.pip-reso-modal-box { max-width: 440px; width: 95%; padding: 0; }
.pip-reso-items-list {
    display: flex; flex-direction: column;
    padding: 0 12px; gap: 2px;
    max-height: 230px; overflow-y: auto;
}
.pip-reso-item-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; border-radius: 8px;
    transition: background 0.12s;
}
.pip-reso-item-row:hover { background: #f8fafc; }
.pip-reso-item-emoji { font-size: 1rem; flex-shrink: 0; }
.pip-reso-item-label { font-size: 0.87rem; font-weight: 600; color: #1e293b; flex: 1; }
.pip-reso-qty-ctrl { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pip-reso-qty-btn {
    width: 28px; height: 28px;
    background: #f1f5f9; border: 1.5px solid #e2e8f0;
    border-radius: 7px; color: #374151;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s; line-height: 1;
}
.pip-reso-qty-btn:hover { background: #e2e8f0; color: #0f172a; }
.pip-reso-qty-inp {
    width: 54px; text-align: center;
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 7px; padding: 5px 4px;
    font-size: 0.9rem; font-weight: 700; color: #0f172a; outline: none;
    transition: border-color 0.15s;
}
.pip-reso-qty-inp:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }

/* Sezione checklist BOM */
.pip-reso-bom-section {
    margin: 10px 12px 0;
    background: #f8fafc; border-radius: 10px;
    border: 1.5px solid #e2e8f0; overflow: hidden;
}
.pip-reso-bom-title {
    font-size: 0.72rem; font-weight: 700;
    color: #475569; text-transform: uppercase; letter-spacing: 0.07em;
    padding: 8px 12px 6px; border-bottom: 1px solid #e2e8f0;
    background: #f1f5f9;
}
.pip-reso-bom-hint { font-weight: 400; color: #94a3b8; text-transform: none; letter-spacing: 0; }

/* ─── Manuali: file input stilato ────────────────────────────────────────── */
.manuale-file-input { display: none; }

.manuale-file-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #242424;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    user-select: none;
    margin-top: 6px;
}
.manuale-file-label:hover {
    background: #ffffff;
    color: #242424;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* ── CSV Review inline blink ── */
@keyframes csvReviewPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.csv-review-blink {
    animation: csvReviewPulse 1.6s ease-in-out infinite;
    border-left: 4px solid #f59e0b !important;
}
.csv-review-blink.csv-review-missing {
    border-left-color: #eab308 !important;
    background: #fefce8 !important;
}
.csv-review-blink.csv-review-finish {
    border-left-color: #f97316 !important;
    background: #fff7ed !important;
}
.csv-review-order {
    box-shadow: 0 0 0 2px #f59e0b, 0 2px 12px rgba(245,158,11,0.18) !important;
    border-radius: 14px;
}
.csv-review-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.csv-review-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
}
.csv-review-badge.missing {
    background: #fef9c3;
    color: #854d0e;
}
.csv-review-badge.finish {
    background: #fff7ed;
    color: #9a3412;
}
.btn-csv-resolve {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #22c55e;
    color: #fff;
    transition: background 0.15s;
}
.btn-csv-resolve:hover { background: #16a34a; }
}
.manuale-file-label i { font-size: 12px; }
.pip-reso-bom-list {
    max-height: 180px; overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 6px 10px; gap: 2px;
}
.pip-reso-bom-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 4px; border-radius: 6px; cursor: pointer;
    transition: background 0.1s;
}
.pip-reso-bom-row:hover { background: #e2e8f0; }
.pip-reso-bom-chk { width: 16px; height: 16px; cursor: pointer; accent-color: #15803d; flex-shrink: 0; }
.pip-reso-bom-mat { flex: 1; font-size: 0.82rem; color: #334155; }
.pip-reso-bom-qty {
    font-size: 0.82rem; font-weight: 800; color: #15803d;
    background: #dcfce7; border-radius: 5px; padding: 1px 7px; flex-shrink: 0;
}
.pip-reso-bom-empty { font-size: 0.8rem; color: #94a3b8; text-align: center; padding: 12px 8px; }

/* Bottone Registra Reso */
.pip-reso-ok-btn { background: #b45309 !important; }
.pip-reso-ok-btn:hover { background: #92400e !important; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 600px) {
    .pip-page { padding: 6px 0 60px; }
    .pip-header { border-radius: 10px; padding: 12px; margin-bottom: 10px; }
    .pip-header-product { font-size: 0.88rem; }
    .pip-qty-card { border-radius: 10px; padding: 12px; }
    .pip-qty-inputs { gap: 8px; }
    .pip-qty-input { font-size: 1.3rem; padding: 6px 2px; }
    .pip-qty-total-box { min-width: 64px; padding: 6px 10px; }
    .pip-qty-total-val { font-size: 1.4rem; }
    .pip-table-wrap { border-radius: 10px; }
    .pip-table { font-size: 0.8rem; }
    .pip-table thead th { padding: 8px 6px; font-size: 0.62rem; }
    .pip-mat { font-size: 0.82rem; padding: 8px 6px; }
    .pip-fab { font-size: 0.82rem; padding: 6px 6px; }
    .pip-car-input { width: 56px; font-size: 0.88rem; }
    .pip-sez-cell { font-size: 0.65rem; padding: 6px 5px; }
    .pip-legend { font-size: 0.72rem; gap: 10px; }
    .pip-mov-form {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .pip-mov-btn-carico,
    .pip-mov-btn-scarico { justify-content: center; }
    .pip-mov-item { flex-wrap: wrap; gap: 6px; }
    .pip-mov-nota { display: none; }
}


/* ============================================================
   GESTIONE POSTAZIONI QR â€” sezione impostazioni + modal edit
   ============================================================ */

/* â”€â”€ Lista postazioni in impostazioni â”€â”€ */
.qr-post-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: background 0.15s, box-shadow 0.15s;
}
.qr-post-row:last-child { margin-bottom: 0; }
.qr-post-row:hover { background: #f1f5f9; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.qr-post-canvas {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f1f5f9;
    display: block;
    border: 1px solid #e2e8f0;
}
.qr-post-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.qr-post-nome {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qr-post-codice {
    font-size: 10px;
    color: #64748b;
    font-family: monospace;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qr-post-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.qr-post-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.qr-post-btn:hover  { background: #e2e8f0; color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.qr-post-btn:active { transform: scale(0.9); }
.qr-post-btn-print  { background: #f1f5f9; color: #374151; border-color: #e2e8f0; }
.qr-post-btn-print:hover { background: #e2e8f0; color: #0f172a; }
.qr-post-btn-danger { background: #fef2f2; color: #ef4444; border-color: #fecaca; }
.qr-post-btn-danger:hover { background: #fee2e2; color: #dc2626; }

.qr-post-footer-btns {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.qr-post-footer-btns button {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background 0.15s, box-shadow 0.15s;
}
.qr-post-btn-add {
    background: #242424;
    color: #ffffff;
    border: none;
}
.qr-post-btn-add:hover { background: #1e293b; box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
.qr-post-btn-print-all {
    background: #f8fafc;
    color: #374151;
    border: 1.5px solid #e2e8f0;
}
.qr-post-btn-print-all:hover { background: #e2e8f0; }

/* â”€â”€ Modal crea/modifica postazione â”€â”€ */
.qr-edit-content {
    max-width: 600px;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 24px 22px 22px;
    background: #ffffff;
    border-radius: 20px;
}
.qr-edit-grid {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 20px;
    margin-top: 18px;
}
@media (max-width: 520px) {
    .qr-edit-grid { grid-template-columns: 1fr; }
    .qr-edit-preview { order: -1; }
}
.qr-edit-form {
    display: flex;
    flex-direction: column;
}
.qr-edit-emoji-input {
    font-size: 22px;
    text-align: center;
    padding: 8px 10px !important;
    max-width: 90px;
}
.qr-edit-codice-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════════════════════════ */

.admin-panel {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 8px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.admin-tab {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.admin-tab:hover { background: #f1f5f9; color: #334155; }
.admin-tab.active { background: #242424; color: #fff; }

.admin-content { min-height: 200px; }

.admin-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.admin-card h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}
.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.admin-card-header h3 { margin: 0; }

.admin-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 12px;
}

.admin-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s;
}
.admin-input:focus { border-color: #242424; }

.admin-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.admin-btn:hover { background: #e2e8f0; }
.admin-btn-save { background: #242424; color: #fff; }
.admin-btn-save:hover { background: #000; }

.admin-btn-sm {
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    background: #f1f5f9;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}
.admin-btn-danger:hover { background: #fef2f2; }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th {
    text-align: left;
    padding: 8px 10px;
    color: #64748b;
    font-weight: 500;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-actions { text-align: right; }

.admin-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-badge-master { background: #fef3c7; color: #92400e; }
.admin-badge-operatore { background: #e0f2fe; color: #0369a1; }
.admin-badge-commerciale { background: #f0fdf4; color: #166534; }

.admin-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.admin-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
}
.admin-tag-final { background: #dcfce7; color: #166534; }
.admin-tag-x {
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.admin-tag-x:hover { color: #ef4444; }

.admin-moduli-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-modulo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}
.admin-modulo-row:hover { background: #f8fafc; }
.admin-modulo-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #242424;
    flex-shrink: 0;
}
.admin-modulo-icon { font-size: 20px; flex-shrink: 0; }
.admin-modulo-label { font-weight: 600; font-size: 14px; color: #1e293b; }
.admin-modulo-desc { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.admin-import-fields { display: flex; flex-direction: column; gap: 12px; }
.admin-import-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-import-label {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
}
.admin-import-label strong { font-size: 13px; color: #1e293b; }
.admin-import-label .admin-hint { margin: 0; }
.admin-import-row .admin-input { flex: 1; font-family: monospace; font-size: 13px; }
.qr-edit-codice { flex: 1; }
.qr-edit-reset-code {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.qr-edit-reset-code:hover { background: #e2e8f0; color: #0f172a; }

/* â”€â”€ Preview QR nel modal â”€â”€ */
.qr-edit-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.qr-preview-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #94a3b8;
    text-transform: uppercase;
}
.qr-preview-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    border: 1.5px solid #e2e8f0;
    width: 100%;
}
.qr-preview-card img, .qr-preview-card canvas {
    display: block;
    margin: 0 auto 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.qr-preview-nome {
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 3px;
}
.qr-preview-codice {
    font-size: 9px;
    color: #64748b;
    font-family: monospace;
    word-break: break-all;
}
.qr-edit-print-single {
    border: 1.5px solid #e2e8f0;
    background: #f1f5f9;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    transition: background 0.15s;
}
.qr-edit-print-single:hover { background: #e2e8f0; color: #0f172a; }


/* ============================================================
   QR CODE SCANNER â€” bottone topbar + modali
   ============================================================ */

/* â”€â”€ Avatar account nella top-bar mobile â”€â”€ */
.mobile-account-wrap {
    position: relative;
    flex-shrink: 0;
}

/* Stessa forma/colore dell'avatar desktop, ma funziona su sfondo chiaro */
.mobile-avatar-topbar-btn {
    position: relative !important; /* serve per il badge in posizione assoluta */
    margin-left: 6px !important;
}

/* Dropdown mobile: si apre verso IL BASSO (non verso l'alto come desktop) */
.account-dropdown-mob {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
    left: auto !important;
    right: 0 !important;
    transform: translateY(-6px) !important;
    box-shadow: 0 8px 36px rgba(0,0,0,0.55) !important;
    z-index: 9999 !important;
    max-height: 80dvh !important;
    overflow-y: auto !important;
}
.account-dropdown-mob.open {
    transform: translateY(0) !important;
}

/* Badge notifiche dentro la voce "Notifiche" del menu mobile */
.badge-notif-menu {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* â”€â”€ Pulsante QR nella top-bar mobile â”€â”€ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.btn-qr-scan {
    display: none; /* visibile solo su mobile via media query */
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #242424;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transform: none;
    -webkit-transform: translateZ(0);
    transition: background 0.2s, box-shadow 0.18s;
    -webkit-tap-highlight-color: rgba(59,130,246,0.25);
}
.btn-qr-scan:active,
.btn-qr-scan:focus-visible {
    transform: none !important;
    background: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.35), 0 2px 8px rgba(0,0,0,0.25);
}
@media (max-width: 768px) {
    .btn-qr-scan { display: flex; }
}

/* â”€â”€ Modale scanner QR â”€â”€ */
.qr-scanner-overlay {
    background: rgba(0,0,0,0.88) !important;
    align-items: flex-end !important;
}
.qr-scanner-box {
    background: #242424;
    border-radius: 22px 22px 0 0;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 20px 36px;
    box-sizing: border-box;
    color: #f8fafc;
    animation: modalSpring 0.38s cubic-bezier(0.22,1,0.36,1) both;
}
.qr-scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.qr-scanner-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.qr-scanner-close {
    width: 32px; height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #f8fafc;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* â”€â”€ Area video scanner â”€â”€ */
.qr-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 300px;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    margin-bottom: 14px;
}
#qr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Cornici angolari del viewfinder */
.qr-overlay-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.qr-corner {
    position: absolute;
    width: 34px; height: 34px;
    border-color: #4ade80;
    border-style: solid;
}
.qr-corner-tl { top: 20px;    left: 20px;    border-width: 3px 0 0 3px;  border-radius: 4px 0 0 0; }
.qr-corner-tr { top: 20px;    right: 20px;   border-width: 3px 3px 0 0;  border-radius: 0 4px 0 0; }
.qr-corner-bl { bottom: 20px; left: 20px;    border-width: 0 0 3px 3px;  border-radius: 0 0 0 4px; }
.qr-corner-br { bottom: 20px; right: 20px;   border-width: 0 3px 3px 0;  border-radius: 0 0 4px 0; }
/* Linea di scansione animata */
.qr-scan-line {
    position: absolute;
    left: 20px; right: 20px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4ade80, transparent);
    top: 20px;
    animation: qrScanMove 2s ease-in-out infinite;
    border-radius: 2px;
}
@keyframes qrScanMove {
    0%   { top: 20px;    opacity: 1; }
    48%  { opacity: 1; }
    50%  { top: calc(100% - 22px); opacity: 0.6; }
    52%  { opacity: 1; }
    100% { top: 20px;    opacity: 1; }
}
.qr-hint-txt {
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 10px;
}
.qr-error-msg {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}
/* Sezione inserimento manuale */
.qr-manual-wrap {
    margin-top: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}
.qr-manual-toggle {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #9ca3af;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.qr-manual-toggle::-webkit-details-marker { display: none; }
.qr-manual-body {
    padding: 0 14px 14px;
}
.qr-manual-body .input-field-modern {
    background: #1e293b;
    color: #f8fafc;
    border-color: rgba(255,255,255,0.15);
}

/* â”€â”€ Modale azione postazione â”€â”€ */
.qr-azione-content {
    max-height: 88dvh;
    overflow-y: auto;
    padding: 22px 20px 24px;
}
.qr-postazione-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #242424;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 5px 12px;
    border-radius: 99px;
    margin-bottom: 6px;
}
.qr-postazione-badge i {
    font-size: 11px;
    opacity: 0.7;
}

/* Header ordine selezionato */
.qr-ordine-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 13px;
}
.qr-ord-lbl { font-weight: 700; color: #0f172a; }
.qr-cli-lbl { color: #475569; }

/* Bottoni Seleziona Tutti / Nessuno */
.qr-articoli-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.qr-sel-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
}
.qr-sel-btn:active { background: #e2e8f0; }

/* Lista articoli con checkbox */
.qr-articoli-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
}
.qr-articolo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
}
.qr-articolo-row:has(.qr-art-chk:checked) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.qr-articolo-row input[type="checkbox"] {
    width: 17px; height: 17px;
    cursor: pointer;
    accent-color: #242424;
    flex-shrink: 0;
}
.qr-art-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}
.qr-art-codice {
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
}
.qr-art-qty {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}
.qr-art-stato-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1.5px solid;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Pill selezione stato di destinazione */
.qr-stato-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.qr-stato-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: 99px;
    border: 1.5px solid;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    letter-spacing: 0.02em;
    transition: background 0.18s, color 0.18s, transform 0.12s;
}
.qr-stato-pill:active { transform: scale(0.95); }
.qr-pill-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Spinner caricamento articoli */
.qr-loading {
    text-align: center;
    padding: 16px;
    color: #64748b;
    font-size: 13px;
}


/* ============================================================
   ORDINI FORNITORI – Dashboard Acquisti da CSV
   ============================================================ */

/* --- Badge data consegna nell'header ordine --- */
.of-data-badge {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 20px;
}
.of-data-badge i {
    margin-right: 3px;
    opacity: .6;
}

/* Mini progress bar nell'header ordine */
.of-progress-mini {
    width: 70px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.of-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}

/* Chevron di espansione */
.dettagli-chevron {
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.3s ease;
    margin-left: 2px;
}
.riga-ordine.open .dettagli-chevron {
    transform: rotate(180deg);
}

/* --- Card articolo OF: stessa griglia delle card produzione --- */
.of-item-card {
    grid-template-columns: 1.1fr 2.2fr 0.7fr 0.7fr 0.8fr 0.9fr !important;
    cursor: pointer;
}
/* Variante senza importo (utenti non-master): le 5 celle restanti si espandono */
.of-item-card.of-item-card-no-importo {
    grid-template-columns: 1.2fr 2.5fr 0.8fr 0.8fr 1fr !important;
}
.of-item-card b {
    font-size: 0.92rem;
    color: #1e293b;
    font-weight: 600;
}
.of-prodotto-text {
    font-size: 0.84rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.of-cell-importo b {
    color: #3b82f6 !important;
}

/* --- Modal dettaglio OF --- */
.of-modal-content {
    max-width: 480px;
    padding: 24px 28px;
}
.of-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}
.of-modal-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.of-modal-field-wide {
    grid-column: 1 / -1;
}
.of-modal-label {
    font-size: .72rem;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: .5px;
}
.of-modal-value {
    font-size: .92rem;
    color: #1e293b;
}
.of-modal-sep {
    grid-column: 1 / -1;
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}
.of-modal-qty {
    text-align: center;
}
.of-modal-big {
    font-size: 1.3rem;
    font-weight: 700;
}

/* --- Mobile responsive OF --- */
@media (max-width: 768px) {
    .of-data-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    .of-progress-mini {
        width: 50px;
    }

    /*
     * Card articolo OF: griglia 3 colonne con posizionamento esplicito.
     * Le regole !important sono necessarie per sovrascrivere le regole generiche
     * .item-card > div:nth-child(N) definite più in alto nel file.
     *
     * Layout risultante (3 col × 3 righe):
     *   [ CODICE          ] [ IMPORTO (col 2-3, allineato dx) ]
     *   [ PRODOTTO  –  full width su tutta la riga            ]
     *   [ ORDINATA ] [ EVASA ] [ DA CONSEGNARE ]
     */
    .of-item-card {
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-template-rows: auto auto auto !important;
        gap: 8px 10px !important;
        padding: 12px 12px 10px !important;
    }

    .of-item-card > div:nth-child(1) { /* CODICE */
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    .of-item-card > div:nth-child(2) { /* PRODOTTO */
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
    }
    .of-item-card > div:nth-child(3) { /* ORDINATA */
        grid-column: 1 !important;
        grid-row: 3 !important;
    }
    .of-item-card > div:nth-child(4) { /* EVASA */
        grid-column: 2 !important;
        grid-row: 3 !important;
    }
    .of-item-card > div:nth-child(5) { /* DA CONSEGNARE */
        grid-column: 3 !important;
        grid-row: 3 !important;
    }
    .of-item-card > div:last-child {   /* IMPORTO: riga 1, col 2-3, allineato a destra */
        grid-column: 2 / span 2 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: flex-end !important;
    }
    /* Variante senza importo: le 3 celle quantità occupano tutto lo spazio */
    .of-item-card.of-item-card-no-importo {
        grid-template-columns: 1fr 1fr 1fr !important;
    }
    .of-item-card.of-item-card-no-importo > div:nth-child(1) {
        grid-column: 1 / -1 !important; /* CODICE occupa tutta la riga 1 */
        grid-row: 1 !important;
    }

    /* Testo prodotto: max 2 righe con ellissi */
    .of-prodotto-text {
        white-space: normal !important;
        overflow: hidden;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* Tipografia */
    .of-item-card .label-sm {
        font-size: 9px !important;
        margin-bottom: 1px !important;
    }
    .of-item-card b {
        font-size: 12px !important;
    }
    .of-cell-importo b {
        font-size: 13px !important;
    }

    /* Modal dettaglio */
    .of-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .of-modal-content {
        padding: 18px 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   KIT PRODOTTI
   ═══════════════════════════════════════════════════════════════════════════ */

/* Page layout */
.kit-page { max-width: 900px; margin: 0 auto; padding: 12px 16px 80px; }

/* Header */
.kit-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.kit-page-title { font-size: 1.15rem; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.kit-nuevo-btn, .kit-nuovo-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px; font-size: 0.8rem; font-weight: 600;
    background: #1e293b; color: #fff; border: none; cursor: pointer; transition: background .2s;
}
.kit-nuovo-btn:hover { background: #334155; }

/* Cards grid */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.kit-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 16px; cursor: pointer; transition: box-shadow .2s, border-color .2s;
}
.kit-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); border-color: #cbd5e1; }
.kit-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kit-card-nome { font-size: 0.95rem; font-weight: 700; color: #1e293b; }
.kit-card-gear {
    background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1rem;
    padding: 4px 6px; border-radius: 6px; transition: color .15s, background .15s;
}
.kit-card-gear:hover { color: #475569; background: #f1f5f9; }
.kit-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.kit-meta-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
    background: #f1f5f9; color: #475569;
}
.kit-meta-pill--pronti { background: #dcfce7; color: #15803d; }

/* Empty state */
.kit-empty-state {
    text-align: center; padding: 60px 20px; color: #94a3b8;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.kit-empty-icon { font-size: 2.5rem; color: #cbd5e1; }

/* View header */
.kit-view-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.kit-back-btn {
    background: none; border: 1px solid #e2e8f0; color: #475569; font-size: 0.9rem;
    padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: background .15s;
    flex-shrink: 0;
}
.kit-back-btn:hover { background: #f1f5f9; }
.kit-view-nome { font-size: 1rem; font-weight: 700; color: #1e293b; flex: 1; }
.kit-gear-btn-inline {
    background: none; border: 1px solid #e2e8f0; color: #64748b; font-size: 0.9rem;
    padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: background .15s;
}
.kit-gear-btn-inline:hover { background: #f1f5f9; }

/* Tabs */
.kit-tabs {
    display: flex; gap: 4px; margin-bottom: 14px;
    border-bottom: 2px solid #e2e8f0; padding-bottom: 0;
}
.kit-tab {
    padding: 8px 14px; font-size: 0.78rem; font-weight: 600;
    border: none; background: none; color: #64748b; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    border-radius: 6px 6px 0 0; transition: color .15s;
    display: inline-flex; align-items: center; gap: 5px; position: relative;
}
.kit-tab:hover { color: #1e293b; background: #f8fafc; }
.kit-tab--active { color: #1e293b; border-bottom-color: #1e293b; }
.kit-tab-badge {
    width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
    position: absolute; top: 6px; right: 6px;
}
.kit-tab-panel { display: none; }
.kit-tab-panel--active { display: block; }

/* BOM table */
.kit-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 10px; }
.kit-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.kit-table thead th {
    background: #f8fafc; color: #64748b; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px;
    border-bottom: 1px solid #e2e8f0; text-align: left; white-space: nowrap;
}
.kit-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.kit-table tbody tr:hover { background: #f8fafc; }
.kit-table td { padding: 8px 10px; color: #1e293b; vertical-align: middle; }
.kit-bom-sez-row .kit-bom-sez-cell {
    background: #f1f5f9; color: #475569; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; padding: 6px 10px;
}
.kit-mat { font-weight: 500; }
.kit-coeff { text-align: center; }
.kit-coeff-on { font-weight: 700; color: #1e293b; }
.kit-coeff-off { color: #94a3b8; }
.kit-fab { text-align: right; font-weight: 600; }
.kit-fab-zero { color: #94a3b8; }
.kit-car-cell { white-space: nowrap; }
.kit-car-input {
    width: 60px; padding: 5px 7px; border: 1px solid #e2e8f0; border-radius: 7px;
    font-size: 0.82rem; font-weight: 600; text-align: right; color: #1e293b;
    background: #fff; transition: border-color .15s;
}
.kit-car-input:focus { outline: none; border-color: #94a3b8; }
.kit-car-liberi { font-size: 0.7rem; color: #94a3b8; margin-left: 5px; }
.kit-ord-zero { color: #94a3b8; text-align: right; }
.kit-ord-manca { color: #ef4444; font-weight: 700; text-align: right; }
.kit-ord-ok { color: #16a34a; font-weight: 700; text-align: right; }
.kit-legend {
    display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.72rem;
    color: #64748b; margin-bottom: 16px; padding: 0 2px;
}
.kit-leg-item { display: inline-flex; align-items: center; gap: 4px; }

/* Quantità tab */
.kit-qty-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px;
    margin-bottom: 16px;
}
.kit-qty-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #64748b; margin-bottom: 14px; }
.kit-qty-inputs { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.kit-qty-item { display: flex; flex-direction: column; gap: 6px; }
.kit-qty-item label { font-size: 0.78rem; font-weight: 600; color: #475569; white-space: nowrap; }
.kit-qty-input {
    width: 72px; padding: 8px 10px; border: 1.5px solid #e2e8f0; border-radius: 9px;
    font-size: 0.9rem; font-weight: 700; text-align: center; color: #1e293b;
    background: #f8fafc; transition: border-color .15s;
}
.kit-qty-input:focus { outline: none; border-color: #64748b; background: #fff; }
.kit-qty-total-box { display: flex; flex-direction: column; gap: 6px; }
.kit-qty-total-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
.kit-qty-total-val { font-size: 1.5rem; font-weight: 800; color: #1e293b; }

/* Spedizione / Pronti tab */
.kit-sped-section { padding: 4px 0; }
.kit-sped-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #475569; margin-bottom: 12px;
    display: flex; align-items: center; gap: 7px;
}
.kit-sped-sa-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.kit-sped-sa-row {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.kit-sped-sa-label { font-size: 0.85rem; font-weight: 600; color: #1e293b; flex: 1; display: flex; align-items: center; gap: 8px; }
.kit-sped-var-pill {
    font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px;
    background: #e0f2fe; color: #0369a1;
}
.kit-sped-sa-stats { display: flex; gap: 8px; align-items: center; }
.kit-sped-pronti-cnt { font-size: 0.78rem; font-weight: 700; color: #1e293b; }
.kit-sped-max { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.kit-sped-max--ok { background: #dcfce7; color: #15803d; }
.kit-sped-max--zero { background: #f1f5f9; color: #94a3b8; }
.kit-pronti-ctrl { display: flex; align-items: center; gap: 4px; }
.kit-pronti-btn {
    width: 28px; height: 28px; border-radius: 7px; border: 1px solid #e2e8f0;
    background: #f8fafc; color: #1e293b; font-size: 1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.kit-pronti-btn:hover { background: #e2e8f0; }
.kit-pronti-input {
    width: 52px; text-align: center; padding: 4px 6px;
    border: 1.5px solid #e2e8f0; border-radius: 7px; font-size: 0.85rem;
    font-weight: 700; color: #1e293b;
}
.kit-pronti-val-on { border-color: #22c55e; }
.kit-sped-footer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.kit-sped-nota-input {
    flex: 1; min-width: 160px; padding: 9px 12px;
    border: 1px solid #e2e8f0; border-radius: 9px; font-size: 0.82rem; color: #1e293b;
}
.kit-spedisci-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
    background: #1e293b; color: #fff; border: none; border-radius: 9px;
    font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: background .2s;
    white-space: nowrap;
}
.kit-spedisci-btn:hover { background: #334155; }

/* Movimenti tab */
.kit-mov-form {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 14px; margin-bottom: 14px;
}
.kit-mov-form-field { display: flex; flex-direction: column; gap: 5px; }
.kit-mov-form-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }
.kit-mov-form select, .kit-mov-form input[type="number"], .kit-mov-form input[type="text"] {
    padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 0.82rem; color: #1e293b; background: #fff;
}
.kit-mov-btn-carico {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0;
    border-radius: 9px; font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: background .15s;
}
.kit-mov-btn-carico:hover { background: #bbf7d0; }
.kit-mov-btn-scarico {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5;
    border-radius: 9px; font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: background .15s;
}
.kit-mov-btn-scarico:hover { background: #fca5a5; }
.kit-mov-list { display: flex; flex-direction: column; gap: 6px; }
.kit-mov-empty { text-align: center; color: #94a3b8; font-size: 0.82rem; padding: 20px 0; }
.kit-mov-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 0.8rem;
}
.kit-mov-badge {
    display: inline-flex; padding: 2px 7px; border-radius: 5px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; flex-shrink: 0;
}
.kit-mov-badge.carico { background: #dcfce7; color: #15803d; }
.kit-mov-badge.scarico { background: #fee2e2; color: #b91c1c; }
.kit-mov-badge.spedizione { background: #dbeafe; color: #1d4ed8; }
.kit-mov-badge.reso { background: #fef3c7; color: #92400e; }
.kit-mov-mat { flex: 1; font-weight: 500; color: #1e293b; }
.kit-mov-qty { font-weight: 700; }
.kit-mov-qty.carico { color: #15803d; }
.kit-mov-qty.scarico { color: #b91c1c; }
.kit-mov-nota { font-size: 0.72rem; color: #94a3b8; flex: 1; }
.kit-mov-ts { font-size: 0.68rem; color: #94a3b8; white-space: nowrap; }
.kit-mov-del, .kit-mov-edit {
    background: none; border: none; cursor: pointer; color: #94a3b8;
    font-size: 0.9rem; padding: 3px; transition: color .15s;
}
.kit-mov-del:hover { color: #ef4444; }
.kit-mov-edit:hover { color: #1d4ed8; }
.kit-mov-assemb-group {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    overflow: hidden;
}
.kit-mov-assemb-summary {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px;
    cursor: pointer; font-size: 0.8rem; list-style: none;
}
.kit-mov-assemb-summary::-webkit-details-marker { display: none; }
.kit-mov-assemb-label { flex: 1; font-weight: 600; color: #1e293b; }
.kit-assemb-chev { color: #94a3b8; font-size: 0.7rem; transition: transform .2s; }
details[open] .kit-assemb-chev { transform: rotate(180deg); }
.kit-assemb-sub-list { border-top: 1px solid #f1f5f9; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.kit-assemb-sub-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 0.78rem; }
.kit-assemb-sub-mat { color: #475569; }
.kit-sped-bom-divider { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin: 6px 0 2px; font-weight: 700; }
.kit-sped-item-row { background: #f8fafc; padding: 4px 6px; border-radius: 6px; }
.kit-mov-reso-group summary { background: #fffbeb; }

/* Actions bar */
.kit-actions-bar {
    display: flex; gap: 10px; align-items: center; justify-content: flex-end;
    padding: 14px 0 0; border-top: 1px solid #e2e8f0; margin-top: 20px;
}
.kit-reso-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: #fff; color: #475569; border: 1px solid #e2e8f0;
    border-radius: 9px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.kit-reso-btn:hover { background: #f1f5f9; }
.kit-save-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    background: #fff; color: #1e293b; border: 1px solid #cbd5e1;
    border-radius: 9px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: all .15s;
}
.kit-save-btn:hover { background: #f1f5f9; }
.kit-save-loading { opacity: .6; cursor: not-allowed; }
.kit-save-ok { border-color: #22c55e; color: #15803d; background: #dcfce7; }
.kit-save-err { border-color: #ef4444; color: #b91c1c; background: #fee2e2; }
.kit-btn-secondary {
    padding: 8px 16px; background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
    border-radius: 9px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background .15s;
}
.kit-btn-secondary:hover { background: #e2e8f0; }
.kit-btn-danger {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5;
    border-radius: 9px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.kit-btn-danger:hover { background: #fca5a5; }

/* ═══ CONFIGURATORE ═══════════════════════════════════════════════════════════ */
.kit-cfg-panel { padding: 4px 0; }
.kit-cfg-section { display: flex; flex-direction: column; gap: 10px; }
.kit-cfg-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }
.kit-cfg-input {
    padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 9px;
    font-size: 0.85rem; color: #1e293b; background: #fff; width: 100%; box-sizing: border-box;
}
.kit-cfg-input:focus { outline: none; border-color: #94a3b8; }
.kit-cfg-input-small { width: 80px; }
.kit-cfg-input-sez { font-weight: 700; }
.kit-cfg-input-comp { flex: 1; }
.kit-cfg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kit-cfg-select {
    padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 9px;
    font-size: 0.82rem; color: #1e293b; background: #fff; flex: 1;
}
.kit-cfg-del-btn {
    background: none; border: none; color: #94a3b8; cursor: pointer;
    font-size: 0.85rem; padding: 5px 7px; border-radius: 7px; transition: color .15s, background .15s;
    flex-shrink: 0;
}
.kit-cfg-del-btn:hover { color: #ef4444; background: #fee2e2; }
.kit-cfg-copy-btn {
    background: #eff6ff; border: 1px solid #bfdbfe; color: #2563eb; cursor: pointer;
    font-size: 0.82rem; padding: 6px 9px; border-radius: 8px; transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
}
.kit-cfg-copy-btn:hover { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.kit-cfg-add-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: #f8fafc; color: #475569; border: 1px dashed #cbd5e1;
    border-radius: 9px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
    transition: background .15s; align-self: flex-start;
}
.kit-cfg-add-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.kit-cfg-add-comp-btn {
    display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px;
    background: #fff; color: #475569; border: 1px dashed #cbd5e1;
    border-radius: 7px; font-size: 0.73rem; font-weight: 600; cursor: pointer;
    margin-top: 4px; transition: background .15s;
}
.kit-cfg-add-comp-btn:hover { background: #f1f5f9; }
.kit-cfg-sez-block {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.kit-cfg-sez-header { display: flex; align-items: center; gap: 8px; }
.kit-cfg-del-sez { font-size: 1rem; }
.kit-cfg-comp-header {
    display: flex; align-items: center; font-size: 0.67rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: #94a3b8;
    padding: 0 4px; gap: 8px;
}
.kit-cfg-comp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kit-cfg-coeffs { display: flex; gap: 5px; flex-wrap: wrap; }
.kit-cfg-coeff {
    width: 52px; padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 7px;
    font-size: 0.78rem; text-align: center; color: #1e293b; background: #f8fafc;
}
.kit-cfg-coeff-lbl { width: 52px; text-align: center; flex-shrink: 0; }
.kit-cfg-help { font-size: 0.78rem; color: #64748b; background: #f8fafc; padding: 9px 12px; border-radius: 8px; line-height: 1.5; }
.kit-cfg-warn { font-size: 0.78rem; color: #92400e; background: #fef3c7; padding: 9px 12px; border-radius: 8px; }

/* Variante field (label + input stacked) */
.kit-cfg-var-field { display: flex; flex-direction: column; gap: 4px; }

/* SA grouped */
.kit-cfg-sa-group {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.kit-cfg-sa-group-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.kit-cfg-sa-count { font-size: 0.7rem; color: #94a3b8; font-weight: 600; }
.kit-cfg-sa-empty { font-size: 0.78rem; color: #94a3b8; padding: 4px 0; }
.kit-cfg-sarow { background: #fff; border-radius: 8px; padding: 4px 6px; }

/* Info recap */
.kit-cfg-recap {
    background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.kit-cfg-recap-row {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.82rem; color: #1e293b; line-height: 1.4;
}
.kit-cfg-recap-row i { color: #0284c7; margin-top: 2px; flex-shrink: 0; width: 14px; text-align: center; }
.kit-cfg-danger { padding-top: 10px; border-top: 1px solid #fee2e2; margin-top: 10px; }

/* Modal spedizione kit items list */
.kit-sped-item-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.kit-sped-item-row:last-child { border-bottom: none; }
.kit-sped-item-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.kit-sped-item-label { font-size: 0.85rem; font-weight: 600; color: #1e293b; }
.kit-sped-item-qty { font-size: 0.82rem; font-weight: 700; color: #64748b; }

/* Reso modal */
.kit-reso-item-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.kit-reso-item-row:last-child { border-bottom: none; }
.kit-reso-item-label { flex: 1; font-size: 0.85rem; font-weight: 500; color: #1e293b; display: flex; align-items: center; gap: 6px; }
.kit-reso-qty-ctrl { display: flex; align-items: center; gap: 4px; }
.kit-reso-qty-btn {
    width: 28px; height: 28px; border-radius: 7px; border: 1px solid #e2e8f0;
    background: #f8fafc; color: #1e293b; font-size: 1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.kit-reso-qty-btn:hover { background: #e2e8f0; }
.kit-reso-qty-inp {
    width: 48px; text-align: center; padding: 4px 6px;
    border: 1px solid #e2e8f0; border-radius: 7px; font-size: 0.82rem; font-weight: 700;
}
.kit-reso-bom-empty { font-size: 0.78rem; color: #94a3b8; text-align: center; padding: 10px 0; }

/* Modal import / copia sezioni kit */
.kit-import-modal-box {
    width: min(940px, calc(100vw - 28px));
    max-height: min(88vh, 820px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.kit-import-mode-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 20px 12px;
}
.kit-import-mode-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.kit-import-mode-btn--active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}
.kit-import-search-wrap { padding: 0 20px 12px; }
.kit-import-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    padding: 0 20px;
}
.kit-import-col,
.kit-import-target-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kit-import-col-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}
.kit-import-list {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    min-height: 120px;
    max-height: 240px;
    overflow: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kit-import-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #ffffff;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
}
.kit-import-option--active {
    border-color: #93c5fd;
    background: #eff6ff;
}
.kit-import-option input {
    margin-top: 2px;
    flex-shrink: 0;
}
.kit-import-option-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.kit-import-option-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
}
.kit-import-option-meta {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.4;
}
.kit-import-source-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kit-import-target-wrap {
    padding: 12px 20px 0;
}
.kit-import-target-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.kit-import-target-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.kit-import-preview {
    margin: 12px 20px 0;
}
.kit-import-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    padding: 16px 10px;
}

/* Responsive */
@media (max-width: 600px) {
    .kit-grid { grid-template-columns: 1fr; }
    .kit-mov-form { grid-template-columns: 1fr; }
    .kit-tabs { flex-wrap: wrap; }
    .kit-tab { font-size: 0.72rem; padding: 6px 10px; }
    .kit-sped-sa-row { flex-direction: column; align-items: flex-start; }
    .kit-cfg-comp-row { flex-direction: column; align-items: flex-start; }
    .kit-import-columns { grid-template-columns: 1fr; }
    .kit-import-target-head { align-items: flex-start; }
}


/* ─── Ported from PROD ────────────────────────────────────────────────── */
/* ─── Date ordine/consegna in card ─────────────────────────────── */
.card-date-row {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
    padding: 3px 0 2px; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9;
    margin: 2px 0;
}
.card-date-vals {
    display: flex; align-items: center; gap: 0; flex-wrap: wrap;
}
.card-date-item { font-size: .78rem; color: #475569; display: flex; align-items: center; gap: 2px; }
.card-date-sep  { color: #cbd5e1; margin: 0 6px; font-size: .8rem; }
.card-date-lbl  { color: #94a3b8; font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; margin-right: 1px; }

/* ─── Data consegna nell'header ordine ─────────────────────────── */
.ord-hdr-date {
    display: inline-flex; align-items: center;
    font-size: .72rem; font-weight: 600;
    margin-top: 2px; white-space: nowrap;
}

/* ─── Qty evasa/rimanente inline (sempre visibile) ─────────────── */
.qty-rim-inline {
    display: inline-flex; align-items: center; gap: 3px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 2px 8px; font-size: .78rem; margin-left: 6px; white-space: nowrap;
}
.qty-rimanente-val { font-weight: 700; font-size: .82rem; }

/* ─── Filtro avanzato — trigger button ─────────────────────────── */
.pf-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.pf-trigger-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border: 1px solid #e2e8f0; border-radius: 8px;
    background: #fff; color: #64748b; font-size: .82rem; font-weight: 500;
    cursor: pointer; transition: border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap; user-select: none;
}
.pf-trigger-btn:hover { border-color: #94a3b8; color: #334155; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.pf-trigger-btn.pf-trigger-active { border-color: #6366f1; color: #6366f1; }
.pf-active-badge {
    background: #6366f1; color: #fff; border-radius: 999px;
    font-size: .65rem; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center;
}
.pf-caret { font-size: .6rem; transition: transform .2s; }
.pf-reset-btn {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid #e2e8f0;
    background: #fff; color: #94a3b8; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: .75rem;
    transition: border-color .15s, color .15s;
}
.pf-reset-btn:hover { border-color: #fca5a5; color: #dc2626; }

/* ─── Filtro — dropdown panel ───────────────────────────────────── */
.pf-panel {
    position: absolute; top: calc(100% + 5px); left: 0; z-index: 9999;
    background: #fff; border: 1px solid #e8ecf0; border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12); min-width: 230px; max-width: 280px;
    padding: 6px 0; overflow: hidden;
}
.pf-panel-section { padding: 8px 14px; }
.pf-panel-title {
    font-size: .65rem; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px;
}
.pf-panel-sep { height: 1px; background: #f1f5f9; }
.pf-row {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 4px; cursor: pointer; border-radius: 7px; user-select: none;
    transition: background .1s;
}
.pf-row:hover { background: #f8fafc; }
.pf-radio {
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid #cbd5e1;
    flex-shrink: 0; transition: border-color .12s, background .12s;
}
.pf-radio-on { border-color: #6366f1; background: #6366f1; box-shadow: 0 0 0 2px #e0e7ff; }
.pf-check {
    width: 14px; height: 14px; border-radius: 4px; border: 2px solid #cbd5e1;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    transition: background .12s, border-color .12s;
}
.pf-check-on { background: #6366f1; border-color: #6366f1; }
.pf-stato-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pf-row-lbl { font-size: .82rem; color: #334155; line-height: 1.3; }

/* ─── Info ordine — overlay panel ──────────────────────────────── */
.iop-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.iop-box {
    background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.18);
    width: min(680px, 100%); max-height: 80vh; display: flex; flex-direction: column;
    overflow: hidden;
}
.iop-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
}
.iop-title { font-size: .92rem; font-weight: 700; color: #1e293b; }
.iop-close {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid #e2e8f0;
    background: #f8fafc; color: #64748b; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: .78rem;
}
.iop-close:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.iop-table-wrap { overflow: auto; flex: 1; padding: 12px 18px; }
.iop-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.iop-th {
    text-align: left; font-size: .65rem; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 8px 0;
    border-bottom: 1px solid #f1f5f9; white-space: nowrap;
}
.iop-td { padding: 8px 10px 8px 0; border-bottom: 1px solid #f8fafc; color: #334155; vertical-align: middle; }
.iop-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: #0f172a; }
.iop-hint { font-size: .72rem; color: #94a3b8; padding: 8px 18px 12px; flex-shrink: 0; border-top: 1px solid #f8fafc; margin: 0; }
/* Tasto Sollecita (commerciali) */
.btn-sollecita {
    background: #d97706 !important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px !important;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sollecita:hover { background: #b45309 !important; }
/* Tasto Ripristina (archivio ordine) */
.btn-ripristina {
    background: #242424!important;
    color: #ffffff !important;
    border: none !important;
    transition: background 0.2s, color 0.2s !important;
}
.btn-ripristina:hover {
    background: #ffffff !important;
    color: #242424!important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}

/* â”€â”€ Helper visibilitÃ  desktop/mobile â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.hide-mobile  { /* visibile di default, nascosto da @media â‰¤600 */ }
.show-mobile-flex { display: none; } /* mostrato da @media â‰¤600 */

/* â”€â”€ Menu azioni (tre puntini) â€“ visibile sempre â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.ord-azioni-menu {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.ord-azioni-trigger {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.ord-azioni-trigger:hover {
    background: #f1f5f9;
    color: #334155;
}
.ord-azioni-menu.open .ord-azioni-trigger {
    background: #f1f5f9;
    color: #334155;
}
.ord-azioni-popup {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 10001;
    min-width: 160px;
    overflow: hidden;
    flex-direction: column;
    padding: 4px;
}
.ord-azioni-menu.open .ord-azioni-popup { display: flex; }
.ord-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-align: left;
    border-radius: 8px;
    transition: background 0.12s;
    font-family: inherit;
    box-sizing: border-box;
}
.ord-menu-item i { width: 14px; text-align: center; flex-shrink: 0; color: #64748b; }
.ord-menu-item:hover { background: #f1f5f9; }
.ord-menu-item + .ord-menu-item { border-top: none; }
.ord-menu-item--danger { color: #dc2626; }
.ord-menu-item--danger i { color: #dc2626; }
.ord-menu-item--danger:hover { background: #fef2f2; }
.ord-menu-item--warn { color: #d97706; }
.ord-menu-item--warn i { color: #d97706; }
.ord-menu-item--warn:hover { background: #fffbeb; }




















/* ============================================================
   7. BOTTONI SUPPORTO E AZIONI (SOS)
   ============================================================ */

.btn-sos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 15px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sos:hover {
    background: #fef2f2;
}

.btn-sos-small {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    min-width: 140px;  /* Forza i tasti ad avere la stessa larghezza */
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

.badge-count {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    min-width: 80px;   /* Allinea anche il badge finale */
    text-align: center;
}

















/* ============================================================
   8. MODAL SUPPORTO (FINESTRA DI DIALOGO)
   ============================================================ */

/* ============================================================
   AUTOCOMPLETE ORDINE (modal nuova richiesta)
   ============================================================ */
.modal-ordine-row { margin-bottom: 14px; }
.ordine-autocomplete-wrapper {
    position: relative;
}
.ordine-autocomplete-wrapper .input-field-modern {
    width: 100%;
    box-sizing: border-box;
}
.ordine-autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 99999;
    overflow: hidden;
    max-height: 240px;
    overflow-y: auto;
}
.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    gap: 10px;
    transition: background 0.12s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f0f9ff; }
.ac-ordine { font-weight: 700; font-size: 13px; color: #1e293b; white-space: nowrap; }
.ac-cliente { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

.modal-ordine-row .input-field-modern {
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 28px 56px -8px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
    opacity: 0;
    transform: scale(0.84) translateY(22px);
}

.modal-overlay.active .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: modalSpring 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn-tipo {
    flex: 1;
    padding: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: all 0.2s;
    text-transform: uppercase;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.btn-tipo.active {
    background: #242424;
    color: white;
    border-color: #242424;
}

#wrapper-operatori {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 10px 0;
}

.op-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 13px;
}

.op-label:hover {
    background: #f8fafc;
}














/* ============================================================
   9. GESTIONE MESSAGGI (INBOX) E STATISTICHE
   ============================================================ */

.inbox-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.messaggio-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.border-assegna {
    border-left: 5px solid #242424;
}

.border-domanda {
    border-left: 5px solid #f59e0b;
}

.badge-tipo {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

.card-stat {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}















/* ============================================================
   10. STILE CHAT MODERNA
   ============================================================ */

/* utility classes moved from inline templates */
.empty-msg {
    padding: 20px;
    color: #94a3b8;
    text-align: center;
}
.hidden-search { display: none !important; }

/* Risultati secondari (contengono il termine ma non iniziano con esso) */
.search-secondary {
    opacity: 0.62;
    border-style: dashed !important;
}
.separatore-archivio {
    margin: 60px 0 30px 0;
    text-align: center;
    border-top: 2px dashed #e2e8f0;
    position: relative;
}
.separatore-archivio span {
    background: #f8fafc;
    color: #94a3b8;
    padding: 5px 20px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #e2e8f0;
}
.sezione-archiviata { opacity: 0.9; }
.slim { display: inline-block; }
.flex-grow { flex-grow: 1; min-width: 0; overflow: hidden; }
.order-info { display: flex; align-items: center; gap: 10px; }
.order-number { color: #94a3b8; margin-left: 15px; }
.order-title { font-weight: 800; font-size: 0.92rem; color: var(--order-color, inherit); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
/* Badge con ordine + articoli combinati */
.badge-ord-num { font-weight: 800; opacity: 0.85; margin-right: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; display: inline-block; vertical-align: middle; }
.badge-sep { margin: 0 5px; opacity: 0.4; font-size: 10px; }
.dettagli-container.hidden { display: none; padding: 10px; background: #f1f5f9; }

/* sos button variants */
.btn-sos-small.warning {
    background: #f97316;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.btn-sos-small.success {
    background: #22c55e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}


.chat-card {
    background: #ffffff;
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
}
/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ TAB BAR ACQUISTI â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#acq-tab-bar {
    display: none;
    gap: 4px;
    padding: 8px 16px 0;
    background: transparent;
    flex-shrink: 0;
}
.acq-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 10px 10px 0 0;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background 0.18s, color 0.18s;
    position: relative;
}
.acq-tab:hover { background: #e2e8f0; color: #334155; }
.acq-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 -2px 0 0 #6366f1 inset;
}
.badge-acq-tab {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.4;
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ PAGINA ORDINI ACQUISTI â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.ordini-acq-page { padding-bottom: 40px; }
.ordini-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.ordine-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.ordine-group.all-done { opacity: 0.7; }
.ordine-group[open] { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.ordine-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    list-style: none;
    transition: background 0.15s;
}
.ordine-group-summary::-webkit-details-marker { display: none; }
.ordine-group[open] .ordine-group-summary { background: #f1f5f9; border-bottom-color: #e2e8f0; }
.ordine-group-summary:hover { background: #eff3f7; }

.og-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.og-operatore { font-size: 13px; font-weight: 800; color: #1e293b; }
.og-data { font-size: 12px; color: #64748b; }
.og-progress { font-size: 11px; font-weight: 700; background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 20px; }
.og-done-badge { font-size: 11px; font-weight: 700; color: #15803d; background: #dcfce7; padding: 2px 8px; border-radius: 20px; }
.og-done-badge i { margin-right: 3px; }
.og-chevron { font-size: 11px; color: #94a3b8; transition: transform 0.25s; }
.ordine-group[open] .og-chevron { transform: rotate(180deg); }

.ordine-items { display: flex; flex-direction: column; gap: 0; }

.ordine-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.ordine-item:last-child { border-bottom: none; }
.ordine-item.is-ordinato { background: #f0fdf4; }
.ordine-item:hover { background: #f8fafc; }
.ordine-item.is-ordinato:hover { background: #ecfdf5; }

.oi-check-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}
.oi-check-btn:hover { border-color: #22c55e; color: #22c55e; }
.oi-check-btn.checked { border-color: #22c55e; color: #22c55e; background: #dcfce7; }
.oi-check-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.oi-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.ordine-item.is-ordinato .oi-thumb { opacity: 0.45; }


    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-ordinato { background: #22c55e; }
.dot-attesa   { background: #94a3b8; }

.oi-info { flex: 1; min-width: 0; }
.oi-nome { display: block; font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ordine-item.is-ordinato .oi-nome { text-decoration: line-through; color: #64748b; }
.oi-details { font-size: 12px; color: #94a3b8; }

.oi-stato-badge { flex-shrink: 0; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 20px; letter-spacing: 0.3px; white-space: nowrap; }
.badge-ordinato-sm { background: #dcfce7; color: #15803d; }
.badge-attesa-sm   { background: #f1f5f9; color: #64748b; }
.badge-ordinato-sm i { margin-right: 3px; }
/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ fine ordini acquisti â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

/* â”€â”€â”€ GRUPPI RICHIESTE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.req-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}
.req-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.req-group[open] { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.req-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
    list-style: none;
}
.req-group-summary::-webkit-details-marker { display: none; }
.req-group[open] .req-group-summary { border-bottom-color: #e2e8f0; background: #f1f5f9; }
.req-group-summary:hover { background: #eff3f7; }
.rg-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rg-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    flex-shrink: 0;
}
.rg-icon-assegna { background: #dcfce7; color: #16a34a; }
.rg-icon-domanda  { background: #fee2e2; color: #dc2626; }
.rg-icon-scadenza { background: #fef3c7; color: #d97706; }
.rg-icon-fabbisogno { background: #dbeafe; color: #1d4ed8; }
.rg-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #374151;
    text-transform: uppercase;
}
.rg-count, .rg-count-dom {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: #dcfce7;
    color: #15803d;
}
.rg-count-dom   { background: #fee2e2; color: #b91c1c; }
.rg-count-scad  { background: #fef3c7; color: #b45309; }
.rg-count-fabb  { background: #dbeafe; color: #1d4ed8; }
.rg-chevron {
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.25s ease;
}
.req-group[open] .rg-chevron { transform: rotate(180deg); }
.req-group .chat-inbox {
    padding: 12px 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

/* ─── Fabbisogno produzione buttons ─────────────────────────────── */
.fabprod-sel-btn-wrap {
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
}
.fabprod-actions-wrap {
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.fabprod-sel-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 12px 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.fabprod-sel-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #1e293b;
}
.fabprod-sel-btn.has-selection {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #5b21b6;
}
.fabprod-sel-badge {
    background: #7c3aed;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.fabprod-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #1e293b;
    border: 1.5px solid #1e293b;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.fabprod-print-btn:hover {
    background: #334155;
    border-color: #334155;
}
.fabprod-print-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.fabprod-empty-sel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    color: #94a3b8;
    text-align: center;
}
.fabprod-empty-sel-icon { font-size: 1.8rem; opacity: 0.5; }
.fabprod-empty-sel-text { font-size: 0.88rem; font-weight: 500; max-width: 220px; }
.fabprod-qty-breakdown {
    font-size: 0.74rem;
    color: #94a3b8;
    margin: 1px 0 4px;
    padding: 0 2px;
    line-height: 1.5;
}
.fabprod-sel-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.2s;
}
.fabprod-sel-modal-overlay--in { opacity: 1; }
.fabprod-sel-modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    transform: scale(0.96);
    transition: transform 0.2s;
}
.fabprod-sel-modal-overlay--in .fabprod-sel-modal-box { transform: scale(1); }
.fabprod-sel-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.fabprod-sel-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.fabprod-sel-modal-close:hover { background: #f1f5f9; color: #475569; }
.fabprod-sel-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.fabprod-sel-search-icon { color: #94a3b8; font-size: 0.82rem; flex-shrink: 0; }
.fabprod-sel-search {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.88rem;
    color: #1e293b;
    background: transparent;
    padding: 4px 0;
}
.fabprod-sel-search::placeholder { color: #cbd5e1; }
.fabprod-sel-modal-body {
    overflow-y: auto;
    padding: 8px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fabprod-sel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1.5px solid transparent;
}
.fabprod-sel-item:hover { background: #f8fafc; }
.fabprod-sel-item--checked { background: #f1f5f9; border-color: #334155; }
.fabprod-sel-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1e293b;
    flex-shrink: 0;
    cursor: pointer;
}
.fabprod-sel-item-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fabprod-sel-ord { font-size: 0.88rem; font-weight: 600; color: #1e293b; }
.fabprod-sel-cli {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fabprod-sel-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px 20px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.fabprod-sel-btn-cancel {
    flex: 1;
    background: #f1f5f9;
    border: none;
    border-radius: 12px;
    padding: 11px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s;
}
.fabprod-sel-btn-cancel:hover { background: #e2e8f0; }
.fabprod-sel-btn-apply {
    flex: 2;
    background: #1e293b;
    border: none;
    border-radius: 12px;
    padding: 11px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.fabprod-sel-btn-apply:hover { background: #334155; }

/* ─── Scadenze → Fabbisogno buttons ─────────────────────────────── */
.scad-actions-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 8px;
}
.scad-fab-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .15s ease;
}
.scad-fab-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.scad-fab-btn:disabled { opacity: .55; cursor: not-allowed; }
.scad-fab-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    user-select: none;
    cursor: pointer;
}
.scad-fab-pick .scad-fab-chk {
    width: 15px;
    height: 15px;
    accent-color: #1e293b;
}
.scad-fab-pick .scad-fab-chk:checked + span { color: #0f172a; }
