/* =========================================
   1. الإعدادات الأساسية (Main Settings & Theme Variables)
   ========================================= */
:root { 
    /* المتغيرات الأساسية للنظام القديم */
    --brand-orange: #F59E0B; 
    --brand-dark: #1E293B; 

    /* متغيرات التصميم الجديد - الوضع الليلي (الافتراضي للوحة الإدارة) */
    --bg: #0a0d14; 
    --bg2: #111520; 
    --bg3: #161c2e; 
    --card: #1a2035; 
    --card2: #1f2740;
    --gold: #f5a623; 
    --gold2: #ffcc5c; 
    --orange: #ff6b2b; 
    --accent: #4f9fff;
    --green: #22d3a5; 
    --red: #ff4d6d; 
    --purple: #a855f7; 
    --text: #e8ecf5; 
    --text2: #8b95b0; 
    --text3: #5a6380;
    --border: rgba(255,255,255,0.07); 
    --glow: rgba(245,166,35,0.15);
}

body.light-mode {
    /* متغيرات التصميم الجديد - الوضع النهاري */
    --bg: #f0f4ff; 
    --bg2: #e8eef9; 
    --bg3: #dde5f5; 
    --card: #fff; 
    --card2: #f7f9ff;
    --gold: #d4870a; 
    --gold2: #b36b00; 
    --orange: #e5531a; 
    --accent: #1a6fd4;
    --green: #0ea87a; 
    --red: #d42045; 
    --purple: #7c3aed; 
    --text: #1a2035; 
    --text2: #4a5570; 
    --text3: #8090b0;
    --border: rgba(0,0,0,0.08); 
    --glow: rgba(245,166,35,0.08);
}

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Cairo:wght@300;400;600;700;900&display=swap');

body { font-family: 'Tajawal', sans-serif; background-color: #F1F5F9; color: #1E293B; overflow-x: hidden; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; transition: all 0.4s; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.will-change-transform { will-change: transform, opacity; }

/* دعم الإنجليزية (LTR) */
body[dir="ltr"] { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body[dir="ltr"] .fa-arrow-left { transform: rotate(180deg); }
body[dir="ltr"] .fa-arrow-right { transform: rotate(180deg); }

/* =========================================
   2. شاشة الدخول الجديدة (New Login UI)
   ========================================= */
#login-view {
  --lg-gold: #E8970A;
  --lg-gold2: #F5B730;
  --lg-gold3: #FDD16A;
  --lg-gold-dark: #BF7A08;
  --lg-navy: #0B1D3A;
  --lg-navy2: #132847;
  --lg-navy3: #1A3A6B;
  --lg-navy-card: #142035;
  --lg-navy-border: #1E3055;
  --lg-bg: #EFF3FB;
  --lg-bg2: #E4ECF7;
  --lg-white: #FFFFFF;
  --lg-text: #0B1D3A;
  --lg-muted: #6B82A8;
  --lg-border: #D6E2F0;
  --lg-input: #F5F8FE;

  position: fixed; inset: 0; z-index: 99999;
  background: var(--lg-bg);
  font-family: 'Cairo', sans-serif;
  overflow-x: hidden; overflow-y: auto;
  
  /* تجاوز خصائص الـ Flex القديمة لضمان تمدد الشاشة 100% في الجوال */
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  flex-direction: column !important;
  width: 100%;
  height: 100%;
}

#login-view .bg-layer { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; width: 100vw; height: 100vh; }
#login-view .bg-grad { position: absolute; inset: 0; background: linear-gradient(145deg,#E8F0FD 0%,#F5F8FF 40%,#FEF6E4 80%,#FDF0C8 100%); }
#login-view .dot-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle,rgba(11,29,58,0.1) 1px,transparent 1px);
  background-size: 32px 32px;
  animation: driftGrid 35s linear infinite;
}
@keyframes driftGrid { 0% {background-position:0 0;} 100% {background-position:64px 64px;} }
#login-view .blob { position: absolute; border-radius: 50%; filter: blur(70px); animation: blobPulse ease-in-out infinite; }
#login-view .b1 { width: 500px; height: 500px; top: -120px; right: -100px; background: radial-gradient(circle,rgba(232,151,10,0.18) 0%,transparent 70%); animation-duration: 8s; }
#login-view .b2 { width: 400px; height: 400px; bottom: -80px; left: -80px; background: radial-gradient(circle,rgba(11,29,58,0.12) 0%,transparent 70%); animation-duration: 11s; animation-delay: 2s; }
#login-view .b3 { width: 280px; height: 280px; top: 45%; left: 45%; transform: translate(-50%,-50%); background: radial-gradient(circle,rgba(245,183,48,0.1) 0%,transparent 70%); animation-duration: 7s; animation-delay: 1s; }
@keyframes blobPulse { 0%,100% {transform:scale(1) translate(0,0);} 50% {transform:scale(1.08) translate(12px,-12px);} }
#login-view .geo { position: absolute; opacity: 0.06; animation: geoSpin linear infinite; pointer-events: none; }
#login-view .geo svg { display: block; }
#login-view .g1 { top: 6%; right: 6%; width: 80px; animation-duration: 24s; }
#login-view .g2 { bottom: 18%; left: 5%; width: 60px; animation-duration: 19s; animation-direction: reverse; }
#login-view .g3 { top: 38%; left: 4%; width: 40px; animation-duration: 30s; }
#login-view .g4 { top: 22%; left: 12%; width: 50px; animation-duration: 20s; animation-direction: reverse; }
@keyframes geoSpin { from{transform:rotate(0deg);} to{transform:rotate(360deg);} }

@keyframes fadeUpAni { from{opacity:0;transform:translateY(20px);} to{opacity:1;transform:translateY(0);} }
@keyframes shimLine { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }
@keyframes btnShine { 0%,65%,100%{left:-100%;} 35%{left:130%;} }
@keyframes logoPop { from{opacity:0;transform:scale(0.4) rotate(-20deg);} to{opacity:1;transform:scale(1) rotate(0deg);} }
@keyframes iconPop { from{opacity:0;transform:scale(0.3) rotate(-30deg);} to{opacity:1;transform:scale(1) rotate(0);} }

#login-view .shimmer-bar {
  position: absolute; top: 0; left: 15%; right: 15%; height: 3px;
  background: linear-gradient(90deg,transparent,var(--lg-gold),var(--lg-gold2),var(--lg-gold3),var(--lg-gold2),var(--lg-gold),transparent);
  background-size: 200% 100%;
  animation: shimLine 2.5s linear infinite;
}
#login-view .lg-field { margin-bottom: 18px; text-align: right; }
#login-view .lg-field-lbl { font-size: 11px; font-weight: 700; color: var(--lg-muted); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 9px; display: block; }
#login-view .lg-field-box { position: relative; display: flex; align-items: center; }
#login-view .lg-field-box input {
  width: 100%; background: var(--lg-input) !important; border: 2px solid var(--lg-border) !important; border-radius: 14px !important;
  padding: 14px 46px 14px 14px !important; color: var(--lg-text) !important;
  font-family: 'Cairo', sans-serif !important; font-size: 15px !important; font-weight: 500 !important;
  outline: none !important; transition: all 0.3s !important; text-align: right !important;
  -webkit-appearance: none !important; box-shadow: none !important;
}
#login-view .lg-field-box input:focus { border-color: var(--lg-gold) !important; background: #FFFDF6 !important; box-shadow: 0 0 0 4px rgba(232,151,10,0.1) !important; }
#login-view .lg-field-box input::placeholder { color: #B8C9DF !important; font-weight: 300 !important; }
#login-view .ficon { position: absolute; right: 14px; color: #C0D0E8; transition: color 0.3s; pointer-events: none; }
#login-view .lg-field-box:focus-within .ficon { color: var(--lg-gold); }
#login-view .eye-btn {
  position: absolute; left: 14px; background: none; border: none; cursor: pointer;
  color: #C0D0E8; transition: color 0.3s; padding: 6px; display: flex;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
#login-view .eye-btn:hover { color: var(--lg-gold); }
#login-view .opts-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; direction: rtl; }
#login-view .chk { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
#login-view .chk input { display: none; }
#login-view .chkbox {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--lg-border); background: var(--lg-input);
  display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;
}
#login-view .chk input:checked ~ .chkbox {
  background: linear-gradient(135deg, var(--lg-gold), var(--lg-gold2));
  border-color: transparent; box-shadow: 0 2px 8px rgba(232,151,10,0.35);
}
#login-view .chk input:checked ~ .chkbox::after { content: '✓'; color: #fff; font-size: 13px; font-weight: 800; }
#login-view .chk-lbl { font-size: 13px; color: var(--lg-muted); }
#login-view .forgot { font-size: 13px; color: var(--lg-gold); font-weight: 700; text-decoration: none; }
#login-view .forgot:hover { text-decoration: underline; }
#login-view .lg-btn {
  width: 100%; padding: 17px;
  background: linear-gradient(135deg, var(--lg-gold-dark), var(--lg-gold) 40%, var(--lg-gold2) 70%, var(--lg-gold3));
  background-size: 250% 100%; background-position: 0% 0%;
  border: none; border-radius: 16px; color: var(--lg-navy);
  font-family: 'Cairo', sans-serif; font-size: 16px; font-weight: 800; cursor: pointer;
  transition: all 0.5s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 6px 24px rgba(232,151,10,0.45);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; letter-spacing: 0.3px;
}
#login-view .lg-btn:hover { background-position: 100% 0%; box-shadow: 0 8px 36px rgba(232,151,10,0.6); transform: translateY(-2px); }
#login-view .lg-btn:active { transform: scale(0.97); }
#login-view .lg-btn .shine {
  position: absolute; top: 0; left: -100%; width: 55%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: skewX(-20deg); animation: btnShine 3s ease-in-out infinite;
}
#login-view .step-dots { display: flex; align-items: center; gap: 5px; }
#login-view .sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--lg-border); transition: all 0.4s; }
#login-view .sdot.on { width: 20px; border-radius: 4px; background: linear-gradient(90deg, var(--lg-gold), var(--lg-gold2)); }
#login-view .card-foot { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#login-view .secure { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--lg-muted); }
#login-view .secure svg { width: 13px; height: 13px; color: var(--lg-gold); }
#login-view .powered { font-size: 10px; color: #C0CEDF; letter-spacing: 0.5px; }

#login-view .lg-desktop-view { display: none; }
#login-view .lg-mobile-view { display: block; position: relative; z-index: 10; width: 100%; flex: 1; }

@media(min-width:768px) {
  #login-view .lg-desktop-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; position: relative; z-index: 10; flex: 1; }
  #login-view .lg-mobile-view { display: none; }

  #login-view .side-panel {
    position: fixed; left: 0; top: 0; bottom: 0; width: 38%;
    background: linear-gradient(160deg, var(--lg-navy) 0%, var(--lg-navy2) 60%, var(--lg-navy3) 100%);
    clip-path: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);
    display: flex; flex-direction: column; align-items: flex-start;
    justify-content: center; padding: 60px 80px 60px 50px;
    animation: panelSlide 1s cubic-bezier(0.16,1,0.3,1) both;
    z-index: 5; text-align: right;
  }
  @keyframes panelSlide { from{transform:translateX(-100%);opacity:0;} to{transform:translateX(0);opacity:1;} }
  #login-view .side-line-bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--lg-gold), var(--lg-gold2), var(--lg-gold3), transparent); }
  #login-view .hdr-dots { position: absolute; inset: 0; background-image: radial-gradient(circle,rgba(255,255,255,0.05) 1px,transparent 1px); background-size: 22px 22px; }
  #login-view .side-logo {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--lg-gold-dark), var(--lg-gold), var(--lg-gold2));
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    margin-bottom: 30px; box-shadow: 0 8px 30px rgba(232,151,10,0.5);
    animation: logoPop 1.2s cubic-bezier(0.34,1.56,0.64,1) 0.4s both;
  }
  #login-view .side-logo svg { width: 36px; height: 36px; color: #0B1D3A; }
  #login-view .side-tag { font-size: 11px; font-weight: 700; letter-spacing: 3px; color: var(--lg-gold2); margin-bottom: 14px; text-transform: uppercase; opacity: 0; animation: fadeUpAni 0.8s ease 0.7s forwards; }
  #login-view .side-title { font-size: 36px; font-weight: 900; color: #fff; line-height: 1.2; margin-bottom: 14px; opacity: 0; animation: fadeUpAni 0.8s ease 0.9s forwards; }
  #login-view .side-title span { color: var(--lg-gold2); }
  #login-view .side-desc { font-size: 14px; font-weight: 300; color: rgba(255,255,255,0.5); line-height: 1.8; max-width: 270px; opacity: 0; animation: fadeUpAni 0.8s ease 1.1s forwards; }
  #login-view .side-stats { display: flex; gap: 16px; margin-top: 36px; opacity: 0; animation: fadeUpAni 0.8s ease 1.3s forwards; }
  #login-view .sstat { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 14px 18px; backdrop-filter: blur(10px); }
  #login-view .sstat-n { font-size: 22px; font-weight: 900; color: var(--lg-gold2); }
  #login-view .sstat-l { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }

  #login-view .desktop-card-wrap { margin-right: 0; margin-left: auto; width: 460px; padding: 20px; animation: cardEntrance 0.9s cubic-bezier(0.16,1,0.3,1) 0.5s both; }
  @keyframes cardEntrance { from{opacity:0;transform:translateY(50px) scale(0.96);} to{opacity:1;transform:translateY(0) scale(1);} }
  #login-view .desktop-card {
    background: var(--lg-white); border-radius: 28px; padding: 44px 40px; text-align: right;
    box-shadow: 0 2px 0 var(--lg-border), 0 24px 70px rgba(11,29,58,0.14), 0 4px 16px rgba(11,29,58,0.06);
    position: relative; overflow: hidden;
  }
  #login-view .welcome-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  #login-view .hi-badge {
    display: flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #FFF8E6, #FFF1C2);
    border: 1px solid rgba(232,151,10,0.2);
    border-radius: 30px; padding: 5px 14px; font-size: 12px; font-weight: 700; color: var(--lg-gold);
  }
  #login-view .time-chip { font-size: 12px; color: var(--lg-muted); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
  #login-view .card-title { font-size: 26px; font-weight: 900; color: var(--lg-text); margin-bottom: 4px; margin-top: 20px; }
  #login-view .card-sub { font-size: 13px; color: var(--lg-muted); margin-bottom: 28px; }
  #login-view .vpill { position: absolute; top: 14px; left: 14px; background: var(--lg-bg2); border: 1px solid var(--lg-border); border-radius: 20px; padding: 4px 12px; font-size: 10px; font-weight: 700; color: var(--lg-muted); letter-spacing: 1px; }
}

@media(max-width:767px) {
  #login-view .top-header {
    position: relative; z-index: 10;
    background: linear-gradient(135deg, var(--lg-navy) 0%, var(--lg-navy2) 60%, var(--lg-navy3) 100%);
    padding: 52px 22px 72px;
    border-radius: 0 0 36px 36px; overflow: hidden;
    animation: headerDrop 0.9s cubic-bezier(0.16,1,0.3,1) both; text-align: right;
  }
  @keyframes headerDrop { from{opacity:0;transform:translateY(-100%);} to{opacity:1;transform:translateY(0);} }
  #login-view .top-header::after {
    content: ''; position: absolute; bottom: 0; left: 10%; right: 10%; height: 3px;
    background: linear-gradient(90deg,transparent,var(--lg-gold),var(--lg-gold2),var(--lg-gold3),var(--lg-gold2),var(--lg-gold),transparent);
    background-size: 200% 100%; animation: shimLine 2.5s linear infinite; border-radius: 2px 2px 0 0;
  }
  #login-view .hdr-dots { position: absolute; inset: 0; background-image: radial-gradient(circle,rgba(255,255,255,0.06) 1px,transparent 1px); background-size: 20px 20px; }
  #login-view .hdr-inner { position: relative; z-index: 2; }
  #login-view .hdr-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
  #login-view .logo-pill {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 40px; padding: 8px 14px; backdrop-filter: blur(10px);
  }
  #login-view .logo-icon {
    width: 34px; height: 34px; background: linear-gradient(135deg, var(--lg-gold), var(--lg-gold2));
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(232,151,10,0.4); animation: iconPop 1s cubic-bezier(0.34,1.56,0.64,1) 0.5s both;
  }
  #login-view .logo-icon svg { width: 18px; height: 18px; color: #0B1D3A; }
  #login-view .logo-name { font-size: 14px; font-weight: 800; color: #fff; }
  #login-view .logo-sub { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 1px; }
  #login-view .time-chip-mob {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 700;
    color: var(--lg-gold2); letter-spacing: 1px; font-variant-numeric: tabular-nums;
  }
  #login-view .hdr-greeting { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.5); margin-bottom: 6px; letter-spacing: 0.5px; animation: fadeUpAni 0.7s ease 0.7s both; }
  #login-view .hdr-title { font-size: 28px; font-weight: 900; color: #fff; line-height: 1.2; animation: fadeUpAni 0.7s ease 0.9s both; }
  #login-view .hdr-title span { color: var(--lg-gold2); }
  #login-view .stats-row { display: flex; gap: 10px; margin-top: 20px; animation: fadeUpAni 0.7s ease 1.1s both; }
  #login-view .mob-stat { flex: 1; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(8px); }
  #login-view .mob-stat-n { font-size: 18px; font-weight: 900; color: var(--lg-gold2); }
  #login-view .mob-stat-l { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 1px; }

  #login-view .mobile-card-wrap { position: relative; z-index: 10; margin: -36px 16px 0; animation: cardUp 0.9s cubic-bezier(0.16,1,0.3,1) 0.4s both; }
  @keyframes cardUp { from{opacity:0;transform:translateY(60px);} to{opacity:1;transform:translateY(0);} }
  #login-view .mobile-card {
    background: var(--lg-white); border-radius: 28px; padding: 32px 22px 28px; text-align: right;
    box-shadow: 0 20px 60px rgba(11,29,58,0.14), 0 4px 16px rgba(11,29,58,0.06);
    position: relative; overflow: hidden;
  }
  #login-view .mob-welcome { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
  #login-view .hi-badge-mob {
    display: flex; align-items: center; gap: 6px; background: linear-gradient(135deg, #FFF8E6, #FFF1C2);
    border: 1px solid rgba(232,151,10,0.2); border-radius: 30px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--lg-gold);
  }
  #login-view .mob-card-title { font-size: 22px; font-weight: 900; color: var(--lg-text); margin-bottom: 3px; }
  #login-view .mob-card-sub { font-size: 12px; color: var(--lg-muted); margin-bottom: 22px; }
}

/* =========================================
   3. الحقول والأزرار العامة
   ========================================= */
.form-label { font-size: 13px; font-weight: 800; color: #334155; margin-bottom: 6px; display: block; }
.input-box, .select-box { 
    width: 100%; background-color: #FFFFFF !important; color: #1E293B !important;
    border: 1.5px solid #CBD5E1; padding: 12px 14px; border-radius: 12px;
    outline: none; transition: all 0.2s ease; font-size: 13px; font-weight: 600; 
    appearance: none; -webkit-appearance: none;
}
.select-wrapper { position: relative; }
.select-wrapper::after {
    content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    color: #64748B; pointer-events: none; font-size: 14px;
}
body[dir="ltr"] .select-wrapper::after { right: 15px; left: auto; }
.input-box:focus, .select-box:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
select option { background-color: #FFF; color: #1E293B; padding: 10px; font-weight: bold; }

/* =========================================
   4. بطاقات الشحنات (Shipment Cards)
   ========================================= */
.shipment-card {
    background: white; border-radius: 16px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease; 
    position: relative; overflow: hidden; display: flex; flex-direction: column; height: 100%;
    border: 1px solid #E2E8F0; contain: content; transform: translateZ(0);
}
.shipment-card:hover { transform: translateY(-3px); box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1); }

.card-status-strip { height: 8px; width: 100%; position: absolute; top: 0; left: 0; }
.st-transit .card-status-strip { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.st-done .card-status-strip { background: linear-gradient(90deg, #10B981, #34D399); }
.st-returned .card-status-strip { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.st-cancelled .card-status-strip { background: linear-gradient(90deg, #EF4444, #F87171); }

.status-badge { padding: 6px 14px; border-radius: 20px; font-size: 11px; font-weight: 800; display: inline-flex; items-center; gap: 6px; }
.bg-st-transit { background: #FFF7ED; color: #C2410C; border: 1px solid #FFEDD5; }
.bg-st-done { background: #ECFDF5; color: #047857; border: 1px solid #D1FAE5; }
.bg-st-returned { background: #F5F3FF; color: #6D28D9; border: 1px solid #DDD6FE; }
.bg-st-cancelled { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.type-badge-company { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.type-badge-mukhrig { background: #FDF4FF; color: #9333EA; border: 1px solid #E9D5FF; }

/* =========================================
   5. خط الزمن والنوافذ (Timeline & Modals)
   ========================================= */
.timeline-container { margin-top: auto; padding: 15px; background: #F8FAFC; border-top: 1px solid #E2E8F0; position: relative; }
.timeline-line { position: absolute; top: 24px; left: 35px; right: 35px; height: 2px; background: #E2E8F0; z-index: 1; }
.timeline-flex { display: flex; justify-content: space-between; position: relative; z-index: 2; }
.t-step { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 48%; }
.t-point { width: 16px; height: 16px; border-radius: 50%; background: #CBD5E1; border: 3px solid white; box-shadow: 0 0 0 1px #E2E8F0; transition: 0.3s; }
.t-point.active { background: #F59E0B; box-shadow: 0 0 0 2px #FFEDD5; }
.t-point.done { background: #10B981; box-shadow: 0 0 0 2px #D1FAE5; }
.t-point.returned { background: #7C3AED; box-shadow: 0 0 0 2px #DDD6FE; }
.t-point.cancelled { background: #EF4444; box-shadow: 0 0 0 2px #FEE2E2; }
.t-label { font-size: 10px; font-weight: 700; color: #64748B; margin-bottom: 2px; }
.t-date { font-size: 10px; font-weight: 700; color: #334155; background: white; padding: 3px 8px; border-radius: 6px; border: 1px solid #E2E8F0; display: inline-block; text-align: center; line-height: 1.4; }

.filter-select { padding: 8px 16px; border-radius: 8px; border: 1px solid #CBD5E1; font-weight: bold; color: #475569; font-size: 13px; outline: none; background: white; }
.radio-card { cursor: pointer; border: 2px solid #E2E8F0; padding: 15px; border-radius: 10px; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; height: 100%; background: white; }
.radio-card.selected { border-color: var(--brand-orange); background: #FFFBEB; }
.modal-content { border-radius: 20px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); transform: translateZ(0); }
.step-ind { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; border: 2px solid #E2E8F0; color: #94A3B8; font-size: 13px; background: white; }
.step-ind.active { background: var(--brand-orange); color: white; border-color: var(--brand-orange); }
.step-ind.completed { background: #10B981; color: white; border-color: #10B981; }

.btn-primary { 
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white; 
    border-radius: 12px; 
    font-weight: 800; 
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    border: none;
    transition: transform 0.2s, box-shadow 0.2s; 
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; 
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:hover { box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4); }

/* =========================================
   6. واجهة الموظف (Employee View)
   ========================================= */
#employee-view { min-height: 100vh; background: #F1F5F9;  flex-direction: column; display: none; }
.emp-scan-header { background: #1E293B; color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top:0; z-index: 50; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.emp-content { max-width: 600px; margin: 0 auto; padding: 15px; width: 100%; flex: 1; display: flex; flex-direction: column; gap: 15px; }

.scan-container { background: white; padding: 25px; border-radius: 16px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 2px dashed #CBD5E1; transition: 0.3s; }
.scan-container.active { border-color: var(--brand-orange); background: #FFFBEB; border-style: solid; }
.scan-input { font-size: 28px; text-align: center; letter-spacing: 3px; font-weight: 900; border: none; background: transparent; width: 100%; outline: none; margin: 15px 0; color: #1E293B; }

.lang-select {
    background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: bold; outline: none;
    cursor: pointer; transition: 0.2s; -webkit-appearance: none; appearance: none;
}
.lang-select:hover { background: rgba(255,255,255,0.2); }
.lang-select option { background: #1E293B; color: white; }

.insp-item { border: 1px solid #E2E8F0; border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; transition: 0.2s; }
.insp-item.checked-ok { border-color: #10B981; background: #ECFDF5; }
.insp-item.checked-bad { border-color: #EF4444; background: #FEF2F2; }

.insp-btn { flex: 1; padding: 12px; border-radius: 8px; font-weight: bold; font-size: 13px; border: 1px solid #E2E8F0; color: #94A3B8; background: white; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.insp-btn.active-ok { background: #10B981; color: white; border-color: #10B981; box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3); }
.insp-btn.active-bad { background: #EF4444; color: white; border-color: #EF4444; box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3); }

.bad-inputs-container { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #EF4444; }
.bad-inputs-container.active { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

.action-btn-large { width: 100%; padding: 16px; border-radius: 12px; font-weight: 800; font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.1s; border: none; cursor: pointer; color: white; touch-action: manipulation; }
.btn-delivered { background: #10B981; box-shadow: 0 4px 0 #047857; } .btn-delivered:active { transform: translateY(2px); box-shadow: none; }
.btn-transit { background: #F59E0B; box-shadow: 0 4px 0 #B45309; } .btn-transit:active { transform: translateY(2px); box-shadow: none; }
.btn-returned { background: #7C3AED; box-shadow: 0 4px 0 #5B21B6; } .btn-returned:active { transform: translateY(2px); box-shadow: none; }
.btn-cancel { background: #EF4444; box-shadow: 0 4px 0 #B91C1C; } .btn-cancel:active { transform: translateY(2px); box-shadow: none; }

body.role-manager .btn-delete { display: none !important; }
body.role-manager .admin-only { display: none !important; }
body.role-gen_manager .btn-delete { display: none !important; }
body.role-gen_manager .btn-edit-status { display: none !important; }
body.role-gen_manager .admin-only { display: none !important; }
body.role-gen_manager .hide-gen-manager { display: none !important; }

/* =========================================
   7. نظام التوصيل الحديث (Modern Delivery UI)
   ========================================= */
.delivery-card { 
    background: white; 
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e2e8f0;
    position: relative;
}
.delivery-card:active { transform: scale(0.98); }
.delivery-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px rgba(0,0,0,0.05); }

.card-strip { height: 6px; width: 100%; }
.card-manual .card-strip { background: linear-gradient(90deg, #64748b, #94a3b8); } 
.card-assigned .card-strip { background: linear-gradient(90deg, #4f46e5, #818cf8); } 
.card-request .card-strip { background: linear-gradient(90deg, #0d9488, #2dd4bf); } 
.card-multi .card-strip { background: linear-gradient(90deg, #f97316, #fbbf24); } 
.card-urgent .card-strip { background: linear-gradient(90deg, #EF4444, #F87171); }

.badge-urgent { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.del-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.st-requested { background-color: #ccfbf1; color: #0f766e; border: 1px solid #CCFBF1; } 
.st-claimed { background-color: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; } 
.st-active { background-color: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; animation: pulse-slow 2s infinite; } 
.st-assigned { background-color: #e0e7ff; color: #4338ca; border: 1px solid #F3E8FF; } 
.st-completed { background-color: #dcfce7; color: #15803d; border: 1px solid #D1FAE5; } 
.st-new { background: #E0F2FE; color: #0284C7; }

.badge-manual { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.badge-assigned { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; }
.badge-multi { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.badge-request { background: #F0FDFA; color: #0F766E; border: 1px solid #CCFBF1; }

.camera-zone-container {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}

.camera-upload-box {
    width: 100%;
    height: 180px; 
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.camera-upload-box:active {
    background-color: #e0e7ff;
    border-color: #6366f1;
    transform: scale(0.99);
}

.camera-upload-box.has-image {
    border-style: solid;
    border-color: #22c55e;
    background-color: #f0fdf4;
}

.camera-icon-large {
    font-size: 3.5rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}
.camera-upload-box:active .camera-icon-large { color: #6366f1; }
.camera-upload-box.has-image .camera-icon-large { color: #22c55e; }

.camera-hint-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
}

.camera-input-hidden {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
    z-index: 10;
}

.btn-hero {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    font-weight: 900;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
}
.btn-hero:active { transform: scale(0.97); }

.btn-hero-start {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}
.btn-hero-finish {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}
.btn-hero-maps {
    background: white;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.trip-stepper { padding: 0 20px 20px; }
.trip-step { display: flex; gap: 1rem; position: relative; padding-bottom: 1.5rem; }
.trip-step:last-child { padding-bottom: 0; }
.trip-line { position: absolute; right: 14px; top: 30px; bottom: 0; width: 2px; background-color: #e2e8f0; z-index: 0; }
.trip-step:last-child .trip-line { display: none; }
.step-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.8rem; z-index: 1; position: relative; flex-shrink: 0; background: white; border: 2px solid #e2e8f0; color: #64748b; transition: 0.3s; }
.trip-step.active .step-icon { border-color: #f97316; background: #fff7ed; color: #c2410c; box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1); transform: scale(1.1); }
.trip-step.done .step-icon { border-color: #22c55e; background: #dcfce7; color: #15803d; }
.trip-step.pending .step-content { background: #F8FAFC; opacity: 0.6; }
.step-content { flex: 1; background: #FFF; border: 1px solid #E2E8F0; border-radius: 12px; padding: 15px; transition: 0.3s; }

@keyframes pulse-slow { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes float-up { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.animate-float { animation: float-up 0.4s ease-out forwards; }
@keyframes pulse-border { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } }

.rating-badge { font-weight: 900; padding: 2px 8px; border-radius: 4px; font-size: 10px; }
.rate-excellent { background: #10B981; color: white; }
.rate-good { background: #3B82F6; color: white; }
.rate-late { background: #F59E0B; color: white; }
.rate-bad { background: #EF4444; color: white; }
.notification-alert { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; padding: 10px; border-radius: 8px; font-size: 12px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.stop-item { display: flex; justify-content: space-between; align-items: center; background: #F8FAFC; border: 1px solid #E2E8F0; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: 12px; }

#assign-modal { z-index: 99999 !important; } 
#assign-modal .modal-content { overflow: visible !important; }
#assign-modal .select-wrapper { z-index: 999999; position: relative; }

.trip-header-info { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: bold; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

#branch-dashboard { min-height: 100vh; background: #F8FAFC; display: none; flex-direction: column; }
.branch-header { background: #0F766E; color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }

/* =========================================
   8. الطباعة (Print Styles)
   ========================================= */
@media print {
    @page { size: A4; margin: 0; }
    body * { visibility: hidden !important; }
    
    body.printing-bill #print-area, body.printing-bill #print-area * { visibility: visible !important; }
    body.printing-bill #print-area { display: block !important; position: absolute; left: 0; top: 0; width: 210mm; background: white; box-sizing: border-box; }
    
    body.printing-report #print-inspector-area, body.printing-report #print-inspector-area * { visibility: visible !important; }
    body.printing-report #print-inspector-area { display: block !important; position: absolute; left: 0; top: 0; width: 210mm; min-height: 297mm; background: white; padding: 10mm; box-sizing: border-box; }

    body.printing-delivery #print-delivery-area, body.printing-delivery #print-delivery-area * { visibility: visible !important; }
    body.printing-delivery #print-delivery-area { display: block !important; position: absolute; left: 0; top: 0; width: 210mm; min-height: 297mm; background: white; padding: 10mm; box-sizing: border-box; }

    .swal2-container, #login-view, #employee-view, #admin-dashboard, #delivery-dashboard, #branch-dashboard { display: none !important; }
    
    .print-page { width: 210mm; min-height: 290mm; padding: 10mm; position: relative; background: white; display: flex; flex-direction: column; }
    .page-break { page-break-before: always; margin-top: 30px; }

    .print-header { border-bottom: 3px solid #1E293B; padding-bottom: 15px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
    .print-box { border: 2px solid #000; margin-bottom: 15px; }
    .print-box-title { background: #e2e8f0; border-bottom: 2px solid #000; padding: 6px 10px; font-weight: 900; font-size: 14px; -webkit-print-color-adjust: exact; }
    .print-box-content { padding: 10px; font-size: 13px; font-weight: bold; }
    .doc-images-container { display: flex; gap: 20px; justify-content: center; margin-top: 10px; }
    .doc-box { border: 2px dashed #000; padding: 5px; width: 48%; height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .doc-box img { max-width: 100%; max-height: 190px; object-fit: contain; }
    .doc-box-label { font-weight: bold; margin-bottom: 5px; border-bottom: 1px solid #000; font-size: 12px; width: 100%; text-align: center; }
    .print-footer { margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; align-items: flex-end; text-align: center; font-size: 12px; }
    .sig-line { margin-top: 30px; border-top: 1px dotted #000; width: 80%; margin-left: auto; margin-right: auto; }
    .red-stamp { width: 130px; height: 130px; border: 4px double #b91c1c; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #b91c1c; font-weight: 900; font-size: 14px; text-align: center; transform: rotate(-12deg); opacity: 0.8; margin: 0 auto; -webkit-print-color-adjust: exact; position: absolute; left: 30px; bottom: 100px; }
    
    .ir-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 2px solid #000; margin-bottom: 20px; }
    .ir-stat-box { padding: 15px; text-align: center; background: #fff; border-left: 2px solid #000; display: flex; flex-direction: column; justify-content: center; align-items: center; }
    .ir-stat-box:last-child { border-left: none; }
    .ir-stat-label { font-size: 14px; font-weight: 900; color: #000; display: block; margin-bottom: 8px; text-transform: uppercase; border-bottom: 2px solid #000; padding-bottom: 4px; width: 80%; }
    .ir-stat-val { font-size: 32px; font-weight: 900; line-height: 1; }
    
    .report-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; border: 2px solid #000; }
    .report-table th { background: #e2e8f0; border: 1px solid #000; padding: 8px; text-align: center; font-weight: 900; -webkit-print-color-adjust: exact; font-size: 14px; }
    .report-table td { border: 1px solid #000; padding: 8px; text-align: center; vertical-align: middle; font-weight: bold; }
    
    .status-ok-print { color: #000; font-weight: 900; background: #fff; padding: 4px; border: 1px solid #000; -webkit-print-color-adjust: exact; }
    .status-bad-print { color: #fff; font-weight: 900; background: #000; padding: 4px; -webkit-print-color-adjust: exact; }

    .del-print-info { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
    .del-print-info td { border: 1px solid #ccc; padding: 10px; width: 50%; }
    .del-print-label { font-weight: bold; background: #f8fafc; color: #333; -webkit-print-color-adjust: exact; }
}

#process-delivery-modal img { display: none !important; }

/* =========================================
   9. إعدادات الهيكل الأساسي للوحة الإدارة (Layout Settings)
   ========================================= */
main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

#main-shipments-view, #admin-branch-requests-view, #live-map-view, #global-stats-view, #delivery-dashboard {
    flex: 1; overflow-y: auto;
}

.view-container {
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* =========================================
   10. تصميم لوحة التحكم الجديدة (New Admin Dashboard)
   ========================================= */
   
/* عزل تطبيق الثيم الداكن على حاوية لوحة الإدارة فقط */
#admin-dashboard { background-color: var(--bg) !important; color: var(--text) !important; }
#global-stats-view { background-color: var(--bg) !important; }

/* القائمة الجانبية (Sidebar) */
.sidebar { background: var(--bg2) !important; border-left: 1px solid var(--border) !important; transition: all .3s; z-index: 100; }
.logo-area { padding: 24px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; animation: fadeUp .5s ease both; }
.logo-icon { width: 44px; height: 44px; background: linear-gradient(135deg, var(--gold), var(--orange)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; animation: float 3s ease-in-out infinite; }

/* ------ الإصلاح الجذري: إجبار ظهور النصوص بشكل سليم وفاتح ------ */
.logo-text { font-family: 'Tajawal', sans-serif; font-weight: 800; font-size: 16px; line-height: 1.2; color: var(--text) !important; }
.logo-sub { font-size: 11px; color: var(--text2) !important; font-weight: 400; }
/* --------------------------------------------------- */

.status-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: blink 2s infinite; margin-right: 6px; }

/* ------ إصلاح نصوص العناوين والروابط في القائمة الجانبية ------ */
.nav-section { padding: 16px 20px; font-size: 10px; font-weight: 800; color: var(--text3) !important; text-align: right; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin: 2px 8px; border-radius: 10px; cursor: pointer; transition: all .3s; font-size: 13px; color: var(--text2) !important; font-weight: 700; border: 1px solid transparent; width: auto; }
.nav-item:hover { background: var(--bg3) !important; color: var(--text) !important; transform: translateX(-5px); }
.nav-item.active { background: linear-gradient(135deg, rgba(245,166,35,.15), rgba(255,107,43,.1)) !important; color: var(--gold) !important; border: 1px solid rgba(245,166,35,.2) !important; transform: none; box-shadow: none; }
.nav-item .icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; transition: 0.3s; }
.nav-item:hover .icon { transform: scale(1.1); color: var(--text) !important; }
.nav-item.active .icon { background: linear-gradient(135deg, var(--gold), var(--orange)) !important; color: #000 !important; transform: none; }
/* --------------------------------------------------- */

.nav-badge { margin-right: auto; background: var(--red); color: #fff !important; font-size: 10px; padding: 1px 7px; border-radius: 20px; font-weight: 700; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }
.admin-card { background: var(--bg3) !important; border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.admin-avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff !important; }

/* ------ إصلاح بيانات المستخدم السفلى ------ */
.admin-name { font-size: 13px; font-weight: 600; color: var(--text) !important; }
.admin-role { font-size: 11px; color: var(--text2) !important; }
.admin-card .fa-sign-out-alt { color: var(--text2) !important; transition: 0.3s; }
.admin-card .fa-sign-out-alt:hover { color: var(--red) !important; }
/* --------------------------------------------------- */

/* ------ الترويسة العلوية (Topbar) وإصلاح لون العناوين ------ */
.topbar { background: var(--bg2) !important; border-bottom: 1px solid var(--border) !important; display: flex; align-items: center; padding: 16px 24px; gap: 16px; z-index: 40; backdrop-filter: blur(20px); justify-content: space-between; }
.topbar-title { font-family: 'Tajawal', sans-serif; font-size: 20px; font-weight: 800; color: var(--text) !important; display: flex; align-items: center; gap: 8px; margin: 0; }
.topbar-title span#header-text-main { color: var(--gold) !important; }
.topbar-title span:last-child { color: var(--text) !important; }
/* --------------------------------------------------- */

.topbar-right { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 44px; height: 24px; background: var(--bg3); border-radius: 12px; cursor: pointer; position: relative; border: 1px solid var(--border); transition: all .3s; }
.theme-toggle-dot { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); transition: all .3s; display: flex; align-items: center; justify-content: center; font-size: 10px; }
body.light-mode .theme-toggle-dot { right: auto; left: 2px; }
.filter-btn { background: var(--bg3); border: 1px solid var(--border); padding: 6px 14px; border-radius: 8px; color: var(--text2); font-size: 12px; cursor: pointer; transition: all .2s; font-family: 'Tajawal', sans-serif; font-weight: bold; }
.filter-btn.active, .filter-btn:hover { background: var(--gold) !important; color: #000 !important; border-color: var(--gold) !important; font-weight: 800; }
.notif-btn { width: 36px; height: 36px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; font-size: 16px; transition: all .2s; color: var(--text) !important; }
.notif-btn:hover { border-color: var(--gold); }
.notif-badge { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; background: var(--red); border-radius: 50%; font-size: 9px; color: #fff !important; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* صف الإحصائيات العلوية (Stats Row) */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; position: relative; overflow: hidden; transition: all .3s; animation: fadeUp .5s ease both; display: block; text-align: right; }
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; width: 80px; height: 80px; border-radius: 50%; opacity: .06; transition: all .3s; }
.stat-card:hover { transform: translateY(-4px); border-color: rgba(245,166,35,.3); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.stat-card:hover::before { transform: scale(1.5); }
.stat-card.gold::before { background: var(--gold); }
.stat-card.green::before { background: var(--green); }
.stat-card.blue::before { background: var(--accent); }
.stat-card.red::before { background: var(--red); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.stat-card.gold .stat-icon { background: rgba(245,166,35,.15); color: var(--gold); }
.stat-card.green .stat-icon { background: rgba(34,211,165,.15); color: var(--green); }
.stat-card.blue .stat-icon { background: rgba(79,159,255,.15); color: var(--accent); }
.stat-card.red .stat-icon { background: rgba(255,77,109,.15); color: var(--red); }
.stat-value { font-family: 'Tajawal', sans-serif; font-size: 32px; font-weight: 900; line-height: 1; margin-bottom: 4px; }
.stat-card.gold .stat-value { color: var(--gold) !important; }
.stat-card.green .stat-value { color: var(--green) !important; }
.stat-card.blue .stat-value { color: var(--accent) !important; }
.stat-card.red .stat-value { color: var(--red) !important; }
.stat-label { font-size: 12px; color: var(--text2) !important; margin-bottom: 8px; font-weight: bold; }
.stat-change { font-size: 11px; display: flex; align-items: center; gap: 4px; font-weight: bold; color: var(--text3) !important; }
.stat-change.up { color: var(--green) !important; }
.stat-change.down { color: var(--red) !important; }
.stat-bg-text { position: absolute; bottom: -10px; left: 10px; font-size: 60px; font-weight: 900; opacity: .04; font-family: 'Tajawal', sans-serif; color: var(--text) !important; }

/* صف الرسوم البيانية (Charts Row) */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; animation: fadeUp .6s ease both; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-title { font-family: 'Tajawal', sans-serif; font-size: 16px; font-weight: 700; color: var(--text) !important; display: flex; align-items: center; gap: 8px; }
.panel-title span { font-size: 18px; }
.panel-action { font-size: 11px; color: var(--accent); cursor: pointer; padding: 4px 10px; border: 1px solid rgba(79,159,255,.2); border-radius: 6px; transition: all .2s; font-weight: bold; }
.panel-action:hover { background: rgba(79,159,255,.1); }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-bottom: 24px; position: relative; border-bottom: 1px solid var(--border); }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.bar { width: 100%; background: linear-gradient(180deg, var(--gold), rgba(245,166,35,.3)); border-radius: 6px 6px 0 0; position: relative; cursor: pointer; transition: all .3s; min-height: 4px; }
.bar:hover { filter: brightness(1.2); transform: scaleX(1.05); }
.bar.alt { background: linear-gradient(180deg, var(--accent), rgba(79,159,255,.3)); }
.bar-label { position: absolute; bottom: -20px; font-size: 10px; color: var(--text3) !important; white-space: nowrap; font-weight: bold; }
.bar-val { position: absolute; top: -18px; font-size: 10px; color: var(--text2) !important; font-weight: 600; white-space: nowrap; }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.donut-svg { width: 140px; height: 140px; }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 10px;}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2) !important; font-weight: bold; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-val { margin-right: auto; font-weight: 700; color: var(--text) !important; }

/* قسم الجداول والموظفين (Tables) */
.table-section { margin-bottom: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-family: 'Tajawal', sans-serif; font-size: 18px; font-weight: 800; color: var(--text) !important; display: flex; align-items: center; gap: 8px; }
.section-title span { color: var(--gold) !important; }
.see-all { font-size: 12px; color: var(--accent); cursor: pointer; padding: 6px 14px; background: rgba(79,159,255,.08); border: 1px solid rgba(79,159,255,.15); border-radius: 8px; transition: all .2s; font-weight: bold; }
.see-all:hover { background: rgba(79,159,255,.15); }

.data-table { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; width: 100%; }
.data-table-head { display: grid; grid-template-columns: 40px 1fr 80px 80px 80px 100px 80px; gap: 0; background: var(--bg3); padding: 12px 16px; font-size: 11px; color: var(--text2) !important; font-weight: 600; letter-spacing: .5px; text-align: center; }
.data-table-head div:nth-child(2) { text-align: right; }
.data-table-row { display: grid; grid-template-columns: 40px 1fr 80px 80px 80px 100px 80px; gap: 0; padding: 14px 16px; border-top: 1px solid var(--border); transition: all .2s; cursor: default; align-items: center; animation: fadeUp .5s ease both; text-align: center; }
.data-table-row:hover { background: var(--bg3); }
.rank { font-size: 11px; color: var(--text3) !important; font-weight: 700; text-align: center; }
.rank.top { color: var(--gold) !important; font-size: 14px; }
.agent-info { display: flex; align-items: center; gap: 10px; text-align: right; }
.agent-avatar { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff !important; flex-shrink: 0; }
.agent-name { font-size: 13px; font-weight: 600; color: var(--text) !important; }
.agent-id { font-size: 10px; color: var(--text3) !important; font-weight: bold; }
.cell { text-align: center; font-size: 13px; font-weight: 600; color: var(--text) !important; }
.cell.green { color: var(--green) !important; }
.cell.red { color: var(--red) !important; }
.cell.gold { color: var(--gold) !important; }
.quality-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; position: relative; }
.quality-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.quality-text { font-size: 11px; font-weight: 700; margin-top: 2px; text-align: center; color: var(--text) !important; }
.pressure-bars { display: flex; gap: 2px; align-items: flex-end; height: 20px; justify-content: center; }
.pressure-bar { width: 4px; border-radius: 2px; background: var(--green); }

/* الصف السفلي (Bottom Row & Activity) */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.act-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.act-content { flex: 1; text-align: right; }
.act-title { font-size: 12px; color: var(--text) !important; font-weight: 600; }
.act-sub { font-size: 11px; color: var(--text2) !important; margin-top: 2px; font-weight: bold; }
.act-time { font-size: 10px; color: var(--text3) !important; white-space: nowrap; font-weight: bold; }

.live-tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; background: rgba(255,77,109,.1); border: 1px solid rgba(255,77,109,.2); border-radius: 20px; font-size: 11px; color: var(--red) !important; font-weight: 700; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }

/* التجاوب (Responsive) للتصميم الجديد */
@media(max-width:1100px){
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .bottom-row { grid-template-columns: 1fr; }
}
@media(max-width: 768px){
    .data-table-head { display: none; }
    .data-table-row { grid-template-columns: 1fr; gap: 10px; padding: 15px; }
    .rank { display: none; }
    .agent-info { justify-content: space-between; }
    .cell { display: flex; justify-content: space-between; }
    .cell::before { content: attr(data-label); color: var(--text2) !important; font-size: 11px; }
}

/* Animations للوحة الجديدة */
@keyframes fadeUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}

/* تخصيص شريط التمرير */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #F59E0B; }
#admin-dashboard ::-webkit-scrollbar-track { background: var(--bg); }
#admin-dashboard ::-webkit-scrollbar-thumb { background: var(--bg3); }
#admin-dashboard ::-webkit-scrollbar-thumb:hover { background: var(--gold); }