:root {
    --bg-main: #000000;
    --bg-panel: #161616;
    --sidebar-w: 260px;
    --primary: #ffcc00;
    --text-main: #ffffff;
    --text-muted: #888888;
    --border-color: #222222;
    --header-h: 145px;
    --glass: rgba(15, 15, 15, 0.8);
}
.loading-bar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--primary); width: 0; transition: width 0.3s ease; box-shadow: 0 0 10px var(--primary); z-index: 1000; }
.loading-bar.active { width: 100%; animation: loading-shimmer 2s infinite; }
@keyframes loading-shimmer { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

/* --- ACQUISTI MODULE PREMIUM STYLES --- */
.mu-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #eee;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.mu-btn:hover { background: #3a3a3a; border-color: #555; }
.mu-btn.active {
    background: #000;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

.yellow-btn {
    background: var(--primary);
    border: none;
    color: #000;
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: all 0.2s;
}
.yellow-btn:hover { background: #ffdb4d; transform: translateY(-1px); }
.yellow-btn:active { transform: translateY(0); }

/* KPI CARDS HEADER */
.kpi-h-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 140px;
}
.k-main-info { display: flex; align-items: center; gap: 12px; }
.k-icon { font-size: 1.4rem; color: #555; }
.k-info { display: flex; flex-direction: column; }
.k-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.k-val-lrg { font-size: 1.3rem; font-weight: 900; line-height: 1.1; }
.k-val-mid { font-size: 1.1rem; font-weight: 800; color: #fff; line-height: 1.1; }

.header-btn {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.header-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(255, 204, 0, 0.05); }

.user-badge {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 5px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #bbb;
}
.user-badge i { color: var(--primary); font-size: 1.1rem; }

#view-acquisti .sales-table {
    width: 100%;
    border-collapse: collapse;
}
#view-acquisti .sales-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #1a1a1a;
}
#view-acquisti .sales-table th, 
#view-acquisti .sales-table td {
    padding: 12px 20px;
    white-space: nowrap;
    border-bottom: 1px solid #222;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
}

#app-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #000;
    border-right: 2px solid var(--primary);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    height: 100%;
}

.sidebar-header-vertical {
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-lrg {
    width: 130px;
    height: auto;
}

.sidebar-title-box {
    text-align: center;
}

.sub-logo-text {
    font-size: 10px;
    color: #333;
    font-weight: 900;
    letter-spacing: 2px;
}

.sidebar-header-vertical h2 {
    font-size: 21px;
    font-weight: 900;
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 10px 15px;
    overflow-y: auto;
}

.nav-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: #888;
    padding: 12px 18px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: #888;
}

.nav-btn.active {
    background: var(--primary);
    color: #000;
    border-radius: 8px;
}
.nav-badge {
    background: #ff4444;
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
    animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
}

.admin-pending-section { padding: 20px; border-bottom: 1px solid #222; }
.admin-user-card.pending-glow { border: 1px solid var(--primary); box-shadow: 0 0 15px rgba(255, 204, 0, 0.1); }

/* MAIN CONTENT & SECTIONS */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-main);
    height: 100%;
    overflow: hidden;
}

/* view-section rules are defined at the top of the file */

/* TOP HEADER (ENHANCED READABILITY) */
.top-header {
    background: #000;
    border-bottom: 2px solid var(--primary);
    min-height: var(--header-h);
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1000;
}

.header-unified-row {
    display: flex;
    align-items: center;
    padding: 0 25px;
    gap: 25px;
    height: 100%;
    width: 100%;
}

/* KPI CARDS */
.kpis-section {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 12px;
    height: 100%;
}

.kpi-h-card {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
    min-height: 110px; /* Altezza minima garantita */
    transition: border-color 0.2s;
}

.k-icon {
    font-size: 24px;
    color: var(--primary);
}

.k-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.k-label {
    font-size: 10px;
    font-weight: 900;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.k-val-lrg {
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
}

.k-val-mid {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}


/* SELECTORS GRIDS (4x5 ANNI) */
.selectors-section {
    display: flex;
    gap: 15px;
    border-left: 2px solid #111;
    padding-left: 20px;
    height: 110px; /* Altezza fissa per i selettori */
    align-items: center;
}

.mini-grid {
    display: grid;
    gap: 3px;
}

.grid-5x4 { grid-template-columns: repeat(5, 1fr); }
.grid-3x4 { grid-template-columns: repeat(3, 1fr); }

.pill, .m-pill {
    width: 32px;
    height: 18px;
    background: #111;
    border: 1px solid #222;
    color: #555;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.pill.active, .m-pill.bound {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}
.m-pill.in-range {
    background: #222;
    color: var(--primary);
}

.grid-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.grid-label {
    font-size: 10px;
    font-weight: 900;
    color: #777;
    text-align: center;
}

.pill:hover, .m-pill:hover {
    border-color: var(--primary);
    color: #fff;
}
.m-pill {
    justify-content: center;
    background: #080808;
    border: 1px solid #222;
    font-size: 9px;
    font-weight: 900;
    color: #555;
    cursor: pointer;
    border-radius: 3px;
}

.m-pill.in-range {
    background: rgba(255, 204, 0, 0.1);
    color: var(--primary);
}

.m-pill.bound {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* VERTICAL LAYOUT SELECTOR */
.meta-section {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}

.layout-selector-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #111;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #222;
}

.col-btn {
    background: transparent;
    border: none;
    color: #444;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.col-btn.active {
    background: var(--primary);
    color: #000;
}

.col-btn:hover:not(.active) {
    color: #888;
}

.date-selector {
    background: #111;
    border: 1px solid #222;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    outline: none;
}

/* VIEWS CONTAINER */
.views-container {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    width: 100%;
    position: relative;
}

.view-section {
    display: none;
    width: 100%;
}

.view-section.active {
    display: block !important;
}

/* CHARTS GRID & CARDS */
.charts-full-grid {
    display: grid;
    gap: 20px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.charts-full-grid.cols-1 {
    grid-template-columns: 1fr;
}

.charts-full-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.charts-full-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px;
    min-height: 550px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #111;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.chart-title-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-title-btn:hover {
    filter: brightness(1.2);
}

.chart-title-btn i {
    font-size: 10px;
    color: #444;
}


.plotly-chart-full {
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Force specific wide modules to take full row */
.chart-box[data-module="V_06_1"],
.chart-box[data-module="V_06_2"],
.chart-box.full-width-force {
    grid-column: 1 / -1 !important;
    min-height: 550px;
    max-height: 700px;
    /* Limit height and use scrollbar */
}

/* BI-TAMPIERI TABLE STANDARD (Centralized in bitampieri_tables.css) */


/* MODULE SELECTOR DROPDOWN */
.module-dropdown {
    position: absolute;
    top: 50px;
    left: 25px;
    background: #111;
    border: 1px solid var(--primary);
    border-radius: 8px;
    z-index: 3000;
    width: 220px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    display: none;
}

.module-dropdown.active {
    display: block;
}

.drop-item {
    padding: 10px 15px;
    font-size: 11px;
    font-weight: 800;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #222;
}

.drop-item:last-child {
    border-bottom: none;
}

.drop-item:hover {
    background: var(--primary);
    color: #000;
}

.drop-item .v-tag {
    font-family: monospace;
    color: var(--primary);
    margin-right: 8px;
    font-size: 10px;
}

.drop-item:hover .v-tag {
    color: #000;
}

/* SIDEBAR SUBMENU */
.sidebar-submenu {
    background: #030303;
    border-left: 2px solid #1a1a1a;
    margin: 0;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.open {
    max-height: 400px;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 24px;
    font-size: 10px;
    font-weight: 800;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submenu-item:hover {
    color: var(--primary);
    background: rgba(255, 204, 0, 0.04);
}

.submenu-item .v-badge {
    font-family: monospace;
    font-size: 9px;
    color: #333;
    margin-right: 2px;
    min-width: 40px;
}

.submenu-item:hover .v-badge {
    color: var(--primary);
}

/* HOME VIEW */
.welcome-screen {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.welcome-content {
    width: 100%;
    max-width: 1200px;
    padding: 60px;
    text-align: center;
}

.welcome-logo {
    width: 180px;
    margin-bottom: 20px;
}

.welcome-content h1 {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 5px;
}

.highlight {
    color: var(--primary);
}

.subtitle {
    font-size: 16px;
    color: #333;
    margin-bottom: 60px;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 900;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
}

.feature-card {
    background: var(--glass);
    border: 1px solid #1a1a1a;
    padding: 40px 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border-top: 3px solid #1a1a1a;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-top-color: var(--primary);
    background: rgba(20, 20, 20, 0.9);
}

.feature-card i {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 12px;
}

.feature-card p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

/* V05 DRILL-DOWN */
.v05-detail-container {
    margin-top: 20px;
    border-top: 2px solid var(--primary);
    padding-top: 15px;
    height: 300px;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Production styles moved to produzione.css */

/* ==========================================================================
   LOGIN PAGE (PREMIUM OVERHAUL)
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.8s ease-out;
}

.login-box {
    background: rgba(15, 15, 15, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 204, 0, 0.1);
    padding: 50px 40px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 204, 0, 0.05);
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
    font-size: 48px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.3));
    animation: pulseGlow 3s infinite ease-in-out;
}

.login-box h2 {
    font-size: 28px;
    margin-bottom: 35px;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffcc00 0%, #ff9900 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 204, 0, 0.1);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #ffcc00 0%, #ff9900 100%);
    border: none;
    border-radius: 12px;
    padding: 16px;
    color: #000;
    font-weight: 900;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 10px 20px -5px rgba(255, 204, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(255, 204, 0, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-msg {
    margin-top: 20px;
    color: #ff4444;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 68, 68, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-btn-logout {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: #a6adc8;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.nav-btn-logout:hover {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border-color: rgba(255, 68, 68, 0.2);
}

.version-tag {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.2);
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    transition: color 0.2s;
}

.version-tag:hover {
    color: #fab387;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 204, 0, 0.6));
    }
}

/* === ADMIN PAGE === */
.admin-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
    animation: fadeIn 0.4s ease;
}

.admin-sidebar {
    width: 200px;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 10px;
}

.admin-nav-item {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 4px;
    color: #888;
    margin-bottom: 5px;
    transition: all 0.2s;
    font-weight: 600;
}

.admin-nav-item:hover {
    background: #1a1a1a;
    color: #fff;
}

.admin-nav-item.active {
    background: var(--primary);
    color: #000;
}

.admin-main {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #111;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-main h3 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

/* === ADMIN TREE PERMISSIONS === */
.admin-permissions-header {
    background: #111;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-group-select {
    background: #000;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    font-size: 14px;
    outline: none;
}

.perm-tree-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.perm-area-block {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
}

.perm-area-title {
    background: #151515;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #222;
}

.perm-area-title h4 {
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    flex: 1;
}

.perm-items-list {
    padding: 10px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.perm-item-node {
    background: #111;
    border: 1px solid #1a1a1a;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.perm-item-node:hover {
    border-color: #333;
    background: #141414;
}

.perm-item-info {
    flex: 1;
}

.perm-item-info b {
    display: block;
    color: #eee;
    font-size: 12px;
}

.perm-item-info small {
    color: #666;
    font-size: 10px;
}

.tree-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.master-checkbox {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

/* User List */
.admin-user-card {
    background: #0f0f0f;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border 0.3s;
}

.admin-user-card:hover {
    border-color: #333;
}

.user-info .name {
    font-weight: 700;
    color: #fff;
    display: block;
    font-size: 14px;
}

.user-info .mail {
    font-size: 11px;
    color: #555;
}

.tg-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tg-badge.pending { background: #ffcc0033; color: #ffcc00; border: 1px solid #ffcc0055; }
.tg-badge.active { background: #00cc8833; color: #00cc88; border: 1px solid #00cc8855; }

.user-groups-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.group-chip {
    background: #111;
    color: #555;
    font-size: 10px;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #222;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.group-chip.active {
    background: rgba(0, 204, 136, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.admin-save-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 15px;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(0, 204, 136, 0.2);
}
.admin-tab-content.active {
    display: block;
}

.admin-main h3 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

/* === ADMIN TREE PERMISSIONS === */
.admin-permissions-header {
    background: #111;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-group-select {
    background: #000;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    font-size: 14px;
    outline: none;
}

.perm-tree-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.perm-area-block {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
}

.perm-area-title {
    background: #151515;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #222;
}

.perm-area-title h4 {
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    flex: 1;
}

.perm-items-list {
    padding: 10px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.perm-item-node {
    background: #111;
    border: 1px solid #1a1a1a;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.perm-item-node:hover {
    border-color: #333;
    background: #141414;
}

.perm-item-info {
    flex: 1;
}

.perm-item-info b {
    display: block;
    color: #eee;
    font-size: 12px;
}

.perm-item-info small {
    color: #666;
    font-size: 10px;
}

.tree-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.master-checkbox {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

/* User List */
.admin-user-card {
    background: #0f0f0f;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border 0.3s;
}

.admin-user-card:hover {
    border-color: #333;
}
.admin-user-card.pending-glow {
    border: 1px solid var(--primary);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.1);
    animation: border-pulse 3s infinite;
}
@keyframes border-pulse {
    0% { border-color: rgba(255, 204, 0, 0.3); }
    50% { border-color: rgba(255, 204, 0, 1); }
    100% { border-color: rgba(255, 204, 0, 0.3); }
}
.admin-pending-section {
    background: rgba(255, 204, 0, 0.03);
    border: 1px dashed rgba(255, 204, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}
.admin-pending-title {
    color: var(--primary);
    font-weight: 900;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info .name {
    font-weight: 700;
    color: #fff;
    display: block;
    font-size: 14px;
}

.user-info .mail {
    font-size: 11px;
    color: #555;
}

.tg-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tg-badge.pending { background: #ffcc0033; color: #ffcc00; border: 1px solid #ffcc0055; }
.tg-badge.active { background: #00cc8833; color: #00cc88; border: 1px solid #00cc8855; }

.user-groups-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.group-chip {
    background: #111;
    color: #555;
    font-size: 10px;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #222;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.group-chip.active {
    background: rgba(0, 204, 136, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.admin-save-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 15px;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(0, 204, 136, 0.2);
}

.admin-save-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
/* RIORDINO / OPERATIONS MODULE */
.riordino-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
}
.tab-btn {
    background: #0f0f0f;
    border: 1px solid #222;
    color: #555;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.8rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab-btn:hover { border-color: #444; color: #888; }
.tab-btn.active { background: #333; color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(0, 204, 136, 0.2); }

.type-badge {
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.type-badge.RIORDINO { background: #4facfe22; color: #4facfe; }
.type-badge.RIFIUTI { background: #ff555522; color: #ff5555; }
.type-badge.MANUTENZIONE { background: #ffcc0022; color: #ffcc00; }
.type-badge.FILTRI { background: #00cc8822; color: #00cc88; }

.table-input {
    background: #000;
    border: 1px solid #222;
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    width: 100%;
    font-size: 0.85rem;
}
.table-input.small { width: 80px; }
.table-input:focus { border-color: var(--primary); outline: none; }

.waste-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.waste-card {
    background: #0f0f0f;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s;
}
.waste-card:hover { transform: translateY(-5px); border-color: #333; }
.cer-code { font-family: monospace; color: #ff5555; font-weight: 900; font-size: 1.2rem; margin-bottom: 5px; }
.waste-name { color: #888; font-size: 0.9rem; margin-bottom: 15px; }
.waste-total { font-size: 2rem; font-weight: 900; color: #fff; }
.waste-total .unit { font-size: 1rem; color: #555; }
.waste-count { font-size: 0.75rem; color: #444; margin-top: 10px; text-transform: uppercase; letter-spacing: 1px; }

/* TRACCIABILITA / WELDING UI */
.trace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.trace-section {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    padding: 20px;
    border-radius: 12px;
}
.trace-section h3 {
    margin-top: 0;
    font-size: 0.9rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.trace-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.trace-form input {
    background: #000;
    border: 1px solid #222;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.table-container.compact {
    max-height: 250px;
    overflow-y: auto;
}
.bitampieri-table.mini {
    font-size: 0.75rem;
}
.bitampieri-table.mini td, .bitampieri-table.mini th {
    padding: 6px 10px;
}
.yellow-btn.mini {
    padding: 4px 8px;
    font-size: 10px;
}
.pdf-link {
    color: #ff5555;
    text-decoration: none;
    font-weight: 700;
}
.pdf-link:hover {
    text-decoration: underline;
}

.riordino-header-light {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
}
.riordino-header-light h2 { margin: 0; font-size: 1.1rem; color: #fff; font-weight: 800; }

.qr-print-container {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 25px;
}
.qr-gen-form { margin-bottom: 30px; border-bottom: 1px solid #222; padding-bottom: 25px; }
.form-row { display: flex; gap: 20px; align-items: flex-start; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 8px; position: relative; }
.form-group label { font-size: 0.75rem; color: #666; font-weight: 800; text-transform: uppercase; }
.form-group input, .form-group select {
    background: #000;
    border: 1px solid #222;
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.form-group input:focus { border-color: var(--primary); outline: none; }

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111;
    border: 1px solid #333;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    border-radius: 0 0 8px 8px;
    display: none;
}
.search-item { padding: 10px 15px; cursor: pointer; border-bottom: 1px solid #222; font-size: 0.85rem; }
.search-item:hover { background: #1a1a1a; color: var(--primary); }

.qr-preview-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    background: #000;
    border: 1px dashed #333;
    border-radius: 12px;
}

.qr-label-card {
    background: #fff;
    color: #000;
    padding: 20px;
    border-radius: 4px;
    width: 250px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.label-header { font-weight: 900; font-size: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 15px; letter-spacing: 1px; }
.qr-image-box img { width: 160px; height: 160px; }
.label-footer { margin-top: 15px; }
.label-token { font-family: monospace; font-weight: 900; font-size: 1.2rem; margin-bottom: 5px; }
.label-desc { font-size: 0.75rem; color: #444; font-weight: 600; line-height: 1.2; }

.riordino-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #1a1a1a; }
.riordino-header h2 { margin: 0; font-size: 1.5rem; color: #fff; }
.riordino-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid #333; transition: transform 0.2s; }
.riordino-thumb:hover { transform: scale(1.1); border-color: var(--primary); }
.urg-badge { font-size: 0.75rem; font-weight: 800; padding: 4px 10px; border-radius: 4px; text-transform: uppercase; }
.urg-high { background: #ff555522; color: #ff5555; border: 1px solid #ff555544; }
.urg-med { background: #ffcc0022; color: #ffcc00; border: 1px solid #ffcc0044; }
.urg-low { background: #4facfe22; color: #4facfe; border: 1px solid #4facfe44; }
.status-badge { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; }
.st-DA_ASSOCIARE { background: #ff555533; color: #ff5555; }
.st-DA_ORDINARE { background: #ffcc0033; color: #ffcc00; }
.st-ORDINATO { background: #00cc8833; color: #00cc88; }
.badge-finito { background: #ff555522; color: #ff5555; padding: 2px 6px; border-radius: 4px; font-weight: 800; font-size: 0.7rem; border: 1px solid #ff555533; }
.article-code-box { background: #1a1a1a; padding: 4px 10px; border-radius: 4px; border: 1px solid #333; font-family: monospace; font-weight: 700; color: #4facfe; }
.btn-action { padding: 6px 12px; border-radius: 4px; border: none; font-size: 0.75rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.btn-action.associate { background: #4facfe; color: #000; }
.btn-action.ok { background: #00cc88; color: #000; }
.btn-filter { background: #111; border: 1px solid #333; color: #666; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 700; }
.btn-filter.active { background: #333; color: #fff; border-color: #555; }

/* BRICK TOOLTIP V2 */
.brick {
    position: relative;
}

.brick-tooltip-v2 {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    width: 280px;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    pointer-events: none;
}

.brick:hover .brick-tooltip-v2 {
    opacity: 1;
    visibility: visible;
    bottom: 140%;
}

.brick-tooltip-v2::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: rgba(255, 204, 0, 0.3) transparent transparent transparent;
}

.brick-tooltip-header {
 font-weight: 900;
 color: var(--primary);
 font-size: 14px;
 margin-bottom: 10px;
 text-transform: uppercase;
 border-bottom: 1px solid rgba(255,255,255,0.1);
 padding-bottom: 5px;
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
}

.brick-tooltip-row {
 display: flex;
 justify-content: space-between;
 margin-bottom: 4px;
 gap: 15px;
}

.brick-tooltip-row span:first-child {
 color: #888;
 font-weight: 600;
}

.brick-tooltip-row span:last-child {
 color: #fff;
 font-weight: 800;
 text-align: right;
}

/* BI-TAMPIERI UI DESIGN SYSTEM (MODERN DARK) */
.mu-toolbar {
    margin: 10px 30px 10px 30px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    background: #111 !important;
    padding: 12px 25px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    gap: 15px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
}

.mu-search-container {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    flex: 1 !important;
}

.mu-search-container i {
    position: absolute !important;
    left: 18px !important;
    color: #555 !important;
    font-size: 1rem !important;
    z-index: 5 !important;
}

.mu-input {
    background: #000 !important;
    border: 1px solid #333 !important;
    border-radius: 30px !important;
    padding: 10px 20px 10px 45px !important;
    color: #fff !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
}

.mu-input:focus {
    border-color: #ffcc00 !important;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.2) !important;
    outline: none !important;
}

.mu-kpi-group {
    display: flex !important;
    gap: 30px !important;
    align-items: center !important;
    border-left: 1px solid #333 !important;
    padding-left: 25px !important;
    margin-left: auto !important;
}

.mu-kpi-item {
    text-align: right !important;
}

.mu-kpi-label {
    font-size: 10px !important;
    color: #666 !important;
    text-transform: uppercase !important;
    display: block !important;
    letter-spacing: 1px !important;
    font-weight: 800 !important;
}

.mu-kpi-value {
    font-weight: 900 !important;
    font-size: 1.7rem !important;
    line-height: 1 !important;
}

.mu-kpi-value.blue { color: #4facfe !important; }
.mu-kpi-value.yellow { color: #ffcc00 !important; }

/* TABELLA STANDARD */
.mu-table-container { padding: 0 30px 30px 30px !important; }
.mu-table { width: 100% !important; border-collapse: collapse !important; }
.mu-table thead tr { background: #111 !important; border-bottom: 2px solid #222 !important; }
.mu-table th { padding: 15px !important; color: #888 !important; font-weight: 800 !important; text-align: left !important; font-size: 0.8rem !important; text-transform: uppercase !important; }
.mu-table td { padding: 15px !important; border-bottom: 1px solid rgba(255,255,255,0.02) !important; font-size: 1rem !important; vertical-align: middle !important; color: #ccc !important; }
.mu-table td.highlight { color: #fff !important; font-weight: 700 !important; }
.mu-table td.accent { color: #ffcc00 !important; font-weight: 800 !important; }

/* --- FULLSCREEN MODE FOR COMMESSE CONSUNTIVO (FORCED) --- */
body.fullscreen-active #sidebar {
    display: none !important;
}
body.fullscreen-active #top-header {
    display: none !important;
}
body.fullscreen-active #main-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    flex: 0 0 100vw !important;
}
body.fullscreen-active .views-container {
    padding: 0 !important;
    width: 100% !important;
}
body.fullscreen-active #view-commesse {
    width: 100% !important;
    padding: 15px !important;
}

/* Tabella ad alta densità per consuntivo */
.mu-table-dense {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.mu-table-dense th {
    position: sticky;
    top: 0;
    background: #111;
    padding: 8px 6px;
    text-align: left;
    border-bottom: 2px solid var(--primary);
    z-index: 50;
    color: var(--primary);
    text-transform: uppercase;
}
.mu-table-dense td {
    padding: 5px 6px;
    border-bottom: 1px solid #1a1a1a;
    white-space: nowrap;
}
.mu-table-dense tr:hover {
    background: rgba(255, 204, 0, 0.05);
}

/* --- COMMODITY MODULE SPECIFIC --- */
.comm-select {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 6px 10px;
    border-radius: 6px;
    width: 220px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}
.comm-select:hover {
    border-color: var(--primary);
    background: #333;
}
.comm-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.1);
}
.comm-select option {
    background: #1a1a1a;
    color: #fff;
}

/* FOTOVOLTAICO MODERN UI */
.date-nav-group-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #222;
}

.nav-btn-modern {
    background: #111;
    border: 1px solid #333;
    color: #ccc;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn-modern:hover {
    background: #222;
    color: #ffcc00;
    border-color: #ffcc00;
}

.date-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.header-date-input-modern {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
    padding: 6px 12px 6px 35px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    width: 140px;
    outline: none;
    transition: all 0.2s;
}

.header-date-input-modern:focus, 
.header-date-input-modern:hover {
    border-color: #ffcc00;
    background: #000;
}

.calendar-icon {
    position: absolute;
    left: 12px;
    color: #ffcc00;
    font-size: 14px;
    pointer-events: none;
}

/* Remove default calendar icon in some browsers to use ours */
.header-date-input-modern::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

.fotov-custom-header .k-val-mid {
    font-size: 1.3rem !important;
    font-weight: 900 !important;
}

.fotov-custom-header .kpi-h-card {
    min-width: 120px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(30, 30, 40, 0.98);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    z-index: 99999;
    min-width: 240px;
    padding: 6px 0;
    animation: menuFadeIn 0.15s ease-out;
    pointer-events: all;
    visibility: hidden; /* Nascondi finché non posizionato */
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.context-menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    color: #ffd700;
}

.context-menu-item.danger {
    color: #ff5555;
}

.context-menu-item.danger:hover {
    background: rgba(255, 85, 85, 0.1);
}

.context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 4px 0;
}

/* --- TOGGLE SWITCH --- */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:focus + .slider { box-shadow: 0 0 1px var(--primary); }
input:checked + .slider:before { transform: translateX(22px); background-color: #000; }
.slider.round { border-radius: 34px; }

.admin-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

/* --- MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal-content-wrapper {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    overflow: hidden;
}

.modal-sm { width: 400px; max-width: 95%; }
.modal-md { width: 700px; max-width: 95%; }
.modal-lg { width: 1200px; max-width: 95%; }
.modal-xl { width: 95% !important; max-width: 95% !important; }

.modal-header {
    padding: 15px 25px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    text-transform: uppercase;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 10px 25px;
    background: #0d0d0d;
    border-top: 1px solid #222;
    text-align: right;
    color: #555;
    font-size: 0.75rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.fade-in { animation: fadeIn 0.3s ease; }
.fade-out { animation: fadeOut 0.2s ease forwards; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

.commessa-link { color: #3b82f6; text-decoration: none; font-weight: bold; border-bottom: 1px dashed rgba(59, 130, 246, 0.4); transition: all 0.2s; }
.commessa-link:hover { color: #60a5fa; border-bottom-style: solid; border-bottom-color: #60a5fa; }

@keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); } 70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); } }

/* Admin Switch & Reset PWD */
.switch-small {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider-round {
    background-color: var(--primary);
}

input:checked + .slider-round:before {
    transform: translateX(16px);
}

.reset-pwd-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #666 !important;
    color: #fff !important;
}

/* ==========================================================================
   TRACCIABILITA PREMIUM MODULE
   ========================================================================== */
.tracc-premium-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    background: #000;
    color: #fff;
    padding: 0;
    overflow: hidden;
}

.tracc-header {
    background: #0a0a0a;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #111;
    gap: 40px;
    flex-shrink: 0;
}

.tracc-header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tracc-icon-box {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ffcc0033 0%, #ffcc0011 100%);
    border: 1px solid #ffcc0033;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary);
}

.tracc-header-info h1 {
    font-size: 24px;
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.5px;
}

.tracc-header-info p {
    font-size: 13px;
    color: #585b70;
    margin: 0;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Google Style Search Bar */
.tracc-search-wrapper {
    flex: 1;
    max-width: 600px;
}

.google-search-bar {
    background: #111;
    border: 1px solid #222;
    border-radius: 50px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.google-search-bar:focus-within {
    background: #151515;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.1);
}

.google-search-bar .search-icon {
    color: #444;
    margin-left: 15px;
    font-size: 18px;
}

.google-search-bar input {
    background: transparent;
    border: none;
    flex: 1;
    padding: 10px 15px;
    color: #fff;
    font-size: 16px;
    outline: none;
}

.google-search-bar button {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 50px;
    padding: 10px 25px;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.google-search-bar button:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.tracc-header-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 10px;
    color: #444;
    font-weight: 900;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 22px;
    font-weight: 900;
    color: #eee;
}

/* Main Content Area */
.tracc-main-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
}

.tracc-results-card {
    background: #0a0a0a;
    border: 1px solid #111;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tracc-card-header {
    padding: 20px 30px;
    border-bottom: 1px solid #111;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tracc-card-header h3 {
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.tracc-view-filters {
    display: flex;
    gap: 10px;
}

.filter-chip {
    background: #111;
    border: 1px solid #222;
    color: #555;
    padding: 6px 15px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: #444;
    color: #888;
}

.filter-chip.active {
    background: #ffcc0011;
    border-color: var(--primary);
    color: var(--primary);
}

/* Badges */
.badge-status-missing {
    background: #ff475711;
    color: #ff4757;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 900;
    border: 1px solid #ff475733;
}

.badge-status-ok {
    background: #2ed57311;
    color: #2ed573;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 900;
    border: 1px solid #2ed57333;
}

.pdm-code-tag {
    background: #1a1a1a;
    color: #eee;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    border-left: 3px solid var(--primary);
}

/* --- WASTE / RIFIUTI MODULE STYLES --- */
.waste-dashboard {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.waste-section h3 {
    font-size: 1.1rem;
    color: #888;
    margin-bottom: 15px;
    border-bottom: 1px solid #222;
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.waste-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.waste-card {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.waste-card:hover {
    transform: translateY(-5px);
    border-color: #444;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.waste-card.full {
    border-left: 4px solid #f38ba8;
    background: linear-gradient(145deg, #161616, #0a0a0a);
}
.waste-card .cer-code {
    font-size: 1.8rem;
    font-weight: 900;
    color: #ffcc00;
    line-height: 1;
    margin-bottom: 5px;
}
.waste-card .waste-name {
    font-size: 0.9rem;
    color: #eee;
    font-weight: 600;
    margin-bottom: 15px;
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.waste-card .waste-token {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 10px;
}
.waste-card .waste-total {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 5px;
}
.waste-card .waste-total .unit {
    font-size: 1rem;
    color: #666;
    font-weight: 400;
}
.waste-card .waste-count {
    font-size: 0.8rem;
    color: #888;
}
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: #0a0a0a;
    border: 1px dashed #333;
    border-radius: 12px;
    color: #555;
    font-style: italic;
}
