:root {
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0f766e;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --dark: #0f172a;
  --gray-900: #1e293b;
  --gray-700: #334155;
  --gray-500: #64748b;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --header-height: 80px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #f8fafc;
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ======================================================== */
/* 🖥️ Desktop Header (80px height) & Navigation             */
/* ======================================================== */
.app-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.header-subtitle {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--gray-300);
}

.header-right {
  display: flex;
  align-items: center;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background-color: var(--gray-100);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.user-profile {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-100);
  padding: 6px 12px;
  border-radius: 20px;
}

.btn-logout {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #fee2e2;
}

/* Mobile Toggle & Drawers (Hidden on Desktop) */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--gray-700);
  cursor: pointer;
  padding: 6px;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.mobile-drawer.open {
  right: 0;
}

.mobile-drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.mobile-drawer-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.mobile-drawer-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-500);
}

.mobile-drawer-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 15px;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  display: none;
}

.mobile-drawer-backdrop.open {
  display: block;
}

/* ======================================================== */
/* 🖥️ Main Container                                        */
/* ======================================================== */
.main-content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.icon-blue { background: #dbeafe; color: #1d4ed8; }
.icon-green { background: #d1fae5; color: #047857; }
.icon-amber { background: #fef3c7; color: #b45309; }
.icon-purple { background: #ede9fe; color: #6d28d9; }

.stat-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Card Box */
.card-box {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* Buttons */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  min-width: 1050px;
}

.data-table th {
  background: #f8fafc;
  color: var(--gray-700);
  font-weight: 600;
  padding: 9px 10px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  font-size: 12.5px;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-900);
  vertical-align: middle;
  font-size: 13px;
}

.data-table tr:hover {
  background-color: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-sent {
  background: #dcfce7;
  color: #15803d;
}

.badge-unsent {
  background: #fef2f2;
  color: #b91c1c;
}

.badge-category {
  background: #e0e7ff;
  color: #3730a3;
}

/* ======================================================== */
/* 🖥️ Clients Page Layout (Desktop 2-Column Side by Side)    */
/* ======================================================== */
.mobile-tree-bar {
  display: none;
}

.tree-backdrop {
  display: none;
}

.clients-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - var(--header-height) - 48px);
  min-height: 600px;
  width: 100%;
}

.tree-sidebar {
  width: 320px;
  min-width: 320px;
  flex-shrink: 0;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tree-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  background: #f8fafc;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-close-tree {
  display: none !important;
}

.tree-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.tree-node {
  margin: 2px 0;
  user-select: none;
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
  transition: background 0.15s;
}

.tree-item:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.tree-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.tree-toggle {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  font-size: 10px;
  color: var(--gray-500);
}

.tree-icon {
  margin-right: 6px;
  font-size: 14px;
}

.tree-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-count {
  font-size: 11px;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

.tree-children {
  margin-left: 16px;
  display: none;
}

.tree-children.open {
  display: block;
}

.leads-panel {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leads-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fafbfc;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  width: 240px;
  outline: none;
}
.search-input:focus {
  border-color: var(--primary);
}

.select-filter {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: #fff;
}

.leads-table-container {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.table-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Match Score Badges */
.badge-score {
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-score-high {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.badge-score-med {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.badge-score-low {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Action Icons in Table */
.action-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.icon-btn.whatsapp {
  color: #22c55e;
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.icon-btn.whatsapp:hover {
  background: #22c55e;
  color: #fff;
}

.icon-btn.email {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.icon-btn.email:hover {
  background: #2563eb;
  color: #fff;
}

.icon-btn.social-li {
  color: #0a66c2;
  border-color: #bae6fd;
  background: #f0f9ff;
  font-weight: 700;
}
.icon-btn.social-li:hover {
  background: #0a66c2;
  color: #fff;
}

.icon-btn.social-fb {
  color: #1877f2;
  border-color: #bfdbfe;
  background: #eff6ff;
  font-weight: 700;
}
.icon-btn.social-fb:hover {
  background: #1877f2;
  color: #fff;
}

.icon-btn.social-in {
  color: #e1306c;
  border-color: #fbcfe8;
  background: #fdf2f8;
}
.icon-btn.social-in:hover {
  background: #e1306c;
  color: #fff;
}

.icon-btn.social-tw {
  color: #0f172a;
  border-color: #e2e8f0;
  background: #f8fafc;
  font-weight: 700;
}
.icon-btn.social-tw:hover {
  background: #0f172a;
  color: #fff;
}

.icon-btn.copy-addr {
  color: #d97706;
  border-color: #fde68a;
  background: #fffbeb;
}
.icon-btn.copy-addr:hover {
  background: #d97706;
  color: #fff;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  font-size: 14px;
  display: none;
  animation: toastFadeIn 0.3s ease;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-dialog {
  background: #fff;
  width: 100%;
  max-width: 650px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--primary);
}

.form-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfc;
}

/* ======================================================== */
/* 📱 Mobile & Tablet Responsive Media Queries (<= 768px)    */
/* ======================================================== */
@media (max-width: 1024px) {
  .app-header {
    padding: 0 16px;
  }
  .main-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tree-sidebar {
    width: 260px;
    min-width: 260px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .app-header {
    padding: 0 14px;
    height: var(--header-height);
  }

  .header-logo {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .header-title {
    font-size: 18px;
  }

  .header-subtitle {
    display: none;
  }

  .desktop-nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: block !important;
  }

  .main-content {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

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

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }

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

  .stat-label {
    font-size: 12px;
  }

  /* Clients Page on Mobile */
  .mobile-tree-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
  }

  .clients-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 12px;
  }

  .tree-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    min-width: 300px;
    height: 100vh;
    z-index: 1050;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.25);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tree-sidebar.open {
    left: 0 !important;
  }

  .mobile-close-tree {
    display: block !important;
  }

  .tree-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1040;
    display: none;
  }

  .tree-backdrop.open {
    display: block !important;
  }

/* Country Flag Icon */
.country-flag-img,
.country-flag-icon {
  display: inline-block !important;
  vertical-align: middle !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  margin-right: 4px !important;
}

.country-flag-fallback {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}

  .leads-panel {
    height: calc(100vh - var(--header-height) - 90px);
    min-height: 500px;
  }

  .leads-toolbar {
    padding: 10px 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toolbar-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .search-input {
    grid-column: span 2;
    width: 100%;
  }

  .select-filter {
    width: 100%;
    font-size: 12px;
    padding: 7px 8px;
  }

  #batchSendBtn {
    grid-column: span 2;
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
  }

  .table-footer {
    padding: 10px 12px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  /* Responsive Tabs & Knowledge Base & Tasks on Mobile */
  .nav-tabs {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
    border-bottom: 2px solid var(--gray-200) !important;
    margin-bottom: 16px !important;
    padding-bottom: 4px !important;
    scrollbar-width: none !important;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .nav-tab-btn {
    white-space: nowrap !important;
    font-size: 13.5px !important;
    padding: 8px 14px !important;
  }

  .category-pills-bar {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
    padding-bottom: 8px !important;
    scrollbar-width: none !important;
  }
  .category-pills-bar::-webkit-scrollbar {
    display: none !important;
  }

  .cat-pill-btn {
    white-space: nowrap !important;
    font-size: 12.5px !important;
    padding: 6px 12px !important;
  }

  .form-input, select.form-input, textarea.form-input {
    max-width: 100% !important;
  }

  .modal-overlay {
    padding: 8px !important;
  }

  .modal-dialog {
    width: 98% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    margin: auto !important;
    border-radius: 10px !important;
  }

  .modal-body {
    padding: 14px !important;
    max-height: calc(92vh - 130px) !important;
    overflow-y: auto !important;
  }

  .modal-footer {
    padding: 10px 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .modal-footer > button, .modal-footer > div {
    width: 100% !important;
  }

  .modal-footer > div {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .modal-footer > div > button {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .toolbar-right {
    grid-template-columns: 1fr !important;
  }

  .search-input, .select-filter, #batchSendBtn {
    grid-column: span 1 !important;
  }

  .header-title {
    font-size: 16px !important;
  }

  .stat-card {
    padding: 12px !important;
  }

  .card-box {
    border-radius: 8px !important;
  }

  .card-header {
    padding: 12px 14px !important;
  }

  .card-body {
    padding: 12px 14px !important;
  }
}

/* ==========================================================================
   Market Intelligence & Blue Ocean Radar Styling (High-Tech & Mobile-First)
   ========================================================================== */

.market-tabs-nav {
  display: flex;
  gap: 12px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.market-tab-btn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px 6px 0 0;
}

.market-tab-btn:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.04);
}

.market-tab-btn.active {
  color: #2563eb !important;
  border-bottom-color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.category-pills-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.category-pill {
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.category-pill:hover {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: #f0f7ff;
  transform: translateY(-1px);
}

.category-pill.active {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
}

/* High-Tech Glowing Stat Cards */
.market-stats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.market-stat-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.market-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -5px rgba(37, 99, 235, 0.12);
}

.market-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.market-stat-card.stat-purple::before {
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
}

.market-stat-card.stat-green::before {
  background: linear-gradient(90deg, #10b981, #84cc16);
}

.market-stat-card.stat-amber::before {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.market-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.market-stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.market-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.market-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  margin-bottom: 6px;
}

.market-stat-sub {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.market-progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 10px;
}

.market-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

/* Tender Lead Cards */
.tender-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.tender-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.08);
}

.tender-card-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tender-contacts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 18px;
  background: #f8fafc;
  border-top: 1px dashed #e2e8f0;
}

.contact-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.badge-web {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.badge-web:hover {
  background: #dbeafe;
}

.badge-wa {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.badge-wa:hover {
  background: #d1fae5;
}

.badge-linkedin {
  background: #f0fdf4;
  color: #0369a1;
  border-color: #bae6fd;
}
.badge-linkedin:hover {
  background: #e0f2fe;
}

.badge-copy {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.badge-copy:hover {
  background: #e2e8f0;
}

.badge-email {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.badge-email:hover {
  background: #fde68a;
}

.badge-imported {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
  cursor: default;
}

/* Mobile Responsive Optimization for Market Module */
@media (max-width: 900px) {
  .market-stats-container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .market-tabs-nav {
    flex-direction: column !important;
    gap: 6px !important;
    border-bottom: none !important;
  }

  .market-tab-btn {
    width: 100% !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 10px 14px !important;
    margin-bottom: 0 !important;
  }

  .market-tab-btn.active {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
  }

  .category-pills-wrap {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding-bottom: 6px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .category-pills-wrap::-webkit-scrollbar {
    display: none !important;
  }

  .category-pill {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
  }

  .market-stats-container {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .market-stat-value {
    font-size: 17px !important;
  }

  .tender-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .tender-contacts-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .contact-action-badge {
    justify-content: center !important;
    padding: 7px 10px !important;
    font-size: 12.5px !important;
  }
}

