/* ==========================================================================
           ADMIN SPECIFIC HIGH-CONTRAST & TYPOGRAPHY OVERRIDES
           ========================================================================== */
        .kpi-value, .stock-card .qty, .heavy-num {
            font-family: 'Playfair Display', serif !important;
            font-weight: 900 !important;
            color: var(--primary) !important;
            -webkit-text-stroke: 1px var(--primary) !important; 
            text-shadow: 2px 2px 4px rgba(217, 177, 93, 0.3) !important;
            letter-spacing: 1px !important;
        }
        
        .kpi-label, .form-label, .panel-title, .fraud-alert-title { 
            font-weight: 900 !important; 
            color: var(--primary) !important;
            text-transform: uppercase !important;
            letter-spacing: 1px !important;
        }

        /* Clean, Readable Typography for Tables */
        table.data-table th { font-weight: 900 !important; color: var(--text-inverse) !important; -webkit-text-stroke: 0px !important; font-size: 0.9rem !important; }
        table.data-table td { font-weight: 800 !important; color: var(--text-primary) !important; -webkit-text-stroke: 0px !important; font-size: 0.95rem !important; vertical-align: middle; }

        /* Premium Date Picker Enhancements */
        input[type="date"]::-webkit-datetime-edit, input[type="date"]::-webkit-datetime-edit-text, input[type="date"]::-webkit-datetime-edit-month-field, input[type="date"]::-webkit-datetime-edit-day-field, input[type="date"]::-webkit-datetime-edit-year-field {
            color: var(--primary) !important; font-weight: 900 !important; opacity: 1 !important;
        }

        /* ==========================================================================
           MODERN SIDEBAR NAVIGATION (3-LINE MENU)
           ========================================================================== */
        #sidebar-nav {
            position: fixed;
            top: 0; left: -320px;
            width: 300px; height: 100vh;
            background: rgba(241, 245, 249, 0.95);
            backdrop-filter: blur(25px) saturate(200%);
            border-right: 2px solid var(--primary);
            box-shadow: var(--shadow-lg);
            z-index: 9999;
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex; flex-direction: column;
            overflow-y: auto;
        }
        #sidebar-nav.open {
            transform: translateX(320px);
        }
        .sidebar-header {
            padding: 25px 20px;
            display: flex; justify-content: space-between; align-items: center;
            border-bottom: 2px dashed rgba(217, 177, 93, 0.3);
        }
        .sidebar-menu {
            display: flex; flex-direction: column; padding: 20px 15px; gap: 8px;
        }
        .side-btn {
            background: transparent; border: none; text-align: left;
            padding: 14px 20px; border-radius: 12px; font-weight: 900;
            color: var(--text-primary); font-size: 1rem; cursor: pointer;
            transition: all 0.2s; display: flex; align-items: center; gap: 12px;
        }
        .side-btn i { width: 24px; text-align: center; font-size: 1.2rem; color: var(--primary); transition: 0.2s; }
        .side-btn:hover { background: rgba(217, 177, 93, 0.1); padding-left: 25px; color: var(--primary); }
        .side-btn.active {
            background: var(--primary); color: var(--surface);
            box-shadow: 0 8px 20px rgba(217, 177, 93, 0.3);
        }
        .side-btn.active i { color: var(--surface); }

        #sidebar-overlay {
            position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(4px); z-index: 9998; opacity: 0; pointer-events: none;
            transition: 0.4s ease;
        }
        #sidebar-overlay.active { opacity: 1; pointer-events: auto; }

        /* ==========================================================================
           STAFF & SECURITY: MULTI-SELECT CHECKBOX CARDS
           ========================================================================== */
        .role-selector { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
        .role-card {
            position: relative; display: flex; align-items: flex-start; padding: 15px 20px;
            background: rgba(255, 255, 255, 0.5); border: 2px solid var(--border-strong);
            border-radius: 14px; cursor: pointer; transition: 0.2s;
        }
        .role-card input[type="checkbox"] {
            appearance: none; margin: 0; width: 0; height: 0;
        }
        .role-card::before {
            content: ''; width: 20px; height: 20px; border-radius: 6px; 
            border: 2px solid var(--primary); margin-right: 15px; margin-top: 2px;
            transition: 0.2s; flex-shrink: 0; background: transparent;
        }
        .role-card:hover { border-color: var(--primary); background: rgba(255,255,255,0.8); }
        .role-card:has(input[type="checkbox"]:checked) {
            background: var(--primary); border-color: var(--primary); box-shadow: 0 8px 20px rgba(217, 177, 93, 0.3);
        }
        .role-card:has(input[type="checkbox"]:checked)::before {
            content: '\f00c'; font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free', 'fas'; font-weight: 900;
            color: white; font-size: 12px; display: flex; align-items: center; justify-content: center;
            background: var(--primary); border: 2px solid white; box-shadow: inset 0 0 0 1px var(--primary);
        }
        .role-content h4 { font-weight: 900; font-size: 1.05rem; margin-bottom: 4px; color: var(--text-primary); transition: 0.2s; }
        .role-content p { font-weight: 700; font-size: 0.75rem; color: var(--text-muted); margin: 0; line-height: 1.4; transition: 0.2s; }
        .role-card:has(input[type="checkbox"]:checked) .role-content h4,
        .role-card:has(input[type="checkbox"]:checked) .role-content p {
            color: var(--surface) !important;
        }

        /* Modal Layer Fixes for Admin Details */
        .modal-overlay { 
            position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important;
            background: rgba(15, 23, 42, 0.85) !important; z-index: 2147483647 !important; 
            display: none; align-items: center; justify-content: center; 
            backdrop-filter: blur(15px) saturate(180%) !important; -webkit-backdrop-filter: blur(15px) saturate(180%) !important;
        }
        .modal-overlay.active-modal { display: flex !important; }
        .modal-content { 
            background: var(--surface) !important; color: var(--text-primary) !important; 
            border-radius: 28px; padding: 40px; width: 90%; max-width: 600px; 
            box-shadow: 0 30px 80px rgba(0,0,0,0.4) !important; border: 4px solid var(--primary) !important; 
            position: relative; animation: popInPro 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            max-height: 90vh; overflow-y: auto; margin: auto;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }
        .close-modal { 
            position: absolute; top: 15px; right: 15px; background: rgba(99, 102, 241, 0.15); 
            border: 2px solid var(--primary); color: var(--primary); width: 45px; height: 45px; 
            border-radius: 50%; font-size: 1.5rem; cursor: pointer; display: flex; 
            align-items: center; justify-content: center; font-weight: 900; z-index: 50; transition: 0.2s;
        }
        .close-modal:hover { background: var(--primary); color: white; transform: rotate(90deg); }
        
        /* Custom Table Badges */
        .status-badge {
            font-size: 0.70rem; font-weight: 900; text-transform: uppercase;
            padding: 4px 10px; border-radius: 8px; border: 1px solid;
            display: inline-block; white-space: nowrap;
        }
        .status-admin { background: rgba(217, 177, 93, 0.1); color: var(--primary); border-color: var(--primary); }
        .status-supervisor { background: rgba(249, 115, 22, 0.1); color: #ea580c; border-color: #ea580c; }
        .status-staff { background: rgba(2, 132, 199, 0.1); color: #0284c7; border-color: #0284c7; }
        .status-assistant { background: rgba(16, 185, 129, 0.1); color: #10b981; border-color: #10b981; }

        @keyframes popInPro { 0% { transform: scale(0.9) translateY(20px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

        /* ==========================================================================
           NEW PREMIUM ALERT & WASTAGE CARDS (NOTIFICATION CENTER STYLE)
           ========================================================================== */
        #fraud-alerts-container, #wastage-notifications-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
            gap: 20px;
            padding: 10px 0;
        }

        .premium-alert-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            padding: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.06);
            border: 1px solid var(--surface-hover);
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
            transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            backdrop-filter: blur(15px);
        }
        .premium-alert-card:hover {
            transform: translateY(-5px) scale(1.02);
            box-shadow: 0 15px 40px rgba(0,0,0,0.12);
        }
        
        .alert-card-header {
            display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px;
        }
        
        .alert-icon-box {
            width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: white; flex-shrink: 0;
        }
        .icon-critical { background: var(--danger); box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4); }
        .icon-high { background: #ea580c; box-shadow: 0 4px 15px rgba(234, 88, 12, 0.4); }
        .icon-info { background: #0ea5e9; box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4); }
        .icon-wastage { background: var(--thulian-pink); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }

        .alert-title { font-weight: 900; font-size: 1.05rem; color: var(--text-primary); line-height: 1.3; }
        .alert-time { font-size: 0.75rem; color: var(--text-muted); font-weight: 800; margin-top: 4px; }
        .alert-body { font-size: 0.9rem; color: var(--text-secondary); font-weight: 700; line-height: 1.5; margin-bottom: 15px; flex-grow: 1; }
        
        .alert-actions { display: flex; gap: 8px; margin-top: auto; border-top: 1px dashed rgba(0,0,0,0.1); padding-top: 15px; }
        .alert-actions button { padding: 10px !important; font-size: 0.8rem !important; border-radius: 10px !important; flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; }

        /* ==========================================================================
           MOBILE UI REFINEMENTS (APP-LIKE EXPERIENCE)
           ========================================================================== */
        @media (max-width: 767px) {
            /* Fix Date Range Pickers & Filter Cards on Mobile */
            .desktop-flex-row { flex-direction: column !important; gap: 10px !important; padding: 15px !important; border-radius: 20px !important; }
            .desktop-flex-row > div { width: 100% !important; min-width: 100% !important; margin-bottom: 5px; }
            .desktop-flex-row > button { width: 100% !important; margin-top: 10px; height: 50px !important; font-size: 1.1rem !important; border-radius: 14px !important;}
            
            /* Date Split Wrapper specifically for mobile */
            .mobile-date-split { display: flex; gap: 10px; width: 100%; }
            .mobile-date-split > div { flex: 1; }

            /* Pill style inputs for mobile (handled globally) */
            select.input-elegant { text-align-last: left; }
            
            /* KPI Grid 2x2 on Mobile */
            .kpi-card { padding: 15px !important; border-radius: 16px !important; }
            .kpi-label { font-size: 0.65rem !important; }
            .kpi-value { font-size: 1.5rem !important; }

            /* Shift Audit Card Mobile Fixes */
            .shift-audit-card { margin-bottom: 15px; border-radius: 16px; border: 2px solid rgba(79, 70, 229, 0.1); background: #FFF !important;}
            .shift-audit-header { padding: 15px; border-bottom: 1px solid rgba(0,0,0,0.05); background: rgba(241, 245, 249, 0.3) !important;}
            .shift-audit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 15px; }
            .shift-audit-box { border: 1px dashed rgba(79, 70, 229, 0.3) !important; border-radius: 10px; padding: 10px; text-align: center;}
            
            /* Data Tables -> Mobile Cards */
            table.data-table, table.data-table thead, table.data-table tbody, table.data-table th, table.data-table td, table.data-table tr { 
                display: block; 
            }
            table.data-table thead tr { 
                position: absolute; top: -9999px; left: -9999px;
            }
            table.data-table tr { 
                border: 1px solid var(--border-strong) !important; border-radius: 16px; margin-bottom: 15px; background: var(--surface); padding: 12px; box-shadow: var(--shadow-sm);
            }
            table.data-table td { 
                display: flex !important;
                flex-direction: column !important;
                align-items: flex-start !important;
                position: relative;
                border: none !important; 
                border-bottom: 1px dashed rgba(0,0,0,0.05) !important; 
                padding: 12px 15px !important; 
                text-align: left !important; 
                min-height: 40px;
                font-size: 0.85rem !important;
                word-wrap: break-word;
                gap: 4px;
            }
            table.data-table td:last-child { border-bottom: 0 !important; }
            table.data-table td::before { 
                content: attr(data-label); 
                position: static !important;
                width: 100% !important; 
                text-align: left; 
                font-weight: 900; 
                color: var(--text-muted); 
                text-transform: uppercase; 
                font-size: 0.75rem; 
                white-space: normal;
                line-height: 1.2;
            }
            table.data-table td[colspan] { padding-left: 10px !important; text-align: center; display: block; }
            table.data-table td[colspan]::before { content: none; }
            
            #fraud-alerts-container, #wastage-notifications-container { grid-template-columns: 1fr; gap: 12px;}
            
            /* Fix long text spilling in Stock by Location on mobile */
            .stock-loc-grid span { 
                font-size: 0.75rem !important; 
                word-wrap: break-word; 
                overflow-wrap: anywhere; 
            }
            
            /* Action Group Top Bar */
            .header-actions-group { width: 100%; justify-content: space-between; }
        }

        /* iPad specific fixes */
        @media (max-width: 1024px) {
            input, select, textarea { font-size: 16px !important; } /* Prevents iOS auto-zoom */
        }
