    :root {
      --primary: #1a234e;       /* كحلي شعار Astrix Pharma */
      --primary-dark: #101636;
      --primary-light: #eef2ff;
      --accent: #7ac143;        /* أخضر ورقة الشعار */
      --accent-orange: #f59233; /* برتقالي الشعار */
      --accent-purple: #5b3a96; /* بنفسجي الشعار */
      --bg: #f4f6fa;
      --card: rgba(255, 255, 255, 0.96);
      --text: #1e293b;
      --muted: #64748b;
      --border: #e2e8f0;
      --green: #166534;
      --green-bg: #dcfce7;
      --orange: #d97706;
      --orange-bg: #fef3c7;
      --red: #dc2626;
      --red-bg: #fee2e2;
    }
    * { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
    body {
      margin: 0;
      background-color: var(--bg);
      color: var(--text);
      position: relative;
      min-height: 100vh;
    }
    /* علامة مائية شفافة للشعار في خلفية الموقع بالكامل */
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      background-image: url('../astrix-logo.png');
      background-repeat: no-repeat;
      background-position: center center;
      background-size: 520px auto;
      opacity: 0.05;
      pointer-events: none;
      z-index: 0;
    }
    #appWrapper, .modal-backdrop { position: relative; z-index: 1; }

    /* خلفية شاشة تسجيل الدخول بألوان الهوية مع الشعار */
    .login-screen {
      position: fixed; inset: 0;
      background: radial-gradient(circle at top right, #283575 0%, #1a234e 55%, #0e132e 100%);
      display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000;
      overflow: hidden;
    }
    .login-screen::before {
      content: "";
      position: absolute;
      width: 680px; height: 680px;
      background-image: url('../astrix-logo.png');
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
      opacity: 0.06;
      pointer-events: none;
    }
    .login-card {
      position: relative; z-index: 2;
      background: #ffffff; border-radius: 18px; max-width: 420px; width: 100%; padding: 32px 28px;
      box-shadow: 0 24px 48px rgba(0,0,0,0.38); text-align: center;
      border-top: 5px solid var(--accent);
    }
    .login-logo { height: 74px; width: auto; max-width: 100%; margin-bottom: 14px; object-fit: contain; }
    .login-card h2 { margin: 0 0 4px; color: var(--primary); font-size: 21px; font-weight: 800; }
    .login-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
    .login-err { color: #b91c1c; font-size: 13px; font-weight: 600; margin-top: 10px; min-height: 18px; }
    .login-ok { color: #166534; font-size: 13px; font-weight: 600; margin-top: 10px; }

    /* الهيدر العلوي متدرج من الغامق يساراً إلى الفاتح يميناً */
    header {
      background: linear-gradient(90deg, #090e24 0%, #162152 38%, #2b3f94 74%, #4c66d4 100%);
      color: #fff; padding: 12px 24px;
      display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
      box-shadow: 0 4px 14px rgba(9, 14, 36, 0.25);
      border-bottom: 3px solid #2dd4bf;
    }
    .header-left { display: flex; align-items: center; gap: 14px; }
    .brand-logo-box {
      background: #ffffff; padding: 6px 14px; border-radius: 10px; display: flex; align-items: center;
      justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    .brand-logo-box img { height: 42px; width: auto; display: block; object-fit: contain; }
    header h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: 0.2px; }
    header p { margin: 2px 0 0; font-size: 12px; opacity: 0.92; font-weight: 500; }
    .header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

    .avatar-trigger {
      position: relative; width: 42px; height: 42px; border-radius: 50%;
      border: 2px solid #2dd4bf; background: #101636; color: #fff;
      display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
      overflow: hidden; cursor: pointer; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    }
    .avatar-trigger img { width: 100%; height: 100%; object-fit: cover; }
    .avatar-trigger:hover::after {
      content: "📷"; position: absolute; inset: 0; background: rgba(0,0,0,0.55);
      display: flex; align-items: center; justify-content: center; font-size: 15px;
    }

    .table-avatar {
      width: 34px; height: 34px; border-radius: 50%; background: #e0e7ff; color: #1a234e;
      display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
      overflow: hidden; vertical-align: middle; border: 1px solid #cbd5e1;
    }
    .table-avatar img { width: 100%; height: 100%; object-fit: cover; }

    .container { max-width: 1360px; margin: 20px auto; padding: 0 16px; }

    .dashboard-title-bar {
      background: linear-gradient(90deg, #e8edff 0%, #f4f7ff 55%, #ffffff 100%);
      padding: 12px 18px; border-radius: 10px; border: 1px solid #d8e1ff;
      font-size: 16px; font-weight: 800; color: var(--primary); margin-bottom: 14px;
      display: flex; align-items: center; justify-content: space-between;
      border-left: 5px solid #162152; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    }
    .kpi-section-title {
      font-size: 12px; font-weight: 700; color: #475569; text-transform: uppercase;
      margin: 14px 0 7px 2px; letter-spacing: 0.6px; display: flex; align-items: center; gap: 6px;
    }
    .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
    .kpi {
      background: var(--card); padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border);
      cursor: pointer; transition: transform 0.14s, box-shadow 0.14s; box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    }
    .kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(26, 35, 78, 0.1); border-color: #2dd4bf; }
    .kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
    .kpi .val { font-size: 24px; font-weight: 800; color: var(--primary); margin-top: 4px; }

    .filters {
      background: var(--card); padding: 14px; border-radius: 12px; border: 1px solid var(--border);
      display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto auto; gap: 8px; margin-bottom: 18px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    }
    @media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 600px) { .filters { grid-template-columns: 1fr; } }
    input, select, textarea {
      width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
      font-size: 14px; outline: none; background: #fff; transition: border-color 0.15s;
    }
    input:focus, select:focus, textarea:focus { border-color: var(--primary); }
    .btn {
      padding: 9px 14px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
      cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; text-decoration: none;
      position: relative; overflow: hidden; white-space: nowrap; transition: opacity 0.15s, transform 0.1s;
    }
    .btn:hover { opacity: 0.92; }
    .btn:disabled { opacity: 0.6; cursor: not-allowed; }
    .btn-primary { background: var(--primary); color: #fff; }
    /* زر Scan Card باللون الأخضر الفاتح المائي */
    .btn-scan { background: linear-gradient(135deg, #2dd4bf, #14b8a6); color: #042f2e; font-weight: 800; box-shadow: 0 2px 8px rgba(45, 212, 191, 0.35); }
    .btn-export { background: #5b3a96; color: #fff; }
    .btn-excel { background: #15803d; color: #fff; }
    .btn-pdf { background: #b91c1c; color: #fff; }
    .btn-admin { background: var(--accent-orange); color: #ffffff; }
    .btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
    .btn-danger { background: #fee2e2; color: #991b1b; }
    .btn-wa { background: #25D366; color: #fff; }

    .file-overlay-input {
      position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10;
    }

    .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(345px, 1fr)); gap: 16px; }
    .card {
      background: var(--card); border-radius: 12px; border: 1px solid var(--border);
      padding: 18px; display: flex; flex-direction: column; justify-content: space-between;
      box-shadow: 0 2px 6px rgba(0,0,0,0.03); transition: box-shadow 0.15s;
    }
    .card:hover { box-shadow: 0 8px 20px rgba(26, 35, 78, 0.09); }
    .card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
    .company-name { font-size: 16px; font-weight: 800; color: var(--primary); margin: 0; }
    .sub-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

    .badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
    .badge-approved { background: var(--green-bg); color: var(--green); }
    /* Conditional بلون أصفر/برتقالي مثل Medium و Rejected بلون أحمر فاتح مثل High */
    .badge-conditional { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }
    .badge-rejected { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

    .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
    .tag { background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
    .tag-gray { background: #f1f5f9; color: #334155; }

    .info-row { font-size: 13px; margin: 5px 0; color: #334155; line-height: 1.45; }
    .copyable { cursor: pointer; border-bottom: 1px dashed #94a3b8; }
    .copyable:hover { color: var(--primary); }

    .notes-box {
      background: #f8fafc; border-left: 3px solid var(--accent); padding: 9px 11px;
      font-size: 12px; color: #475569; margin-top: 10px; border-radius: 6px; white-space: pre-line;
    }
    .card-actions {
      display: flex; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap;
    }

    .table-wrapper {
      background: var(--card); border-radius: 12px; border: 1px solid var(--border);
      display: none; box-shadow: 0 2px 8px rgba(0,0,0,0.04); overflow: hidden;
    }
    .table-scroll-controls {
      display: flex; align-items: center; justify-content: space-between; gap: 10px;
      padding: 8px 14px; background: #f1f5f9; border-bottom: 1px solid var(--border);
      font-size: 12px; color: var(--primary); font-weight: 700; flex-wrap: wrap;
    }
    .table-scroll-btns { display: flex; gap: 6px; align-items: center; }
    .table-top-scroll {
      overflow-x: auto; overflow-y: hidden; height: 16px;
      background: #e2e8f0; border-bottom: 1px solid #cbd5e1;
    }
    .table-top-scroll-inner { height: 1px; }
    .table-scroll-container {
      overflow-x: auto; overflow-y: auto; max-height: 70vh; width: 100%;
    }
    .table-top-scroll::-webkit-scrollbar,
    .table-scroll-container::-webkit-scrollbar {
      height: 13px; width: 10px;
    }
    .table-top-scroll::-webkit-scrollbar-track,
    .table-scroll-container::-webkit-scrollbar-track {
      background: #e2e8f0; border-radius: 6px;
    }
    .table-top-scroll::-webkit-scrollbar-thumb,
    .table-scroll-container::-webkit-scrollbar-thumb {
      background: #1a234e; border-radius: 6px; border: 2px solid #e2e8f0;
    }
    .table-top-scroll::-webkit-scrollbar-thumb:hover,
    .table-scroll-container::-webkit-scrollbar-thumb:hover {
      background: #14b8a6;
    }
    .vendors-table {
      width: 100%; min-width: 2250px; border-collapse: separate; border-spacing: 0; font-size: 13px;
    }
    .vendors-table th, .vendors-table td {
      padding: 11px 13px; border-bottom: 1px solid var(--border); border-right: 1px solid #f1f5f9;
      text-align: left; vertical-align: top;
    }
    .vendors-table th {
      position: sticky; top: 0; z-index: 3;
      background: #f1f5f9; font-weight: 700; color: var(--primary); white-space: nowrap;
      border-bottom: 2px solid #cbd5e1;
    }
    .vendors-table th:first-child,
    .vendors-table td:first-child {
      position: sticky; left: 0; min-width: 230px; max-width: 270px;
      box-shadow: 3px 0 8px rgba(15, 23, 42, 0.06);
    }
    .vendors-table th:first-child { z-index: 4; background: #e8edff; }
    .vendors-table td:first-child { z-index: 2; background: #ffffff; }
    .vendors-table tr:hover td { background: #f8fafc; }
    .vendors-table tr:hover td:first-child { background: #f1f5ff; }
    .tbl-notes-cell {
      max-width: 340px; min-width: 240px; max-height: 92px; overflow-y: auto;
      white-space: pre-line; font-size: 12px; color: #475569; line-height: 1.4;
    }

    .modal-backdrop {
      position: fixed; inset: 0; background: rgba(16, 22, 54, 0.68); display: none;
      align-items: center; justify-content: center; padding: 10px; z-index: 1000; overflow-y: auto;
    }
    .modal {
      background: #fff; border-radius: 14px; max-width: 720px; width: 100%; padding: 22px;
      max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 35px rgba(0,0,0,0.28);
      border-top: 4px solid #2dd4bf;
    }
    .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    @media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
    .form-group { margin-bottom: 12px; text-align: left; }
    .form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #334155; }
    .full-width { grid-column: 1 / -1; }

    .scan-box {
      border: 2px dashed #14b8a6; background: #f0fdfa; border-radius: 10px;
      padding: 16px; text-align: center; margin-bottom: 16px;
    }
    .scan-status { font-size: 13px; font-weight: 600; color: #0f766e; margin-top: 10px; }
    .drive-badge {
      display: none; margin-top: 8px; padding: 6px 10px; background: #dbeafe;
      color: #1e40af; border-radius: 6px; font-size: 12px; font-weight: 600;
    }
    .preview-gallery { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
    .preview-item {
      position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
      border: 1px solid #cbd5e1; background: #fff; display: flex; align-items: center; justify-content: center;
      font-size: 10px; font-weight: bold; color: var(--primary);
    }
    .preview-item img { width: 100%; height: 100%; object-fit: cover; }
    .checkbox-group {
      display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #f8fafc;
      padding: 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px;
    }
    @media (max-width: 600px) { .checkbox-group { grid-template-columns: 1fr; } }
    .checkbox-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
    .checkbox-group input[type="checkbox"] { width: auto; }
    .loader { text-align: center; padding: 50px; color: var(--muted); font-size: 15px; }

    .users-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
    .users-table th, .users-table td { padding: 8px 9px; border-bottom: 1px solid var(--border); text-align: left; }
    .users-table th { background: #f3f4f6; font-weight: 700; color: var(--primary); }

    .tab-bar { display: flex; gap: 8px; border-bottom: 2px solid var(--border); margin-bottom: 14px; padding-bottom: 8px; }
    .tab-btn { padding: 7px 14px; border-radius: 6px; border: none; font-weight: 700; font-size: 13px; cursor: pointer; background: #f3f4f6; color: #374151; }
    .tab-btn.active { background: var(--primary); color: #fff; }

    .export-section {
      background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: 14px; margin-bottom: 12px;
    }
    .export-section h4 { margin: 0 0 8px; font-size: 14px; color: var(--primary); }

    .toast {
      position: fixed; bottom: 20px; right: 20px; background: var(--primary); color: #fff;
      padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
      box-shadow: 0 4px 12px rgba(0,0,0,0.25); border-left: 4px solid #2dd4bf; z-index: 3000; display: none;
    }

