        /* --- 1. PREMIUM SLATE PALETTE & VARIABLES --- */
        :root {
            --bg-body: #f8fafc;
            --bg-card: #ffffff;
            --bg-subtle: #f1f5f9;
            
            --text-main: #0f172a; 
            --text-muted: #64748b; 
            --text-light: #94a3b8;
            
            --border: #e2e8f0; 
            
            --primary: #2563eb; 
            --primary-hover: #1d4ed8;
            --primary-light: #eff6ff;
            --accent-green: #10b981;
            --accent-green-bg: #d1fae5;
            --accent-red: #ef4444;
            --accent-red-bg: #fee2e2;

            --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
            --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
            --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
            
            --radius: 12px;
            --ease: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* --- GLOBAL RESET & BASE --- */
        * { margin:0; padding:0; box-sizing:border-box; font-family:'Inter', sans-serif; outline:none; -webkit-tap-highlight-color: transparent; }
        
        body { 
            background: var(--bg-body); 
            color: var(--text-main); 
            font-size: 14px; 
            line-height: 1.6; /* Improved Breathing Room */
            height: 100vh; 
            display: flex; 
            flex-direction: column; 
            overflow: hidden; 
        }

        body.rtl { direction: rtl; }
        .rtl .nav-item { flex-direction: row-reverse; justify-content: flex-end; }
        .rtl .nav-item .nav-label { order: 1; text-align: right; flex: 1; }
        .rtl .nav-item i { order: 2; margin-left: 8px; }
        .rtl .nav-section { text-align: right; }
        .rtl aside .brand { text-align: left; margin-right: auto; margin-left: 0; direction: ltr; unicode-bidi: bidi-override; }
        .rtl .top-bar { flex-direction: row; justify-content: space-between; direction: ltr; }
        .rtl .page-title { text-align: right; }
        .rtl label { text-align: right; }
        .rtl h1, .rtl h2, .rtl h3, .rtl h4 { text-align: right; }
        
        h1, h2, h3, h4 { letter-spacing: -0.02em; } /* Tighter Headers */

        #app { display:flex; height:100%; width:100%; }
        
        /* --- ANIMATIONS --- */
        @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
        @keyframes shake { 
            0%, 100% { transform: translateX(0); } 
            10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); } 
            20%, 40%, 60%, 80% { transform: translateX(4px); } 
        }
        @keyframes ghostFly {
            0% { transform: scale(1); opacity: 1; }
            50% { opacity: 0.8; transform: scale(0.5); }
            100% { transform: scale(0.1); opacity: 0; }
        }
        
        /* --- GLASS EFFECT UTILITY --- */
        .glass-effect {
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(226, 232, 240, 0.6);
        }

        /* --- LAYOUT COMPONENTS --- */
        aside { 
            width: 260px; 
            background: var(--bg-card); 
            border-right: 1px solid var(--border); 
            display: flex; 
            flex-direction: column; 
            z-index: 50; 
        }
        
        main { flex:1; display:flex; flex-direction:column; position:relative; overflow:hidden; }
        
        .brand { 
            font-size: 1.25rem; 
            font-weight: 800; 
            padding: 24px; 
            color: var(--text-main);
            display: flex; 
            align-items: center; 
            gap: 10px; 
            letter-spacing: -0.5px;
        }

        .nav-item { 
            margin: 4px 16px; 
            padding: 10px 16px; 
            border-radius: 8px; 
            color: var(--text-muted); 
            cursor: pointer; 
            font-weight: 500; 
            display: flex; 
            align-items: center; 
            gap: 12px; 
            transition: var(--ease); 
        }
        
        .nav-item:hover { background: var(--bg-subtle); color: var(--text-main); }
        .nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600;}
        
        .nav-section { 
            font-size: 0.7rem; 
            text-transform: uppercase; 
            color: var(--text-light); 
            padding: 24px 32px 10px; 
            font-weight: 700; 
            letter-spacing: 0.5px;
        }
        
        /* --- TOP BAR --- */
        .top-bar { 
            height: 64px; 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            padding: 0 32px; 
            flex-shrink: 0; 
            z-index: 40;
        }
        
        .page-title { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
        
        .wallet-badge { 
            background: var(--text-main); 
            color: white; 
            padding: 6px 14px; 
            border-radius: 20px; 
            font-weight: 600; 
            display: flex; 
            align-items: center; 
            gap: 8px; 
            font-size: 0.85rem; 
            box-shadow: var(--shadow-md);
        }

        .notif-btn {
            position: relative;
            border: 1px solid var(--border);
            background: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            cursor: pointer;
            transition: var(--ease);
        }
        .notif-btn:hover { background: var(--bg-subtle); color: var(--primary); }
        .notif-count {
            position: absolute;
            top: -4px;
            right: -4px;
            background: var(--accent-red);
            color: white;
            font-size: 0.65rem;
            padding: 2px 6px;
            border-radius: 999px;
            font-weight: 700;
            min-width: 18px;
            text-align: center;
            box-shadow: var(--shadow-sm);
        }

        .content-scroll { flex:1; overflow-y:auto; padding:32px; }

        /* --- TRACKING UI --- */
        .tracking-grid { display:grid; grid-template-columns: 1fr 1.2fr; gap:24px; }
        .tracking-card { background:var(--bg-card); border:1px solid var(--border); border-radius:12px; padding:16px; box-shadow: var(--shadow-sm); }
        .tracking-list { display:flex; flex-direction:column; gap:12px; }
        .tracking-item { border:1px solid var(--border); border-radius:12px; padding:14px; cursor:pointer; transition:var(--ease); background: #fff; }
        .tracking-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
        .tracking-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
        .status-badge { padding:4px 10px; border-radius:999px; font-weight:600; font-size:0.75rem; display:inline-flex; align-items:center; gap:6px; }
        .status-non_expedie { background: var(--bg-subtle); color: var(--text-muted); }
        .status-en_preparation { background: #e0f2fe; color: #0369a1; }
        .status-confirmation_client { background: #fef3c7; color: #b45309; }
        .status-expedie { background: #dbeafe; color: #1d4ed8; }
        .status-en_livraison { background: #ede9fe; color: #6d28d9; }
        .status-tentative { background: #fef3c7; color: #92400e; }
        .status-non_repond { background: var(--accent-red-bg); color: var(--accent-red); }
        .status-annule_client { background: var(--accent-red-bg); color: var(--accent-red); }
        .status-livre { background: var(--accent-green-bg); color: var(--accent-green); }

        .timeline { border-left:2px solid var(--border); padding-left:18px; display:flex; flex-direction:column; gap:16px; }
        .timeline-item { position:relative; padding-left:8px; }
        .timeline-item::before { content:''; position:absolute; left:-26px; top:4px; width:12px; height:12px; border-radius:50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
        .timeline-meta { font-size:0.75rem; color:var(--text-light); margin-top:4px; }

        .notif-item { border:1px solid var(--border); border-radius:12px; padding:14px; background:#fff; display:flex; gap:12px; align-items:flex-start; }
        .notif-dot { width:10px; height:10px; border-radius:50%; margin-top:6px; }
        .level-info { background:#3b82f6; }
        .level-success { background:#10b981; }
        .level-warning { background:#f59e0b; }
        .level-danger { background:#ef4444; }

        /* --- MARKETING CENTER --- */
        .mk-section { border:1px solid var(--border); border-radius:14px; padding:16px; background:linear-gradient(180deg, #ffffff, #f8fafc); }
        .mk-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
        .mk-header h4 { margin:0; font-size:1.05rem; font-weight:800; }
        .mk-header span { font-size:0.8rem; color:var(--text-muted); }
        .mk-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:14px; }
        .mk-card { border:1px solid var(--border); border-radius:12px; padding:12px; background:#fff; box-shadow:var(--shadow-sm); }
        .mk-card h5 { margin:0 0 8px; font-size:0.9rem; font-weight:700; }
        .mk-preview { position:relative; width:100%; border-radius:10px; overflow:hidden; background:#0f172a; box-shadow:0 8px 16px rgba(15,23,42,0.15); }
        .mk-ratio-9x16 { padding-top:177.78%; }
        .mk-ratio-1x1 { padding-top:100%; }
        .mk-ratio-16x9 { padding-top:56.25%; }
        .mk-canvas { position:absolute; inset:0; background-size:cover; background-position:center; }
        .mk-overlay { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:flex-end; padding:12px; background:linear-gradient(180deg, rgba(2,6,23,0.05), rgba(2,6,23,0.75)); color:#fff; }
        .mk-tag { align-self:flex-start; background:rgba(255,255,255,0.85); color:#111827; font-size:0.65rem; font-weight:800; padding:4px 6px; border-radius:6px; margin-bottom:6px; }
        .mk-title { font-weight:800; font-size:0.95rem; line-height:1.2; }
        .mk-sub { font-size:0.75rem; opacity:0.9; margin-top:4px; }
        .mk-price { font-size:1rem; font-weight:900; margin-top:6px; }
        .mk-banner { align-items:center; text-align:center; }
        .mk-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
        .mk-style-row { display:flex; gap:8px; flex-wrap:wrap; margin:8px 0 10px; }
        .mk-style-row .btn { padding:6px 10px; font-size:0.75rem; }
        .mk-preview.generated img { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:cover; }
        
        .mk-text-card { margin-top:14px; border:1px dashed var(--border); border-radius:12px; padding:12px; background:#fff; }
        .mk-text-item { display:flex; gap:10px; align-items:flex-start; justify-content:space-between; padding:10px; border-radius:10px; background:var(--bg-subtle); margin-bottom:8px; }
        .mk-text-item:last-child { margin-bottom:0; }
        .mk-text { font-size:0.85rem; color:var(--text-main); white-space:pre-line; }
        @media (max-width: 900px) {
            .mk-grid { grid-template-columns:1fr; }
        }
        @media (max-width: 900px) {
            .tracking-grid { grid-template-columns: 1fr; }
        }
        
        /* --- BUTTONS & INPUTS --- */
        .btn { 
            padding: 10px 18px; 
            border-radius: 8px; 
            border: 1px solid transparent; 
            cursor: pointer; 
            font-weight: 600; 
            display: inline-flex; 
            align-items: center; 
            justify-content: center;
            gap: 8px; 
            transition: var(--ease); 
            font-size: 0.9rem; 
            text-decoration: none; 
        }
        
        .btn-primary { background: var(--primary); color: white; box-shadow: 0 6px 12px rgba(37, 99, 235, 0.18); }
        .btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22); }
.btn-outline { background: white; border-color: var(--border); color: var(--text-main); box-shadow: var(--shadow-sm); }
        .btn-outline:hover { background: var(--bg-subtle); border-color: #cbd5e1; }
        .btn-danger { background: var(--accent-red-bg); color: var(--accent-red); border-color: transparent; }
        .btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
        .btn-icon-only { padding: 8px; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: white; color: var(--text-muted); cursor: pointer; transition: var(--ease); }
        .btn-icon-only:hover { background: var(--bg-subtle); color: var(--primary); border-color: var(--primary-light); }
        .btn:active { transform: translateY(0); }
        .btn:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }

        .w-full { width:100%; }
        
        .input-field { 
            width: 100%; 
            padding: 10px 12px; 
            border: 1px solid var(--border); 
            border-radius: 8px; 
            margin-bottom: 15px; 
            background: #fff; 
            transition: var(--ease);
            color: var(--text-main);
        }
        .input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

        .file-input-modern {
            position: relative;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 6px 10px;
            border: 1px dashed var(--border);
            border-radius: 12px;
            background: linear-gradient(180deg, #ffffff, #f8fafc);
        }
        .file-input-native {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }
        .file-input-trigger {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            border-radius: 999px;
            background: #ffffff;
            border: 1px solid var(--border);
            box-shadow: var(--shadow-sm);
            cursor: pointer;
            transition: var(--ease);
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-main);
        }
        .file-input-trigger.file-input-icon-only {
            width: 36px;
            height: 36px;
            padding: 0;
            justify-content: center;
        }
        .file-input-trigger:hover {
            border-color: var(--primary-light);
            color: var(--primary);
        }
        .file-input-logo {
            width: 18px;
            height: 18px;
            display: inline-block;
            background-color: #111827;
            -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V5'/%3E%3Cpath d='M7 10l5-5 5 5'/%3E%3Cpath d='M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V5'/%3E%3Cpath d='M7 10l5-5 5 5'/%3E%3Cpath d='M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E") center / contain no-repeat;
        }
        .file-input-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
        }
        
        label { display:block; margin-bottom:6px; font-weight:600; color:var(--text-main); font-size:0.85rem; }

        /* --- CARDS & ELEVATION --- */
        .card { 
            background: var(--bg-card); 
            border-radius: var(--radius); 
            box-shadow: var(--shadow-sm); 
            padding: 24px; 
            border: 1px solid var(--border); 
            transition: var(--ease);
        }

        /* --- ASSISTANT EXPERIENCE --- */
        .assistant-header { gap: 12px; flex-wrap: wrap; }
        .assistant-actions { display:flex; gap:8px; flex-wrap:wrap; }
        .assistant-chat {
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            border: 1px solid var(--border);
        }
        .assistant-messages {
            background: #f1f5f9;
            border-radius: 14px;
            border: 1px solid rgba(226, 232, 240, 0.9);
        }
        .assistant-row {
            display:flex;
            align-items:flex-end;
            gap:10px;
            margin-bottom:12px;
            animation: fadeIn 0.2s ease-out;
        }
        .assistant-row:last-child { margin-bottom:0; }
        .assistant-row-user { justify-content: flex-end; }
        .assistant-row-bot { justify-content: flex-start; }
        .assistant-avatar {
            width: 32px;
            height: 32px;
            border-radius: 10px;
            background: #fff;
            border: 1px solid var(--border);
            display:flex;
            align-items:center;
            justify-content:center;
            color: var(--primary);
            box-shadow: var(--shadow-sm);
        }
        .assistant-bubble {
            max-width: 78%;
            padding: 12px 14px;
            border-radius: 16px;
            white-space: pre-line;
            line-height: 1.55;
            box-shadow: var(--shadow-sm);
        }
        .assistant-bubble-user {
            background: var(--primary);
            color: #fff;
            border-radius: 16px 16px 6px 16px;
            box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
        }
        .assistant-bubble-bot {
            background: #ffffff;
            color: var(--text-main);
            border: 1px solid var(--border);
            border-radius: 16px 16px 16px 6px;
        }
        .assistant-typing-row .assistant-bubble {
            display: flex;
            gap: 6px;
            align-items:center;
            padding: 12px 16px;
        }
        .assistant-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--text-light);
            animation: assistantPulse 1s infinite ease-in-out;
        }
        .assistant-dot:nth-child(2) { animation-delay: 0.15s; }
        .assistant-dot:nth-child(3) { animation-delay: 0.3s; }
        @keyframes assistantPulse {
            0%, 100% { transform: translateY(0); opacity: 0.6; }
            50% { transform: translateY(-4px); opacity: 1; }
        }
        .assistant-empty {
            text-align: center;
            padding: 36px 20px;
            color: var(--text-muted);
        }
        .assistant-empty-icon {
            width: 56px;
            height: 56px;
            border-radius: 18px;
            background: #ffffff;
            border: 1px solid var(--border);
            display:flex;
            align-items:center;
            justify-content:center;
            margin: 0 auto 12px;
            color: var(--primary);
            box-shadow: var(--shadow-sm);
        }
        .assistant-empty-title {
            font-weight: 800;
            color: var(--text-main);
            margin-bottom: 8px;
            font-size: 1.05rem;
        }
        .assistant-empty-sub { white-space: pre-line; line-height: 1.7; }
        .assistant-empty-list {
            margin-top: 16px;
            display: inline-flex;
            flex-direction: column;
            gap: 6px;
            font-size: 0.85rem;
            background: rgba(255,255,255,0.75);
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px dashed var(--border);
        }
        .assistant-composer { position: relative; }
        .assistant-form .btn.is-loading .btn-label { opacity: 0.7; }
        .assistant-form .btn .btn-spinner {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.3);
            border-top-color: #fff;
            display: none;
            animation: spin 0.8s linear infinite;
        }
        .assistant-form .btn.is-loading .btn-spinner { display: inline-block; }
        .assistant-form .btn.is-loading i { display: none; }
        @keyframes spin { to { transform: rotate(360deg); } }
        
        .grid-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:24px; margin-bottom:32px; }
        .grid-products { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:24px; }
        
        /* --- MODERN PRODUCT CARD --- */
        .p-card { 
            background: var(--bg-card); 
            border-radius: var(--radius); 
            box-shadow: var(--shadow-sm);
            border: 1px solid transparent; 
            overflow: hidden; 
            transition: var(--ease); 
            cursor: pointer; 
            display: flex; 
            flex-direction: column; 
            height: 100%; 
            position: relative;
            animation: fadeIn 0.4s ease-out forwards;
        }
        
        .p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
        
        .p-img { 
            height: 180px; 
            background: #fff; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            padding: 20px; 
            position: relative; 
            border-bottom: 1px solid var(--bg-subtle);
        }
        .p-img img { max-height: 100%; max-width: 100%; object-fit: contain; mix-blend-mode: multiply; }
        
        .p-info { padding: 16px; flex: 1; display: flex; flex-direction: column; }
        
        .p-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
        .p-brand { 
            font-size: 0.7rem; 
            font-weight: 700; 
            text-transform: uppercase; 
            color: var(--primary); 
            background: var(--primary-light); 
            padding: 4px 8px; 
            border-radius: 4px;
        }
        
        .p-name { font-weight: 600; font-size: 0.95rem; line-height: 1.4; margin-bottom: 16px; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 42px; }
        
        .p-metrics { margin-top: auto; }
        .p-price-group { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
        .label { font-size: 0.75rem; color: var(--text-muted); display: block; }
        .value-lg { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
        
        .p-profit-pill { 
            background: var(--accent-green-bg); 
            color: #047857; 
            font-size: 0.75rem; 
            font-weight: 700; 
            padding: 6px 10px; 
            border-radius: 6px; 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            gap: 6px;
        }

        /* --- FILTERS --- */
        .filters { 
            display: flex; 
            gap: 12px; 
            margin-bottom: 24px; 
            flex-wrap: wrap; 
            background: var(--bg-card); 
            padding: 16px; 
            border-radius: var(--radius); 
            box-shadow: var(--shadow-sm); 
            align-items: center; 
        }
        .market-filters {
            flex-wrap: nowrap;
            align-items: center;
            gap: 10px;
        }
        .filter-toggle {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 6px 10px;
            font-size: 0.85rem;
            border-radius: 10px;
            width: auto;
            height: 38px;
            margin-left: 0;
        }
        .filter-toggle-label {
            font-weight: 600;
            font-size: 0.8rem;
        }
        .filter-search {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
            min-width: 180px;
        }
        .filter-sep {
            height: 20px;
            width: 1px;
            background: var(--border);
        }
        .filter-select {
            min-width: 180px;
            flex: 0 0 auto;
        }
        .market-filters.collapsed .filter-select,
        .market-filters.collapsed .filter-sep {
            display: none;
        }

        /* --- DATA TABLES --- */
        .table-container { 
            overflow-x: auto; 
            border-radius: var(--radius); 
            background: transparent; 
            box-shadow: none; 
            border: none;
            animation: fadeIn 0.4s ease-out forwards;
        }
        table { width: 100%; border-collapse: separate; border-spacing: 0 10px; white-space: nowrap; }
        
        th { 
            text-align: left; 
            padding: 10px 16px; 
            background: transparent; 
            font-size: 0.75rem; 
            text-transform: uppercase; 
            color: var(--text-muted); 
            font-weight: 700; 
            border-bottom: none; 
            letter-spacing: 0.5px;
        }
        
        td { 
            padding: 14px 16px; 
            border-bottom: none; 
            color: var(--text-main); 
            vertical-align: middle; 
            font-size: 0.9rem;
        }
        tbody tr { background: var(--bg-card); box-shadow: var(--shadow-sm); transition: var(--ease); }
        tbody tr:hover { box-shadow: var(--shadow-md); }
        tbody tr td:first-child { border-radius: 10px 0 0 10px; }
        tbody tr td:last-child { border-radius: 0 10px 10px 0; }
        
        .badge { 
            padding: 6px 12px; 
            border-radius: 999px; 
            font-size: 11px; 
            font-weight: 700; 
            text-transform: uppercase; 
            display: inline-flex; 
            align-items: center; 
            gap: 8px; 
            letter-spacing: 0.5px;
            box-shadow: var(--shadow-sm);
        }
        .badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.8; }
        .bg-green { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
        .bg-orange { background: #fed7aa; color: #92400e; border: 1px solid #fbcf8f; }
        .bg-red { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
        .bg-blue { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
        .bg-black { background: #e2e8f0; color: #334155; border: 1px solid #cbd5e1; }
        
        /* Status-specific badges */
        .status-pending { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
        .status-shipped { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
        .status-delivered { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
        .status-cancelled { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
        .status-banned { background: #e5e7eb; color: #374151; border: 1px solid #d1d5db; }

        /* --- AUTH SCREEN --- */
        #auth-screen { position:fixed; inset:0; z-index:1000; background:white; display:grid; grid-template-columns:1fr 1fr; }
        .auth-left { background: #000; color:white; display:flex; flex-direction:column; justify-content:center; padding:80px; position: relative; overflow: hidden;}
        .auth-left::before { content:''; position: absolute; top: -50%; right: -50%; width: 100%; height: 100%; background: radial-gradient(circle, #2563eb 0%, transparent 60%); opacity: 0.4; filter: blur(60px); }
        .auth-right { display:flex; align-items:flex-start; justify-content:center; padding:40px 40px; overflow-y:auto; background: var(--bg-body); min-height:100vh; max-height:100vh; }

        /* --- REGISTRATION 2-STEP STYLES --- */
        .step-dot {
            width: 40px; 
            height: 40px; 
            border-radius: 50%; 
            background: var(--bg-subtle); 
            color: var(--text-muted); 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            font-weight: 700; 
            transition: var(--ease);
        }
        .step-dot.active {
            background: var(--primary);
            color: white;
        }

        .upload-zone {
            border: 2px dashed var(--border);
            border-radius: 12px;
            padding: 30px 20px;
            text-align: center;
            cursor: pointer;
            transition: var(--ease);
            background: var(--bg-subtle);
        }
        .upload-zone:hover {
            border-color: var(--primary);
            background: var(--primary-light);
        }

        /* --- MODALS --- */
        .modal { position:fixed; inset:0; background:rgba(15, 23, 42, 0.55); z-index:200; display:none; align-items:center; justify-content:center; backdrop-filter:blur(6px); transition: opacity 0.2s; }
        .modal.open { display:flex; opacity: 1; }
        .modal-box { 
            background: white; 
            width: 90%; 
            max-width: 550px; 
            padding: 32px; 
            border-radius: 16px; 
            max-height: 90vh; 
            overflow-y: auto; 
            box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); 
            animation: fadeIn 0.3s ease-out;
        }
        /* --- LIGHTBOX --- */
        #lightbox {
            position: fixed;
            inset: 0;
            background: rgba(2, 6, 23, 0.85);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1200;
            padding: 24px;
        }
        #lightbox.active { display: flex; }
        #lightbox img {
            max-width: 90vw;
            max-height: 90vh;
            border-radius: 12px;
            box-shadow: 0 25px 50px -12px rgba(0,0,0,0.45);
            background: white;
            object-fit: contain;
        }

        /* --- SKELETON LOADING (Fade Transition) --- */
        .skeleton { background: #e2e8f0; background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%); background-size: 200% 100%; animation: 1.5s shine linear infinite; border-radius: 6px; }
        @keyframes shine { to { background-position-x: -200%; } }
        .sk-card { height: 320px; border-radius: var(--radius); padding: 16px; background:white; display:flex; flex-direction:column; box-shadow: var(--shadow-sm); }
        .sk-img { height: 160px; width: 100%; margin-bottom: 20px; border-radius: 8px; }
        .sk-line { height: 12px; width: 80%; margin-bottom: 12px; }
        .sk-price { height: 20px; width: 40%; margin-top: auto; }

        /* --- CART DRAWER --- */
        #modal-cart { position: fixed; inset: 0; z-index: 500; pointer-events: none; display:block; }
        #modal-cart .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; transition: 0.3s; pointer-events: auto; display:none; backdrop-filter: blur(2px); }
        #modal-cart .cart-drawer { 
            position: absolute; top: 0; right: 0; bottom: 0; width: 100%; max-width: 450px; 
            background: white; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
            pointer-events: auto; display: flex; flex-direction: column; padding: 30px; box-shadow: -10px 0 30px rgba(0,0,0,0.1);
        }
        #modal-cart.open .modal-backdrop { opacity: 1; display:block; }
        #modal-cart.open .cart-drawer { transform: translateX(0); }

        /* --- VARIANTS & TOAST --- */
        .var-chip { padding:8px 14px; border:1px solid var(--border); border-radius:6px; cursor:pointer; font-weight:600; font-size:0.85rem; background:#fff; display:inline-block; margin:0 6px 6px 0; color: var(--text-main); transition: var(--ease); }
        .var-chip:hover { border-color: var(--primary); }
        .var-chip.selected { border-color:var(--primary); background:var(--primary-light); color:var(--primary); box-shadow: 0 0 0 1px var(--primary); }
        .var-chip.disabled { opacity:0.5; text-decoration:line-through; cursor:not-allowed; background: var(--bg-subtle); border-color: transparent; }
        
        /* Shake Animation Class */
        .shake-it { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; border-color: var(--accent-red) !important; background: var(--accent-red-bg); }

        .hidden { display:none!important; }
        #toast { 
            position: fixed; bottom: 30px; right: 30px; 
            background: #1e293b; color: white; 
            padding: 14px 24px; border-radius: 8px; 
            z-index: 5000; transform: translateY(150px); 
            transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            font-weight: 500; 
            box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1); 
            display: flex; align-items: center; gap: 10px;
        }
        #toast.show { transform: translateY(0); }

        /* --- GHOST ANIMATION ELEMENT --- */
        .fly-item {
            position: fixed; z-index: 9999;
            width: 50px; height: 50px;
            object-fit: cover; border-radius: 50%;
            pointer-events: none;
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
            animation: ghostFly 0.8s forwards ease-in-out;
        }

        /* --- STATUS ACTIONS MODERNIZATION --- */
.status-actions-container {
            display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

        .status-action-button {
            padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; 
            font-weight: 600; font-size: 0.85rem; cursor: pointer; 
            transition: var(--ease); display: flex; align-items: center; gap: 6px;
            text-transform: uppercase; letter-spacing: 0.5px;
        }
        .status-action-button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
        .status-action-btn-pending { 
            background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
        }
        .status-action-btn-pending:hover { background: #fde68a; }
        
        .status-action-btn-shipped { 
            background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe;
        }
        .status-action-btn-shipped:hover { background: #bfdbfe; }
        
        .status-action-btn-delivered { 
            background: #d1fae5; color: #047857; border: 1px solid #a7f3d0;
        }
        .status-action-btn-delivered:hover { background: #a7f3d0; }
        
        .status-action-btn-cancelled { 
            background: #fee2e2; color: #dc2626; border: 1px solid #fecaca;
        }
        .status-action-btn-cancelled:hover { background: #fecaca; }
        
        .status-action-dropdown {
            position: relative; display: inline-block;
        }
        .status-dropdown-menu {
            position: absolute; top: 100%; right: 0; background: white; 
            border: 1px solid var(--border); border-radius: 8px; 
            box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 100;
            min-width: 180px; overflow: hidden; opacity: 0; 
            pointer-events: none; transform: translateY(-10px); 
            transition: all 0.2s ease-out;
        }
        .status-action-dropdown.open .status-dropdown-menu {
            opacity: 1; pointer-events: auto; transform: translateY(8px);
        }
        .dropdown-item {
            padding: 12px 16px; border: none; background: none; 
            width: 100%; text-align: left; cursor: pointer; 
            font-weight: 500; color: var(--text-main); 
            transition: background 0.1s; border-bottom: 1px solid rgba(0,0,0,0.05);
        }
        .dropdown-item:last-child { border-bottom: none; }
        .dropdown-item:hover { background: var(--bg-subtle); }
        .dropdown-item.danger { color: var(--accent-red); }
        .dropdown-item.success { color: var(--accent-green); }
        
        /* Confirmation Modal */
        .confirmation-modal {
            position: fixed; inset: 0; z-index: 300; 
            background: rgba(15, 23, 42, 0.7); 
            display: none; align-items: center; justify-content: center;
            backdrop-filter: blur(6px);
        }
        .confirmation-modal.active { display: flex; animation: fadeIn 0.2s ease-out; }
        .confirmation-box {
            background: white; border-radius: 16px; padding: 32px; 
            max-width: 400px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
            animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .confirmation-box h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; color: var(--text-main); }
        .confirmation-box p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
        .confirmation-actions { display: flex; gap: 12px; }
        .confirmation-actions button { flex: 1; padding: 12px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: var(--ease); }
        
        /* --- MOBILE & RESPONSIVE OPTIMIZATIONS --- */
        @media(max-width:900px) { 
            #auth-screen { grid-template-columns:1fr; } 
            .auth-left { display:none; } 
            
            /* BOTTOM NAVIGATION TRANSFORMATION */
            aside { 
                position: fixed; bottom: 0; left: 0; width: 100%; height: 70px; 
                flex-direction: row; border-right: none; border-top: none; /* Removed border */
                justify-content: space-around; padding: 0; align-items: center;
                box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
                z-index: 100;
            }
            aside .brand, aside .nav-section, aside div:last-child { display: none; }
            
            #nav-content { display: flex; flex-direction: row; width: 100%; justify-content: space-around; }
            
            .nav-item { 
                flex-direction: column; padding: 6px; gap: 3px; font-size: 0.6rem; 
                border-radius: 0; margin: 0; background: transparent !important; text-align:center;
            }
            .nav-item i { font-size: 1rem; margin-bottom: 1px; }
            .nav-item.active { color: var(--primary); }
            
            main { padding-bottom: 80px; } 
            .top-bar { padding: 6px 10px; flex-wrap: wrap; gap: 8px; }
            .page-title { font-size: 0.85rem; }
            .content-scroll { padding: 10px; }
            .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
            .grid-stats { grid-template-columns: 1fr; gap: 16px; }
            .input-field, select, textarea { font-size: 14px; }
            .btn { min-height: 36px; }
            .btn.btn-primary, .btn.btn-outline { padding: 6px 10px; font-size: 0.85rem; }
            .btn.btn-sm { padding: 4px 8px; font-size: 0.75rem; }
            .card { padding: 12px; }
            .market-filters {
                border-radius: 14px;
                padding: 10px;
                gap: 8px;
            }
            .market-filters.collapsed {
                flex-wrap: nowrap;
                justify-content: space-between;
            }
            .filter-toggle {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                padding: 6px 10px;
                font-size: 0.8rem;
                border-radius: 10px;
                width: 38px;
                height: 38px;
                margin-left: auto;
            }
            .market-filters {
                flex-wrap: wrap;
                align-items: center;
            }
            .filter-search {
                width: auto;
                flex: 1;
            }
            .market-filters.collapsed .filter-select,
            .market-filters.collapsed .filter-sep {
                display: none;
            }
            .filter-search {
                width: 100%;
                min-width: 0;
                padding: 6px 10px;
                background: var(--bg-subtle);
                border-radius: 10px;
            }
            .filter-search .input-field {
                width: 100%;
                padding: 6px 0;
            }
            .filter-sep {
                display: none;
            }
            .filter-select {
                width: 100%;
                min-width: 0;
                background: var(--bg-subtle);
                border-radius: 10px;
                padding: 6px 10px;
            }
            #cart-btn { padding: 4px 10px; }
            #wallet-display { padding: 6px 8px; font-size: 0.75rem; }
            
            /* Mobile Sheet Modal - The Slide Up */
            .modal-box { 
                width: 100%; 
                max-width: 100%;
                border-radius: 18px 18px 0 0; 
                padding: 16px; 
                position: fixed;
                bottom: 0;
                left: 0;
                max-height: 85vh;
                margin: 0;
                animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            }
            .modal-box .grid-cols-2 { grid-template-columns: 1fr !important; }
            #mp-grid { grid-template-columns: 1fr !important; gap: 20px !important; }

            /* CARDIFICATION OF TABLES */
            .table-container { background: transparent; border: none; box-shadow: none; overflow: visible; }
            .table-container table, thead, tbody, th, td, tr { display: block; }
            .table-container thead tr { position: absolute; top: -9999px; left: -9999px; } 
            
            .table-container tr {
                margin-bottom: 12px;
                background: white;
                border: 1px solid transparent;
                border-radius: 12px;
                box-shadow: var(--shadow-sm);
                padding: 12px;
                position: relative;
            }
            
            .table-container td {
                border: none;
                position: relative;
                padding: 6px 0;
                text-align: right;
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 0.8rem;
            }

            /* Payouts: keep table layout like desktop on mobile */
            .payouts-table-wrap { overflow-x: auto; }
            .payouts-table-wrap { -webkit-overflow-scrolling: touch; }
            .payouts-table-wrap table { display: table; }
            .payouts-table-wrap thead { display: table-header-group; }
            .payouts-table-wrap tbody { display: table-row-group; }
            .payouts-table-wrap tr { display: table-row; }
            .payouts-table-wrap th,
            .payouts-table-wrap td { display: table-cell; }
            .payouts-table {
                min-width: 860px;
                border-collapse: separate;
                border-spacing: 0 12px;
                width: 100%;
            }
            .payouts-table thead tr { position: static; }
            .payouts-table th {
                font-size: 0.7rem;
                text-transform: uppercase;
                letter-spacing: 0.04em;
                color: var(--text-muted);
                padding: 8px 14px;
                text-align: left;
            }
            .payouts-table tbody tr {
                background: white;
                box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
                border-radius: 12px;
            }
            .payouts-table tbody td {
                padding: 12px 14px;
                font-size: 0.9rem;
                white-space: nowrap;
            }
            .payouts-table tbody tr td:first-child {
                border-top-left-radius: 12px;
                border-bottom-left-radius: 12px;
            }
            .payouts-table tbody tr td:last-child {
                border-top-right-radius: 12px;
                border-bottom-right-radius: 12px;
            }

            /* Sticky Add to Cart Bar */
            #mp-actions {
                position: sticky;
                bottom: -24px; /* Offset for padding */
                margin: 0 -24px -24px -24px;
                background: white;
                padding: 12px;
                border-top: 1px solid var(--border);
                box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
                z-index: 20;
            }

            /* Assistant chat spacing on mobile */
            .assistant-chat {
                height: calc(100vh - 200px);
                min-height: 320px;
            }
            .assistant-messages {
                padding: 10px;
            }
            .assistant-chat form[onsubmit="sendAssistantMessage(event)"] {
                flex-direction: column;
            }
            .assistant-chat form[onsubmit="sendAssistantMessage(event)"] textarea {
                min-height: 80px;
            }
            .assistant-chat form[onsubmit="sendAssistantMessage(event)"] .btn {
                width: 100%;
                justify-content: center;
            }
            .assistant-chat .btn.btn-outline {
                padding: 4px 8px;
                font-size: 0.75rem;
            }
            .assistant-header { flex-direction: column; align-items: flex-start; }
            .assistant-actions { width: 100%; }
            .assistant-actions .btn { width: 100%; justify-content: center; }
            .assistant-bubble { font-size: 0.85rem; max-width: 88%; }
            .assistant-avatar { width: 26px; height: 26px; border-radius: 8px; }
            .assistant-empty { padding: 28px 16px; }
            .assistant-empty-list { width: 100%; }

            /* Catalog cards: compact */
            .p-img { height: 90px; padding: 8px; }
            .p-info { padding: 8px; }
            .p-brand { font-size: 0.6rem; padding: 3px 6px; }
            .p-name { font-size: 0.75rem; height: 30px; margin-bottom: 8px; }
            .label { font-size: 0.65rem; }
            .value-lg { font-size: 0.85rem; }
            .p-profit-pill { font-size: 0.65rem; padding: 4px 6px; }

            /* Wallet: compact */
            .wallet-card { padding: 16px !important; margin-bottom: 20px !important; }
            .wallet-label { font-size: 0.85rem !important; }
            .wallet-amount { font-size: 2.1rem !important; }
            .wallet-actions { gap: 8px !important; margin-bottom: 10px !important; }
            .wallet-title { font-size: 0.95rem !important; }
            .wallet-export .btn { padding: 4px 8px; font-size: 0.75rem; }

            /* Product modal: compact */
            #mp-name { font-size: 1.2rem !important; margin: 8px 0 10px !important; }
            #mp-desc { font-size: 0.85rem !important; margin-bottom: 16px !important; }
            #mp-images { min-height: 200px; }
            #mp-brand { font-size: 0.65rem !important; padding: 3px 6px !important; }
            #mp-public-id { font-size: 0.7rem !important; }
            #mp-variants .var-chip { padding: 6px 10px; font-size: 0.75rem; }
            #mp-qty { height: 36px; font-size: 0.85rem; }
            #mp-actions .btn { padding: 8px 10px; font-size: 0.85rem; }
            #mp-gain, #mp-retail-price, #mp-wholesale { font-size: 1rem !important; }

        }
        .rtl #page-title { order: 2; margin-left: auto; }
        .rtl .top-bar > div:last-child { order: 1; margin-right: auto; }
        .rtl #cart-btn { order: 1; }
        .rtl #notif-btn { order: 2; }
        .rtl #wallet-display { order: 3; }

.cat-dd { position:relative; min-width:180px; }
.cat-dd-trigger {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    width:100%;
    border:1px solid var(--border);
    border-radius:12px;
    background:#ffffff;
    color:var(--text-main);
    padding:10px 12px;
    cursor:pointer;
    font-size:0.9rem;
    transition:box-shadow 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}
.cat-dd-trigger:hover { border-color: rgba(59,130,246,0.4); box-shadow:0 6px 16px rgba(59,130,246,0.12); }
.cat-dd.open .cat-dd-trigger { border-color: rgba(59,130,246,0.5); box-shadow:0 8px 18px rgba(59,130,246,0.16); }
.cat-dd-trigger i { font-size:0.75rem; opacity:0.7; transition:transform 0.2s ease; }
.cat-dd.open .cat-dd-trigger i { transform:rotate(180deg); }
.cat-dd-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cat-dd-menu {
    position:absolute;
    top:calc(100% + 6px);
    left:0;
    right:0;
    background:#ffffff;
    border:1px solid var(--border);
    border-radius:12px;
    padding:8px;
    max-height:280px;
    overflow:auto;
    z-index:50;
    display:none;
    box-shadow:0 16px 40px rgba(0,0,0,0.12);
}
.cat-dd.open .cat-dd-menu { display:block; }
.cat-option {
    display:flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius:10px;
    cursor:pointer;
    transition:background 0.15s ease, transform 0.1s ease;
}
.cat-option:hover { background:var(--bg-subtle); }
.cat-option-all { font-weight:600; }
.cat-expander,
.cat-expander-spacer {
    width:20px;
    height:20px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.cat-expander {
    border:1px solid rgba(59,130,246,0.35);
    border-radius:7px;
    background:rgba(59,130,246,0.08);
    font-size:0.8rem;
    line-height:1;
    cursor:pointer;
    color:var(--primary);
    transition:transform 0.1s ease, background 0.15s ease;
}
.cat-expander:hover { background:rgba(59,130,246,0.15); }
.cat-option-label { font-size:0.9rem; }
