/* --- FONTS & VARIABLES --- */
        @font-face { font-family: 'LemonMilk'; src: url('fonts/LEMONMILKProFTR-Regular.otf') format('opentype'); }
        :root { 
            --maroon: #650123; --maroon-hover: #80012c; 
            --cream: #F4D08F; --white: #FFFFFF; --dark: #1a1a1a; 
            --light-bg: #f3f4f6; --border: #e2e8f0; --text-muted: #64748b;
            --font-lemon: 'LemonMilk', sans-serif; --font-ui: 'Inter', sans-serif; 
            --sidebar-expanded: 280px; --sidebar-collapsed: 80px;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: var(--font-ui); background-color: var(--light-bg); color: var(--dark); display: flex; width: 100vw; height: 100vh; overflow: hidden; }
        h1, h2, h3, h4, .lemon-text { font-family: var(--font-lemon); font-weight: normal;}

        /* --- LOGIN SCREEN --- */
        #login-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--light-bg); z-index: 9999; display: flex; justify-content: center; align-items: center; }
        .login-box { background: var(--white); padding: 40px; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.08); width: 100%; max-width: 400px; text-align: center; border-top: 6px solid var(--maroon);}
        .login-box object { width: 90px; height: 90px; pointer-events: none; margin-bottom: 20px;}
        .login-box h2 { color: var(--maroon); margin-bottom: 25px; font-size: 1.6rem;}
        .login-box .input-group { text-align: left; margin-bottom: 20px;}
        
        /* --- MODERN BUTTONS --- */
        button { font-family: var(--font-ui); font-weight: 600; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; outline: none; }
        .btn-primary { background: var(--maroon); color: var(--white); padding: 10px 20px; border: none; border-radius: 8px; font-size: 0.9rem; box-shadow: 0 4px 6px rgba(101, 1, 35, 0.15); }
        .btn-primary:hover { background: var(--maroon-hover); transform: translateY(-1px); box-shadow: 0 6px 12px rgba(101, 1, 35, 0.25); }
        .btn-secondary { background: var(--white); color: var(--maroon); padding: 9px 18px; border: 1.5px solid var(--maroon); border-radius: 8px; font-size: 0.9rem; box-shadow: 0 1px 2px rgba(0,0,0,0.05);}
        .btn-secondary:hover { background: #fffafb; transform: translateY(-1px); }
        .btn-danger { background: #ef4444; color: white; padding: 8px 14px; border: none; border-radius: 8px; font-size: 0.85rem; box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);}
        .btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
        .btn-edit { background: #10b981; color: white; padding: 8px 14px; border: none; border-radius: 8px; font-size: 0.85rem; box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);}
        .btn-edit:hover { background: #059669; transform: translateY(-1px); }
        .btn-warning { background: #f59e0b; color: #fff; padding: 8px 14px; border: none; border-radius: 8px; font-size: 0.85rem; box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15);}
        .btn-warning:hover { background: #d97706; transform: translateY(-1px); }
        
        button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;}

        /* --- NAVIGATION DRAWER --- */
        #dashboard { display: none; width: 100vw; height: 100vh; flex-direction: row; }
        .sidebar { 
            height: 100%; background: var(--maroon); color: var(--white); 
            display: flex; flex-direction: column; width: var(--sidebar-collapsed); 
            transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; box-shadow: 4px 0 20px rgba(0,0,0,0.1);
            overflow-x: hidden; white-space: nowrap; flex-shrink: 0;
        }
        .sidebar:hover { width: var(--sidebar-expanded); }
        
        .sidebar-header { padding: 25px 0; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; align-items: center; min-width: var(--sidebar-expanded);}
        .sidebar-header object { width: 45px; height: 45px; background: var(--white); border-radius: 8px; padding: 4px; pointer-events: none; transition: 0.3s;}
        .sidebar:hover .sidebar-header object { width: 60px; height: 60px; }
        .sidebar-title { opacity: 0; margin-top: 15px; font-size: 0.95rem; letter-spacing: 1px; transition: opacity 0.2s;}
        .sidebar:hover .sidebar-title { opacity: 1; transition-delay: 0.1s;}

        .sidebar-nav { flex-grow: 1; padding: 15px 0; overflow-y: auto; overflow-x: hidden; min-width: var(--sidebar-expanded);}
        .sidebar-nav::-webkit-scrollbar { width: 4px; } .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
        
        .nav-btn { 
            width: 100%; background: none; border: none; color: rgba(255, 255, 255, 0.7); 
            padding: 14px 28px; text-align: left; font-family: var(--font-lemon); font-size: 0.8rem; 
            cursor: pointer; transition: 0.2s; display: flex; align-items: center; border-left: 3px solid transparent; justify-content: flex-start;
            box-shadow: none; border-radius: 0;
        }
        .nav-btn:hover { background: rgba(0,0,0,0.1); color: var(--white); transform: none; box-shadow: none;}
        .nav-btn.active { background: var(--light-bg); color: var(--maroon); border-left-color: var(--maroon); border-radius: 20px 0 0 20px; margin-left: 8px; width: calc(100% - 8px);}
        
        .nav-btn svg { width: 22px; height: 22px; min-width: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; transition: stroke 0.2s;}
        .nav-text { margin-left: 20px; opacity: 0; transition: opacity 0.2s; }
        .sidebar:hover .nav-text { opacity: 1; transition-delay: 0.1s; }

        .sidebar-footer { padding: 15px; border-top: 1px solid rgba(255,255,255,0.08); min-width: var(--sidebar-expanded);}
        .logout-btn-container { opacity: 0; transition: 0.2s; padding: 0 15px;}
        .sidebar:hover .logout-btn-container { opacity: 1; transition-delay: 0.1s;}

        /* --- MAIN CONTENT & TOPBAR --- */
        .main-content { flex-grow: 1; min-width: 0; height: 100%; overflow-y: auto; background: var(--light-bg); transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);}
        .topbar { background: var(--white); height: 75px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 5;}
        .topbar h2 { color: var(--dark); font-family: var(--font-lemon); font-size: 1.3rem; letter-spacing: 0.5px;}
        .topbar-actions { display: flex; gap: 15px; align-items: center; position: relative;}
        
        /* Notifications */
        .notif-bell { position: relative; cursor: pointer; color: var(--text-muted); transition: 0.2s; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #f8fafc;}
        .notif-bell:hover { color: var(--maroon); background: #fee2e2; }
        .notif-bell .badge { position: absolute; top: -2px; right: -2px; background: #ef4444; color: white; font-size: 0.65rem; font-weight: bold; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--white);}
        .notif-dropdown { display: none; position: absolute; top: 50px; right: 0; background: var(--white); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.1); border-radius: 12px; width: 320px; z-index: 2000; flex-direction: column; overflow: hidden; }
        .notif-dropdown.active { display: flex; animation: fadeIn 0.2s ease; }
        .notif-header { padding: 15px; border-bottom: 1px solid var(--border); background: #f8fafc; font-weight: bold; color: var(--dark); }
        .notif-list { max-height: 300px; overflow-y: auto; }
        .notif-item { padding: 15px; border-bottom: 1px solid #eee; font-size: 0.85rem; cursor: pointer; transition: background 0.2s;}
        .notif-item:hover { background: #f8fafc; }

        .tab-content { padding: 30px; display: none; animation: fadeIn 0.3s; max-width: 1500px; margin: 0 auto;}
        .tab-content.active { display: block; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        /* --- FORMS & PANELS --- */
        .admin-panel { background: var(--white); padding: 30px; border-radius: 16px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); border: 1px solid var(--border); margin-bottom: 30px;}
        .panel-header { font-size: 1.3rem; color: var(--maroon); font-family: var(--font-lemon); border-bottom: 2px solid var(--border); padding-bottom: 15px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center;}
        
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
        .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
        .form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
        .input-group { display: flex; flex-direction: column; width: 100%; position: relative;}
        .input-group.full { grid-column: 1 / -1; margin-bottom: 20px;}
        .input-group label { font-weight: 600; margin-bottom: 8px; color: var(--dark); font-size: 0.9rem; display: flex; justify-content: space-between;}
        .input-group input:not([type="file"]):not([type="checkbox"]), .input-group select, .input-group textarea { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-ui); font-size: 0.95rem; background: #fff; transition: all 0.2s;}
        .input-group input:focus, .input-group select:focus, .input-group textarea:focus { outline: none; border-color: var(--maroon); box-shadow: 0 0 0 4px rgba(101,1,35,0.1); }
        .input-group input[type="checkbox"] { width: auto; transform: scale(1.2); margin-right: 10px; cursor: pointer;}
        
        .file-upload-wrapper { display: flex; align-items: center; gap: 15px; }
        .custom-file-btn { background: var(--maroon); color: var(--white) !important; padding: 12px 24px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; font-weight: 600; font-family: var(--font-ui); font-size: 0.95rem; transition: 0.2s; box-shadow: 0 4px 6px rgba(101, 1, 35, 0.15); border: none;}
        .custom-file-btn:hover { background: var(--maroon-hover); box-shadow: 0 6px 12px rgba(101, 1, 35, 0.25); transform: translateY(-1px);}
        .file-name-display { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; font-style: italic;}

        .search-box-wrapper { position: relative; width: 100%; }
        .search-box-wrapper svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: #94a3b8; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;}
        .search-box-wrapper input { padding-left: 42px !important; }

        /* --- VARIANT BUILDER --- */
        .variants-wrapper { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 25px; margin-bottom: 25px;}
        .variant-row-block { background: var(--white); padding: 20px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 15px; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.02);}
        .v-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 15px; margin-bottom: 15px;}
        .v-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px;}
        .remove-var-btn { position: absolute; top: -12px; right: -12px; background: #ef4444; color: white; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-weight: bold; box-shadow: 0 2px 5px rgba(239,68,68,0.3); transition: 0.2s; display: flex; align-items: center; justify-content: center;}
        .remove-var-btn:hover { transform: scale(1.1); background: #dc2626;}

        /* --- FSSAI ICONS --- */
        .fssai-icon { display: inline-flex; align-items: center; justify-content: center; padding: 2px; background: #fff; border-radius: 4px; margin-right: 8px; vertical-align: middle; box-shadow: 0 1px 3px rgba(0,0,0,0.1);}
        
        /* --- LIVE CATALOG LIST --- */
        .category-tabs { display: flex; gap: 20px; border-bottom: 2px solid var(--border); margin-bottom: 25px; overflow-x: auto; padding-bottom: 2px; }
        .cat-tab { background: none; border: none; padding: 10px 0; font-family: var(--font-ui); font-weight: 700; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; border-bottom: 3px solid transparent; border-radius:0; box-shadow:none; transition: 0.2s; white-space: nowrap; text-transform: uppercase;}
        .cat-tab:hover { color: var(--dark); transform:none; }
        .cat-tab.active { color: var(--maroon); border-bottom-color: var(--maroon); }
        .cat-count { background: #e2e8f0; color: #475569; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; margin-left: 6px; }
        .cat-tab.active .cat-count { background: var(--cream); color: var(--maroon); }

        #list-container { max-height: calc(100vh - 280px); overflow-y: auto; padding-right: 10px; }
        #list-container::-webkit-scrollbar { width: 6px; } #list-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
        
        .product-card { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 15px; transition: 0.2s;}
        .product-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
        .product-card img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; margin-right: 20px; border: 1px solid #eee; }
        .pc-info { flex-grow: 1; min-width: 0; }
        .pc-title { font-family: var(--font-lemon); color: var(--maroon); font-size: 1.2rem; display: flex; align-items: center; margin-bottom: 6px;}
        .pc-badges { display: flex; gap: 8px; margin-bottom: 10px; align-items: center;}
        .pc-badge { background: #dcfce7; color: #166534; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; border: 1px solid #bbf7d0; text-transform: uppercase; display: flex; align-items: center; gap: 4px;}
        .pc-badge-bs { background: #fef08a; color: #854d0e; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; border: 1px solid #fde047; text-transform: uppercase; display: flex; align-items: center; gap: 4px;}
        .pc-id { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 10px;}
        
        .variant-tags { display: flex; flex-wrap: wrap; gap: 10px; }
        .v-tag { background: #f8fafc; border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; display: flex; flex-direction: column; min-width: 110px;}
        .v-tag strong { color: var(--dark); font-size: 1rem; margin: 4px 0;}
        .stock-alert { font-size: 0.75rem; font-weight: 700;}
        .stock-out { color: #dc2626; } .stock-low { color: #ea580c; } .stock-ok { color: #16a34a; }

        .pc-actions { display: flex; flex-direction: column; gap: 10px; justify-content: flex-start; margin-left: 20px;}

        /* --- ORDERS & CUSTOMERS TAB --- */
        .order-filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;}
        .order-filter-btn { padding: 10px 20px; border-radius: 8px; border: 1px solid var(--border); background: var(--white); cursor: pointer; font-weight: 600; font-size: 0.95rem; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 2px 4px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 8px;}
        .order-filter-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.08); border-color: #cbd5e1;}
        .order-filter-btn.active { background: var(--maroon); color: var(--white); border-color: var(--maroon); box-shadow: 0 4px 10px rgba(101,1,35,0.2); transform: translateY(-2px);}
        .order-count-badge { background: #e2e8f0; color: #475569; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; transition: 0.2s;}
        .order-filter-btn.active .order-count-badge { background: var(--cream); color: var(--maroon); }
        
        .order-card { background: var(--white); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.02); overflow: hidden; margin-bottom:20px;}
        .order-header { background: #f8fafc; padding: 20px 25px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center;}
        .order-id { font-family: var(--font-ui); font-size: 1.3rem; color: var(--maroon); font-weight: 800;}
        
        .status-badge { padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; display: flex; align-items: center; gap: 6px;}
        .status-Pending { background: #fef3c7; color: #b45309; border: 1px solid #fde68a;}
        .status-Confirmed { background: #e0e7ff; color: #1d4ed8; border: 1px solid #bfdbfe;}
        .status-Shipped { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd;}
        .status-Delivered { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0;}
        .status-Cancelled { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca;}
        .status-Returned { background: #f3f4f6; color: #475569; border: 1px solid #cbd5e1;}
        
        .pay-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: bold; border: 1px solid;}
        .pay-Paid { background: #dcfce7; color: #166534; border-color: #bbf7d0;}
        .pay-Unpaid { background: #fee2e2; color: #b91c1c; border-color: #fecaca;}

        .order-body { padding: 25px; display: grid; grid-template-columns: 2fr 1fr; gap: 30px;}
        .order-items { background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid var(--border);}
        .order-actions { padding: 20px 25px; background: #f8fafc; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 15px; align-items: center;}

        /* --- DATA TABLES --- */
        .data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.95rem; }
        .data-table th { padding: 15px; background: #f8fafc; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px;}
        .data-table td { padding: 15px; border-bottom: 1px solid var(--border); vertical-align: middle;}
        .data-table tr:hover { background: #fdfdfd; }

        /* --- ANALYTICS TAB --- */
        .analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 25px; margin-bottom: 30px;}
        .metric-card { background: var(--white); padding: 25px; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 10px rgba(0,0,0,0.03); border-left: 6px solid var(--cream); text-align: left;}
        .metric-card.finance-card { border-left-color: #10b981; }
        .metric-card h4 { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;}
        .metric-card h2 { color: var(--maroon); font-size: 2.2rem; font-family: var(--font-lemon); margin: 0;}
        .metric-sub { font-size: 0.85rem; color: #10b981; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 5px;}
        .chart-container { background: var(--white); padding: 25px; border-radius: 16px; border: 1px solid var(--border); margin-bottom: 30px; box-shadow: 0 4px 10px rgba(0,0,0,0.02);}

        /* --- CUSTOM MODALS (Overlay Component) --- */
        .custom-dialog-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); z-index: 10000; justify-content: center; align-items: center; }
        .custom-dialog-box { background: var(--white); padding: 35px; border-radius: 16px; width: 90%; max-width: 420px; box-shadow: 0 25px 50px rgba(0,0,0,0.15); text-align: center; animation: dialogPop 0.2s cubic-bezier(0.16, 1, 0.3, 1); max-height: 90vh; overflow-y: auto;}
        @keyframes dialogPop { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
        .custom-dialog-box h3 { color: var(--dark); font-family: var(--font-ui); font-size: 1.3rem; font-weight: 700; margin-bottom: 15px; }
        .custom-dialog-box p { color: var(--text-muted); font-size: 1rem; margin-bottom: 25px; line-height: 1.5;}
        .custom-dialog-box input { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px; font-family: var(--font-ui); font-size: 1rem; margin-bottom: 25px; text-align: center;}
        .custom-dialog-box input:focus { outline: none; border-color: var(--maroon); }
        .dialog-actions { display: flex; gap: 15px; justify-content: center; }
        .dialog-actions button { flex: 1; margin: 0; }

        /* Print Styles for Invoice & Waybills */
        @media screen { #printArea { display: none !important; } }
        @media print {
            body * { visibility: hidden; }
            #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; background: white; padding: 0; margin: 0; visibility: visible !important; }
            #printArea * { visibility: visible !important; }
            .no-print { display: none !important; }
            
            /* Invoice Styles */
            .invoice-wrapper { padding: 30px; font-family: var(--font-ui); color: var(--dark); page-break-after: always; box-sizing: border-box; height: auto !important; overflow: visible !important;}
            .invoice-table { width:100%; border-collapse:collapse; margin:15px 0; }
            .invoice-table th { background:#f8fafc !important; padding:10px; border:1px solid var(--border); text-align:left; color: var(--text-muted); -webkit-print-color-adjust: exact; color-adjust: exact;}
            .invoice-table td { padding:10px; border:1px solid var(--border); }
            
            /* Waybill Bulk Grid Styles (4 per A4) */
            .waybill-grid-page { display: grid !important; grid-template-columns: 1fr 1fr !important; grid-template-rows: 1fr 1fr !important; height: 100vh !important; gap: 15px; padding: 15px; box-sizing: border-box; page-break-after: always; }
            .waybill-box { border: 2px dashed #ccc; padding: 20px; display: flex !important; flex-direction: column !important; justify-content: space-between !important; overflow: hidden; height: 100%; box-sizing: border-box; page-break-inside: avoid; }
        }

        @media (max-width: 1024px) {
            .sidebar { width: var(--sidebar-collapsed); }
            .sidebar:hover { width: var(--sidebar-expanded); }
            .main-content { margin-left: 0; width: 100%; }
        }