/* ============================================================
   Pharmacy Bot Dashboard — Design System
   أبيض + سماوي مع لمسات زرقاء | Modern SaaS | RTL
   نسخة محسّنة للريسبونسف الكامل على كل الأجهزة
   ============================================================ */

:root {
  /* الألوان */
  --bg: #f3f8fd;
  --bg-soft: #eef5fc;
  --card: #ffffff;
  --ink: #0e2238;
  --ink-2: #33475e;
  --muted: #6b8299;
  --line: #e3edf7;
  --line-2: #d5e5f3;

  --sky: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --sky-100: #e0f2fe;
  --sky-50: #f0f9ff;
  --blue: #2563eb;
  --blue-100: #dbeafe;

  --green: #10b981;
  --green-100: #d1fae5;
  --amber: #f59e0b;
  --amber-100: #fef3c7;
  --red: #ef4444;
  --red-100: #fee2e2;
  --violet: #8b5cf6;
  --violet-100: #ede9fe;

  /* أشكال */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 6px 24px -8px rgba(2, 132, 199, 0.12);
  --shadow-lg: 0 18px 48px -12px rgba(2, 132, 199, 0.22);
  --shadow-sm: 0 2px 8px -2px rgba(14, 34, 56, 0.06);

  --sidebar-w: 268px;
  --topbar-h: 72px;
  --font: "Cairo", "Segoe UI", Tahoma, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* يمنع أي سكرول أفقي غير مقصود على الموبايل */
}

::selection {
  background: var(--sky-100);
  color: var(--sky-700);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c6dcee;
  border-radius: 99px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sky);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ============ أدوات عامة ============ */
.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

.bold {
  font-weight: 700;
}

.mono {
  font-family: "Segoe UI", monospace, var(--font);
  letter-spacing: .3px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(.94) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }
}

.page-anim {
  animation: fadeUp .38s cubic-bezier(.22, .9, .3, 1) both;
}

/* ============ الأزرار ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  transition: all .2s ease;
  white-space: nowrap;
  user-select: none;
  border: 1.5px solid transparent;
  min-height: 40px; /* حد أدنى مريح للمس */
}

.btn svg {
  flex-shrink: 0;
}

.btn:active {
  transform: scale(.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%);
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(14, 165, 233, .45);
}

.btn-primary:hover {
  box-shadow: 0 10px 22px -4px rgba(14, 165, 233, .55);
  transform: translateY(-1px);
}

.btn-soft {
  background: var(--sky-50);
  color: var(--sky-700);
  border-color: var(--sky-100);
}

.btn-soft:hover {
  background: var(--sky-100);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-2);
}

.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--sky);
  color: var(--sky-700);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(16, 185, 129, .4);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -4px rgba(16, 185, 129, .5);
}

.btn-danger-soft {
  background: #fff5f5;
  color: var(--red);
  border-color: #fecaca;
}

.btn-danger-soft:hover {
  background: var(--red-100);
}

.btn-warning-soft {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.btn-warning-soft:hover {
  background: var(--amber-100);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 9px;
  min-height: 34px;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 15.5px;
  border-radius: 12px;
  min-height: 48px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  background: var(--card);
  transition: all .2s ease;
  position: relative;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--sky-600);
  border-color: var(--sky);
  background: var(--sky-50);
}

/* ============ الشارات ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pending {
  background: var(--amber-100);
  color: #b45309;
}

.badge-accepted {
  background: var(--green-100);
  color: #047857;
}

.badge-partial {
  background: var(--sky-100);
  color: var(--sky-700);
}

.badge-rejected {
  background: var(--red-100);
  color: #b91c1c;
}

.badge-active {
  background: var(--green-100);
  color: #047857;
}

.badge-suspended {
  background: #f1f5f9;
  color: #64748b;
}

.badge-info {
  background: var(--blue-100);
  color: var(--blue);
}

/* ============================================================
   🆕 (تعديل) سويتش عرض/إخفاء ملوّن — بديل بصري لبوتن toggle-top-search
   ------------------------------------------------------------
   شكل بادج دائري: أخضر واضح لما يكون "عرض" مفعّل، وأحمر واضح لما
   يكون "إخفاء" مفعّل، عشان تبقى الحالة الحالية بايّنة من أول نظرة
   من غير ما تحتاج تقرا النص.
   ============================================================ */
.vis-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 800;
  border: 1.5px solid transparent;
  transition: all .2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.vis-toggle.is-show {
  background: var(--green-100);
  color: #047857;
  border-color: #a7f3d0;
}

.vis-toggle.is-show:hover {
  background: #bbf7d0;
}

.vis-toggle.is-hide {
  background: var(--red-100);
  color: #b91c1c;
  border-color: #fecaca;
}

.vis-toggle.is-hide:hover {
  background: #fecaca;
}

.execution-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--ring-color, var(--green)) calc(var(--ring-value, 0) * 1%), rgba(226, 232, 240, 0.38) 0);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.95);
  transition: background .35s ease;
  flex-shrink: 0;
}

.execution-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: inset 0 1px 4px rgba(2, 132, 199, 0.08);
}

.execution-ring span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-2);
}

.execution-ring.small {
  width: 54px;
  height: 54px;
}

.execution-ring.small span {
  font-size: 12px;
}

/* ============ البطاقات ============ */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 237, 247, .8);
  padding: 22px;
  min-width: 0; /* يمنع تمدد البطاقات جوه الجريد */
}

.card-title {
  font-size: 16.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title svg {
  color: var(--sky);
  flex-shrink: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* ============================================================
   🛠️ (إضافة) دعم عام لـ .card-header / .card-body
   ------------------------------------------------------------
   pages4.js بيستخدم class="card-header" و class="card-body" كأسماء
   عامة جوه أي .card عادي (مش بس .pharmacy-card) — زي كارت "المبيعات
   الشهرية" وكارت "الطلبات في الفترة المختارة" في صفحة تفاصيل
   الصيدلية. لكن اللي كان متعرّف فى الملف قبل كده هو بس
   ".pharmacy-card .card-header" و ".pharmacy-card .card-body"
   (مربوطين بـ .pharmacy-card تحديدًا)، فأي حد تاني بيستخدم نفس
   الاسمين من غير .pharmacy-card كان بيرجع من غير أي تنسيق خالص —
   مثلاً هيدر فيه عنوان + بادج كان بيبان مكدّس تحت بعض بدل صف واحد
   جنب بعض، وبدون مسافة تفصله عن محتوى الكارت.

   الحل: تعريف عام لـ .card-header (فليكس + مسافة بين العناصر) و
   .card-body، وسايبين ".pharmacy-card .card-header/.card-body" زي
   ما هما (تحت) عشان لسه بيخصصوا شكل كارت الصيدلية بالذات
   (align-items:flex-start مثلاً) لأنهم أكتر تحديدًا (specificity
   أعلى) وهيفضلوا كاسبين على التعريف العام ده.
   ============================================================ */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-header h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
}

.card-body {
  min-width: 0;
}

/* ============ النماذج ============ */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 7px;
  color: var(--ink-2);
}

.field label .req {
  color: var(--red);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line-2);
  background: #fbfdff;
  font-size: 14.5px; /* أكبر من 16px تمنع الزوم التلقائي فى iOS، فأبقيناها قريبة من كده */
  transition: all .2s ease;
  outline: none;
  min-height: 44px; /* هدف لمس مريح */
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--sky);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .12);
}

.input::placeholder,
.textarea::placeholder {
  color: #9db4c8;
}

.textarea {
  resize: vertical;
  min-height: 90px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b8299' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
  cursor: pointer;
}

.input-wrap {
  position: relative;
}

.input-wrap > svg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 13px;
  color: #9db4c8;
  pointer-events: none;
}

.input-wrap .input {
  padding-right: 42px;
}

.med-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .18s ease;
  background: #fbfdff;
  user-select: none;
}

.med-check:hover {
  border-color: var(--sky);
}

.med-check input {
  display: none;
}

.med-check .box {
  width: 21px;
  height: 21px;
  border-radius: 7px;
  border: 2px solid #b8cfe2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s ease;
  flex-shrink: 0;
  background: #fff;
}

.med-check .box svg {
  opacity: 0;
  transform: scale(.4);
  transition: all .18s ease;
  color: #fff;
}

.med-check.checked {
  border-color: var(--green);
  background: #f0fdf9;
}

.med-check.checked .box {
  background: var(--green);
  border-color: var(--green);
}

.med-check.checked .box svg {
  opacity: 1;
  transform: scale(1);
}

.med-check .med-name {
  font-weight: 600;
  font-size: 14px;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  display: none;
}

.switch .track {
  position: absolute;
  inset: 0;
  background: #d5e5f3;
  border-radius: 99px;
  transition: all .25s ease;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
}

.switch input:checked+.track {
  background: linear-gradient(135deg, var(--sky), var(--blue));
}

.switch input:checked+.track::after {
  transform: translateX(-20px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row .s-title {
  font-weight: 700;
  font-size: 14.5px;
}

.setting-row .s-desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ============================================================
   هيكل التطبيق (Sidebar + Topbar + Content)
   ============================================================ */
.shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh; /* يراعي أشرطة المتصفح فى الموبايل */
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform .3s cubic-bezier(.22, .9, .3, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 18px -4px rgba(14, 165, 233, .5);
}

.sidebar-logo .name {
  font-weight: 900;
  font-size: 16.5px;
  line-height: 1.25;
}

.sidebar-logo .sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.nav-label {
  font-size: 11px;
  font-weight: 800;
  color: #9db4c8;
  letter-spacing: .6px;
  padding: 14px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: all .2s ease;
  position: relative;
  min-height: 44px;
}

.nav-link svg {
  color: #8aa5bd;
  transition: all .2s ease;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--sky-50);
  color: var(--sky-700);
}

.nav-link:hover svg {
  color: var(--sky);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(14, 165, 233, .5);
}

.nav-link.active svg {
  color: #fff;
}

.nav-link .nav-count {
  margin-right: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 21px;
  height: 21px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.nav-link.active .nav-count {
  background: rgba(255, 255, 255, .25);
}

.sidebar-user {
  margin-top: auto;
  padding: 14px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--sky-50), var(--blue-100));
  border: 1px solid var(--sky-100);
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar-user .u-name {
  font-weight: 800;
  font-size: 13.5px;
  line-height: 1.3;
}

.sidebar-user .u-role {
  font-size: 11.5px;
  color: var(--sky-700);
  font-weight: 700;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px -2px rgba(2, 132, 199, .3);
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  font-size: 27px;
}

.avatar-xl {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  font-size: 32px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 56, .4);
  z-index: 55;
  backdrop-filter: blur(3px);
  animation: fadeIn .25s ease;
}

.main {
  flex: 1;
  margin-right: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .page-title {
  font-size: 18.5px;
  font-weight: 900;
}

.topbar .page-crumb {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.topbar-spacer {
  flex: 1;
}

.hamburger {
  display: none;
  min-width: 40px;
  min-height: 40px;
}

.bell-btn .ping {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: pulse 2s infinite;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  background: var(--green-100);
  padding: 5px 12px;
  border-radius: 99px;
}

.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s infinite;
}

.live-dot.off {
  color: var(--muted);
  background: #f1f5f9;
}

.live-dot.off::before {
  background: #b6c6d6;
  animation: none;
}

.content {
  padding: 26px;
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.col-span-2 {
  grid-column: span 2;
}

.stat-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 237, 247, .8);
  display: flex;
  align-items: flex-start;
  gap: 15px;
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
  min-width: 0;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--sc-tint, var(--sky-50));
  opacity: .55;
  z-index: 0;
}

.stat-card>* {
  position: relative;
  z-index: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sc-bg, var(--sky-100));
  color: var(--sc-color, var(--sky-600));
}

.stat-info {
  min-width: 0;
}

.stat-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch; /* سكرول سلس على iOS */
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
  background: #fff;
}

.table thead th {
  background: var(--sky-50);
  color: var(--sky-700);
  font-size: 12.5px;
  font-weight: 800;
  padding: 13px 16px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background .15s ease;
}

.table tbody tr:hover {
  background: var(--sky-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table .row-link {
  cursor: pointer;
}

.cell-main {
  font-weight: 700;
}

.cell-sub {
  font-size: 12px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  border: 1.5px solid var(--line-2);
  background: #fff;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.tab:hover {
  border-color: var(--sky);
  color: var(--sky-700);
}

.tab.active {
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 5px 14px -4px rgba(14, 165, 233, .5);
}

.tab .t-count {
  background: rgba(255, 255, 255, .25);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11.5px;
}

.tab:not(.active) .t-count {
  background: var(--bg-soft);
  color: var(--muted);
}

/* ============================================================
   صفحة تسجيل الدخول
   ============================================================ */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
}

.login-hero {
  flex: 1.15;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  color: #fff;
  background: linear-gradient(150deg, #0284c7 0%, #0ea5e9 45%, #2563eb 100%);
}

.login-hero::before,
.login-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}

.login-hero::before {
  width: 420px;
  height: 420px;
  top: -140px;
  left: -120px;
}

.login-hero::after {
  width: 300px;
  height: 300px;
  bottom: -110px;
  right: -70px;
}

.hero-blob {
  position: absolute;
  border-radius: 32px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(4px);
  animation: floatY 7s ease-in-out infinite;
}

@keyframes floatY {

  0%,
  100% {
    transform: translateY(0) rotate(var(--rot, 8deg));
  }

  50% {
    transform: translateY(-18px) rotate(var(--rot, 8deg));
  }
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 520px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 7px 15px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 24px;
}

.login-hero h1 {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 14px;
}

.login-hero p {
  font-size: 15.5px;
  opacity: .92;
  line-height: 1.9;
  margin-bottom: 30px;
}

.hero-feats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-feat {
  display: flex;
  align-items: center;
  gap: 13px;
  animation: slideIn .6s both;
}

.hero-feat:nth-child(2) {
  animation-delay: .1s;
}

.hero-feat:nth-child(3) {
  animation-delay: .2s;
}

.hero-feat:nth-child(4) {
  animation-delay: .3s;
}

.hero-feat .f-ico {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-feat .f-txt {
  font-weight: 700;
  font-size: 14.5px;
}

.hero-feat .f-sub {
  font-size: 12.5px;
  opacity: .85;
}

.login-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 420px;
  animation: fadeUp .5s ease both;
}

.login-box .logo-row {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.login-box h2 {
  font-size: 25px;
  font-weight: 900;
  margin-bottom: 6px;
}

.login-box .welcome {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
}

.login-card {
  background: #fff;
  border-radius: 22px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.demo-box {
  margin-top: 18px;
  background: var(--sky-50);
  border: 1.5px dashed var(--sky);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 13px;
}

.demo-box .d-title {
  font-weight: 800;
  color: var(--sky-700);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.demo-box .d-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  color: var(--ink-2);
  flex-wrap: wrap;
}

.demo-box code {
  background: #fff;
  border: 1px solid var(--line);
  padding: 1px 9px;
  border-radius: 7px;
  font-weight: 700;
  color: var(--sky-700);
  cursor: pointer;
  transition: all .15s;
}

.demo-box code:hover {
  background: var(--sky-100);
}

.login-error {
  display: none;
  background: var(--red-100);
  color: #b91c1c;
  font-weight: 700;
  font-size: 13.5px;
  padding: 11px 15px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  border: 1px solid #fecaca;
  align-items: center;
  gap: 9px;
  animation: popIn .3s ease;
}

.login-error.show {
  display: flex;
}

.pass-toggle {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9db4c8;
  pointer-events: auto !important;
  cursor: pointer;
  background: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  z-index: 2;
}

.pass-toggle:hover {
  color: var(--sky-600);
  background: var(--sky-50);
}

/* ============================================================
   بطاقات الطلبات وتفاصيل الطلب
   ============================================================ */
.order-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 237, 247, .8);
  transition: all .25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: fadeUp .4s ease both;
  min-width: 0;
}

.order-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sky-100);
}

.order-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: var(--oc, var(--amber));
  border-radius: 0 99px 99px 0;
}

.order-card .oc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.order-card .oc-id {
  font-weight: 900;
  font-size: 15.5px;
  color: var(--sky-700);
}

.order-card .oc-customer {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.order-card .oc-name {
  font-weight: 800;
  font-size: 15px;
}

.order-card .oc-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 13px;
}

.order-card .oc-meta>div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.order-card .oc-meta svg {
  color: #9db4c8;
  flex-shrink: 0;
}

.med-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.med-chip {
  background: var(--sky-50);
  color: var(--sky-700);
  border: 1px solid var(--sky-100);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.med-chip.ok {
  background: #f0fdf9;
  color: #047857;
  border-color: #a7f3d0;
}

.med-chip.no {
  background: #fff5f5;
  color: #b91c1c;
  border-color: #fecaca;
  text-decoration: line-through;
}

.med-chip.more {
  background: var(--bg-soft);
  color: var(--muted);
  border-color: var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  align-items: start;
}

.info-list {
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .i-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sky-50);
  color: var(--sky-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-row .i-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.info-row .i-value {
  font-weight: 800;
  font-size: 14.5px;
  word-break: break-word;
}

.rx-image {
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  overflow: hidden;
  cursor: zoom-in;
  transition: all .2s ease;
  background: var(--bg-soft);
}

.rx-image:hover {
  border-color: var(--sky);
  box-shadow: var(--shadow);
}

.rx-image img {
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.rx-empty {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #9db4c8;
  border: 2px dashed var(--line-2);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 700;
}

.timeline {
  position: relative;
  padding-right: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  right: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line-2);
  border-radius: 99px;
}

.tl-item {
  position: relative;
  padding-bottom: 20px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  right: -21px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tlc, var(--sky));
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px var(--tlc, var(--sky));
}

.tl-item .tl-text {
  font-weight: 700;
  font-size: 13.5px;
}

.tl-item .tl-time {
  color: var(--muted);
  font-size: 12px;
}

.price-box {
  background: linear-gradient(135deg, var(--sky-50), var(--blue-100));
  border: 1px solid var(--sky-100);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.price-box .p-label {
  font-weight: 700;
  color: var(--sky-700);
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.price-box .p-value {
  font-weight: 900;
  font-size: 22px;
  color: var(--sky-700);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   المودالات والتنبيهات والقوائم المنسدلة
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 56, .45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .22s ease;
}

.modal {
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  animation: popIn .3s cubic-bezier(.22, .9, .3, 1);
}

.modal-lg {
  max-width: 640px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
  gap: 10px;
}

.modal-title {
  font-size: 17.5px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title svg {
  color: var(--sky);
  flex-shrink: 0;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 0 24px 22px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg-soft);
  transition: all .18s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--red-100);
  color: var(--red);
}

/* ============================================================
   🆕 التنبيهات (Toasts)
   ============================================================ */
.toasts {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 11px;
  max-width: 370px;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  overflow: hidden;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #fff;
  border-radius: 15px;
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  animation: toastIn .35s cubic-bezier(.22, .9, .3, 1) both;
  border-right: 4px solid var(--tc, var(--sky));
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-30px) scale(.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast.out {
  animation: toastOut .3s ease both;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(-30px) scale(.95);
  }
}

.toast .t-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--tcb, var(--sky-100));
  color: var(--tc, var(--sky));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast .t-title {
  font-weight: 800;
  font-size: 14px;
}

.toast .t-msg {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
}

.toast .t-close {
  margin-right: auto;
  color: #b6c6d6;
  flex-shrink: 0;
}

.toast .t-close:hover {
  color: var(--red);
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  padding: 8px;
  z-index: 90;
  animation: popIn .22s ease;
  transform-origin: top left;
  max-width: calc(100vw - 24px); /* ما تخرجش برة الشاشة على الموبايل */
}

.dropdown-menu .dd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
  width: 100%;
  text-align: right;
}

.dropdown-menu .dd-item:hover {
  background: var(--sky-50);
  color: var(--sky-700);
}

.dropdown-menu .dd-item svg {
  color: #8aa5bd;
}

.dropdown-menu .dd-item.danger {
  color: var(--red);
}

.dropdown-menu .dd-item.danger svg {
  color: var(--red);
}

.dropdown-menu .dd-item.danger:hover {
  background: var(--red-100);
}

.dd-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 4px;
}

.notif-menu {
  min-width: 330px;
  max-width: 360px;
  padding: 0;
  overflow: hidden;
}

.notif-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s;
  align-items: flex-start;
}

.notif-item:hover {
  background: var(--sky-50);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item .n-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--amber-100);
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item .n-title {
  font-weight: 700;
  font-size: 13px;
}

.notif-item .n-time {
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================
   الرسوم البيانية والتحليلات
   ============================================================ */
.chart-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-tooltip {
  position: fixed;
  z-index: 300;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 9px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}

.chart-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend .lg {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.legend .lg .sw {
  width: 11px;
  height: 11px;
  border-radius: 4px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.donut-center-txt {
  font-weight: 900;
  font-size: 24px;
}

.donut-center-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
}

.hbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.hbar-row .hb-rank {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hbar-row.top .hb-rank {
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
}

.hbar-row .hb-name {
  width: 130px;
  font-weight: 700;
  font-size: 13.5px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-row .hb-track {
  flex: 1;
  height: 26px;
  background: var(--bg-soft);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-width: 40px;
}

.hbar-row .hb-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--sky), var(--blue));
  width: 0;
  transition: width .9s cubic-bezier(.22, .9, .3, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hbar-row .hb-val {
  font-weight: 800;
  font-size: 13px;
  color: var(--sky-700);
  width: 76px;
  text-align: left;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.search-hero {
  background: linear-gradient(135deg, var(--sky-50), var(--blue-100));
  border: 1px solid var(--sky-100);
  border-radius: var(--r-lg);
  padding: 26px;
  text-align: center;
  margin-bottom: 22px;
}

.search-hero h3 {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-hero p {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.search-hero .input-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.search-hero .input {
  border-radius: 99px;
  padding: 13px 46px 13px 20px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 15px;
}

.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.empty-state .e-ico {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  background: var(--sky-50);
  color: var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.empty-state h4 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-2);
  margin-bottom: 5px;
}

.empty-state p {
  font-size: 13.5px;
}

/* ============================================================
   الإعدادات والملف الشخصي
   ============================================================ */
.webhook-box {
  background: #0e2238;
  color: #a5f3fc;
  border-radius: var(--r-md);
  padding: 18px;
  font-family: "Segoe UI", monospace;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  line-height: 1.8;
  border: 1px solid #1e3a5c;
}

.webhook-box .w-key {
  color: #7dd3fc;
}

.webhook-box .w-str {
  color: #86efac;
}

.webhook-url-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.webhook-url-row .input {
  direction: ltr;
  text-align: left;
  font-family: "Segoe UI", monospace;
  font-size: 13.5px;
  min-width: 0;
}

.integration-note {
  display: flex;
  gap: 12px;
  background: var(--amber-100);
  border: 1px solid #fde68a;
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 13px;
  color: #92600a;
  font-weight: 600;
  align-items: flex-start;
}

.integration-note svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 26px;
  background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%);
  border-radius: var(--r-lg);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.profile-head::after {
  content: "";
  position: absolute;
  left: -40px;
  top: -40px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.profile-head .ph-name {
  font-size: 21px;
  font-weight: 900;
}

.profile-head .ph-role {
  background: rgba(255, 255, 255, .2);
  padding: 4px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  margin-top: 6px;
}

/* ============================================================
   لايت بوكس صورة الروشتة — الصورة تاخد طول الصفحة تقريبًا
   ============================================================ */
.rx-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 56, .55);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: fadeIn .18s ease;
  cursor: zoom-out;
}

.rx-lightbox.out {
  animation: fadeIn .16s ease reverse;
}

.rx-lightbox img {
  width: auto;
  height: 94vh;
  height: 94dvh;
  max-width: 96vw;
  max-height: 94vh;
  max-height: 94dvh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .5);
  cursor: default;
  animation: popIn .2s cubic-bezier(.22, .9, .3, 1);
}

.rx-lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all .15s;
  z-index: 1;
}

.rx-lightbox-close:hover {
  background: #fff;
  color: var(--red);
}

@media (max-width: 640px) {
  .rx-lightbox {
    padding: 8px;
  }

  .rx-lightbox img {
    height: 90vh;
    height: 90dvh;
    max-width: 98vw;
  }

  .rx-lightbox-close {
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
  }
}

/* ============================================================
   Responsive — نسخة موسّعة تغطي كل مقاسات الأجهزة
   ============================================================ */

/* شاشات كبيرة جدًا (٤K / شاشات مكاتب عريضة) */
@media (min-width: 1600px) {
  .content {
    max-width: 1600px;
  }
}

/* لابتوبات صغيرة وتابلت بالعرض (Landscape) */
@media (max-width: 1200px) {
  .grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* تابلت (iPad وما شابه) */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main {
    margin-right: 0;
  }

  .hamburger {
    display: inline-flex;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .col-span-2 {
    grid-column: span 1;
  }

  .login-hero {
    display: none;
  }

  .grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }

  .content {
    padding: 22px;
  }
}

/* تابلت بورتريه / موبايل كبير */
@media (max-width: 768px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .card-head {
    align-items: flex-start;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .donut-wrap {
    justify-content: center;
    text-align: center;
  }

  .profile-head {
    text-align: center;
    justify-content: center;
  }
}

/* موبايل */
@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  .grid-4,
  .grid-6,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 14px;
  }

  .topbar .page-title {
    font-size: 16px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-card {
    padding: 16px;
    gap: 12px;
  }

  .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .login-card {
    padding: 22px;
  }

  .hbar-row .hb-name {
    width: 92px;
    font-size: 12.5px;
  }

  .modal-foot {
    flex-direction: column-reverse;
  }

  .modal-foot .btn {
    width: 100%;
  }

  .toasts {
    left: 12px;
    right: 12px;
    max-width: none;
    bottom: 12px;
    max-height: 46vh;
    max-height: 46dvh;
  }

  .toast {
    padding: 12px 14px;
  }

  .live-dot span.txt {
    display: none;
  }

  .avatar-lg {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    font-size: 22px;
  }

  .execution-ring {
    width: 56px;
    height: 56px;
  }

  .execution-ring span {
    font-size: 12px;
  }

  .price-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .price-box .p-value {
    font-size: 19px;
  }

  .modal-head,
  .modal-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .modal-foot {
    padding-left: 18px;
    padding-right: 18px;
  }

  .search-hero {
    padding: 20px 16px;
  }

  .rx-image img {
    height: 170px;
  }

  .notif-menu {
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: 340px;
  }

  .table-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
  }

  .table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
  }

  .table tbody tr:hover {
    background: var(--card);
  }

  .table tbody td {
    display: block;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    grid-column: 1 / -1;
    text-align: right;
  }

  .table tbody td:last-child {
    border-bottom: none;
  }

  .table tbody td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    margin-bottom: 3px;
  }

  .table tbody td.td-id {
    grid-column: 1;
    grid-row: 1;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 15.5px;
    font-weight: 900;
    align-self: center;
  }

  .table tbody td.td-status {
    grid-column: 2;
    grid-row: 1;
    border-bottom: none;
    padding-bottom: 0;
    text-align: left;
    align-self: center;
  }

  .table tbody td.td-action {
    border-bottom: none;
    padding-top: 10px;
    display: flex;
    justify-content: flex-end;
  }

  .table tbody td.td-action .icon-btn {
    width: 38px;
    height: 38px;
  }

  .table tbody td.td-meds .med-chips,
  .table tbody td.td-customer,
  .table tbody td.td-pharmacy {
    text-align: right;
  }
}

/* موبايل صغير جدًا (٣٦٠–٣٨٠ بكسل) */
@media (max-width: 380px) {
  .sidebar {
    width: 86vw;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar .page-title {
    font-size: 14.5px;
  }

  .stat-value {
    font-size: 19px;
  }

  .hbar-row .hb-name {
    width: 70px;
    font-size: 11.5px;
  }

  .hbar-row .hb-val {
    width: 58px;
    font-size: 12px;
  }

  .login-card {
    padding: 18px;
  }

  .demo-box .d-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .card {
    padding: 16px;
  }
}

/* دعم حواف الشاشات المنحنية / النوتش (iPhone وغيره) */
@supports (padding: max(0px)) {
  .topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .content {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .toasts {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar {
    padding-top: max(22px, env(safe-area-inset-top));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
}

/* أهداف لمس أكبر على الأجهزة اللي بتشتغل باللمس */
@media (pointer: coarse) {
  .icon-btn,
  .modal-close,
  .hamburger {
    min-width: 42px;
    min-height: 42px;
  }

  .nav-link {
    padding: 13px 12px;
  }

  .tab {
    padding: 10px 16px;
  }
}

/* تقليل الحركة لمن يفضّل ذلك (إتاحة/Accessibility) */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* عرض أفقي على الموبايل (Landscape) - يقلل ارتفاع الأشياء الثابتة */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar {
    height: 56px;
  }

  .login-hero {
    padding: 30px 40px;
  }

  .login-panel {
    padding: 20px;
  }
}

/* ============ صفحات الصيدليات والتحليلات (pages4.js) ============ */

/* شبكة البطاقات */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* بطاقة الصيدلية */
.pharmacy-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 237, 247, .8);
  padding: 22px;
  cursor: pointer;
  transition: all .3s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pharmacy-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pharmacy-card .card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pharmacy-card .card-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 4px 0;
}

.pharmacy-card .card-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin: 2px 0;
}

.pharmacy-card .card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stat-box {
  background: var(--bg-soft);
  padding: 14px;
  border-radius: 12px;
  text-align: center;
}

.stat-box .stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.stat-box .stat-label {
  font-size: 12px;
  color: var(--muted);
}

.pharmacy-card .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 0;
}

/* مختار الفترة الزمنية */
.period-selector {
  display: flex;
  gap: 8px;
  background: var(--bg-soft);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.period-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}

.period-tab input {
  display: none;
}

.period-tab:hover {
  border-color: var(--sky);
  color: var(--sky);
  background: var(--sky-50);
}

.period-tab.active {
  background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%);
  border-color: transparent;
  color: white;
}

/* شبكة الإحصائيات */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stats-grid .stat-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(227, 237, 247, .8);
  padding: 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, currentColor, transparent);
  opacity: 0.05;
  border-radius: 50%;
  z-index: 0;
}

.stat-card > * {
  position: relative;
  z-index: 1;
}

/* ============================================================
   🛠️ (تعديل) إصلاح بگ "نص شفاف/غير مرئي" جوه حلقة نسبة التنفيذ
   ------------------------------------------------------------
   المشكلة القديمة: القاعدة ".stats-grid .stat-icon { color: white; }"
   كانت بتلوّن العنصر (div.stat-icon) نفسه، ولون النص ده بيتورّث
   (inherit) لأي عنصر جواه من غير لون خاص بيه — بما فيهم
   ".execution-ring span" (النسبة المئوية لمعدل التنفيذ) في كارت
   "معدل التنفيذ" بصفحة تفاصيل الصيدلية. التعارض في الـ specificity:
   ".execution-ring span" (كلاس + عنصر) أضعف من ".stats-grid
   .stat-icon" (كلاسين)، فقاعدة اللون الأبيض كانت بتكسب، والنتيجة:
   نص النسبة المئوية بيبان أبيض على خلفية شبه بيضا جوه الحلقة —
   يعني مختفي عمليًا.

   نفس المشكلة كانت بتأثر على أي عنصر تاني يتحط جوه .stat-icon من
   غير لون خاص بيه (زي نص أو أيقونة إضافية).

   الحل: بدل ما نلوّن الـ div كله (وأي حاجة جواه)، بنلوّن الـ svg
   بس (المباشر جوه .stat-icon) — عشان أي عنصر تاني زي execution-ring
   يفضل ياخد لونه الطبيعي من القاعدة الخاصة بيه.
   ============================================================ */
.stats-grid .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-grid .stat-icon > svg {
  color: white;
}

.stats-grid .stat-card:nth-child(1) .stat-icon > svg {
  color: #0284c7;
}

.stats-grid .stat-card:nth-child(2) .stat-icon > svg {
  color: #16a34a;
}

.stats-grid .stat-card:nth-child(3) .stat-icon > svg {
  color: #d97706;
}

.stats-grid .stat-card:nth-child(4) .stat-icon > svg {
  color: #dc2626;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

/* ============================================================
   🛠️ (تعديل) رسم بياني الأعمدة الشهرية على سطح المكتب — ١٢ عمود
   ============================================================ */
.monthly-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  min-height: 200px;
  align-items: flex-end;
}

.month-bar {
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}

.month-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px rgba(2, 132, 199, .35);
}

/* الجدول */
.table-responsive {
  overflow-x: auto;
  margin: -22px -22px -22px -22px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  padding: 0 22px;
}

.table thead {
  background: var(--bg-soft);
}

.table th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tr:hover {
  background: var(--bg-soft);
}

.table tr:last-child td {
  border-bottom: none;
}

/* الحالة الفارغة (Empty State) */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state svg {
  opacity: 0.4;
  margin-bottom: 12px;
}

.empty-state h3 {
  color: var(--ink-2);
  font-size: 16px;
  margin: 0;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.empty-state.small {
  padding: 32px 24px;
}

/* رأس الصفحة */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 8px 0;
  color: var(--ink);
}

.page-header .text-muted {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

/* الكول على الموبايل */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* ============================================================
     🛠️ (تعديل) الشارت الشهري على الموبايل — يبان الـ ١٢ شهر كلهم
     ------------------------------------------------------------
     المشكلة القديمة: كان بيقلّل الأعمدة لـ 6 بس (repeat(6, ...))،
     يعني نص السنة كان بيختفي تمامًا من غير ما يبان فيه أي إشارة
     إن فيه شهور تانية، وده اللي المستخدم لاحظه (بيبان بس 6 شهور
     على الموبايل).

     الحل: رجّعنا الشارت لـ 12 عمود زي سطح المكتب بالظبط، وكل عمود
     بحد أدنى عرض 44px (minmax(44px,1fr)) — لو المساحة مش كافية
     لعرض كل الاتناشر عمود مرة واحدة، الشارت بيعمل سكرول أفقي
     (overflow-x:auto) بدل ما يقصّ الشهور أو يكسر الصفحة. أسماء
     الشهور نفسها بقت مختصرة (شوف ARABIC_MONTHS_SHORT في pages4.js)
     عشان تاخد مساحة أقل جوه العمود الضيق.
     ============================================================ */
  .monthly-chart {
    grid-template-columns: repeat(12, minmax(44px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .pharmacy-card .card-body {
    grid-template-columns: 1fr;
  }

  .period-selector {
    flex-direction: column;
  }

  .period-tab {
    width: 100%;
    justify-content: center;
  }

  .pharmacy-card .card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .pharmacy-card .card-footer a {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .btn {
    width: 100%;
  }
}


/* ============================================================
   🆕 lightbox-addon.css
   ============================================================ */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 56, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
  cursor: zoom-out;
}

.lightbox-overlay.in {
  opacity: 1;
}

.lightbox-img {
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 90vh;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .5);
  cursor: default;
  transform: scale(.94);
  transition: transform .2s cubic-bezier(.22, .9, .3, 1);
}

.lightbox-card {
  background: #fff;
  border-radius: 22px;
  padding: 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  cursor: default;
  transform: scale(.94);
  transition: transform .2s cubic-bezier(.22, .9, .3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.lightbox-overlay.in .lightbox-img,
.lightbox-overlay.in .lightbox-card {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all .15s;
  z-index: 1;
}

.lightbox-close:hover {
  background: #fff;
  color: var(--red);
}

.lightbox-avatar-big {
  width: 110px;
  height: 110px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 42px;
  box-shadow: 0 10px 26px -6px rgba(2, 132, 199, .4);
  margin-bottom: 6px;
}

.lightbox-avatar-name {
  font-size: 19px;
  font-weight: 900;
  color: var(--ink);
}

.lightbox-avatar-sub {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.lightbox-avatar-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 600;
}

@media (max-width: 640px) {
  .lightbox-overlay {
    padding: 12px;
  }

  .lightbox-img {
    max-width: 96vw;
    max-height: 88vh;
    max-height: 88dvh;
  }

  .lightbox-close {
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
  }

  .lightbox-card {
    padding: 24px 20px;
  }
}
