* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #f4f6fa;
  color: #222;
  font-size: 14px;
  padding-bottom: 60px;
}
#app { max-width: 720px; margin: 0 auto; }

/* Header */
.hdr {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0 0 16px 16px;
  margin-bottom: 12px;
}
.hdr-content { flex: 1; text-align: right; }
.hdr-title { font-size: 13px; opacity: 0.9; margin-bottom: 4px; }
.hdr-name { font-size: 22px; font-weight: 800; }
.refresh-btn {
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  font-weight: 700;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}
.stat {
  background: #fff;
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  border-bottom: 3px solid #6c5ce7;
}
.stat.sent { border-color: #1ea952; }
.stat.replied { border-color: #f39c12; }
.stat.pending { border-color: #e74c3c; }
.stat-num { font-size: 22px; font-weight: 800; color: #6c5ce7; }
.stat.sent .stat-num { color: #1ea952; }
.stat.replied .stat-num { color: #f39c12; }
.stat.pending .stat-num { color: #e74c3c; }
.stat-lbl { font-size: 10px; color: #666; margin-top: 2px; }

/* Filters */
.filters {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
  overflow-x: auto;
  flex-wrap: wrap;
  justify-content: center;
}
.chip {
  background: #fff;
  border: 1px solid #ddd;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: #555;
}
.chip.active { background: #6c5ce7; color: #fff; border-color: #6c5ce7; }

/* Order list */
.list { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.loader, .empty {
  text-align: center;
  padding: 30px 16px;
  color: #888;
  font-size: 13px;
  background: #fff;
  border-radius: 10px;
}
.order {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-right: 4px solid #e74c3c;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.1s;
}
.order:active { transform: scale(0.98); }
.order.sent { border-right-color: #1ea952; opacity: 0.85; }
.order.pending { border-right-color: #e74c3c; }
.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.order-name { font-weight: 700; font-size: 15px; flex: 1; color: #2c3e50; }
.order-meta { font-size: 12px; color: #666; margin-bottom: 3px; line-height: 1.5; }
.order-status {
  font-size: 11px;
  font-weight: 700;
  color: #1ea952;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #eef0f5;
}
.order-status.pending { color: #e74c3c; }

/* Status badges */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.badge.raja3 { background: #ffeaea; color: #c0392b; border: 1px solid #f5b7b1; }
.badge.moajala { background: #fff4e0; color: #d68910; border: 1px solid #f5cba7; }
.badge.taswiya { background: #ede0ff; color: #7d3c98; border: 1px solid #d2b4de; }
.badge.replied {
  display: block;
  background: #fff4e0;
  color: #d68910;
  border: 1px solid #f5cba7;
  margin-top: 8px;
  text-align: center;
  padding: 5px;
  font-size: 11px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 720px;
  height: 92vh;
  max-height: 92vh;
  border-radius: 16px 16px 0 0;
  padding: 55px 18px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 1;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e0e4e8;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  color: #555;
  z-index: 100;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  margin: -45px 0 8px -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: #ffe6e6;
  color: #e74c3c;
  border-color: #f5b7b1;
  transform: scale(1.08);
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #6c5ce7;
  margin-bottom: 12px;
  padding-left: 40px;
}
.modal-row {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f5;
  color: #444;
}
.modal-row b { color: #2c3e50; margin-left: 6px; }
.modal-row a { color: #6c5ce7; text-decoration: none; font-weight: 700; }
.modal-message {
  background: #f7f8ff;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
  margin: 14px 0;
  border-right: 3px solid #6c5ce7;
  white-space: pre-wrap;
}

/* Action buttons */
.btn-wa {
  display: block;
  background: #25D366;
  color: #fff;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 15px;
  margin: 10px 0;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}
.btn-wa:active { transform: scale(0.98); }
.btn-toggle {
  display: block;
  width: 100%;
  background: #6c5ce7;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 10px;
}
.btn-toggle:active { transform: scale(0.98); }

/* Reply section */
.reply-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid #eef0f5;
}
.reply-title { font-size: 13px; font-weight: 700; color: #555; margin-bottom: 8px; text-align: center; }
.reply-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.reply-buttons button {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #555;
}
.reply-buttons button:active { background: #6c5ce7; color: #fff; }

/* Bottom bar */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid #eef0f5;
  padding: 8px 16px;
  text-align: center;
  font-size: 11px;
  color: #888;
  z-index: 50;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.ok { background: #1ea952; }
.toast.show.ok { background: #1ea952; }

/* === Last contact badge === */
.contact-badge {
  display: block;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.contact-badge.gray { background: #f0f0f0; color: #888; }
.contact-badge.green { background: #d4f4dd; color: #1e7e34; border: 1px solid #1ea952; }
.contact-badge.yellow { background: #fff3cd; color: #856404; border: 1px solid #f39c12; }
.contact-badge.red { background: #ffe6e6; color: #c0392b; border: 1px solid #e74c3c; animation: blinkRed 2s infinite; }
@keyframes blinkRed {
  0%, 100% { background: #ffe6e6; }
  50% { background: #ffcccc; }
}

/* === Direct call button === */
.btn-call {
  display: block;
  background: #2196f3;
  color: #fff;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 15px;
  margin: 10px 0;
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}
.btn-call:active { transform: scale(0.98); }

/* === Activity Log === */
.log-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 2px solid #eef0f5;
}
.log-title {
  font-size: 13px;
  font-weight: 700;
  color: #555;
  margin-bottom: 10px;
  text-align: center;
}
.log-empty {
  text-align: center;
  color: #aaa;
  font-size: 12px;
  padding: 14px;
  background: #fafafa;
  border-radius: 8px;
}
.log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.log-entry {
  background: #f7f8ff;
  border-radius: 8px;
  padding: 8px 10px;
  border-right: 3px solid #6c5ce7;
}
.log-entry.sup { background: #fff4e0; border-right-color: #f39c12; }
.log-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-bottom: 4px;
}
.log-icon { font-size: 14px; }
.log-by { font-weight: 700; color: #6c5ce7; }
.log-entry.sup .log-by { color: #d68910; }
.log-time { color: #999; margin-right: auto; font-size: 10px; }
.log-text {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  word-wrap: break-word;
}

/* === Note input box === */
.note-box {
  margin-top: 14px;
  padding: 12px;
  background: #f7f8ff;
  border-radius: 10px;
  border: 1px solid #e0e0ff;
}
.note-title {
  font-size: 13px;
  font-weight: 700;
  color: #555;
  margin-bottom: 8px;
}
.note-box textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
}
.btn-note {
  display: block;
  width: 100%;
  background: #6c5ce7;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}
.btn-note:active { transform: scale(0.98); }

/* === Editable message textarea === */
.msg-edit-wrap {
  margin: 14px 0;
}
.msg-edit-label {
  font-size: 13px;
  font-weight: 700;
  color: #555;
  margin-bottom: 6px;
}
.msg-edit {
  width: 100%;
  background: #f7f8ff;
  border: 1px solid #6c5ce7;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
  font-family: inherit;
  resize: vertical;
  min-height: 220px;
  box-sizing: border-box;
  white-space: pre-wrap;
  direction: rtl;
}
.msg-edit:focus {
  outline: none;
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

/* === FEATURE #1: Chip Badges === */
.chip { position: relative; }
.chip-badge {
  display: inline-block;
  background: #6c5ce7;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 4px;
  min-width: 20px;
  text-align: center;
  vertical-align: middle;
}
.chip.active .chip-badge { background: #fff; color: #6c5ce7; }
.chip-badge.high { background: #e74c3c; animation: pulseB 1.5s infinite; }
.chip.active .chip-badge.high { background: #fff; color: #e74c3c; }
@keyframes pulseB { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

/* 🆕 نبضة لزر "أبلغي المندوب" لما الرد = يبي يستلم */
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(39,174,96,0.4); }
  50% { box-shadow: 0 4px 24px rgba(39,174,96,0.9); }
}
.btn-notify-driver:active { transform: scale(0.97); }

/* 🆕 زر "الزبون استلم" - أخضر مميز */
.btn-customer-delivered {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(39,174,96,0.35);
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-customer-delivered:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(39,174,96,0.5);
}
.btn-customer-delivered:active {
  transform: scale(0.98);
}

/* 🆕 زر "الزبون يرفض" - أحمر مرجاني مميز */
.btn-customer-refused {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, #e74c3c, #ff7675);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.35);
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-customer-refused:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(231, 76, 60, 0.5);
}
.btn-customer-refused:active {
  transform: scale(0.98);
}

/* 🆕 ====== نظام الأرشفة + عداد أيام المتابعة ====== */
.followup-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 800;
  margin-top: 6px;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.fu-green  { background: #d4f7d4; color: #1d6f1d; border-color: #95d195; }
.fu-yellow { background: #fff3cd; color: #856404; border-color: #ffeaa7; }
.fu-orange { background: #ffd9b3; color: #b34a00; border-color: #ffab66; }
.fu-red    { background: #ffe0e0; color: #c0392b; border-color: #f5b7b1; animation: pulseB 1.8s infinite; }
.fu-gray   { background: #ecf0f1; color: #5a6c7d; border-color: #bdc3c7; }

.order.archived {
  background: #f7f9fa;
  opacity: 0.85;
  border-left: 4px solid #95a5a6;
}
.order.archived .order-name { color: #5a6c7d; }
.archive-reason {
  background: #ecf0f1;
  color: #5a6c7d;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  margin-top: 6px;
  border-right: 3px solid #95a5a6;
}

.modal-followup {
  margin: 8px 0;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  border: 2px solid transparent;
}
.modal-followup.fu-green  { background: #e9f9e9; border-color: #1d6f1d; color: #1d6f1d; }
.modal-followup.fu-yellow { background: #fff8d6; border-color: #d68910; color: #856404; }
.modal-followup.fu-orange { background: #ffe8d0; border-color: #d35400; color: #b34a00; }
.modal-followup.fu-red    { background: #fde2e2; border-color: #c0392b; color: #c0392b; }

.modal-followup-archived {
  background: linear-gradient(135deg, #5a6c7d, #2c3e50);
  color: #fff;
  margin: 8px 0;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
}
.btn-reactivate {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: #27ae60;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(39,174,96,0.4);
}
.btn-reactivate:active { transform: scale(0.97); }

.postpone-row {
  background: #fff8e6;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  border-right: 4px solid #f39c12;
}
.postpone-title {
  font-weight: 700;
  color: #d68910;
  font-size: 13px;
}

/* 🆕 ====== نظام "المزيد" + الأزرار الديناميكية ====== */

/* زر المزيد - تصميم مميز */
.chip-more-btn {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border: 1px solid #6c5ce7 !important;
  transition: all 0.2s ease;
}
.chip-more-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(108, 92, 231, 0.3);
}
.chip-more-btn.chip-more-open {
  background: linear-gradient(135deg, #5a4dd6, #8c80f0) !important;
}

/* الأزرار الثانوية - لما تظهر في "المزيد" */
.chip.chip-secondary {
  animation: chipFadeIn 0.25s ease-out;
}
@keyframes chipFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* الأزرار الديناميكية - نبضة لطيفة للفت الانتباه (ليس مزعجة) */
.chip-urgent-pulse {
  animation: urgentPulse 2.5s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
    transform: scale(1.03);
  }
}

/* 🆕 ====== بطاقة البونص الكبيرة ====== */
.bonus-card {
  background: linear-gradient(135deg, #16a085 0%, #1abc9c 50%, #2ecc71 100%);
  color: #fff;
  margin: 0 12px 12px;
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(26, 188, 156, 0.35);
  position: relative;
  overflow: hidden;
}
.bonus-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.bc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.bc-left { flex: 1; }
.bc-right { text-align: center; }
.bc-label {
  font-size: 12px;
  opacity: 0.95;
  font-weight: 600;
  margin-bottom: 4px;
}
.bc-amount {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.bc-currency {
  font-size: 16px;
  font-weight: 700;
  opacity: 0.9;
}
.bc-rank {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}
.bc-sub {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}
.bc-progress-wrap {
  margin: 10px 0;
  position: relative;
  z-index: 1;
}
.bc-progress-bar {
  height: 10px;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  overflow: hidden;
}
.bc-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}
.bc-progress-text {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.95;
  text-align: center;
}
.bc-bonus-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  position: relative;
  z-index: 1;
}
.bc-tag {
  background: rgba(255,255,255,0.22);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
}
.bc-footer {
  margin-top: 12px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.bc-details-link {
  color: #fff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-block;
}
.bc-empty {
  background: rgba(255,255,255,0.15);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

/* وضع داكن */
body.dark .bonus-card {
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

/* === FEATURE #4: Daily Goal Progress Bar === */
.daily-goal-bar {
  background: #fff;
  margin: 0 12px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dg-text {
  font-size: 13px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dg-edit {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: auto;
}
.dg-progress {
  height: 8px;
  background: #eef0f5;
  border-radius: 4px;
  overflow: hidden;
}
.dg-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c5ce7, #1ea952);
  transition: width 0.5s ease;
}

/* === FEATURE #5: Hourly Banner === */
.hourly-banner {
  margin: 0 12px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid;
}
.hourly-banner.fire { background: #fff0e6; color: #d35400; border-color: #ffb380; animation: glow 2s infinite; }
.hourly-banner.good { background: #d4f4dd; color: #1e7e34; border-color: #6fcf97; }
.hourly-banner.low { background: #fff4e0; color: #856404; border-color: #f5cba7; }
.hourly-banner.idle { background: #f0f0f0; color: #888; border-color: #ddd; }
@keyframes glow {
  0%,100% { box-shadow: 0 0 0 rgba(211,84,0,0); }
  50% { box-shadow: 0 0 12px rgba(211,84,0,0.4); }
}

/* === FEATURE #19: Dark Mode === */
.dm-btn {
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  margin-left: 8px;
}

body.dark { background: #1a1d24; color: #e0e0e0; }
body.dark .stat,
body.dark .order,
body.dark .daily-goal-bar,
body.dark .modal-content,
body.dark .empty,
body.dark .loader,
body.dark .bottom-bar,
body.dark .note-box,
body.dark .reply-buttons button { background: #2a2e3a; color: #e0e0e0; }
body.dark .order-name,
body.dark .modal-title,
body.dark .nm,
body.dark .dg-text { color: #e0e0e0; }
body.dark .order-meta,
body.dark .stat-lbl,
body.dark .modal-row,
body.dark .pt { color: #b0b0b0; }
body.dark .modal-row b { color: #fff; }
body.dark .chip { background: #2a2e3a; color: #ccc; border-color: #3a3e4a; }
body.dark .chip.active { background: #6c5ce7; color: #fff; }
body.dark .msg-edit { background: #1a1d24; color: #e0e0e0; border-color: #6c5ce7; }
body.dark .log-entry { background: #2a2e3a; }
body.dark .log-entry.sup { background: #3d2f1a; }
body.dark .note-box textarea { background: #1a1d24; color: #e0e0e0; }
body.dark .ord-row { background: #2a2e3a; color: #e0e0e0; }
body.dark .modal-row { border-color: #3a3e4a; }
body.dark .dg-edit { background: #2a2e3a; color: #ccc; border-color: #444; }
body.dark .hourly-banner.idle { background: #2a2e3a; color: #888; border-color: #3a3e4a; }
body.dark .modal-message { background: #1a1d24; color: #e0e0e0; }
body.dark .contact-badge.gray { background: #2a2e3a; color: #888; }

/* === New status badges (6 statuses) === */
.badge.sharika { background: #e8e0ff; color: #5e3fb5; border: 1px solid #c5b3ff; }
.badge.tawseel { background: #d4f4dd; color: #1e7e34; border: 1px solid #6fcf97; }
.badge.ela_mandoub { background: #d6ebff; color: #1f5e9e; border: 1px solid #8fb8e0; }
.badge.fare3 { background: #fdf2d0; color: #806600; border: 1px solid #e6cc66; }
.badge.other { background: #f0f0f0; color: #666; border: 1px solid #ccc; }

/* === FEATURE #11: Snooze === */
.snooze-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid #eef0f5;
}
.snooze-title { font-size: 13px; font-weight: 700; color: #555; margin-bottom: 8px; text-align: center; }
.snooze-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.snooze-buttons button {
  background: #fff4e0;
  border: 1px solid #f5cba7;
  color: #856404;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.snooze-buttons button:active { background: #f5cba7; color: #fff; }
.snooze-badge {
  display: block;
  background: #fff4e0;
  color: #856404;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  text-align: center;
  border: 1px solid #f5cba7;
}
.order.snoozed { opacity: 0.7; }

/* === FEATURE #13: Smart Batching === */
.batch-group {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.batch-header {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.batch-header a { color: #fff; text-decoration: underline; font-weight: 800; }
.batch-count {
  background: rgba(255,255,255,0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-right: auto;
}
.batch-orders { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.batch-orders .order { box-shadow: none; border-right-width: 3px; }

/* === Search Bar === */
.search-bar {
  position: relative;
  margin: 0 12px 12px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e0e0e0;
}
.search-icon { font-size: 16px; margin-left: 8px; opacity: 0.6; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color:

/* 🆕 ====== الرسالة المطوية + زر عرض/تعديل ====== */
.msg-collapsed-wrap {
  background: #f7f9fa;
  border: 1px solid #e0e4e8;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.msg-collapsed-label {
  font-size: 13px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-edited-badge {
  background: #f39c12;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
}
.msg-preview-text {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #34495e;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-right: 3px solid #1ea952;
  font-family: inherit;
  max-height: 140px;
  overflow: hidden;
}
.msg-toggle-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  margin-top: 10px;
  font-family: inherit;
  box-shadow: 0 3px 10px rgba(108, 92, 231, 0.35);
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}
.msg-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(108, 92, 231, 0.5);
}
.msg-toggle-btn:active {
  transform: scale(0.98);
}
.msg-edit-expanded {
  margin-top: 10px;
}
.msg-restore-btn {
  margin-top: 8px;
  background: #95a5a6;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.msg-restore-btn:hover {
  background: #7f8c8d;
}

/* وضع داكن */
body.dark .msg-collapsed-wrap {
  background: #2a2f3a;
  border-color: #3a4150;
}
body.dark .msg-preview-text {
  background: #1f242e;
  color: #d0d6e0;
}
body.dark .msg-toggle-btn {
  background: #1f242e;
}


/* 🆕 ====== تحسينات الموبايل (شاشات < 600px) ====== */
@media (max-width: 600px) {
  .modal-content {
    padding: 50px 12px 20px;
    font-size: 13px;
    height: 93vh;
    max-height: 93vh;
  }
  .modal-title {
    font-size: 16px;
    margin-bottom: 8px;
  }
  .modal-row {
    font-size: 12.5px;
    padding: 6px 0;
    line-height: 1.5;
  }
  .modal-row b {
    font-size: 12.5px;
  }
  .reply-title {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .reply-buttons button {
    padding: 9px;
    font-size: 12px;
  }
  .btn-customer-delivered,
  .btn-customer-refused {
    padding: 11px;
    font-size: 13.5px;
  }
  .btn-wa, .btn-call, .btn-notify-driver, .btn-notify-dex {
    padding: 11px !important;
    font-size: 13.5px !important;
  }
  .btn-toggle {
    padding: 10px;
    font-size: 13px;
  }
  .snooze-row {
    padding: 10px;
  }
  .snooze-buttons button {
    padding: 8px;
    font-size: 11.5px;
  }
  .msg-collapsed-wrap {
    padding: 10px;
  }
  .msg-preview-text {
    font-size: 12px;
    line-height: 1.6;
    padding: 8px 10px;
  }
  .msg-toggle-btn {
    padding: 9px 14px;
    font-size: 12.5px;
  }
  .msg-edit {
    font-size: 12px !important;
  }
  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 22px;
    margin: -42px 0 6px -6px;
  }
  /* بطاقة البونص أصغر شوي */
  .bonus-card {
    padding: 12px;
    margin: 0 8px 10px;
  }
  .bc-amount { font-size: 30px; }
  .bc-rank { font-size: 22px; }
}

/* للشاشات الصغيرة جداً (< 380px) */
@media (max-width: 380px) {
  .modal-content {
    padding: 46px 10px 18px;
  }
  .modal-title {
    font-size: 15px;
  }
  .modal-row,
  .modal-row b {
    font-size: 12px;
  }
}


/* 🆕 ✉️ زر SMS قصير - برتقالي مميز يدل على التوفير */
.btn-sms {
  display: block;
  background: linear-gradient(135deg, #e67e22, #f39c12);
  color: #fff;
  text-align: center;
  padding: 13px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  margin: 8px 0;
  box-shadow: 0 3px 10px rgba(230, 126, 34, 0.35);
  transition: all 0.2s ease;
  position: relative;
}
.btn-sms:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(230, 126, 34, 0.5);
}
.btn-sms:active {
  transform: scale(0.98);
}
.btn-sms::after {
  content: '💰 يوفّر 89%';
  position: absolute;
  top: -8px;
  left: 12px;
  background: #27ae60;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
