/* ========== dark-mode.css - الوضع الداكن الشامل ========== */

/* === انتقالات سلسة عند تبديل الثيم === */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* === 1. متغيرات الجذر - الوضع الداكن === */
/* html[data-theme] has higher specificity than :root to override page-specific CSS */
html[data-theme="dark"] {
  --background: #0f172a;
  --text-dark: #e2e8f0;
  --text-light: #94a3b8;
  --border-color: #1e293b;
  --primary-blue: #818cf8;
  --primary-teal: #34d399;
  --primary-yellow: #fbbf24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

  /* conversation variables */
  --chat-bg: #0b141a;
  --chat-bg-pattern: none;
  --incoming-bubble: #1f2c34;
  --outgoing-bubble: #005c4b;
  --outgoing-bubble-gradient: linear-gradient(135deg, #005c4b 0%, #004d40 100%);
  --primary-color: #00a884;
  --primary-dark: #00c49a;
  --message-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

  /* dashboard variables */
  --dash-bg: #0f172a;
  --dash-card: #1e293b;
  --dash-text: #e2e8f0;
  --dash-text-light: #94a3b8;
  --dash-border: #334155;
  --dash-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --dash-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);

  color-scheme: dark;
}

/* === 2. عناصر الجسم الأساسية === */
[data-theme="dark"] body {
  background-color: #0f172a;
  color: #e2e8f0;
}

/* === 3. شريط التنقل العلوي === */
[data-theme="dark"] .navbar {
  background: #1e293b;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .brand-text {
  color: #e2e8f0;
}

[data-theme="dark"] .nav-link {
  color: #94a3b8;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.1);
}

[data-theme="dark"] .navbar-toggler {
  color: #e2e8f0;
}

[data-theme="dark"] .username {
  color: #e2e8f0;
}

[data-theme="dark"] .user-info:hover {
  background: rgba(129, 140, 248, 0.1);
}

[data-theme="dark"] .user-info i {
  color: #34d399;
}

[data-theme="dark"] .notifications-icon i {
  color: #94a3b8;
}

/* === 4. القوائم المنسدلة === */
[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-header {
  color: #94a3b8;
  border-bottom-color: #334155;
}

[data-theme="dark"] .dropdown-item {
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background: rgba(129, 140, 248, 0.1);
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item.text-danger {
  color: #f87171 !important;
}

[data-theme="dark"] .dropdown-item.text-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

[data-theme="dark"] .dropdown-divider {
  border-color: #334155;
}

[data-theme="dark"] .dropdown-footer {
  border-top-color: #334155;
}

[data-theme="dark"] .dropdown-footer a {
  color: #818cf8;
}

/* === 5. الإشعارات === */
[data-theme="dark"] .notification-dropdown {
  background: #1e293b;
}

[data-theme="dark"] .notification-item {
  border-bottom-color: #334155;
}

[data-theme="dark"] .notification-item:hover {
  background-color: rgba(129, 140, 248, 0.05);
}

[data-theme="dark"] .notification-item.unread {
  background-color: rgba(52, 211, 153, 0.08);
}

[data-theme="dark"] .notification-title {
  color: #e2e8f0;
}

[data-theme="dark"] .notification-content {
  color: #94a3b8;
}

[data-theme="dark"] .notification-time {
  color: #64748b;
}

[data-theme="dark"] .empty-state p {
  color: #64748b !important;
}

/* === 6. الشريط الجانبي CRM === */
html[data-theme="dark"] .crm-sidebar {
  background-color: #1e293b !important;
  border-left-color: #334155 !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .crm-sidebar-nav a {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .crm-sidebar-nav a:hover {
  background-color: rgba(129, 140, 248, 0.1) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .crm-sidebar-nav a.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
}

html[data-theme="dark"] .crm-sidebar-user-section {
  border-top-color: #334155 !important;
}

html[data-theme="dark"] .sidebar-notif-btn,
html[data-theme="dark"] .sidebar-theme-btn {
  background: #334155 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .sidebar-notif-btn:hover,
html[data-theme="dark"] .sidebar-theme-btn:hover {
  background: rgba(129, 140, 248, 0.15) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .sidebar-user-info {
  background: #334155 !important;
}

html[data-theme="dark"] .sidebar-user-info:hover {
  background: rgba(129, 140, 248, 0.1) !important;
}

html[data-theme="dark"] .sidebar-user-name {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .sidebar-user-role {
  color: #64748b !important;
}

html[data-theme="dark"] .sidebar-user-chevron {
  color: #64748b !important;
}

html[data-theme="dark"] .sidebar-user-menu-list li a {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .sidebar-user-menu-list li a:hover {
  background: rgba(129, 140, 248, 0.1) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .sidebar-user-menu-list li a.text-danger {
  color: #f87171 !important;
}

/* === 7. محتوى CRM === */
html[data-theme="dark"] .crm-container {
  background-color: #0f172a !important;
}

html[data-theme="dark"] .crm-content {
  background-color: #0f172a !important;
}

/* === 8. البطاقات === */
[data-theme="dark"] .card,
[data-theme="dark"] .crm-content .card {
  background-color: #1e293b !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .crm-content .card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .crm-content .card-header,
[data-theme="dark"] .card-header {
  background-color: #1e293b !important;
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .crm-content .card-body,
[data-theme="dark"] .card-body {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .card-footer {
  background-color: #1e293b !important;
  border-top-color: #334155 !important;
}

/* === 9. الجداول === */
[data-theme="dark"] .table {
  --bs-table-bg: #1e293b !important;
  --bs-table-color: #e2e8f0 !important;
  --bs-table-border-color: #334155 !important;
  --bs-table-hover-bg: #334155 !important;
  --bs-table-striped-bg: #253348 !important;
  color: #e2e8f0 !important;
  background-color: #1e293b !important;
}

[data-theme="dark"] .crm-content .table thead,
[data-theme="dark"] .table thead {
  background-color: #0f172a !important;
}

[data-theme="dark"] .crm-content .table th,
[data-theme="dark"] .table th {
  color: #94a3b8 !important;
  background-color: #0f172a !important;
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .crm-content .table td,
[data-theme="dark"] .table td {
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
  background-color: transparent !important;
}

[data-theme="dark"] .crm-content .table tbody tr:hover,
[data-theme="dark"] .table tbody tr:hover {
  background-color: #334155 !important;
}

[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent !important;
  color: inherit !important;
  border-bottom-color: #334155 !important;
}

/* === 10. النماذج === */
[data-theme="dark"] .form-control,
[data-theme="dark"] .crm-content .form-control {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .crm-content .form-control:focus {
  background-color: #0f172a !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .form-control::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] .form-control:disabled {
  background-color: #1e293b !important;
  color: #64748b !important;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] .crm-content .form-label {
  color: #94a3b8;
}

[data-theme="dark"] .form-check-input {
  background-color: #334155;
  border-color: #475569;
}

[data-theme="dark"] .form-check-input:checked {
  background-color: #6366f1;
  border-color: #6366f1;
}

[data-theme="dark"] .input-group-text {
  background-color: #334155;
  border-color: #334155;
  color: #94a3b8;
}

/* === 11. الأزرار === */
[data-theme="dark"] .btn-outline-primary {
  color: #818cf8;
  border-color: #818cf8;
}

[data-theme="dark"] .btn-outline-secondary {
  color: #94a3b8;
  border-color: #475569;
}

[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-light {
  background-color: #334155;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-light:hover {
  background-color: #475569;
}

[data-theme="dark"] .btn-secondary {
  background-color: #475569;
  border-color: #475569;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* === 12. التنبيهات === */
[data-theme="dark"] .alert-success {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.25);
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
}

[data-theme="dark"] .alert-info {
  background-color: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
}

/* === 13. المودال === */
[data-theme="dark"] .modal-content {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .modal-header {
  background-color: #1e293b;
  border-bottom-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .modal-body {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .modal-footer {
  background-color: #0f172a;
  border-top-color: #334155;
}

[data-theme="dark"] .modal-title {
  color: #e2e8f0;
}

[data-theme="dark"] .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

/* === 14. الحاوية الرئيسية === */
[data-theme="dark"] .container {
  background-color: #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* === 15. الفوتر === */
[data-theme="dark"] .footer {
  background: #1e293b;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .footer .company-name {
  color: #64748b;
}

[data-theme="dark"] .footer .social-link {
  color: #64748b;
}

[data-theme="dark"] .footer .social-link:hover {
  color: #818cf8;
}

/* === 16. شارات و badges === */
[data-theme="dark"] .badge.bg-light {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .badge.bg-secondary {
  background-color: #475569 !important;
}

/* === 17. التقسيمات (breadcrumb) === */
[data-theme="dark"] .crm-content .breadcrumb {
  background-color: #1e293b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .crm-content .breadcrumb-item a {
  color: #818cf8;
}

[data-theme="dark"] .crm-content .breadcrumb-item.active {
  color: #94a3b8;
}

/* === 18. لوحة التحكم (Dashboard) === */
[data-theme="dark"] .dashboard-content {
  background: #0f172a !important;
}

[data-theme="dark"] .dashboard-title h1 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .dashboard-title .subtitle {
  color: #94a3b8 !important;
}

[data-theme="dark"] .kpi-card {
  background-color: #1e293b;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .kpi-value {
  color: #e2e8f0;
}

[data-theme="dark"] .kpi-label {
  color: #94a3b8;
}

[data-theme="dark"] .dashboard-list-card .list-group-item {
  background-color: #1e293b;
  border-bottom-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .dashboard-list-card .list-group-item:hover {
  background-color: #334155;
}

[data-theme="dark"] .chart-card {
  background: #1e293b !important;
}

[data-theme="dark"] .chart-header {
  border-bottom-color: #334155;
}

[data-theme="dark"] .chart-header h3 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .period-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .period-btn:hover {
  border-color: #6366f1;
  color: #818cf8;
}

[data-theme="dark"] .stat-link {
  background: #0f172a;
  color: #94a3b8;
}

[data-theme="dark"] .stat-link:hover {
  background: #6366f1;
  color: white;
}

[data-theme="dark"] .metric-value {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .metric-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .data-table {
  background: #1e293b;
}

[data-theme="dark"] .data-table th {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="dark"] .data-table td {
  color: #e2e8f0;
  border-color: #334155;
}

[data-theme="dark"] .data-table tbody tr:hover {
  background: #334155;
}

/* === 19. صفحة المحادثات (شامل) === */

/* --- 19a. حاوية قائمة المحادثات --- */
html[data-theme="dark"] .conversations-sidebar {
  background-color: #1e293b !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .conversations-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .conversations-header h5 {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-filters-search {
  background-color: #1e293b !important;
  border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .conversation-filters .form-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-item {
  border-bottom-color: #1e293b !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-item:hover {
  background-color: rgba(99, 102, 241, 0.06) !important;
}

html[data-theme="dark"] .conversation-item.active,
html[data-theme="dark"] .conversation-item.selected {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.04) 100%) !important;
  border-right-color: #6366f1 !important;
}

html[data-theme="dark"] .conversation-item.has-unread {
  background-color: rgba(52, 211, 153, 0.06) !important;
}

html[data-theme="dark"] .conversation-item .conversation-name,
html[data-theme="dark"] .conversation-item-name {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-item .last-message-preview {
  color: #64748b !important;
}

html[data-theme="dark"] .conversation-item .conversation-time,
html[data-theme="dark"] .conversation-item-time {
  color: #475569 !important;
}

html[data-theme="dark"] .conversation-item-meta {
  color: #64748b !important;
}

html[data-theme="dark"] .conversation-item-avatar {
  background: linear-gradient(135deg, #312e81 0%, #4338ca 100%) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .conversations-list-column {
  border-left-color: #334155 !important;
}

html[data-theme="dark"] .no-conversations-message {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #64748b !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-menu {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-header {
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item {
  color: #e2e8f0 !important;
  background: transparent !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item:hover {
  background: linear-gradient(135deg, #334155, #2d3a4a) !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item:active {
  background: linear-gradient(135deg, #475569, #334155) !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item:hover::before {
  background: #60a5fa !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item-text {
  background: rgba(15, 23, 42, 0.5) !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-item-text strong {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-actions .dropdown-divider {
  border-top-color: #334155 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .conversation-actions .text-primary { color: #60a5fa !important; }
html[data-theme="dark"] .conversation-actions .text-info { color: #67e8f9 !important; }
html[data-theme="dark"] .conversation-actions .text-success { color: #4ade80 !important; }
html[data-theme="dark"] .conversation-actions .text-warning { color: #fbbf24 !important; }
html[data-theme="dark"] .conversation-actions .text-danger { color: #f87171 !important; }

/* --- 19b. حاوية تفاصيل المحادثة (الرئيسية) --- */
html[data-theme="dark"] .conversation-details-column {
  background-color: #0f172a !important;
}

html[data-theme="dark"] .conversation-details-container {
  background-color: #0f172a !important;
}

html[data-theme="dark"] .conversation-main-container {
  background-color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .conversation-welcome {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #64748b !important;
}

html[data-theme="dark"] .conversation-welcome h4 {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-closed-notice {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  color: #94a3b8 !important;
}

/* --- 19c. رأس المحادثة (معلومات العميل/الأزرار) --- */
html[data-theme="dark"] .conversation-header {
  background: #1e293b !important;
  background-color: #1e293b !important;
  background-image: none !important;
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-details-header,
html[data-theme="dark"] .chat-header {
  background: #1e293b !important;
  background-color: #1e293b !important;
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .customer-info {
  background: transparent !important;
  background-color: transparent !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .customer-name {
  background: transparent !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .customer-name a {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .customer-details {
  background: transparent !important;
  background-color: transparent !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .avatar-container {
  background: transparent !important;
  background-color: transparent !important;
}

html[data-theme="dark"] .customer-avatar {
  background: linear-gradient(135deg, #312e81 0%, #4338ca 100%) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .conversation-meta {
  background: transparent !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .conversation-status-badge {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .message-count {
  color: #64748b !important;
}

html[data-theme="dark"] .customer-tags-container {
  background: transparent !important;
  background-color: transparent !important;
}

html[data-theme="dark"] .customer-tags-container .badge {
  color: #fff !important;
}

html[data-theme="dark"] .customer-tags-container .add-tag-btn {
  color: #94a3b8 !important;
  border-color: #475569 !important;
  background-color: transparent !important;
}

/* --- 19d. حاوية الرسائل --- */
html[data-theme="dark"] .messages-container,
html[data-theme="dark"] .chat-messages-container {
  background-color: #0b141a !important;
  background-image: none !important;
}

/* فقاعات الرسائل */
html[data-theme="dark"] .message-bubble {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* إبراز الرسالة الأصلية عند الانتقال من الرد (وضع داكن) */
html[data-theme="dark"] .message.reply-target-highlight .message-bubble {
  outline: 2px solid rgba(129, 140, 248, 0.95) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.45), 0 10px 26px rgba(56, 189, 248, 0.3) !important;
  filter: brightness(1.12) saturate(1.08) !important;
}

html[data-theme="dark"] .incoming-bubble {
  background-color: #1f2c34 !important;
  background-image: none !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .incoming-bubble::before {
  border-top-color: #1f2c34 !important;
}

html[data-theme="dark"] .outgoing-bubble {
  background: linear-gradient(135deg, #005c4b 0%, #004d40 100%) !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .outgoing-bubble::before {
  border-top-color: #005c4b !important;
}

html[data-theme="dark"] .message-text {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message.incoming .message-text {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message.outgoing .message-text {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message-meta,
html[data-theme="dark"] .message-time {
  color: rgba(255, 255, 255, 0.5) !important;
  opacity: 0.8;
}

html[data-theme="dark"] .message-sender {
  color: #34d399 !important;
}

html[data-theme="dark"] .message-text .message-link {
  color: #93c5fd !important;
}

html[data-theme="dark"] .message.outgoing .message-text .message-link {
  color: #bfdbfe !important;
}

html[data-theme="dark"] .message-with-media .message-text {
  border-top-color: rgba(255, 255, 255, 0.1) !important;
}

/* --- 19d2. مشغل الصوت في المحادثة (الوضع الليلي) --- */
html[data-theme="dark"] .media-container audio,
html[data-theme="dark"] .media-container .media-audio {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .media-container:has(audio),
html[data-theme="dark"] .media-container:has(.media-audio) {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(51, 65, 85, 0.5) 100%) !important;
}

html[data-theme="dark"] .media-container audio::-webkit-media-controls-panel,
html[data-theme="dark"] .media-container .media-audio::-webkit-media-controls-panel {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
}

/* لون النص والوقت داخل مشغل الصوت (WebKit) */
html[data-theme="dark"] .media-container audio::-webkit-media-controls-current-time-display,
html[data-theme="dark"] .media-container audio::-webkit-media-controls-time-remaining-display,
html[data-theme="dark"] .media-container .media-audio::-webkit-media-controls-current-time-display,
html[data-theme="dark"] .media-container .media-audio::-webkit-media-controls-time-remaining-display {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message.incoming .media-container:has(audio),
html[data-theme="dark"] .message.incoming .media-container:has(.media-audio) {
  background: linear-gradient(135deg, rgba(31, 44, 52, 0.9) 0%, rgba(30, 41, 59, 0.85) 100%) !important;
}

html[data-theme="dark"] .message.outgoing .media-container:has(audio),
html[data-theme="dark"] .message.outgoing .media-container:has(.media-audio) {
  background: linear-gradient(135deg, rgba(0, 92, 75, 0.4) 0%, rgba(0, 77, 64, 0.5) 100%) !important;
}

html[data-theme="dark"] .message.incoming .audio-message-container {
  background: linear-gradient(135deg, rgba(31, 44, 52, 0.9) 0%, rgba(30, 41, 59, 0.85) 100%) !important;
}

html[data-theme="dark"] .message.outgoing .audio-message-container {
  background: linear-gradient(135deg, rgba(0, 92, 75, 0.4) 0%, rgba(0, 77, 64, 0.5) 100%) !important;
}

/* --- 19e. منطقة إدخال الرسائل --- */
html[data-theme="dark"] .message-input-area,
html[data-theme="dark"] .chat-input-container,
html[data-theme="dark"] .reply-input-container {
  background-color: #1e293b !important;
  border-top-color: #334155 !important;
}

html[data-theme="dark"] .message-input-area textarea,
html[data-theme="dark"] .message-input-area input {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message-actions-bar {
  background: #1e293b !important;
}

html[data-theme="dark"] .message-tools .btn {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .message-tools .btn:hover {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* --- 19f. لوحة معلومات المحادثة الجانبية --- */
html[data-theme="dark"] .conversation-info-panel,
html[data-theme="dark"] .customer-info-sidebar {
  background-color: #1e293b !important;
  border-left-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* فاصل التاريخ */
html[data-theme="dark"] .date-separator span,
html[data-theme="dark"] .date-divider span {
  background-color: #334155 !important;
  color: #94a3b8 !important;
}

/* الحالة الفارغة */
html[data-theme="dark"] .no-conversation-selected,
html[data-theme="dark"] .empty-conversation-state {
  color: #64748b !important;
}

/* --- 19g. عناصر التفاعل والملاحظات --- */
html[data-theme="dark"] .reaction-emoji,
html[data-theme="dark"] .reaction-item {
  background: #334155 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message.outgoing .reaction-emoji,
html[data-theme="dark"] .message.outgoing .reaction-item {
  background: rgba(0, 92, 75, 0.4) !important;
  border-color: rgba(0, 168, 132, 0.2) !important;
}

html[data-theme="dark"] .message.incoming .reaction-emoji,
html[data-theme="dark"] .message.incoming .reaction-item {
  background: rgba(31, 44, 52, 0.8) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
}

/* =========================================================== */
/* === 19b2. Search container & toasts in conversations ====== */
/* =========================================================== */
html[data-theme="dark"] .search-container .input-group {
  background: #0f172a !important;
  border-color: #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .search-container .input-group:focus-within {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

html[data-theme="dark"] .search-container .input-group-text {
  color: #64748b !important;
  background: transparent !important;
  border: none !important;
}

html[data-theme="dark"] .search-container .form-control {
  background: transparent !important;
  color: #e2e8f0 !important;
  border: none !important;
}

html[data-theme="dark"] .search-container .form-control::placeholder {
  color: #475569 !important;
}

html[data-theme="dark"] .simple-toast {
  background: #1e293b !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .simple-toast .toast-message {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .simple-toast .toast-close {
  color: #64748b !important;
}

html[data-theme="dark"] .loading-text {
  color: #64748b !important;
}

/* =========================================================== */
/* === 19c. Stats bar, department tabs, chat detail areas ==== */
/* =========================================================== */
html[data-theme="dark"] .conversation-stats-bar {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .stat-item {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .stat-item:hover {
  background-color: #334155 !important;
}

html[data-theme="dark"] .stat-item.active {
  background-color: rgba(0, 168, 132, 0.1) !important;
}

html[data-theme="dark"] .stat-item .stat-content i {
  color: #64748b !important;
}

html[data-theme="dark"] .stat-item .stat-label {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .stat-badge {
  background: #334155 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .stat-item.active .stat-badge {
  background: var(--primary-color, #00a884) !important;
  color: #fff !important;
}

html[data-theme="dark"] .stat-badge-warning {
  background: rgba(217, 119, 6, 0.15) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .stat-badge-danger {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #f87171 !important;
}

html[data-theme="dark"] .stat-item.active .stat-badge-warning,
html[data-theme="dark"] .stat-item.active .stat-badge-danger {
  background: var(--primary-color, #00a884) !important;
  color: #fff !important;
}

html[data-theme="dark"] .department-tabs {
  border-bottom-color: #334155 !important;
  background: #1e293b !important;
}

html[data-theme="dark"] .department-tabs .nav-link {
  color: #94a3b8 !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .department-tabs .nav-link:hover {
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

html[data-theme="dark"] .department-tabs .nav-link.active {
  color: #e2e8f0 !important;
  background: #0f172a !important;
  border-color: #334155 #334155 #0f172a !important;
}

html[data-theme="dark"] .customer-tags-container .add-tag-btn:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conversation-quick-actions .btn-group .btn {
  border-color: #475569 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .conversation-quick-actions .btn-group .btn:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .pending-conversations-alert .view-pending-btn {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

html[data-theme="dark"] .conversations-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] #conversationList::-webkit-scrollbar-track {
  background: #0f172a !important;
}

html[data-theme="dark"] #conversationList::-webkit-scrollbar-thumb {
  background: #334155 !important;
}

html[data-theme="dark"] #conversationList::-webkit-scrollbar-thumb:hover {
  background: #475569 !important;
}

html[data-theme="dark"] .media-preview .card,
html[data-theme="dark"] #mediaPreview .card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .message-actions-dropdown .dropdown-menu {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .message-actions-dropdown .dropdown-item {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .message-actions-dropdown .dropdown-item:hover {
  background: #334155 !important;
}

html[data-theme="dark"] .message.internal .message-bubble,
html[data-theme="dark"] .internal-note-bubble {
  background: rgba(251, 191, 36, 0.08) !important;
  border: 1px dashed rgba(251, 191, 36, 0.3) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .reply-context,
html[data-theme="dark"] .quoted-message {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

/* === 20. قائمة مجموعات البحث (Select2) === */
[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .select2-container--default .select2-results__option {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .select2-container--default .select2-results__option--highlighted {
  background-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .select2-dropdown {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .select2-search__field {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
}

/* === 21. SweetAlert2 === */
[data-theme="dark"] .swal2-popup {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .swal2-title {
  color: #e2e8f0;
}

[data-theme="dark"] .swal2-html-container {
  color: #94a3b8;
}

[data-theme="dark"] .swal2-input {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

/* === 22. Scrollbar === */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0f172a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* === 23. نصوص متنوعة === */
[data-theme="dark"] .text-muted {
  color: #64748b !important;
}

[data-theme="dark"] .text-dark {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .bg-white {
  background-color: #1e293b !important;
}

[data-theme="dark"] .bg-light {
  background-color: #0f172a !important;
}

[data-theme="dark"] .border {
  border-color: #334155 !important;
}

[data-theme="dark"] .border-bottom {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .border-top {
  border-top-color: #334155 !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: #e2e8f0;
}

[data-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):not(.crm-sidebar-nav a) {
  color: #818cf8;
}

[data-theme="dark"] hr {
  border-color: #334155;
}

/* === 24. تبويبات (Tabs) === */
[data-theme="dark"] .nav-tabs {
  border-bottom-color: #334155;
}

[data-theme="dark"] .nav-tabs .nav-link {
  color: #94a3b8;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
  border-color: #334155;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
  background-color: #1e293b;
  border-color: #334155 #334155 #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .nav-pills .nav-link.active {
  background-color: #6366f1;
}

/* === 25. Pagination === */
[data-theme="dark"] .page-link {
  background-color: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .page-link:hover {
  background-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .page-item.active .page-link {
  background-color: #6366f1;
  border-color: #6366f1;
}

[data-theme="dark"] .page-item.disabled .page-link {
  background-color: #0f172a;
  color: #475569;
}

/* === 26. List Group === */
[data-theme="dark"] .list-group-item {
  background-color: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .list-group-item:hover {
  background-color: #334155;
}

/* === 27. Tooltip & Popover === */
[data-theme="dark"] .tooltip-inner {
  background-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .popover {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .popover-body {
  color: #e2e8f0;
}

/* === 28. CRM Mobile sidebar overlay === */
@media (max-width: 991.98px) {
  [data-theme="dark"] .crm-sidebar {
    background-color: #1e293b;
    border-right-color: #334155;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
  }

  [data-theme="dark"] .crm-sidebar-overlay.show {
    background-color: rgba(0, 0, 0, 0.7);
  }
}

/* === 29. Whatsapp templates & notices === */
[data-theme="dark"] .template-card {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .template-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .template-component-preview {
  background: #0f172a;
  color: #94a3b8;
}

[data-theme="dark"] .whatsapp-window-notice {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.05));
  border-color: rgba(251, 191, 36, 0.3);
}

/* === 30. مخصص: تبديل الدارك مود في الهيدر === */
[data-theme="dark"] .dark-mode-toggle-item .fa-moon {
  display: none;
}

[data-theme="dark"] .dark-mode-toggle-item::before {
  content: '';
}

.dark-mode-toggle-item {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
}

.dark-mode-toggle-item .form-check {
  pointer-events: none;
}

[data-theme="dark"] .dark-mode-toggle-item .fa-moon::before {
  content: "\f185";
}

[data-theme="dark"] #darkModeToggleHeader {
  background-color: #6366f1;
  border-color: #6366f1;
}

/* === 31. الملاحظات الداخلية === */
[data-theme="dark"] .internal-note-bubble,
[data-theme="dark"] .note-bubble {
  background-color: rgba(251, 191, 36, 0.1) !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
  color: #fbbf24;
}

/* === 32. تنسيقات Flatpickr === */
[data-theme="dark"] .flatpickr-calendar {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .flatpickr-day {
  color: #e2e8f0;
}

[data-theme="dark"] .flatpickr-day:hover {
  background: #334155;
}

[data-theme="dark"] .flatpickr-day.selected {
  background: #6366f1;
  border-color: #6366f1;
}

[data-theme="dark"] .flatpickr-months .flatpickr-month {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .flatpickr-weekdays {
  background: #1e293b;
}

[data-theme="dark"] span.flatpickr-weekday {
  color: #64748b;
}

/* === 33. Navbar collapse on mobile (dark) === */
[data-theme="dark"] .navbar-collapse {
  background-color: #1e293b;
}

/* === 34. Logo background fix === */
[data-theme="dark"] .logo-background {
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* === 35. Contacts page dark mode === */
[data-theme="dark"] {
  --contacts-bg: #0f172a;
  --contacts-card-bg: #1e293b;
  --contacts-border: #334155;
  --contacts-text: #e2e8f0;
  --contacts-text-muted: #94a3b8;
  --contacts-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --contacts-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .contacts-page .card {
  background-color: #1e293b;
}

[data-theme="dark"] .contacts-page .table th {
  background-color: #0f172a;
  color: #94a3b8;
}

[data-theme="dark"] .contacts-page .table td {
  color: #e2e8f0;
}

/* === 36. Manage licenses dark mode === */
[data-theme="dark"] .manage-licenses-container,
[data-theme="dark"] .license-card {
  background-color: #1e293b;
  color: #e2e8f0;
}

/* === 37. Profile page dark mode === */
[data-theme="dark"] .profile-container,
[data-theme="dark"] .profile-card {
  background-color: #1e293b;
  color: #e2e8f0;
}

/* === 38. Header profile picture === */
[data-theme="dark"] .header-profile-picture,
[data-theme="dark"] .header-profile-picture-lg {
  border-color: #334155;
}

/* =========================================================== */
/* === 39. Conversation details - input area, header, cards === */
/* =========================================================== */
html[data-theme="dark"] .message-input-container {
  background-color: #1e293b !important;
  border-top-color: #334155 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] .reply-form-controls {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] .reply-form-controls:focus-within {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

html[data-theme="dark"] .reply-input-wrapper textarea,
html[data-theme="dark"] #replyMessage {
  background-color: transparent !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .reply-input-wrapper textarea::placeholder,
html[data-theme="dark"] #replyMessage::placeholder {
  color: #64748b !important;
}

html[data-theme="dark"] .send-button-wrapper button:disabled {
  background: #475569 !important;
}

html[data-theme="dark"] .conversation-quick-actions .btn-outline-secondary {
  border-color: #475569 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .conversation-quick-actions .btn-outline-secondary:hover {
  background: #334155 !important;
  border-color: #64748b !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .reply-form-content.drag-over,
html[data-theme="dark"] .message-input.drag-over,
html[data-theme="dark"] #replyMessage.drag-over {
  background-color: rgba(99, 102, 241, 0.15) !important;
}

html[data-theme="dark"] .reply-form-disabled textarea,
html[data-theme="dark"] .reply-form-disabled .form-control {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

html[data-theme="dark"] .conversation-calls-section .card {
  background: #1e293b !important;
}

html[data-theme="dark"] .conversation-calls-section .card-header {
  border-bottom-color: #334155 !important;
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .conversation-info-panel .card,
[data-theme="dark"] .customer-info-sidebar .card {
  background-color: #1e293b;
}

[data-theme="dark"] .bg-light {
  background-color: #0f172a !important;
}

[data-theme="dark"] .card.border-0.shadow-sm {
  background-color: #1e293b;
}

/* =========================================================== */
/* === 40. Contacts page - table and inline styles ========== */
/* =========================================================== */
[data-theme="dark"] .contacts-table-container,
[data-theme="dark"] .contacts-page .card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .contacts-table thead,
[data-theme="dark"] .contacts-table thead th {
  background-color: #0f172a !important;
  color: #94a3b8;
  border-bottom-color: #334155;
}

[data-theme="dark"] .contacts-table td {
  border-bottom-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .contacts-table tbody tr:hover {
  background-color: #334155 !important;
}

[data-theme="dark"] .table-contact-name {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .td-phone {
  color: #94a3b8 !important;
}

[data-theme="dark"] .table-tag-more,
[data-theme="dark"] .contact-tag-more {
  background: #334155 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .btn-table-action {
  background: #334155 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .btn-table-action:hover {
  background: #475569 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .sortable-header:hover {
  color: #818cf8 !important;
  background: #334155 !important;
}

[data-theme="dark"] .end-of-list {
  color: #64748b !important;
}

[data-theme="dark"] .contacts-page {
  --contacts-bg: #0f172a;
  --contacts-card-bg: #1e293b;
  --contacts-border: #334155;
  --contacts-text: #e2e8f0;
  --contacts-text-muted: #94a3b8;
}

[data-theme="dark"] .search-input,
[data-theme="dark"] .contacts-page .search-input {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .search-input:focus,
[data-theme="dark"] .contacts-page .search-input:focus {
  background: #0f172a !important;
}

[data-theme="dark"] .clear-search-btn:hover {
  background: #334155 !important;
}

[data-theme="dark"] .btn-filter-toggle {
  background: #334155 !important;
  color: #94a3b8 !important;
  border-color: #475569 !important;
}

[data-theme="dark"] .filter-select,
[data-theme="dark"] .contacts-page .filter-select {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .contact-card-header,
[data-theme="dark"] .contact-card-tags,
[data-theme="dark"] .contact-card-footer {
  background: #0f172a !important;
}

/* =========================================================== */
/* === 41. Leads page - cards, pipeline, table =============== */
/* =========================================================== */
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light th {
  background-color: #0f172a !important;
  color: #94a3b8 !important;
  --bs-table-bg: #0f172a;
  border-color: #334155 !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
  background-color: #334155 !important;
  --bs-table-hover-bg: #334155;
}

[data-theme="dark"] .lead-card,
[data-theme="dark"] .pipeline-card,
[data-theme="dark"] .kanban-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0;
}

[data-theme="dark"] .lead-card:hover,
[data-theme="dark"] .pipeline-card:hover,
[data-theme="dark"] .kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .kanban-column,
[data-theme="dark"] .pipeline-column {
  background-color: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .kanban-column-header,
[data-theme="dark"] .pipeline-column-header {
  background-color: #1e293b;
  border-bottom-color: #334155;
}

/* =========================================================== */
/* === 42. Bootstrap utility overrides for dark mode ========= */
/* =========================================================== */
[data-theme="dark"] .shadow-sm {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .table-responsive {
  background-color: #1e293b;
  border-radius: 8px;
}

[data-theme="dark"] .card .bg-light {
  background-color: #0f172a !important;
}

[data-theme="dark"] .card-footer {
  background-color: #0f172a;
  border-top-color: #334155;
}

/* =========================================================== */
/* === 43. Inline style overrides for conversations page ===== */
/* =========================================================== */
html[data-theme="dark"] .template-card {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .template-card.border-primary {
  background-color: #1e293b !important;
}

html[data-theme="dark"] .template-component-preview {
  background: #0f172a !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .whatsapp-window-notice {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.03)) !important;
  border-color: rgba(251, 191, 36, 0.2) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .whatsapp-window-expired-alert {
  background-color: transparent !important;
}

html[data-theme="dark"] .whatsapp-window-expired-alert .alert {
  background: rgba(251, 191, 36, 0.1) !important;
  border-color: rgba(251, 191, 36, 0.2) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .conversation-closed-notice .card,
html[data-theme="dark"] .conversation-closed-alert {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%) !important;
  color: #818cf8 !important;
}

html[data-theme="dark"] .sending-indicator {
  background: #1e293b !important;
  color: #94a3b8 !important;
}

/* =========================================================== */
/* === 44. Sidebar user section & notification panel dark mode  */
/* =========================================================== */
[data-theme="dark"] .crm-sidebar-user-section {
  border-bottom-color: #334155;
}

[data-theme="dark"] .sidebar-notif-panel {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sidebar-notif-panel-header {
  border-bottom-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .sidebar-notif-panel-header .mark-all-read {
  color: #818cf8;
}

[data-theme="dark"] .sidebar-notif-panel-footer {
  border-top-color: #334155;
}

[data-theme="dark"] .sidebar-notif-panel-footer a {
  color: #818cf8;
}

[data-theme="dark"] .sidebar-notif-panel .notification-item {
  border-bottom-color: #334155;
}

[data-theme="dark"] .sidebar-notif-panel .notification-item:hover {
  background-color: rgba(129, 140, 248, 0.06);
}

[data-theme="dark"] .sidebar-notif-panel .notification-item.unread {
  background-color: rgba(52, 211, 153, 0.08);
}

[data-theme="dark"] .sidebar-notif-panel .notification-title {
  color: #e2e8f0;
}

[data-theme="dark"] .sidebar-notif-panel .notification-content {
  color: #94a3b8;
}

[data-theme="dark"] .sidebar-notif-panel .empty-state p {
  color: #64748b !important;
}

/* =========================================================== */
/* === 45. Misc missing dark mode styles ===================== */
/* =========================================================== */
[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: inherit;
  color: #e2e8f0;
  border-bottom-color: #334155;
}

[data-theme="dark"] .form-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

[data-theme="dark"] .form-select:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.15) !important;
}

[data-theme="dark"] .breadcrumb {
  background-color: #1e293b;
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
  color: #64748b;
}

[data-theme="dark"] .offcanvas,
[data-theme="dark"] .offcanvas-body {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .offcanvas-header {
  border-bottom-color: #334155;
}

[data-theme="dark"] .accordion-item {
  background-color: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .accordion-button {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: #0f172a;
  color: #818cf8;
}

[data-theme="dark"] .accordion-body {
  background-color: #1e293b;
}

[data-theme="dark"] strong,
[data-theme="dark"] b {
  color: inherit;
}

[data-theme="dark"] code {
  color: #f472b6;
}

[data-theme="dark"] pre {
  background-color: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

/* =========================================================== */
/* === 46. Leads pipeline page =============================== */
/* =========================================================== */
[data-theme="dark"] .stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0;
}

[data-theme="dark"] .stat-card.active {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .stat-card .stat-value-num {
  color: #e2e8f0;
}

[data-theme="dark"] .stat-card .stat-label {
  color: #94a3b8;
}

[data-theme="dark"] .pipeline-column {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .pipeline-column-header {
  background: #1e293b !important;
  border-bottom-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .pipeline-column.won-column {
  background: rgba(16, 185, 129, 0.05) !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .pipeline-column.won-column .pipeline-column-header {
  background: rgba(16, 185, 129, 0.1) !important;
}

[data-theme="dark"] .pipeline-column.lost-column {
  background: rgba(239, 68, 68, 0.05) !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .pipeline-column.lost-column .pipeline-column-header {
  background: rgba(239, 68, 68, 0.1) !important;
}

[data-theme="dark"] .lead-card {
  background: #1e293b !important;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .lead-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .lead-card.sortable-ghost {
  background: rgba(99, 102, 241, 0.15) !important;
}

[data-theme="dark"] .lead-card .lead-name {
  color: #e2e8f0;
}

[data-theme="dark"] .lead-card .lead-company,
[data-theme="dark"] .lead-card .lead-value,
[data-theme="dark"] .lead-card .lead-phone {
  color: #94a3b8;
}

[data-theme="dark"] .lead-delete-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

[data-theme="dark"] .pipeline-column-body {
  background: transparent;
}

/* --- 46b. شريط أدوات البحث والفلاتر (Leads pipeline) --- */
[data-theme="dark"] .toolbar-row {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .toolbar-row .search-box input {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .toolbar-row .search-box input::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] .toolbar-row .search-box input:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

[data-theme="dark"] .toolbar-row .search-box .search-icon {
  color: #64748b !important;
}

[data-theme="dark"] .toolbar-row select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .toolbar-row .status-filter .btn {
  background-color: #334155 !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .toolbar-row .status-filter .btn.active,
[data-theme="dark"] .toolbar-row .status-filter .btn:hover {
  background-color: #475569 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .toolbar-row .view-toggle .btn {
  background-color: #334155 !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .toolbar-row .view-toggle .btn.active,
[data-theme="dark"] .toolbar-row .view-toggle .btn:hover {
  background-color: #475569 !important;
  color: #e2e8f0 !important;
}

/* =========================================================== */
/* === 47. Lead show page ==================================== */
/* =========================================================== */
[data-theme="dark"] .lead-detail-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

[data-theme="dark"] .stage-progress .stage-step {
  background: #334155 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .stage-progress .stage-step.passed {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

[data-theme="dark"] .stage-progress .stage-connector {
  background: #475569 !important;
}

[data-theme="dark"] .info-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .info-card h6 {
  color: #e2e8f0 !important;
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .info-row .label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .info-row .value {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .activity-item {
  background: #0f172a !important;
  color: #e2e8f0;
}

[data-theme="dark"] .activity-item .activity-meta {
  color: #64748b !important;
}

[data-theme="dark"] .activity-timeline {
  color: #e2e8f0;
}

[data-theme="dark"] .lead-info-card,
[data-theme="dark"] .lead-activity-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .action-buttons .btn-outline-secondary {
  color: #94a3b8;
  border-color: #475569;
}

[data-theme="dark"] .action-buttons .btn-outline-secondary:hover {
  background: #334155;
  color: #e2e8f0;
}

/* =========================================================== */
/* === 48. Tickets pages ===================================== */
/* =========================================================== */
[data-theme="dark"] .tickets-title {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .filters-section {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .filter-group label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .tickets-table-container {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .tickets-table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .tickets-table tbody tr:hover {
  background: #334155 !important;
}

[data-theme="dark"] .ticket-title a {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .badge-type {
  background: #334155 !important;
  color: #94a3b8 !important;
}

/* Ticket view page */
[data-theme="dark"] .ticket-title-section h1 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .ticket-description {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .info-list li {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .info-list .label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .info-list .value {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .task-item:hover {
  background: #334155 !important;
}

[data-theme="dark"] .task-title.completed {
  color: #64748b !important;
}

[data-theme="dark"] .task-meta,
[data-theme="dark"] .comment-time,
[data-theme="dark"] .history-meta {
  color: #64748b !important;
}

[data-theme="dark"] .comment-item {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .comment-author,
[data-theme="dark"] .history-action {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .comment-text {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .comment-internal {
  background: rgba(251, 191, 36, 0.1) !important;
  color: #fbbf24;
}

[data-theme="dark"] .history-item {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .history-icon {
  background: #334155 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .add-comment-form {
  border-top-color: #334155 !important;
}

[data-theme="dark"] .task-stat {
  background: #0f172a !important;
}

[data-theme="dark"] .task-stat .count {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .task-stat .label {
  color: #94a3b8 !important;
}

/* =========================================================== */
/* === 49. Stats page ======================================== */
/* =========================================================== */
[data-theme="dark"] .loading-overlay {
  background: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="dark"] .metric-card {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .metric-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .customer-item {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] .customer-item:hover {
  background-color: #334155 !important;
}

[data-theme="dark"] .section-title {
  color: #e2e8f0 !important;
}

/* =========================================================== */
/* === 50. Ratings page ====================================== */
/* =========================================================== */
[data-theme="dark"] #ratingsTab {
  border-bottom-color: #334155 !important;
}

[data-theme="dark"] #ratingsTab .nav-link {
  color: #94a3b8 !important;
  background: #0f172a !important;
}

[data-theme="dark"] #ratingsTab .nav-link.active {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .tab-content-wrapper {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .stats-card {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .stats-card .stats-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .rating-distribution {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .distribution-bar {
  background: #334155 !important;
}

[data-theme="dark"] .distribution-label {
  color: #94a3b8 !important;
}

[data-theme="dark"] .ratings-table {
  background: #1e293b !important;
}

[data-theme="dark"] .ratings-table .table th {
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .ratings-table .table td {
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .ratings-table .table td strong,
[data-theme="dark"] .ratings-table .table td a {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .ratings-table .agent-badge {
  background: linear-gradient(135deg, #334155, #475569) !important;
  color: #f1f5f9 !important;
  border: 1px solid #64748b !important;
}

[data-theme="dark"] .ratings-table .agent-badge i {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .filter-card {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .filter-card h5 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .employee-rating-card {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .rating-detail-item {
  background: #0f172a !important;
}

[data-theme="dark"] .rating-detail-item:hover {
  background: #1e293b !important;
}

[data-theme="dark"] .rating-detail-comment {
  background: #1e293b !important;
  color: #cbd5e1 !important;
}

/* =========================================================== */
/* === 51. Pipeline settings page ============================ */
/* =========================================================== */
[data-theme="dark"] .stage-card {
  background: #1e293b !important;
  border-color: #334155;
}

[data-theme="dark"] .stage-description {
  color: #94a3b8 !important;
}

[data-theme="dark"] .drag-handle:hover {
  color: #94a3b8 !important;
}

/* =========================================================== */
/* === 52. Generic dark mode for inline #f0f0f0 borders ====== */
/* =========================================================== */
[data-theme="dark"] [style*="border"] {
  --bs-border-color: #334155;
}

[data-theme="dark"] .stat-info h4 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .stat-info p {
  color: #94a3b8 !important;
}

[data-theme="dark"] .empty-state {
  color: #64748b !important;
}

/* =========================================================== */
/* === 53. Contacts Import page ============================== */
/* =========================================================== */
[data-theme="dark"] .import-header {
  background: linear-gradient(135deg, #4338ca, #3730a3);
}

[data-theme="dark"] .step-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .wizard-step {
  background: #334155;
  color: #64748b;
}

[data-theme="dark"] .upload-zone {
  background: #0f172a;
  border-color: #475569;
}

[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.dragover {
  border-color: #6366f1;
  background: #1e1b4b;
}

[data-theme="dark"] .upload-zone h3 {
  color: #e2e8f0;
}

[data-theme="dark"] .upload-file-info {
  background: #064e3b;
  border-color: #065f46;
}

[data-theme="dark"] .upload-file-info .file-name {
  color: #6ee7b7;
}

[data-theme="dark"] .upload-file-info .btn-remove-file {
  border-color: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .mapping-table th,
[data-theme="dark"] .preview-table th,
[data-theme="dark"] .detail-table th {
  background: #0f172a;
  color: #94a3b8;
  border-bottom-color: #334155;
}

[data-theme="dark"] .mapping-table td,
[data-theme="dark"] .preview-table td,
[data-theme="dark"] .detail-table td {
  border-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .mapping-select {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #475569;
}

[data-theme="dark"] .mapping-select.mapped {
  background: #064e3b;
  border-color: #065f46;
}

[data-theme="dark"] .summary-card-valid {
  background: #064e3b;
  border-color: #065f46;
}

[data-theme="dark"] .summary-card-duplicate {
  background: #451a03;
  border-color: #78350f;
}

[data-theme="dark"] .summary-card-error {
  background: #450a0a;
  border-color: #7f1d1d;
}

[data-theme="dark"] .summary-card-infile {
  background: #0c4a6e;
  border-color: #075985;
}

[data-theme="dark"] .strategy-section {
  background: #0f172a;
}

[data-theme="dark"] .strategy-section h4 {
  color: #e2e8f0;
}

[data-theme="dark"] .strategy-option {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .strategy-option:hover {
  border-color: #6366f1;
}

[data-theme="dark"] .strategy-option.selected {
  background: #1e1b4b;
  border-color: #6366f1;
}

[data-theme="dark"] .strategy-option h5 {
  color: #e2e8f0;
}

[data-theme="dark"] .strategy-option p {
  color: #64748b;
}

[data-theme="dark"] .detail-tab {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .detail-panel {
  border-color: #334155;
}

[data-theme="dark"] .alert-import-info {
  background: #1e1b4b;
  border-color: #312e81;
  color: #a5b4fc;
}

[data-theme="dark"] .alert-import-warning {
  background: #451a03;
  border-color: #78350f;
  color: #fcd34d;
}

[data-theme="dark"] .error-badge {
  background: #450a0a;
  color: #fca5a5;
}

[data-theme="dark"] .result-card-created {
  background: #064e3b;
  border-color: #065f46;
}

[data-theme="dark"] .result-card-updated {
  background: #1e1b4b;
  border-color: #312e81;
}

[data-theme="dark"] .result-card-skipped {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .result-card-failed {
  background: #450a0a;
  border-color: #7f1d1d;
}

[data-theme="dark"] .progress-bar-container {
  background: #334155;
}

[data-theme="dark"] .btn-step-prev {
  background: #334155;
  color: #94a3b8;
  border-color: #475569;
}

[data-theme="dark"] .btn-step-prev:hover {
  background: #475569;
}

/* === 54. User management & AI knowledge base (dark) === */
[data-theme="dark"] .um-stat {
  background: #1e293b !important;
  color: #e2e8f0;
}
[data-theme="dark"] .um-stat .num { color: #93c5fd !important; }
[data-theme="dark"] .um-stat .lbl { color: #94a3b8 !important; }
[data-theme="dark"] .um-stat[style*="f0fdf4"] {
  background: rgba(22, 163, 74, 0.25) !important;
}
[data-theme="dark"] .um-stat[style*="f0fdf4"] .num { color: #4ade80 !important; }
[data-theme="dark"] .um-stat[style*="fef2f2"] {
  background: rgba(220, 38, 38, 0.25) !important;
}
[data-theme="dark"] .um-stat[style*="fef2f2"] .num { color: #f87171 !important; }

[data-theme="dark"] .filters {
  background-color: #1e293b !important;
  border-radius: 8px;
}
[data-theme="dark"] .keyword-badge {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
}
[data-theme="dark"] .knowledge-details {
  background-color: #1e293b !important;
  color: #e2e8f0;
}
[data-theme="dark"] .details-label {
  color: #94a3b8 !important;
}

/* ======== Contact Autocomplete (Lead Forms) ======== */
[data-theme="dark"] .contact-autocomplete-results {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

[data-theme="dark"] .autocomplete-item {
  border-bottom-color: #334155;
}

[data-theme="dark"] .autocomplete-item:hover {
  background: #334155;
}

[data-theme="dark"] .autocomplete-item-name {
  color: #e2e8f0;
}

[data-theme="dark"] .autocomplete-item-details {
  color: #94a3b8;
}

[data-theme="dark"] .autocomplete-no-results {
  color: #94a3b8;
}

[data-theme="dark"] .contact-autocomplete-wrap .input-group-text {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .badge.bg-success-subtle {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* ========================================= */
/* ====== إعدادات المحادثات - الوضع المظلم ====== */
/* ========================================= */
html[data-theme="dark"] .conv-settings-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .conv-settings-card .card-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conv-settings-card .card-body {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .conv-settings-card textarea,
html[data-theme="dark"] .conv-settings-card input,
html[data-theme="dark"] .conv-settings-card select {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .conv-settings-card .form-label,
html[data-theme="dark"] .conv-settings-card label {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .conv-settings-card .text-muted {
  color: #64748b !important;
}

html[data-theme="dark"] .tab-content-wrapper {
  background: #1e293b !important;
}

html[data-theme="dark"] .nav-tabs .nav-link {
  color: #94a3b8 !important;
  background: #0f172a !important;
}

html[data-theme="dark"] .nav-tabs .nav-link:hover {
  color: #60a5fa !important;
  background: #1e293b !important;
}

html[data-theme="dark"] .nav-tabs .nav-link.active {
  color: #60a5fa !important;
  background: #1e293b !important;
  border-bottom-color: #60a5fa !important;
}

html[data-theme="dark"] .close-reasons-table {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .close-reasons-table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .close-reasons-table td {
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .close-reasons-table tr:hover td {
  background: rgba(96, 165, 250, 0.05) !important;
}

html[data-theme="dark"] .variable-badge {
  background: #334155 !important;
  color: #60a5fa !important;
  border-color: #475569 !important;
}
