/* ════════════════════════════════════════════
   🎨 Design Tokens — متطابق مع تطبيق صلص
   ════════════════════════════════════════════ */
:root {
  /* الألوان — Brand */
  --brand-primary: #4F46E5;
  --brand-primary-dark: #3730A3;
  --brand-secondary: #FF6B35;
  --brand-gradient: linear-gradient(135deg, #4F46E5 0%, #3730A3 100%);

  /* الحالات */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* النصوص */
  --text-dark: #111827;
  --text-body: #374151;
  --text-grey: #6B7280;
  --text-muted: #9CA3AF;

  /* الخلفيات */
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --surface-muted: #F3F4F6;
  --border: #E5E7EB;
  --border-light: #F1F2F5;

  /* Spacing & Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 2px 4px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 2px 6px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 8px 16px rgba(17, 24, 39, 0.08), 0 16px 48px rgba(17, 24, 39, 0.08);

  /* Motion */
  --motion-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --motion-md: 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  direction: rtl;
}

::selection { background: var(--brand-primary); color: #fff; }

/* Scrollbar أنيق */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.12);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(17, 24, 39, 0.22); }

/* ════════════════════════════════════════════
   🎨 Theme Overrides — Brand consistency
   ════════════════════════════════════════════ */
.navbar { background: var(--brand-gradient) !important; }
.tab h2 { color: var(--brand-primary) !important; }
.order-info strong { color: var(--brand-primary) !important; }
.order-status select:hover,
.filter-bar select:hover,
.modal input:focus,
.modal select:focus,
.modal textarea:focus { border-color: var(--brand-primary) !important; }
.modal input:focus,
.modal select:focus,
.modal textarea:focus { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important; }
.modal button { background: var(--brand-primary) !important; }
.modal button:hover { background: var(--brand-primary-dark) !important; }
.conversation-item.active { background: rgba(79, 70, 229, 0.08) !important; border-right-color: var(--brand-primary) !important; }
.message.sent { background: rgba(79, 70, 229, 0.1) !important; }

/* Navbar */
.navbar {
  background: linear-gradient(135deg, #4F46E5 0%, #3730A3 100%);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar span {
  font-size: 1.5rem;
  font-weight: bold;
}

.navbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.nav-divider {
  flex: 0 0 auto;
  align-self: center;
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.25);
  margin: 0 4px;
}

.nav-links button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
  white-space: nowrap;
  position: relative;
}

.nav-links button:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.logout-btn {
  background: #ff6b6b !important;
}

.logout-btn:hover {
  background: #ff5252 !important;
}

/* ════ زر كتم الإشعارات ════ */
.mute-btn {
  background: rgba(255,255,255,0.15) !important;
  font-size: 1.1rem !important;
  padding: 0.5rem 0.8rem !important;
}

/* ════ Badge عدّاد الإشعارات ════ */
.nav-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: #ff3b30;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 0 2px white, 0 2px 4px rgba(0,0,0,0.2);
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ════ بانر طلب إذن الإشعارات ════ */
.notif-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-bottom: 2px solid #f59e0b;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #78350f;
  font-weight: 700;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.notif-banner > div {
  display: flex;
  gap: 0.5rem;
}

.notif-banner .enable-btn {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.notif-banner .enable-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.notif-banner .dismiss-btn {
  background: transparent;
  color: #78350f;
  border: 1px solid #d97706;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.notif-banner .dismiss-btn:hover {
  background: rgba(217, 119, 6, 0.1);
}

/* Main Content */
main {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.tab {
  display: none;
  animation: fadeIn 0.3s;
}

.tab:not(.hidden) {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none;
}

.tab h2 {
  color: #4F46E5;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

/* Buttons */
.add-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 1.5rem;
  transition: all 0.3s;
}

.add-btn:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cancel-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 1rem;
}

.cancel-btn:hover {
  background: #5a6268;
}

/* Cards */
.order-card, .restaurant-card, .driver-card, .review-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s;
}

.order-card:hover, .restaurant-card:hover, .driver-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.order-info {
  margin-bottom: 1rem;
}

.order-info strong {
  display: block;
  color: #4F46E5;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.order-info span {
  display: block;
  color: #666;
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

.order-info small {
  color: #999;
  font-size: 0.85rem;
}

.order-status {
  margin-top: 1rem;
}

.order-status select {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  background: white;
  color: #333;
  cursor: pointer;
  font-size: 0.95rem;
}

.order-status select:hover {
  border-color: #4F46E5;
}

/* Filter Bar */
.filter-bar {
  margin-bottom: 1.5rem;
}

.filter-bar select {
  padding: 0.7rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  background: white;
  color: #333;
  cursor: pointer;
  font-size: 1rem;
}

.filter-bar select:hover {
  border-color: #4F46E5;
}

/* Modal */
.modal {
  background: white;
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.modal input, .modal select, .modal textarea {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 0.95rem;
  direction: rtl;
}

.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal button {
  width: 100%;
  padding: 0.8rem;
  background: #4F46E5;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: all 0.3s;
}

.modal button:hover {
  background: #3730A3;
}

/* Messages Container */
.messages-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  min-height: 600px;
}

.conversations-panel {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow-y: auto;
  max-height: 600px;
}

.conversation-item {
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s;
  border-right: 4px solid transparent;
}

.conversation-item:hover {
  background: #f5f5f5;
}

.conversation-item.active {
  background: #e8e9f9;
  border-right-color: #4F46E5;
}

.conversation-item strong {
  display: block;
  color: #333;
}

.conversation-item small {
  color: #999;
}

.messages-panel {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.message {
  margin-bottom: 1rem;
  padding: 0.8rem;
  border-radius: 8px;
  max-width: 70%;
}

.message.sent {
  background: #e8e9f9;
  margin-left: auto;
  text-align: right;
}

.message.received {
  background: #f0f0f0;
  margin-right: auto;
  text-align: right;
}

.message small {
  display: block;
  color: #999;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.message-input {
  display: flex;
  gap: 0.5rem;
}

.message-input input {
  flex: 1;
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  direction: rtl;
}

.message-input button {
  padding: 0.8rem 1.5rem;
  background: #4F46E5;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--brand-gradient);
}

.login-card {
  background: white;
  padding: 2.5rem;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  color: var(--brand-primary);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.login-card h2 {
  color: #666;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  font-weight: normal;
}

.login-card input {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 1rem;
  direction: rtl;
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.login-card button {
  width: 100%;
  padding: 1rem;
  background: var(--brand-gradient);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.login-card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.error {
  color: #dc3545;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 1.4em;
}

.login-hint {
  color: #888;
  text-align: center;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  line-height: 1.5;
  min-height: 1.2em;
}

.login-card button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .messages-container {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 90%;
  }

  main {
    margin: 1rem auto;
  }
}

/* ========== أزرار التحكم بالحالة ========== */
.toggle-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
  margin-right: 0.5rem;
}

.toggle-btn.open {
  background: #28a745;
  color: white;
}

.toggle-btn.open:hover {
  background: #218838;
}

.toggle-btn.closed {
  background: #dc3545;
  color: white;
}

.toggle-btn.closed:hover {
  background: #c82333;
}

.manage-btn {
  padding: 0.5rem 1rem;
  background: #6f42c1;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
  margin-right: 0.5rem;
}

.manage-btn:hover {
  background: #5a32a3;
}

.delete-btn {
  padding: 0.5rem 1rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.delete-btn:hover {
  background: #c82333;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.status-badge.open {
  background: #d4edda;
  color: #155724;
}

.status-badge.closed {
  background: #f8d7da;
  color: #721c24;
}

/* ========== Modal الوجبات ========== */
.products-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.products-modal.hidden {
  display: none;
}

.products-modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.products-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.products-modal-header h2 {
  color: #4F46E5;
  margin: 0;
  font-size: 1.5rem;
}

.close-btn {
  background: #dc3545;
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.close-btn:hover {
  background: #c82333;
  transform: rotate(90deg);
}

/* ========== كرت الوجبة ========== */
.product-card {
  background: white;
  border: 2px solid #f0f0f0;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: all 0.3s;
}

.product-card:hover {
  border-color: #4F46E5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.product-card.unavailable {
  opacity: 0.6;
  background: #f8f9fa;
}

/* 🥤 شارة المشروب العام (نسخة مُدارة مركزياً داخل قائمة المطعم) */
.global-drink-badge {
  display: inline-block;
  margin: 4px 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  font-size: 0.78rem;
  font-weight: 700;
}

/* 🏪 لوحة "في أي مطاعم تظهر المشروبات" داخل قسم المشروبات */
.drinks-rest-panel {
  background: #fff;
  border: 1px solid #e0e4ff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.drinks-rest-panel > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.92rem;
  color: #3730a3;
  list-style: none;
}
.drinks-rest-panel > summary::-webkit-details-marker { display: none; }
.drinks-rest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f1f5;
}
.drinks-rest-row:last-child { border-bottom: none; }
.drinks-rest-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #2d2d3a;
}
.drinks-rest-row .toggle-btn { min-width: 96px; }

.product-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: #e0e0e0;
  flex-shrink: 0;
}

.product-info {
  flex: 1;
}

.product-info strong {
  display: block;
  color: #333;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.product-info p {
  color: #666;
  font-size: 0.85rem;
  margin: 0.2rem 0;
}

.product-price {
  font-size: 1.1rem;
  font-weight: bold;
  color: #28a745;
  margin: 0.3rem 0;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ═══════════════════════════════════════
   تبويبات الطلبات + بحث + رقم الطلب
   ═══════════════════════════════════════ */

/* شريط البحث */
.orders-search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.orders-search-bar:focus-within {
  border-color: #4F46E5;
}
.search-icon { font-size: 1.1rem; flex-shrink: 0; }
.orders-search-bar input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.95rem;
  background: transparent;
  direction: rtl;
}

/* التبويبات */
.orders-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}
.orders-tab {
  background: none;
  border: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #666;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.orders-tab:hover {
  background: #f0f4ff;
  color: #4F46E5;
}
.orders-tab.active-tab {
  background: #4F46E5;
  color: white;
  border-color: #4F46E5;
}
.tab-count {
  background: rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.8rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
}
.orders-tab:not(.active-tab) .tab-count {
  background: #e0e0e0;
  color: #333;
}

/* رقم الطلب البارز */
.order-number-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4F46E5, #3730A3);
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════
   صفحة الإعدادات
   ═══════════════════════════════════════ */
.settings-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  max-width: 600px;
  margin-bottom: 1rem;
}

.settings-card h3 {
  color: #4F46E5;
  border-bottom: 2px solid #f0f4ff;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* تبويبات فرعية للإعدادات */
.settings-subtabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  background: #f8f9fa;
  padding: 0.4rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.settings-subtab {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 0.9rem;
  background: transparent;
  color: #555;
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.settings-subtab:hover {
  background: rgba(79, 70, 229, 0.08);
  color: #4F46E5;
}

.settings-subtab.active-subtab {
  background: white;
  color: #4F46E5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.15);
}

.settings-sub.hidden {
  display: none;
}

/* صناديق الـ hints */
.settings-hint {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

.settings-hint.hint-warn {
  background: #fff3cd;
  border-right: 4px solid #ffa000;
  color: #5d4101;
}

.settings-hint.hint-success {
  background: #e7f5ee;
  border-right: 4px solid #25d366;
  color: #0d4d2b;
}

.settings-hint.hint-info {
  background: #e3f2fd;
  border-right: 4px solid #0d6efd;
  color: #0d3b66;
}

/* زر حفظ بعرض كامل */
.save-btn-full {
  width: 100%;
  padding: 0.85rem;
  background: #4F46E5;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.15s;
}

.save-btn-full:hover {
  background: #3730A3;
  transform: translateY(-1px);
}

/* أزرار روابط داخلية في "معلومات" */
.link-btn {
  width: 100%;
  text-align: right;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  color: #333;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.link-btn:hover {
  background: #e9ecef;
  border-color: #4F46E5;
  color: #4F46E5;
}

.settings-field {
  margin-bottom: 1.5rem;
}

.settings-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #333;
}

.settings-field input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.settings-field input:focus {
  outline: none;
  border-color: #4F46E5;
}

.settings-field small {
  display: block;
  margin-top: 0.4rem;
  color: #666;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ═══════════════════════════════════════
   🏠 العناوين المحفوظة
   ═══════════════════════════════════════ */
.address-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 1rem;
  align-items: start;
}

.address-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.address-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.address-short-id {
  background: linear-gradient(135deg, #4F46E5, #3730A3);
  color: white;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 1rem;
  letter-spacing: 1px;
  font-family: monospace;
}

.address-label {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.address-row {
  font-size: 0.9rem;
  color: #444;
}

.address-row a {
  color: #4F46E5;
  text-decoration: none;
}

.small-link {
  display: inline-block;
  margin-top: 0.4rem;
  color: #4285f4;
  font-size: 0.85rem;
  text-decoration: none;
}

.address-image-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.address-thumb {
  width: 180px;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #eee;
  cursor: pointer;
  transition: transform 0.2s;
}

.address-thumb:hover {
  transform: scale(1.03);
  border-color: #4F46E5;
}

.address-no-image {
  width: 180px;
  height: 130px;
  background: #f5f5f5;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #999;
  gap: 0.3rem;
}

/* صورة البناية في كرت الطلب */
.building-photo-section {
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(135deg, #f0f4ff 0%, #fce4ec 100%);
  border-radius: 8px;
  border-right: 4px solid #4F46E5;
}

.order-building-thumb {
  width: 100%;
  max-width: 280px;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.order-building-thumb:hover {
  transform: scale(1.02);
}

/* ═══════════════════════════════════════
   📸 عارض الصور (Lightbox)
   ═══════════════════════════════════════ */
.image-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.image-viewer-content {
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 10px;
  background: white;
}

.image-viewer-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Responsive */
@media (max-width: 700px) {
  .address-card {
    grid-template-columns: 1fr;
  }
  .address-image-section { align-items: flex-start; }
}

/* ════════════════════════════════════════════
   🚚 زر إرسال للسائق + شارات صورة العنوان
   ════════════════════════════════════════════ */
.driver-send-btn {
  padding: 0.55rem 1rem;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
.driver-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.5);
}
.driver-send-btn:active {
  transform: translateY(0);
}

.addr-img-badge {
  margin-top: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.addr-img-ok      { background: #d1f4d8; color: #155724; border: 1px solid #a8e6b6; }
.addr-img-missing { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.addr-img-none    { background: #f1f3f4; color: #555;    border: 1px solid #ddd;    }

.addr-img-add-btn {
  margin-right: auto;
  padding: 0.3rem 0.7rem;
  background: #fd7e14;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}
.addr-img-add-btn:hover { background: #e8680c; }

/* ════════════════════════════════════════════
   📷 محرر صور البناية (Upload Modal)
   ════════════════════════════════════════════ */
.image-upload-content {
  background: white;
  border-radius: 16px;
  max-width: 560px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.image-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #eee;
}

.image-upload-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.img-drop-zone {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  background: #fafafa;
  transition: all 0.2s;
  cursor: pointer;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-drop-zone.dragging {
  border-color: #4F46E5;
  background: #f0f4ff;
  transform: scale(1.01);
}

.img-drop-zone img#img-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.img-drop-icon {
  font-size: 3.5rem;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.img-drop-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.3rem 0;
  color: #555;
}

.img-drop-or {
  color: #999;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.img-drop-paste-hint {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.img-drop-paste-hint kbd {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: monospace;
  font-size: 0.85rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

.img-preview-label {
  color: #666;
  font-size: 0.85rem;
  margin-top: 0.6rem;
  font-weight: 600;
}

.img-progress {
  margin-top: 1rem;
  padding: 0.8rem;
  background: #f0f4ff;
  border-radius: 10px;
  border: 1px solid #c5d1ff;
}

.img-progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e7ff;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.img-progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #4F46E5, #3730A3);
  border-radius: 4px;
  transition: width 0.2s ease;
  width: 0%;
}

#img-progress-text {
  margin: 0;
  font-size: 0.88rem;
  color: #4c5fd0;
  font-weight: 600;
  text-align: center;
}

.img-upload-actions {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.img-upload-actions button {
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.img-tip {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: #fff8e1;
  border-right: 4px solid #ffa000;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #856404;
}

/* ════════════════════════════════════════════
   🍞 Toast notification
   ════════════════════════════════════════════ */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: white;
  padding: 12px 22px;
  border-radius: 28px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: 90vw;
  text-align: center;
}
.admin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════
   👥 إدارة الأدمنز — Super Admin only
   ════════════════════════════════════════════ */

/* مخفي تماماً لغير الـ Super Admin — للـ Super Admin يتصرّف عادي
   (الـ tab يخفى بـ .hidden، والزر يظهر inline-block افتراضياً) */
body:not(.is-super-admin) .super-admin-only {
  display: none !important;
}

/* بطاقة أدمن */
.admin-card {
  background: white;
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all 0.25s;
}
.admin-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}
.admin-info {
  flex: 1;
  min-width: 0;
}
.admin-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
  color: #333;
}
.admin-email {
  color: #555;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  word-break: break-all;
}
.admin-meta {
  color: #999;
  font-size: 0.8rem;
}

/* زر حذف خطر */
.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-danger:hover {
  background: #c82333;
  transform: translateY(-1px);
}

/* زر حفظ أساسي */
.save-btn {
  background: #C0392B;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 1rem;
  transition: all 0.3s;
}
.save-btn:hover {
  background: #a52f23;
  transform: translateY(-1px);
}
.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* صف أزرار الـ modal */
.modal-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.modal-buttons button {
  margin: 0;
  flex: 1;
  min-width: 140px;
}

/* حالة فارغة */
.empty-state {
  background: white;
  padding: 2rem;
  text-align: center;
  border-radius: 10px;
  color: #555;
}
.empty-state p {
  margin: 0.3rem 0;
}

/* ════════════════════════════════════════════
   ✨ Premium Polish — تحسينات بصرية إضافية
   ════════════════════════════════════════════ */

/* —— كروت أرقى — حدود ناعمة + ظلال متطورة —— */
.order-card,
.restaurant-card,
.driver-card,
.review-card,
.address-card,
.admin-card,
.modal {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: box-shadow var(--motion-md), transform var(--motion-md), border-color var(--motion-md) !important;
}

.order-card:hover,
.restaurant-card:hover,
.driver-card:hover,
.address-card:hover {
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-2px) !important;
  border-color: rgba(79, 70, 229, 0.18) !important;
}

/* —— أزرار رئيسية أنيقة —— */
.add-btn {
  background: var(--success) !important;
  color: white !important;
  border: none !important;
  padding: 0.75rem 1.4rem !important;
  border-radius: var(--r-md) !important;
  cursor: pointer !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  transition: background var(--motion-fast), transform var(--motion-fast),
              box-shadow var(--motion-fast) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25) !important;
}
.add-btn:hover {
  background: #1ea34d !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35) !important;
}
.add-btn:active { transform: translateY(0) !important; }
/* زر معطّل: كان يبدو فعّالاً تماماً فيُضغط بلا فائدة */
.add-btn:disabled,
.add-btn:disabled:hover {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* —— Inputs أنيقة عبر التطبيق —— */
input[type='text'],
input[type='email'],
input[type='number'],
input[type='tel'],
input[type='password'],
input[type='date'],
input[type='datetime-local'],
input[type='time'],
textarea,
select {
  font-family: inherit;
  font-size: 0.95rem;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--r-md) !important;
  padding: 0.65rem 0.85rem !important;
  background: #fff !important;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast) !important;
  color: var(--text-dark) !important;
}
input:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12) !important;
}
input::placeholder,
textarea::placeholder { color: var(--text-muted); }

/* —— Tab navigation buttons — pill style أنظف —— */
.nav-links button {
  border-radius: 999px !important;
  font-weight: 700 !important;
  padding: 0.55rem 1.1rem !important;
  letter-spacing: 0.2px;
  backdrop-filter: blur(6px);
}
.nav-links button:hover {
  background: rgba(255, 255, 255, 0.32) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* —— Status badges أنيقة —— */
.status-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.2px;
}
.status-badge.open { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.status-badge.closed { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }

/* —— Orders tabs — التصميم الأنظف —— */
.orders-tab {
  position: relative;
  padding: 0.55rem 1.1rem !important;
  border: 1.5px solid var(--border) !important;
  background: #fff !important;
  color: var(--text-grey) !important;
  border-radius: 999px !important;
  cursor: pointer;
  font-weight: 800 !important;
  font-size: 0.88rem !important;
  transition: all var(--motion-fast) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.orders-tab:hover {
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}
.orders-tab.active-tab {
  background: var(--brand-primary) !important;
  color: white !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* —— Toast notifications —— */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-dark);
  color: white;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--motion-md), transform var(--motion-md);
  z-index: 10000;
  pointer-events: none;
  max-width: 350px;
}
.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* —— Driver send button (مميّز) —— */
.driver-send-btn {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
  color: white !important;
  border: none !important;
  padding: 0.55rem 0.9rem !important;
  border-radius: var(--r-md) !important;
  cursor: pointer !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  transition: all var(--motion-fast) !important;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3) !important;
}
.driver-send-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.42) !important;
}

/* —— أزرار الإجراءات — توحيد الـ design —— */
.manage-btn,
.toggle-btn,
.delete-btn {
  padding: 0.5rem 0.9rem !important;
  border-radius: var(--r-md) !important;
  border: none !important;
  cursor: pointer !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  transition: all var(--motion-fast) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.manage-btn { background: var(--info); color: white; }
.manage-btn:hover { background: #2563EB; transform: translateY(-1px); }
.toggle-btn.open { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.toggle-btn.open:hover { background: rgba(34, 197, 94, 0.2); }
.toggle-btn.closed { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.toggle-btn.closed:hover { background: rgba(245, 158, 11, 0.2); }
.delete-btn { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }
.delete-btn:hover { background: rgba(239, 68, 68, 0.18); }

/* —— Sticky search bars داخل التبويبات —— */
input[type='search'],
.search-input {
  border-radius: 999px !important;
  padding-left: 2.5rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 12px center !important;
}

/* —— Order number badge —— */
.order-number-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: white;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* —— Address badges (داخل order card) —— */
.addr-img-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 10px !important;
  border-radius: var(--r-md) !important;
  font-size: 0.83rem !important;
  font-weight: 700 !important;
  margin-top: 8px !important;
}
.addr-img-badge.addr-img-none { background: rgba(156, 163, 175, 0.15); color: #4B5563; }
.addr-img-badge.addr-img-ok { background: rgba(34, 197, 94, 0.12); color: #15803d; cursor: pointer; }
.addr-img-badge.addr-img-missing { background: rgba(245, 158, 11, 0.12); color: #b45309; flex-wrap: wrap; }
.addr-img-add-btn {
  background: var(--warning); color: white; border: none;
  padding: 4px 10px; border-radius: var(--r-sm); font-weight: 800;
  cursor: pointer; font-size: 0.78rem; margin-right: auto;
}
.addr-img-add-btn:hover { background: #d97706; }

/* —— Building photo thumbnail —— */
.order-building-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--r-md);
  margin-top: 8px;
  cursor: pointer;
  transition: transform var(--motion-fast);
  border: 1px solid var(--border);
}
.order-building-thumb:hover { transform: scale(1.02); }

/* —— Address card —— */
.address-card {
  background: white !important;
  padding: 1rem !important;
  margin-bottom: 0.8rem !important;
  display: grid !important;
  grid-template-columns: 1fr 140px !important;
  gap: 1rem !important;
  align-items: start !important;
}
.address-info { display: flex; flex-direction: column; gap: 4px; }
.address-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.address-short-id {
  background: var(--brand-primary);
  color: white;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}
.address-label {
  background: var(--surface-muted);
  color: var(--text-body);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.address-row { font-size: 0.88rem; color: var(--text-body); }
.address-row a { color: var(--brand-primary); text-decoration: none; font-weight: 600; }
.small-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.83rem;
  color: var(--info);
  text-decoration: none;
  font-weight: 700;
}
.small-link:hover { text-decoration: underline; }
.address-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: var(--r-md);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform var(--motion-fast);
}
.address-thumb:hover { transform: scale(1.04); }
.address-no-image {
  width: 100%;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  border-radius: var(--r-md);
  border: 2px dashed var(--border);
  color: var(--text-muted);
  gap: 4px;
}

/* —— Image viewer overlay —— */
.image-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s;
}
.image-viewer-content {
  background: white;
  border-radius: var(--r-lg);
  padding: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.image-viewer-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--r-md);
  object-fit: contain;
}
.image-viewer-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* —— Image upload modal (محرر الصور) —— */
.image-upload-content {
  background: white;
  border-radius: var(--r-xl);
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.image-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.image-upload-header h2 { font-size: 1.2rem; color: var(--text-dark); }
.close-btn {
  background: var(--surface-muted);
  border: none;
  width: 36px; height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-grey);
  transition: all var(--motion-fast);
}
.close-btn:hover { background: var(--danger); color: white; }
.img-drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--surface-muted);
  transition: all var(--motion-fast);
  cursor: pointer;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-drop-zone:hover,
.img-drop-zone.dragging {
  border-color: var(--brand-primary);
  background: rgba(79, 70, 229, 0.04);
}
.img-drop-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.img-drop-title { font-weight: 900; color: var(--text-dark); font-size: 1.05rem; margin-bottom: 0.4rem; }
.img-drop-or { color: var(--text-grey); font-size: 0.85rem; margin: 0.6rem 0; }
.img-drop-paste-hint { font-weight: 700; color: var(--text-body); font-size: 0.92rem; }
.img-drop-paste-hint kbd {
  background: white;
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.78rem;
  box-shadow: 0 1px 0 var(--border);
}
#img-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--r-md);
  object-fit: contain;
}
.img-preview-label { color: var(--text-grey); font-size: 0.85rem; margin-top: 0.5rem; }
.img-progress {
  margin-top: 1rem;
  background: var(--surface-muted);
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-md);
}
.img-progress-bar {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
#img-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  width: 0%;
  transition: width var(--motion-md);
}
#img-progress-text { font-size: 0.85rem; color: var(--text-body); font-weight: 700; }
.img-upload-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.img-upload-actions button { flex: 1; }
.img-tip {
  background: rgba(59, 130, 246, 0.08);
  color: #1e40af;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-md);
  font-size: 0.83rem;
  margin-top: 0.8rem;
  line-height: 1.5;
}

/* —— Admin card (إدارة الأدمنز) —— */
.admin-card {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 1rem 1.2rem !important;
  background: white !important;
  margin-bottom: 0.8rem !important;
}
.admin-info { display: flex; flex-direction: column; gap: 4px; }
.admin-name { font-weight: 900; color: var(--text-dark); font-size: 1rem; }
.admin-email { color: var(--brand-primary); font-size: 0.88rem; font-weight: 700; }
.admin-meta { font-size: 0.78rem; color: var(--text-muted); }
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  transition: all var(--motion-fast);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

/* Super admin tab visibility */
body:not(.is-super-admin) [data-super-admin-only] { display: none !important; }

/* —— Loading skeleton للأقسام —— */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-muted) 0%, #eaeaef 50%, var(--surface-muted) 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: var(--r-md);
}

/* ════════════════════════════════════════════
   📸 Image Upload Component
   ════════════════════════════════════════════ */
.img-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  margin: 0.5rem 0 0.9rem;
  background: var(--surface-muted);
  transition: border-color var(--motion-fast), background var(--motion-fast),
    box-shadow var(--motion-fast);
  cursor: pointer;
  overflow: hidden;
}
.img-upload-area:hover { border-color: var(--brand-primary); background: #fff6f3; }
.img-upload-area.drag-over {
  border-color: var(--brand-primary);
  background: #fff6f3;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10);
}
/* عند وجود صورة: حدود ناعمة محايدة بدل الأخضر الصارخ */
.img-upload-area.has-image {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface);
  cursor: default;
}

/* ─── حالة الفراغ: منطقة الإفلات ─── */
.img-upload-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  padding: 1.6rem 1rem;
  min-height: 130px;
  cursor: pointer;
}
.img-upload-icon {
  font-size: 1.5rem;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: var(--r-full);
  box-shadow: var(--shadow-sm);
}
.img-upload-text { font-size: 0.92rem; font-weight: 800; color: var(--text-body); }
.img-upload-hint { font-size: 0.76rem; color: var(--text-muted); }

/* ─── حالة وجود صورة: معاينة أنيقة ─── */
.img-preview-box {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem;
  position: relative;
}
.img-preview-box img {
  width: 92px;
  height: 92px;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--surface-muted);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.img-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
}
.img-preview-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.img-preview-size { font-size: 0.78rem; color: var(--text-grey); }
/* شارة تأكيد صغيرة — تظهر فقط بعد اكتمال الرفع */
.img-preview-info::after {
  content: '✓ جاهزة';
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--success);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.12rem 0.5rem;
  border-radius: var(--r-full);
}
.img-remove-btn {
  background: #fff;
  color: var(--danger);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--motion-fast), color var(--motion-fast),
    border-color var(--motion-fast), transform var(--motion-fast);
}
.img-remove-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  transform: rotate(90deg);
}

/* ─── شريط التقدّم ─── */
.img-upload-progress {
  padding: 1rem 1.1rem 1.2rem;
  display: none;
}
.img-upload-progress.visible { display: block; }
.img-progress-bar-wrap {
  background: var(--border);
  border-radius: var(--r-full);
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.img-progress-bar {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--r-full);
  transition: width 0.2s ease;
  width: 0%;
}
.img-progress-label {
  font-size: 0.8rem;
  color: var(--text-body);
  font-weight: 700;
}

.img-upload-label-text {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.3rem;
}

/* —— Mobile responsive —— */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
  }
  /* تمرير أفقي بدل التكدّس العمودي — شريط تبويبات أنيق على الموبايل */
  .nav-links {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 0.4rem;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .nav-links::-webkit-scrollbar { height: 4px; }
  .nav-links button {
    flex: 0 0 auto;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.82rem !important;
  }
  main { padding: 0 0.7rem; margin: 1rem auto; }
  .messages-container { grid-template-columns: 1fr !important; }
  .address-card { grid-template-columns: 1fr !important; }
  .address-image-section { display: flex; gap: 0.5rem; align-items: center; }
  .address-thumb,
  .address-no-image { width: 100px !important; height: 80px !important; flex-shrink: 0; }
  .order-card,
  .restaurant-card { padding: 1rem !important; }
  .modal { padding: 1.2rem !important; }
  .modal-buttons button { min-width: 100% !important; }
  .tab h2 { font-size: 1.4rem !important; }
  .img-upload-trigger { min-height: 112px; padding: 1.2rem 0.8rem; }
  .img-preview-box img { width: 78px; height: 78px; }
}

/* ════════════════════════════════════════════════════════
   ✨ تطوير احترافي — نظرة عامة · الطلبات · الحسابات
   ════════════════════════════════════════════════════════ */

/* ─── الشريط العلوي: تمييز التبويب النشط ─── */
.nav-links button {
  border-radius: 9px;
  font-weight: 600;
}
.nav-links button.active-nav {
  background: #fff !important;
  color: var(--brand-primary-dark) !important;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}
.nav-links button.active-nav:hover {
  background: #fff !important;
  transform: none;
}

/* ─── ترويسة الصفحة ─── */
.page-head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.page-head h2 { margin: 0 !important; }
.page-head-sub {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-grey);
  background: var(--surface-muted);
  padding: 0.25rem 0.75rem;
  border-radius: var(--r-full);
}

/* ─── بطاقات الإحصائيات ─── */
.stat-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.6rem;
  grid-template-columns: repeat(6, 1fr);
}
@media (max-width: 1180px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--_tone, var(--brand-primary));
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--motion-md), transform var(--motion-md);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.stat-icon {
  font-size: 1.35rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--_toneBg, #eef2ff);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stat-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-body);
  margin-top: 0.15rem;
}
.stat-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.stat-delta {
  font-size: 0.73rem;
  font-weight: 800;
  padding: 0.22rem 0.55rem;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.stat-delta.up   { background: #e6f4ea; color: #1f9d4d; }
.stat-delta.down { background: #fdeaea; color: #d33; }
.stat-delta.flat { background: var(--surface-muted); color: var(--text-grey); }

.tone-blue   { --_tone: #3b82f6; --_toneBg: #e7f0fd; }
.tone-green  { --_tone: #22c55e; --_toneBg: #e6f4ea; }
.tone-red    { --_tone: #ef4444; --_toneBg: #fdeaea; }
.tone-orange { --_tone: #f59e0b; --_toneBg: #fff4e0; }
.tone-purple { --_tone: #8b5cf6; --_toneBg: #f0e9fd; }
.tone-grey   { --_tone: #9ca3af; --_toneBg: #f1f2f5; }
.tone-slate  { --_tone: #475569; --_toneBg: #e8eaee; }

/* ─── شبكة "نظرة عامة" ─── */
.overview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.45fr 1fr;
}
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-muted);
}
.panel-head h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--text-dark);
}
.panel-body { padding: 0.55rem 0.65rem; }
.link-mini {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  font-family: inherit;
}
.link-mini:hover { background: rgba(79, 70, 229, 0.08); }

.ov-order-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.6rem;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--motion-fast);
}
.ov-order-row:hover { background: var(--surface-muted); }
.ov-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ov-order-num { font-weight: 900; color: var(--text-dark); font-size: 0.9rem; }
.ov-order-name {
  flex: 1;
  min-width: 0;
  color: var(--text-body);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ov-order-total { font-weight: 800; color: var(--brand-primary); font-size: 0.87rem; }
.ov-order-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.bd-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.5rem; }
.bd-label { width: 140px; font-size: 0.83rem; color: var(--text-body); flex-shrink: 0; }
.bd-bar-wrap {
  flex: 1;
  height: 9px;
  background: var(--surface-muted);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bd-bar {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  min-width: 2px;
  transition: width var(--motion-md);
}
.bd-count { width: 34px; text-align: left; font-weight: 800; font-size: 0.85rem; color: var(--text-dark); }

/* ─── فلتر التاريخ ─── */
.date-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.date-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.date-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-grey);
  font-weight: 700;
  font-size: 0.84rem;
  font-family: inherit;
  padding: 0.42rem 0.9rem;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--motion-fast);
}
.date-chip:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.date-chip.active-chip {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.date-range-custom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.3rem 0.65rem;
}
.date-range-label { font-size: 0.79rem; font-weight: 800; color: var(--text-grey); }
.date-range-custom input[type='date'] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-body);
  padding: 0.2rem;
}
.date-range-custom input[type='date']:focus { outline: none; }
.date-range-sep { color: var(--text-muted); font-size: 0.8rem; }

/* زر مسح البحث */
.search-clear {
  background: var(--surface-muted);
  border: none;
  color: var(--text-grey);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
  flex-shrink: 0;
  transition: all var(--motion-fast);
}
.search-clear:hover { background: var(--danger); color: #fff; }

/* اتساق لوني مع هوية صلص */
.orders-tab:hover { background: rgba(79, 70, 229, 0.07); color: var(--brand-primary); }
.orders-tab.active-tab { background: var(--brand-primary); border-color: var(--brand-primary); }
.orders-search-bar:focus-within { border-color: var(--brand-primary); }

/* ─── شبكة الطلبات ─── */
#orders-list {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  align-items: start;
}

/* كرت الطلب الاحترافي */
.order-card.oc {
  padding: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* ⚡ لا تخطّط ولا ترسم البطاقات **خارج الشاشة**.
   كل بطاقة ~١٠٠ عنصر؛ ١٥٠ بطاقة = ١٥ ألف عنصر تُخطَّط كلها عند كل تحديثِ طلب
   (قِيس ~١٫٥ث على ١٥٢ بطاقة) — فيتجمّد المتصفح أثناء جلوسك على شاشة الطلبات.
   مع content-visibility يُخطَّط ما يظهر فقط (قِيس ~٠٫٢ث). لا تغيير مرئي: البطاقة
   أصلاً overflow:hidden (احتواء الرسم لا يقصّ شيئاً جديداً)، ولا قوائم منسدلة داخلها.
   `auto 950px`: تقدير ارتفاعٍ قريب من الفعلي (قِيس ~٩٦٠–١٠٠٠px لبطاقةٍ بخطٍّ زمنيٍّ كامل)
   كي لا يقفز شريط التمرير؛ والمتصفح يتذكّر الارتفاع الحقيقي للبطاقة بعد أول ظهور.
   المتصفحات القديمة تتجاهل الخاصية بأمان. */
#orders-list .order-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 950px;
}
/* 🗂️ طلب مطعم + إضافة الماركت الملحقة = طلبٌ واحد: خانةٌ واحدة من الشبكة، البطاقتان فوق بعض
   بطاقة الإضافة مزاحةٌ قليلاً (بشريط لون الماركت) وبترويسة «إضافة على نفس الطلب». */
#orders-list .oc-group { display: flex; flex-direction: column; gap: 0; min-width: 0; }
#orders-list .oc-group > .order-card.oc-addon {
  margin-inline-start: 1.1rem;
  border-top-left-radius: 0; border-top-right-radius: 0;
  contain-intrinsic-size: auto 600px;
}
#orders-list .oc-group > .order-card.oc-addon::before {
  content: '🛒 إضافة ماركت على نفس الطلب — توصيلة واحدة، قبولها أو رفضها لا يمسّ طلب المطعم';
  display: block; padding: 0.35rem 0.8rem; font-size: 12px; font-weight: 800;
  color: var(--success, #2f9e5b); background: rgba(47, 158, 91, 0.08);
}
#orders-list .oc-group > .order-card:first-child { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.oc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-light);
}
.oc-head-main { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.oc-num {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-dark) !important;
  letter-spacing: 0.3px;
}
.oc-status-pill {
  font-size: 0.77rem;
  font-weight: 800;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.oc-time-row {
  padding: 0.5rem 1rem;
  font-size: 0.79rem;
  color: var(--text-grey);
  border-bottom: 1px solid var(--border-light);
}
.oc-time-abs { color: var(--text-muted); }

.oc-body { padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.7rem; flex: 1; }

/* 📊 الخط الزمني لحالة الطلب — يطابق تتبّع الزبون، يتكيّف للاستلام/التوصيل */
.oc-timeline { padding: 0.7rem 0.85rem 0.4rem; background: var(--bg-soft, #FAFAFB); border: 1px solid var(--border-light); border-radius: 12px; }
.oc-tl-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; }
.oc-tl-head b { font-size: 0.82rem; font-weight: 900; color: var(--text-dark); }
.oc-tl-head .oc-tl-ic { width: 26px; height: 26px; border-radius: 9px; background: rgba(79,70,229,.1); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.oc-tl-row { display: flex; align-items: center; gap: 0.65rem; position: relative; min-height: 34px; }
.oc-tl-node { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex: 0 0 auto; z-index: 1; background: var(--border-light); color: var(--text-muted); position: relative; }
.oc-tl-row.done .oc-tl-node { background: var(--brand-primary); color: #fff; font-weight: 900; }
.oc-tl-row.current .oc-tl-node { background: var(--brand-primary); color: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.16); }
.oc-tl-row:not(:last-child) .oc-tl-node::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 2px; height: 12px; background: var(--border); }
.oc-tl-row.done:not(:last-child) .oc-tl-node::after { background: var(--brand-primary); }
.oc-tl-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-align: right; }
.oc-tl-row.done .oc-tl-label { color: var(--text-body); }
.oc-tl-row.current .oc-tl-label { color: var(--brand-primary); font-weight: 900; }
.oc-tl-now { font-size: 0.66rem; font-weight: 800; color: var(--brand-primary); margin-right: 0.25rem; }
.oc-tl-cancelled { padding: 0.7rem 0.85rem; background: #FDEAEA; color: #c62828; border-radius: 12px; font-weight: 800; text-align: center; }
.oc-rows { display: flex; flex-direction: column; gap: 0.34rem; }
.oc-row { display: flex; gap: 0.5rem; font-size: 0.9rem; color: var(--text-body); }
.oc-row-ic { flex-shrink: 0; }
.oc-row-val { word-break: break-word; }
.oc-cust-name { font-weight: 800; color: var(--text-dark); }
/* 👤 اسم الزبون قابل للنقر → يفتح ملفه الكامل (showUserDetail) */
.oc-cust-link { color: var(--brand-primary, #4F46E5); font-weight: 800; cursor: pointer; text-decoration: none; border-bottom: 1px dashed currentColor; }
.oc-cust-link:hover { opacity: 0.85; }
.oc-phone { color: var(--info); text-decoration: none; font-weight: 700; }
.oc-phone:hover { text-decoration: underline; }
/* 📱 زر واتساب صغير بجانب الأرقام (الطلب/الحساب/السائق) */
.oc-wa-mini { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; background: #E7F9EE; text-decoration: none; font-size: 0.95rem; line-height: 1; }
.oc-wa-mini:hover { background: #25D366; }
.oc-row-note { color: var(--text-grey); }

.oc-geo { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.geo-btn {
  flex: 1;
  min-width: 92px;
  text-align: center;
  text-decoration: none;
  padding: 0.46rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.79rem;
  font-weight: 700;
  color: #fff;
  transition: filter var(--motion-fast);
}
.geo-maps { background: #4285f4; }
.geo-waze { background: #1bb6e3; }
.geo-wa   { background: #25d366; }
.geo-btn:hover { filter: brightness(0.93); }
.oc-geo-warn {
  font-size: 0.81rem;
  color: #b42318;
  background: #fdeaea;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-sm);
  font-weight: 700;
}

.oc-items {
  background: var(--surface-muted);
  border-radius: var(--r-md);
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.oc-item-wrap { display: flex; flex-direction: column; gap: 0.25rem; }
.oc-item { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.86rem; }
.oc-item-name { color: var(--text-body); }
.oc-item-name em { color: var(--text-muted); font-style: normal; font-weight: 700; }
.oc-item-price { font-weight: 700; color: var(--text-dark); white-space: nowrap; }
/* 📝 ملاحظة الوجبة (تعليمات المطبخ) — تبرز للأدمن والمطعم */
.oc-item-note {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r-sm);
  padding: 0.28rem 0.5rem;
  margin-right: 0.4rem;
}
.oc-item-note-ic { flex-shrink: 0; }

.oc-totals {
  background: #fbfbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.oc-total-row { display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--text-body); }
.oc-tr-delivery { color: #c2700a; }
.oc-tr-discount { color: #1f9d4d; }
.oc-tr-grand {
  margin-top: 0.2rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--brand-primary);
}

.oc-cancel {
  background: #fdeaea;
  color: #8a1c1c;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-sm);
}

.oc-foot {
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.oc-status-select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  font-family: inherit;
  font-size: 0.89rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
}
.oc-status-select:disabled { background: var(--surface-muted); cursor: not-allowed; color: var(--text-grey); }
.oc-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.oc-btn {
  flex: 1;
  min-width: max-content;
  border: none;
  cursor: pointer;
  padding: 0.52rem 0.6rem;
  border-radius: var(--r-md);
  font-size: 0.81rem;
  font-weight: 800;
  font-family: inherit;
  transition: transform var(--motion-fast), filter var(--motion-fast);
}
.oc-btn:hover { transform: translateY(-1px); filter: brightness(0.96); }
.oc-btn-restaurant { background: #FF6B35; color: #fff; }
/* 🏪 الرقم الاحتياطي للمطعم — نفس عائلة لون المطعم بدرجة أفتح للتمييز */
.oc-btn-restaurant-backup { background: #FFE6D9; color: #C2410C; border: 1px solid #FFC8A8; }
.oc-btn-driver { background: #25d366; color: #fff; }
.oc-btn-assign { background: #eef2ff; color: #3b3f8f; }
.oc-btn-reject { background: #fdeaea; color: #c0392b; }
.oc-btn-chat   { background: var(--brand-primary); color: #fff; }

/* ─── شارة كود العميل ─── */
.cust-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: #eef2ff;
  color: #3b3f8f;
  font-weight: 800;
  font-size: 0.77rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--r-full);
  border: none;
  cursor: default;
  font-family: inherit;
  white-space: nowrap;
  transition: all var(--motion-fast);
}
button.cust-code-badge { cursor: pointer; }
button.cust-code-badge:hover { background: #3b3f8f; color: #fff; }
.cust-code-badge.sm { font-size: 0.69rem; padding: 0.12rem 0.45rem; }
.cust-code-badge.lg { font-size: 0.9rem; padding: 0.3rem 0.7rem; }
.cust-code-badge.guest { background: var(--surface-muted); color: var(--text-grey); }
.cust-code-badge.pending-code { background: #fff4e0; color: #b9770e; }

/* ─── حالة فارغة ─── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.7rem; margin-bottom: 0.6rem; opacity: 0.75; }
.empty-state-text { font-size: 0.95rem; font-weight: 600; }
.empty-state.mini { padding: 1.6rem 1rem; }
.empty-state.mini .empty-state-text { font-size: 0.85rem; }

/* ─── تبويب الحسابات ─── */
.user-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.95rem 1.1rem;
  margin-bottom: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  transition: box-shadow var(--motion-md);
}
.user-card:hover { box-shadow: var(--shadow-md); }
.user-card-main { flex: 1; min-width: 210px; display: flex; flex-direction: column; gap: 0.34rem; }
.user-card-name {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.user-verify { font-size: 0.71rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: var(--r-full); }
.user-verify.ok { background: #e6f4ea; color: #1f9d4d; }
.user-verify.no { background: #fdeaea; color: #d33; }
.user-card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.user-meta-item { font-size: 0.82rem; color: var(--text-grey); }
.user-card-date { font-size: 0.76rem; color: var(--text-muted); }
.user-detail-btn {
  background: var(--brand-primary);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.user-detail-btn:hover { background: var(--brand-primary-dark); transform: translateY(-1px); }

.ud-header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.ud-header h3 { margin: 0; }
.ud-uid {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: right;
  margin-bottom: 1rem;
  word-break: break-all;
}

/* ─── نافذة منبثقة (Overlay) — تعمل من أي تبويب ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  z-index: 1000;
  overflow-y: auto;
  animation: fadeIn 0.18s;
}
.overlay.hidden { display: none; }
.overlay-card {
  width: 100%;
  margin-bottom: 0 !important;
}

/* ─── موبايل ─── */
@media (max-width: 768px) {
  #orders-list { grid-template-columns: 1fr; }
  .stat-grid { gap: 0.7rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-card { padding: 0.9rem 1rem; }
  .date-filter-bar { flex-direction: column; align-items: stretch; }
  .date-range-custom { justify-content: center; }
  .oc-actions .oc-btn { flex: 1 1 100%; }
  .ov-order-time { display: none; }
  .ov-order-name { font-weight: 700; }
}

/* ════════════════════════════════════════════
   🍔 أصناف قائمة المطعم (داخل نافذة إدارة الوجبات)
   ════════════════════════════════════════════ */
.menu-sections-panel {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  margin: 0.25rem 0 1rem;
}

.menu-sections-head strong {
  display: block;
  font-size: 1rem;
  color: var(--text-dark);
}

.menu-sections-head small {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-grey);
  line-height: 1.5;
}

.menu-sections-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.menu-sections-add input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-family: inherit;
}

.menu-sections-add input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.menu-sections-add .add-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.menu-sections-empty {
  margin: 0.75rem 0 0;
  padding: 0.6rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

#menu-sections-list {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.menu-section-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.5rem 0.7rem;
}

.menu-section-rank {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 800;
}

.menu-section-name {
  flex: 1;
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.92rem;
}

.menu-section-btns {
  display: flex;
  gap: 0.3rem;
}

.menu-section-btns button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--motion-fast);
}

.menu-section-btns button:hover:not(:disabled) {
  background: var(--border);
}

.menu-section-btns button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* زر ▲▼ مستقل (يستخدم خارج .menu-section-btns) */
.menu-section-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--motion-fast);
  flex-shrink: 0;
}
.menu-section-btn:hover:not(:disabled) { background: var(--border); }
.menu-section-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* عنوان مجموعة صنف داخل قائمة الوجبات في الأدمن */
.products-group-header {
  margin: 1.1rem 0 0.5rem;
  padding: 0.45rem 0.8rem;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: var(--r-md);
  font-weight: 800;
  font-size: 0.9rem;
}

.products-group-header:first-child {
  margin-top: 0.25rem;
}

/* ─── 📊 نافذة إحصائيات المطعم ─── */
.stats-btn { background: #8b5cf6 !important; }
.stats-btn:hover { background: #7c3aed !important; }

.rs-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 560px) { .rs-stats-grid { grid-template-columns: repeat(2, 1fr); } }

.rs-section-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
  margin: 0.8rem 0 0.5rem;
}
.rs-items-list { display: flex; flex-direction: column; gap: 0.35rem; }
.rs-item-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-muted);
  border-radius: var(--r-md);
  padding: 0.5rem 0.7rem;
}
.rs-item-rank {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 800;
}
.rs-item-name { flex: 1; font-weight: 700; font-size: 0.88rem; color: var(--text-dark); }
.rs-item-qty { font-weight: 800; font-size: 0.85rem; color: var(--brand-primary); white-space: nowrap; }
.rs-item-rev { font-size: 0.8rem; color: var(--text-grey); white-space: nowrap; }
.rs-empty-line { color: var(--text-muted); font-size: 0.85rem; padding: 0.5rem 0; }
.rs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-body);
}

/* ─── ✏️ تعديل الطلب ─── */
.oc-btn-edit { background: #8b5cf6; color: #fff; }
.oc-edit-badge {
  margin: 0.5rem 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 700;
}
.oc-edit-badge.wait { background: #fff4e0; color: #b45309; border: 1px solid #f59e0b; }
.oc-edit-badge.ack  { background: #e6f4ea; color: #1f9d4d; border: 1px solid #22c55e; }

.eo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-muted);
  border-radius: var(--r-md);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.4rem;
}
.eo-item-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.eo-item-name { font-weight: 800; font-size: 0.9rem; color: var(--text-dark); }
.eo-item-price { font-size: 0.76rem; color: var(--text-grey); }
.eo-item-ctrl { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.eo-qbtn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.eo-qbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.eo-qval { min-width: 26px; text-align: center; font-weight: 800; }
.eo-del {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
}
.eo-empty {
  padding: 0.8rem;
  text-align: center;
  color: #b45309;
  background: #fff4e0;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 0.85rem;
}
.eo-add-row { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
#eo-add-select {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  min-width: 0;
}
.eo-add-btn {
  background: var(--info);
  color: #fff;
  border: none;
  padding: 0 1rem;
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 800;
  font-family: inherit;
  white-space: nowrap;
}
.eo-totals {
  background: var(--surface-muted);
  border-radius: var(--r-md);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
}
.eo-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.15rem 0;
  color: var(--text-body);
}
.eo-total-row.eo-discount { color: #1f9d4d; }
.eo-total-row.eo-grand {
  font-weight: 900;
  font-size: 1rem;
  color: var(--text-dark);
  border-top: 1px solid var(--border);
  margin-top: 0.3rem;
  padding-top: 0.4rem;
}
.eo-total-was { font-size: 0.78rem; color: var(--text-muted); text-align: left; margin-top: 0.2rem; }
.eo-label {
  display: block;
  font-weight: 800;
  font-size: 0.88rem;
  margin: 0.5rem 0 0.4rem;
  color: var(--text-dark);
}
.eo-reason-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.eo-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-grey);
  font-weight: 700;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0.35rem 0.7rem;
  border-radius: var(--r-full);
  cursor: pointer;
}
.eo-chip:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.eo-contacted-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.7rem 0 0.2rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dark);
  cursor: pointer;
}
.eo-contacted-label input { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }

/* ════════════════════════════════════════════
   🪟 نوافذ منبثقة احترافية (Centered Modals)
   النماذج العلوية تطفو متمركزة فوق خلفية معتمة واحدة
   مشتركة (#modal-backdrop)، وتنغلق بالضغط خارجها أو Esc.
   مُحدّد بدقّة: يطال فقط النماذج المضمّنة العلوية
   (أبناء .tab أو <main> مباشرةً) — ويستثني:
     • نماذج الوجبات داخل .products-modal
     • نوافذ .overlay / .overlay-card الجاهزة أصلاً
   ════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  z-index: 1000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease;
}
.modal-backdrop.hidden { display: none; }

.tab > .modal:not(.hidden),
main > .modal:not(.hidden) {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  margin: 0;
  z-index: 1001;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: modalPop 0.18s ease;
}

@keyframes modalPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* قفل تمرير الخلفية أثناء فتح نافذة منبثقة */
body.modal-open { overflow: hidden; }

@media (max-width: 768px) {
  .tab > .modal:not(.hidden),
  main > .modal:not(.hidden) {
    width: 94vw;
    max-height: 92vh;
  }
}

/* ════════════════════════════════════════════
   📥 زر تصدير CSV (الطلبات + الأرباح)
   ════════════════════════════════════════════ */
.export-btn {
  background: var(--surface);
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-primary);
  border-radius: var(--r-sm);
  padding: 0.5rem 1rem;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--motion-fast);
  white-space: nowrap;
}
.export-btn:hover { background: var(--brand-primary); color: #fff; transform: translateY(-1px); }

/* ═══════════ مفتاح التبديل (Toggle Switch) — التوزيع الذكي ═══════════ */
.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 30px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #c9ccd2;
  border-radius: 30px;
  transition: background var(--motion-fast, .2s);
}
.switch .slider::before {
  content: '';
  position: absolute;
  height: 24px;
  width: 24px;
  /* RTL: المقبض يبدأ من اليمين */
  right: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform var(--motion-fast, .2s);
}
.switch input:checked + .slider { background: #2f9e5b; }
.switch input:checked + .slider::before { transform: translateX(-24px); }
.switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }

/* بطاقة دفعة توزيع في لوحة الأدمن */
.dispatch-batch {
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
  background: #fff;
}
.dispatch-batch.smart { border-color: #b9d4f0; background: #f7fbff; }
.dispatch-batch-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.dispatch-chip {
  font-size: 0.72rem; font-weight: 800; padding: 0.18rem 0.55rem;
  border-radius: 7px;
}

/* ════════════════════════════════════════════════════════════
   💰 المركز المالي — نظام تصميم موحّد للأرباح والنِسب والحسابات
   ════════════════════════════════════════════════════════════ */
:root {
  --fin-net: #16A34A;        /* صافي الدخل */
  --fin-commission: #7C3AED; /* عمولة */
  --fin-markup: #D97706;     /* زيادة يدوية */
  --fin-delivery: #0D9488;   /* حصّة التوصيل */
  --fin-drinks: #DB2777;     /* مشروبات */
  --fin-cost: #DC2626;       /* تكاليف/خصومات */
  --fin-sales: #1D4ED8;      /* مبيعات */
  --fin-ink: #0F172A;
  --fin-line: #E9EBF0;
}

/* ── شريط تحكّم لاصق (فترة + مطعم + تصدير) ── */
.fin-toolbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--fin-line);
  border-radius: var(--r-lg);
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.fin-field { display: flex; flex-direction: column; gap: 3px; }
.fin-field > label {
  font-size: 0.68rem; font-weight: 800; color: var(--text-muted);
  letter-spacing: 0.2px;
}
.fin-toolbar select,
.fin-toolbar input[type='date'],
.fin-toolbar input[type='search'] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: #fff; font-size: 0.88rem; font-family: inherit; color: var(--text-dark);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.fin-toolbar select:focus,
.fin-toolbar input:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.fin-spacer { margin-inline-start: auto; }
.fin-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: #fff; color: var(--text-body); font-family: inherit;
  font-size: 0.85rem; font-weight: 800; cursor: pointer;
  transition: all var(--motion-fast);
}
.fin-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.fin-btn.primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.fin-btn.primary:hover { background: var(--brand-primary-dark); color: #fff; }
.fin-btn.ghost { background: transparent; border-style: dashed; }
.fin-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.fin-btn.sm { padding: 5px 10px; font-size: 0.76rem; }

/* ── تبويبات داخلية (Segmented) ── */
.fin-nav {
  display: flex; gap: 0.3rem; flex-wrap: wrap;
  background: var(--surface-muted); border-radius: var(--r-full);
  padding: 4px; margin-bottom: 1.1rem;
}
.fin-nav button {
  flex: 1 1 auto; min-width: 110px;
  padding: 0.55rem 0.9rem; border: none; border-radius: var(--r-full);
  background: transparent; color: var(--text-grey);
  font-family: inherit; font-size: 0.85rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
  transition: all var(--motion-fast);
}
.fin-nav button:hover { color: var(--brand-primary); }
.fin-nav button.on {
  background: #fff; color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

/* ── بطاقات KPI ── */
.fin-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.7rem; margin-bottom: 1.1rem;
}
.fin-kpi {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--fin-line);
  border-radius: var(--r-lg); padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}
.fin-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fin-kpi::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 4px; background: var(--k, var(--brand-primary));
}
.fin-kpi.hero { grid-column: span 2; }
@media (max-width: 620px) { .fin-kpi.hero { grid-column: span 1; } }
.fin-kpi-label {
  font-size: 0.72rem; font-weight: 800; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px; margin-bottom: 5px;
}
.fin-kpi-value {
  font-size: 1.5rem; font-weight: 900; color: var(--k, var(--fin-ink));
  line-height: 1.15; letter-spacing: -0.4px;
}
.fin-kpi.hero .fin-kpi-value { font-size: 2rem; }
.fin-kpi-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 5px; }
.fin-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.72rem; font-weight: 900; padding: 2px 7px;
  border-radius: var(--r-full); margin-inline-start: 6px;
}
.fin-delta.up { background: #DCFCE7; color: #15803D; }
.fin-delta.down { background: #FEE2E2; color: #B91C1C; }
.fin-delta.flat { background: var(--surface-muted); color: var(--text-grey); }

/* ── لوحة/قسم ── */
.fin-card {
  background: #fff; border: 1px solid var(--fin-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  margin-bottom: 1rem; overflow: hidden;
}
.fin-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.6rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--fin-line);
  background: linear-gradient(180deg, #FCFCFD 0%, #F8F9FB 100%);
}
.fin-card-head h3, .fin-card-head h4 {
  margin: 0; font-size: 0.95rem; font-weight: 900; color: var(--fin-ink);
}
.fin-card-head .hint { font-size: 0.73rem; color: var(--text-muted); font-weight: 600; }
.fin-card-body { padding: 0.9rem 1rem; }

/* ── بيان الدخل (Waterfall) ── */
.fin-pl { display: flex; flex-direction: column; gap: 2px; }
.fin-pl-row {
  display: grid; grid-template-columns: 1.6fr 2fr auto auto;
  align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.2rem; border-bottom: 1px dashed var(--border-light);
}
.fin-pl-row:last-child { border-bottom: none; }
.fin-pl-name {
  font-size: 0.86rem; font-weight: 700; color: var(--text-body);
  display: flex; align-items: center; gap: 6px;
}
.fin-pl-bar { height: 8px; background: var(--surface-muted); border-radius: var(--r-full); overflow: hidden; }
.fin-pl-bar > span { display: block; height: 100%; border-radius: var(--r-full); transition: width var(--motion-md); }
.fin-pl-amt { font-size: 0.92rem; font-weight: 900; text-align: end; white-space: nowrap; }
.fin-pl-pct { font-size: 0.74rem; color: var(--text-muted); font-weight: 700; min-width: 44px; text-align: end; }
.fin-pl-row.total {
  margin-top: 6px; padding-top: 0.7rem; border-top: 2px solid var(--fin-ink);
  border-bottom: none;
}
.fin-pl-row.total .fin-pl-name { font-size: 0.95rem; font-weight: 900; color: var(--fin-ink); }
.fin-pl-row.total .fin-pl-amt { font-size: 1.2rem; }

/* ── رسم أعمدة يومي ── */
.fin-chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 0.4rem 0; }
.fin-bar-wrap {
  flex: 1 1 0; min-width: 4px; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; cursor: default;
}
.fin-bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #34D399 0%, #16A34A 100%);
  min-height: 2px; transition: filter var(--motion-fast);
}
.fin-bar-wrap:hover .fin-bar { filter: brightness(1.15); }
.fin-bar-wrap::after {
  content: attr(data-tip); position: absolute; bottom: 100%; inset-inline-start: 50%;
  transform: translateX(50%) translateY(-4px);
  background: var(--fin-ink); color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--motion-fast); z-index: 5;
}
.fin-bar-wrap:hover::after { opacity: 1; }
.fin-chart-axis {
  display: flex; justify-content: space-between;
  font-size: 0.68rem; color: var(--text-muted); font-weight: 700;
  padding-top: 4px; border-top: 1px solid var(--fin-line);
}

/* ── جداول ── */
.fin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.fin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 720px; }
table.fin-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F8F9FB; color: var(--text-grey);
  font-size: 0.74rem; font-weight: 900; letter-spacing: 0.2px;
  padding: 9px 10px; text-align: center; white-space: nowrap;
  border-bottom: 2px solid var(--fin-line);
}
table.fin-table thead th:first-child { text-align: start; }
table.fin-table thead th.sortable { cursor: pointer; user-select: none; }
table.fin-table thead th.sortable:hover { color: var(--brand-primary); }
table.fin-table tbody td {
  padding: 8px 10px; text-align: center; white-space: nowrap;
  border-bottom: 1px solid var(--border-light); color: var(--text-body);
}
table.fin-table tbody td:first-child { text-align: start; font-weight: 700; color: var(--fin-ink); white-space: normal; }
table.fin-table tbody tr:nth-child(even) { background: #FBFCFD; }
table.fin-table tbody tr:hover { background: #F3F4FF; }
table.fin-table tfoot td {
  padding: 10px; text-align: center; font-weight: 900;
  background: #F8F9FB; border-top: 2px solid var(--fin-line); white-space: nowrap;
}
table.fin-table tfoot td:first-child { text-align: start; }
.fin-num { font-variant-numeric: tabular-nums; }
.fin-muted { color: var(--text-muted); }

/* ── شارات ── */
.fin-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-full);
  font-size: 0.72rem; font-weight: 900; white-space: nowrap;
}
.fin-badge.ok { background: #DCFCE7; color: #15803D; }
.fin-badge.warn { background: #FEF3C7; color: #B45309; }
.fin-badge.bad { background: #FEE2E2; color: #B91C1C; }
.fin-badge.off { background: var(--surface-muted); color: var(--text-muted); }
.fin-badge.info { background: #DBEAFE; color: #1D4ED8; }

/* ── إدخال داخل الجدول ── */
.fin-inline-input {
  width: 74px; padding: 4px 7px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 0.82rem;
  text-align: center; background: #fff; color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}
.fin-inline-input:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.fin-inline-input.date { width: 128px; }
.fin-inline-input.dirty { border-color: var(--warning); background: #FFFBEB; }

/* ── تنبيهات ── */
.fin-note {
  display: flex; gap: 8px; align-items: flex-start;
  border-radius: var(--r-md); padding: 0.7rem 0.9rem;
  font-size: 0.82rem; line-height: 1.65; margin-bottom: 0.9rem;
}
.fin-note.warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.fin-note.info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.fin-note.danger { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

.fin-empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; font-size: 0.9rem; }

/* ── شريط تقدّم صغير داخل الخلية ── */
.fin-mini-bar { height: 6px; width: 100%; min-width: 52px; background: var(--surface-muted); border-radius: var(--r-full); overflow: hidden; }
.fin-mini-bar > span { display: block; height: 100%; background: var(--brand-primary); border-radius: var(--r-full); }

/* ── معاينة الزيادة الجماعية ── */
.fin-preview-row {
  display: grid; grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 0.5rem; align-items: center;
  padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
}
.fin-preview-row.head { font-weight: 900; color: var(--text-grey); font-size: 0.73rem; background: #F8F9FB; }
.fin-arrow { color: var(--text-muted); font-weight: 900; }

/* رقم سالب/مبلغ يجب أن يُقرأ LTR داخل صفحة RTL (يمنع ظهور "1,000−") */
.fin-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
/* صف معاينة يخفض السعر — تنبيه بصري */
.fin-preview-row.down { background: #FEF2F2; }

/* ══════════════════════════════════════════════════════════════
   🧩 أقسام الطلبات — «كل قسم لحاله»
   شريط تبويبات فوق تبويبات الحالة، ولكل قسم لونه من settings/verticals
   (يُحقن كمتغيّر --vtab-color بعد تنقيته سداسياً في order_kinds.js).
   ══════════════════════════════════════════════════════════════ */
.orders-vertical-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed #e5e7eb;
}
.vtab {
  --vtab-color: #4B5563;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  /* اسم القسم يكتبه المالك بلا حدّ طول ⇒ نمنع كسر الشريط بسطرٍ عملاق */
  max-width: 15rem;
}
.vtab .vtab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vtab:hover {
  border-color: var(--vtab-color);
  color: var(--vtab-color);
  background: #fff;
}
.vtab-active {
  background: var(--vtab-color);
  border-color: var(--vtab-color);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
/* عدّاد هادئ = كل الطلبات */
.vtab-count {
  background: #eef0f4;
  color: #4b5563;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.74rem;
  font-weight: 900;
  min-width: 1.15rem;
  text-align: center;
}
.vtab-active .vtab-count { background: rgba(255, 255, 255, 0.28); color: #fff; }
/* 🔴 عدّاد نابض = طلبات لم تُنجَز بعد. الفصل يجب ألّا يُخفي طلباً:
   الأدمن الواقف على تبويب المطاعم يجب أن يرى أن الصيدلية تنتظره. */
.vtab-live {
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.74rem;
  font-weight: 900;
  min-width: 1.15rem;
  text-align: center;
  animation: vtabPulse 1.8s ease-in-out infinite;
}
.vtab-active .vtab-live { background: #fff; color: var(--vtab-color); animation: none; }
@keyframes vtabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
}
@media (prefers-reduced-motion: reduce) { .vtab-live { animation: none; } }

/* ── هويّة القسم على بطاقة الطلب ────────────────────────────── */
/* شريطٌ جانبي بلون القسم: يميّز طلب الماركت عن طلب المطعم من طرف العين
   قبل قراءة أي كلمة. طلبات المطاعم لا تأخذه إطلاقاً (صفر تغيير عليها). */
/* ⚠️ `!important` مقصود: قاعدةٌ سابقة في هذا الملف تفرض
   `border: 1px solid var(--border-light) !important` على كل البطاقات،
   وبدونها يُبتلع شريط اللون بصمت (اكتُشف بفحص الأنماط المحسوبة لا بالقراءة).
   و`:hover` يفرض `border-color !important` أيضاً ⇒ نثبّت اللون للحالتين. */
.order-card.oc-vertical,
.order-card.oc-vertical:hover {
  border-right: 4px solid var(--oc-vert-color, #6B7280) !important;
}
.oc-vert-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: color-mix(in srgb, var(--oc-vert-color, #6B7280) 12%, #fff);
  color: var(--oc-vert-color, #6B7280);
  border: 1px solid color-mix(in srgb, var(--oc-vert-color, #6B7280) 30%, #fff);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 900;
}
/* متصفّح بلا color-mix ⇒ يبقى مقروءاً بخلفية محايدة (احتياط بصري لا أكثر) */
@supports not (background: color-mix(in srgb, #000 10%, #fff)) {
  .oc-vert-ribbon { background: #f3f4f6; border-color: #e5e7eb; }
}

/* 🧺 قائمة تجهيز الماركت — الطلب هنا «التقاطٌ من الرفّ» لا طبخ */
.oc-picklist {
  margin: 8px 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: #FFF8EF;
  border: 1px solid #F5DFC0;
}
.oc-picklist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 13px;
  color: #92400E;
  margin-bottom: 4px;
}
.oc-picklist-sub { font-size: 12px; color: #A16207; }

/* 💧 سطر الطلب المسطّح (ماء/غاز) — بضع عبوات، فالرقم هو البطل */
.oc-flat {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.oc-flat-qty {
  font-size: 20px;
  font-weight: 900;
  color: #1D4ED8;
  line-height: 1;
}
.oc-flat-name { font-size: 13.5px; font-weight: 800; color: #1E3A8A; }

/* 🩺 كتلة الصيدلية — الأخذ والردّ: صور الوصفة + مَن ينتظر الآن */
.oc-rx {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F0FDFA;
  border: 1px solid #99F6E4;
}
.oc-rx-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 6px;
}
.oc-rx-waiting {
  font-size: 11.5px;
  font-weight: 800;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
  border-radius: 999px;
  padding: 1px 8px;
}
.oc-rx-note {
  background: #fff;
  border: 1px solid #CCFBF1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #134E4A;
  margin-bottom: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.oc-rx-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.oc-rx-photos img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #CCFBF1;
  background: #fff;
}
.oc-rx-none { font-size: 12.5px; color: #0F766E; font-weight: 700; }

/* ── نافذة التسعير (الأدمن يُسعّر بدل الصيدلية عند الحاجة) ── */
.rx-quote-line {
  display: grid;
  grid-template-columns: 1fr 6.5rem 4.5rem auto;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.rx-quote-line input {
  padding: 0.5rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.88rem;
  width: 100%;
  min-width: 0;
}
@media (max-width: 560px) {
  .rx-quote-line { grid-template-columns: 1fr 1fr; }
  .rx-quote-line input.rx-n { grid-column: 1 / -1; }
}
.oc-flat-item { display: inline-flex; align-items: baseline; gap: 5px; }

/* 🗑️ تبويب التقييمات — صفّ زرّ «حذف التقييم» (سوبر أدمن فقط؛ يُرسم له وحده). */
.review-card .review-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light, #eee);
}
.review-card .review-actions .btn-danger:disabled { opacity: 0.5; cursor: progress; }
