/* Enterprise SaaS Design System - Custom CSS Extensions for Bootstrap 5.3 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --wa-primary: #25D366;
  --wa-primary-hover: #1ebe56;
  --wa-primary-light: rgba(37, 211, 102, 0.12);
  --wa-secondary: #128C7E;
  --wa-secondary-dark: #075E54;
  --wa-dark-bg: #0b141a;
  --wa-dark-card: #111b21;
  --wa-dark-border: #222d34;
  --wa-dark-sidebar: #111b21;

  --bs-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --bs-body-bg: #F8FAFC;
  --bs-body-color: #111827;
  --bs-border-color: #E5E7EB;
  --bs-border-radius: 12px;
  --bs-border-radius-lg: 16px;
  --bs-border-radius-sm: 8px;
}

/* Dark theme overrides */
[data-bs-theme="dark"] {
  --bs-body-bg: #0b141a;
  --bs-body-color: #e9edef;
  --bs-border-color: #222d34;
  --wa-card-bg: #111b21;
  --wa-sidebar-bg: #111b21;
  --wa-navbar-bg: #111b21;
  --wa-text-muted: #8696a0;
}

[data-bs-theme="light"] {
  --wa-card-bg: #FFFFFF;
  --wa-sidebar-bg: #FFFFFF;
  --wa-navbar-bg: #FFFFFF;
  --wa-text-muted: #6B7280;
}

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth Scrolling & Typography */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.7);
}

/* App Wrapper & Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  overflow-x: hidden;
}

/* Sidebar Styles */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--wa-sidebar-bg);
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar.collapsed {
  width: 80px;
  min-width: 80px;
}

.app-sidebar.collapsed .sidebar-text,
.app-sidebar.collapsed .sidebar-header-title,
.app-sidebar.collapsed .sidebar-user-info,
.app-sidebar.collapsed .sidebar-chevron {
  display: none !important;
}

.app-sidebar.collapsed .nav-item-link {
  justify-content: center;
  padding: 0.75rem 0;
  margin: 0.2rem 0.5rem;
}

.app-sidebar.collapsed .sidebar-icon {
  margin-right: 0 !important;
  font-size: 1.25rem;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--bs-body-color);
  font-weight: 700;
  font-size: 1.15rem;
}

/* Watstalk logo in the sidebar: the W stays put and only the text part slides/fades away, so collapse and expand are one
   continuous motion (same duration + easing as the sidebar width). Font-size = logo height. */
.sidebar-header .sidebar-brand { gap: 0; flex: 1; min-width: 0; justify-content: center; }
.sb-lg { display: inline-flex; align-items: center; font-size: 26px; line-height: 1; }
.sb-lg img { height: 1em; width: auto; max-width: none; display: block; }
.sb-lg .sb-tx { display: block; overflow: hidden; white-space: nowrap; max-width: 3.4em; margin-left: -0.245em; opacity: 1;
  transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease 0.1s; }
.app-sidebar.collapsed .sb-lg .sb-tx { max-width: 0; margin-left: 0; opacity: 0; transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.12s ease; }
.sidebar-header { min-height: 60px; }
@media (min-width: 992px) {
  .sb-lg { font-size: 28px; }
  /* same padding open and collapsed, so nothing jumps while the width animates */
  .app-sidebar .sidebar-header, .app-sidebar.collapsed .sidebar-header { padding: 0.7rem 1rem !important; min-height: 64px; }
}

.sidebar-menu {
  padding: 1rem 0.75rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wa-text-muted);
  padding: 0.75rem 1rem 0.25rem 1rem;
}

.app-sidebar.collapsed .sidebar-category {
  display: none;
}

.nav-item-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  color: var(--bs-body-color);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item-link:hover {
  background-color: var(--wa-primary-light);
  color: var(--wa-secondary);
}

.nav-item-link.active {
  background-color: var(--wa-primary-light);
  color: var(--wa-secondary);
  font-weight: 600;
}

.nav-item-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 15%;
  height: 70%;
  width: 4px;
  background-color: var(--wa-primary);
  border-radius: 0 4px 4px 0;
}

.sidebar-icon {
  font-size: 1.1rem;
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Main Content Layout */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Page content wrapper below the navbar */
.app-main > .app-page-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Top Navbar */
.app-navbar {
  height: 64px;
  flex-shrink: 0;
  background-color: var(--wa-navbar-bg);
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  backdrop-filter: blur(10px);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-search {
  max-width: 320px;
  width: 100%;
  position: relative;
}

.navbar-search input {
  padding-left: 2.35rem;
  border-radius: 20px;
  background-color: rgba(148, 163, 184, 0.08);
  border: 1px solid transparent;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.navbar-search input:focus {
  background-color: transparent;
  border-color: var(--wa-primary);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.navbar-search .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wa-text-muted);
}

/* Status Indicator Pill */
.wa-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background-color: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Enterprise Card Styling */
.card-saas {
  background-color: var(--wa-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-saas:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.card-saas-lift:hover {
  transform: translateY(-3px);
}

/* Stat Cards with Gradients */
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: white;
}

.icon-gradient-green {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.icon-gradient-blue {
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
}

.icon-gradient-purple {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
}

.icon-gradient-amber {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.icon-gradient-rose {
  background: linear-gradient(135deg, #F43F5E 0%, #BE123C 100%);
}

.icon-gradient-cyan {
  background: linear-gradient(135deg, #06B6D4 0%, #0E7490 100%);
}

/* Growth Pill */
.growth-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.growth-up {
  background-color: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.growth-down {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Custom Tables */
.table-saas-container {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  background-color: var(--wa-card-bg);
}

.table-saas {
  margin-bottom: 0;
  width: 100%;
}

.table-saas th {
  background-color: rgba(148, 163, 184, 0.05);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--wa-text-muted);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.table-saas td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--bs-border-color);
  font-size: 0.875rem;
}

.table-saas tbody tr {
  transition: background-color 0.15s ease;
}

.table-saas tbody tr:hover {
  background-color: rgba(37, 211, 102, 0.03);
}

/* Custom Buttons */
.btn-wa-primary {
  background-color: var(--wa-primary);
  color: white;
  border: none;
  font-weight: 500;
  border-radius: 10px;
  padding: 0.5rem 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2);
}

.btn-wa-primary:hover,
.btn-wa-primary:focus {
  background-color: var(--wa-primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.btn-wa-outline {
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  background: transparent;
  font-weight: 500;
  border-radius: 10px;
  padding: 0.5rem 1.1rem;
  transition: all 0.2s ease;
}

.btn-wa-outline:hover {
  background-color: rgba(148, 163, 184, 0.08);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

/* Tighten the page padding specifically around the full-height chat UI */
.app-page-content:has(> .chat-container) {
  padding: 1rem 1.25rem !important;
}

.app-page-content:has(> .chat-container) .page-header {
  margin-bottom: 0.75rem;
}

/* WhatsApp Chat Screen Layout */
.chat-container {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
  background-color: var(--wa-card-bg);
  display: flex;
}

.chat-sidebar-list {
  width: 340px;
  min-width: 340px;
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-sidebar-list > .flex-grow-1 {
  min-height: 0;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: rgba(248, 250, 252, 0.5);
}

[data-bs-theme="dark"] .chat-area {
  background-color: #0b141a;
}

.chat-messages-viewport {
  flex: 1;
  min-height: 0;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg-bubble {
  max-width: 70%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.msg-in {
  align-self: flex-start;
  background-color: var(--wa-card-bg);
  border: 1px solid var(--bs-border-color);
  border-top-left-radius: 2px;
}

.msg-out {
  align-self: flex-end;
  background-color: #d9fdd3;
  color: #111827;
  border-top-right-radius: 2px;
}

[data-bs-theme="dark"] .msg-out {
  background-color: #005c4b;
  color: #e9edef;
}

.msg-time {
  font-size: 0.7rem;
  opacity: 0.7;
  float: right;
  margin-left: 0.75rem;
  margin-top: 0.2rem;
}

.wa-msg-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.wa-msg-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: #f0f2f5;
  border: 1px solid #d1d7db;
  border-radius: 8px;
  color: #1a5c2a;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.wa-msg-btn:hover {
  background: #e4e6eb;
}
[data-bs-theme="dark"] .wa-msg-btn {
  background: #202c33;
  border-color: #2f3b43;
  color: #e9edef;
}
[data-bs-theme="dark"] .wa-msg-btn:hover {
  background: #2f3b43;
}

.wa-msg-media {
  max-height: 260px;
  object-fit: cover;
}

.wa-date-sep {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.wa-date-sep span {
  background-color: var(--wa-card-bg);
  border: 1px solid var(--bs-border-color);
  color: var(--wa-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Conversation / contact list rows */
.conv-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
}

.conv-item:hover {
  background-color: rgba(37, 211, 102, 0.08);
}

[data-bs-theme="dark"] .conv-item:hover {
  background-color: rgba(37, 211, 102, 0.12);
}

/* Skeleton Loading Shimmer */
.skeleton-loader {
  background: linear-gradient(90deg, rgba(229, 231, 235, 0.5) 25%, rgba(243, 244, 246, 0.8) 37%, rgba(229, 231, 235, 0.5) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
}

[data-bs-theme="dark"] .skeleton-loader {
  background: linear-gradient(90deg, rgba(34, 45, 52, 0.5) 25%, rgba(42, 57, 66, 0.8) 37%, rgba(34, 45, 52, 0.5) 63%);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Page Header & Breadcrumbs */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  letter-spacing: -0.02em;
}

.breadcrumb-saas {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--wa-text-muted);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.15);
  }

  .app-sidebar.show-mobile {
    transform: translateX(0);
  }

  .chat-sidebar-list {
    width: 100%;
    min-width: 100%;
  }

  .chat-area {
    display: none;
  }

  .chat-area.active-mobile {
    display: flex;
    position: fixed;
    top: var(--app-nav-h, 64px);
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--app-nav-h, 64px));
    height: calc(100dvh - var(--app-nav-h, 64px));
    z-index: 1040;
  }
}

/* ========== Status Badges ========== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-badge.delivered {
  background-color: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-badge.read {
  background-color: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.status-badge.pending {
  background-color: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.failed {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-badge.sent {
  background-color: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

/* ========== Campaign List Page ========== */
.campaign-selector {
  min-width: 280px;
}

.campaign-selector .dropdown-menu {
  min-width: 320px;
  max-height: 400px;
  overflow-y: auto;
}

.campaign-selector .dropdown-item {
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
}

.campaign-selector .dropdown-item:hover {
  background-color: var(--wa-primary-light);
  color: var(--wa-secondary);
}

.campaign-selector .dropdown-item.active {
  background-color: var(--wa-primary-light);
  color: var(--wa-secondary);
  font-weight: 600;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--bs-border-color);
  background-color: transparent;
  color: var(--bs-body-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background-color: var(--wa-primary-light);
  border-color: var(--wa-primary);
  color: var(--wa-secondary);
}

.filter-pill.active {
  background-color: var(--wa-primary);
  color: white;
  border-color: var(--wa-primary);
}

.search-input-wrapper {
  position: relative;
  max-width: 360px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wa-text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 2.35rem;
  border-radius: 20px;
  background-color: rgba(148, 163, 184, 0.08);
  border: 1px solid transparent;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
  background-color: transparent;
  border-color: var(--wa-primary);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

/* ========== DataTables Custom ========== */
.dataTables_wrapper .dataTables_length select {
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  /* keep room on the right for the dropdown arrow, otherwise the number overlaps it */
  padding: 0.3rem 2rem 0.3rem 0.65rem;
  min-width: 4.75rem;
  font-size: 0.85rem;
  background-color: var(--wa-card-bg);
  color: var(--bs-body-color);
}

.dataTables_wrapper .dataTables_filter input {
  border-radius: 20px;
  border: 1px solid var(--bs-border-color);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background-color: var(--wa-card-bg);
  color: var(--bs-body-color);
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--wa-primary);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  padding: 0.3rem 0.6rem;
  margin: 0 0.1rem;
  font-size: 0.8rem;
  color: var(--bs-body-color);
  background-color: var(--wa-card-bg);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: var(--wa-primary);
  border-color: var(--wa-primary);
  color: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: var(--wa-primary-light);
  border-color: var(--wa-primary);
  color: var(--wa-secondary);
}

/* ---- DataTables (Bootstrap 5 markup) polish: header, rows, toolbar, pagination ---- */
.dataTables_wrapper { font-size: 0.875rem; }
.dataTables_wrapper > .row:first-child { margin-bottom: 0.85rem; align-items: center; row-gap: 0.5rem; }
.dataTables_wrapper > .row:last-child { margin-top: 0.85rem; align-items: center; row-gap: 0.5rem; }
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0;
  color: var(--wa-text-muted); font-weight: 500; white-space: nowrap;
}
.dataTables_wrapper .dataTables_filter input { min-width: 220px; margin-left: 0 !important; }
.dataTables_wrapper .dataTables_info { color: var(--wa-text-muted); font-size: 0.8rem; padding-top: 0; }
.dataTables_wrapper .dataTables_processing { border-radius: 10px; }

table.dataTable { border-collapse: separate; border-spacing: 0; width: 100% !important; margin: 0 !important; }
table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
  background-color: rgba(148, 163, 184, 0.08);
  color: var(--wa-text-muted);
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  white-space: nowrap;
}
table.dataTable > thead > tr > th:first-child { border-top-left-radius: 10px; border-left: 1px solid var(--bs-border-color); }
table.dataTable > thead > tr > th:last-child { border-top-right-radius: 10px; border-right: 1px solid var(--bs-border-color); }
table.dataTable > tbody > tr > td {
  padding: 0.85rem 1rem; vertical-align: middle;
  border-bottom: 1px solid var(--bs-border-color);
  background-color: transparent;
}
table.dataTable > tbody > tr { transition: background-color 0.15s ease; }
table.dataTable.table-hover > tbody > tr:hover > *,
table.dataTable > tbody > tr:hover > * { --bs-table-bg-state: rgba(37, 211, 102, 0.06); box-shadow: inset 0 0 0 9999px rgba(37, 211, 102, 0.05); }
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * { box-shadow: inset 0 0 0 9999px rgba(148, 163, 184, 0.04); }
table.dataTable > tbody > tr:last-child > td { border-bottom: 0; }
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_desc:after { right: 0.6rem; }
table.dataTable td.dataTables_empty { padding: 2rem 1rem; color: var(--wa-text-muted); text-align: center; }

.dataTables_wrapper .pagination { gap: 0.25rem; margin: 0; }
.dataTables_wrapper .pagination .page-link {
  border-radius: 8px !important; border: 1px solid var(--bs-border-color);
  padding: 0.3rem 0.7rem; font-size: 0.8rem;
  color: var(--bs-body-color); background-color: var(--wa-card-bg);
}
.dataTables_wrapper .pagination .page-link:hover { background-color: var(--wa-primary-light); border-color: var(--wa-primary); color: var(--wa-secondary); }
.dataTables_wrapper .pagination .page-item.active .page-link { background-color: var(--wa-primary); border-color: var(--wa-primary); color: #fff; }
.dataTables_wrapper .pagination .page-item.disabled .page-link { opacity: 0.5; }
/* Cards whose body has no padding (table runs edge to edge): inset the toolbar and footer so the
   search box, "Show" dropdown, info text and pagination don't touch the card border. */
.card-body.p-0 .dataTables_wrapper > .row:first-child,
.card > .dataTables_wrapper > .row:first-child,
.table-saas-container .dataTables_wrapper > .row:first-child {
  margin-left: 0; margin-right: 0; padding: 1rem 0.5rem 0.25rem; margin-bottom: 0.5rem;
}
.card-body.p-0 .dataTables_wrapper > .row:last-child,
.card > .dataTables_wrapper > .row:last-child,
.table-saas-container .dataTables_wrapper > .row:last-child {
  margin-left: 0; margin-right: 0; padding: 0.25rem 0.5rem 1rem; margin-top: 0.5rem;
}
@media (max-width: 575.98px) {
  .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; }
  .dataTables_wrapper .dataTables_filter label { width: 100%; }
}

/* ========== Admin Message Costs ========== */
.rate-card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 1.25rem;
  background-color: var(--wa-card-bg);
  transition: box-shadow 0.2s ease;
}

.rate-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.rate-card .rate-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wa-text-muted);
  margin-bottom: 0.25rem;
}

.rate-card .rate-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bs-body-color);
}

.rate-card .rate-currency {
  font-size: 0.85rem;
  color: var(--wa-text-muted);
  margin-left: 0.15rem;
}

/* ========== Modal Enhancements ========== */
.modal-content {
  border-radius: var(--bs-border-radius-lg);
  border: 1px solid var(--bs-border-color);
}

.modal-header {
  border-bottom: 1px solid var(--bs-border-color);
}

.modal-footer {
  border-top: 1px solid var(--bs-border-color);
}

/* ========== Toast Notifications ========== */
.toast-container {
  z-index: 11000;
}

.toast {
  border-radius: var(--bs-border-radius);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ========== Progress Bar Custom ========== */
.progress-wa {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background-color: rgba(148, 163, 184, 0.15);
}

.progress-wa .progress-bar {
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-wa .progress-bar-success {
  background-color: #22c55e;
}

.progress-wa .progress-bar-warning {
  background-color: #f59e0b;
}

.progress-wa .progress-bar-danger {
  background-color: #ef4444;
}

.progress-wa .progress-bar-info {
  background-color: #3b82f6;
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--wa-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.empty-state-subtext {
  font-size: 0.8rem;
  color: var(--wa-text-muted);
}

/* ========== Spinner ========== */
.spinner-wa {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(37, 211, 102, 0.2);
  border-top-color: var(--wa-primary);
  border-radius: 50%;
  animation: spin-wa 0.6s linear infinite;
}

@keyframes spin-wa {
  to {
    transform: rotate(360deg);
  }
}

/* ========== Tooltip Custom ========== */
.tooltip-wa {
  --bs-tooltip-bg: var(--wa-card-bg, var(--bs-body-bg));
  --bs-tooltip-color: var(--bs-body-color);
  --bs-tooltip-border-radius: 8px;
  --bs-tooltip-padding-x: 0.6rem;
  --bs-tooltip-padding-y: 0.35rem;
  --bs-tooltip-font-size: 0.78rem;
}

/* ========== Scroll Spy Active ========== */
.scrollspy-active {
  color: var(--wa-secondary) !important;
  font-weight: 600;
}

/* ========== Print Styles ========== */
@media print {

  .app-sidebar,
  .app-navbar,
  .btn,
  .modal {
    display: none !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .card-saas {
    box-shadow: none !important;
    border: 1px solid #ddd;
  }
}

.col-sm-12 {
  overflow: scroll;
}

/* =====================================================================
   Phone / tablet layout + installed-app polish
   ===================================================================== */
:root { --app-nav-h: 64px; --bn-h: 62px; }
.min-w-0 { min-width: 0; }
.sidebar-backdrop, .bottom-nav { display: none; }
.navbar-page-title { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 54vw; }

@media (max-width: 991.98px) {
  :root { --app-nav-h: 56px; }
  html, body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
  body { -webkit-text-size-adjust: 100%; }
  .app-wrapper { width: 100%; min-height: 100vh; min-height: 100dvh; }
  .app-main { height: 100vh; height: 100dvh; }   /* no -webkit-overflow-scrolling: it made iPhone stack popups under their backdrop */

  /* Top bar: compact, with the menu button and page title */
  /* Pinned to the screen (not just sticky) so it stays put whichever element ends up scrolling */
  .app-navbar { height: var(--app-nav-h); padding: 0 0.6rem 0 0.4rem; gap: 0.5rem; position: fixed; top: 0; left: 0; right: 0; width: 100%; }
  .app-main { padding-top: var(--app-nav-h); }
  .app-navbar > div { min-width: 0; }
  .wa-status-pill { padding: 0.3rem 0.5rem; }
  .wa-status-pill > span:last-child { display: none; }        /* just the green dot; the number is in Business Profile */
  .page-header { display: none; }                              /* the title now lives in the top bar */
  .navbar-left { flex: 1 1 auto; }
  .navbar-right { flex: 0 0 auto; }
  .hdr-wallet { font-size: 0.72rem !important; }
  .hdr-wallet > a { padding: 0.25rem 0.5rem !important; white-space: nowrap; }
  .navbar-right .dropdown > button > .bi-chevron-down { display: none; }

  /* Page area: tighter padding, and clear of the bottom tab bar */
  .app-page-content {
    padding: 0.85rem !important;
    padding-bottom: calc(var(--bn-h) + 1rem + env(safe-area-inset-bottom)) !important;
  }
  .app-page-content:has(> .chat-container) {
    padding: 0.5rem 0.5rem calc(var(--bn-h) + 0.5rem + env(safe-area-inset-bottom)) !important;
  }
  .chat-container { border-radius: 12px; }
  .chat-sidebar-list { width: 100%; min-width: 0; border-right: 0; }

  /* Slide-in menu */
  .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; height: 100dvh;
    width: min(86vw, 320px); min-width: 0;
    z-index: 1060;
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.28s;
  }
  .app-sidebar.show-mobile {
    transform: none; visibility: visible;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.28);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
  }
  .app-sidebar .sidebar-header { padding: 0.9rem 1rem; }
  .app-sidebar .sidebar-menu { padding-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
  .app-sidebar .nav-item-link { padding: 0.8rem 1rem; }       /* comfortable thumb targets */
  .app-sidebar .dropdown-menu { position: static !important; transform: none !important; width: 100%; box-shadow: none !important; }
  .app-sidebar .sidebar-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1055;
    background: rgba(15, 23, 42, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }

  /* Bottom tab bar */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--wa-navbar-bg); border-top: 1px solid var(--bs-border-color);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .bn-item {
    flex: 1; min-width: 0; position: relative; background: none; border: 0; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--wa-text-muted); text-decoration: none; font-size: 0.68rem; font-weight: 600;
  }
  .bn-item i { font-size: 1.4rem; line-height: 1; }
  .bn-item.active { color: var(--wa-secondary); }
  .bn-item.active i { color: var(--wa-primary); }
  .bn-item:active { background: var(--wa-primary-light); }
  .bn-badge {
    position: absolute; top: 5px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #ef4444; color: #fff; font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .toast-container { margin-bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); }
  .dataTables_wrapper .pagination { flex-wrap: wrap; justify-content: center; }
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info { text-align: center; }
}

/* Slide-in menu on phones/tablets: same look as the desktop sidebar (icon tiles, green highlighted current page) */
@media (max-width: 991.98px) {
  .app-sidebar .sidebar-menu { padding: 0.25rem 0.85rem 1.5rem; }
  .app-sidebar .sidebar-category { display: flex; align-items: center; gap: 0.6rem; padding: 1.1rem 0.5rem 0.4rem; font-size: 0.66rem; letter-spacing: 0.1em; }
  .app-sidebar .sidebar-category::after { content: ''; flex: 1; height: 1px; background: var(--bs-border-color); opacity: 0.8; }
  .app-sidebar .nav-item-link { padding: 0.55rem 0.65rem; margin-bottom: 0.2rem; border-radius: 12px; font-size: 0.92rem; color: #374151; }
  [data-bs-theme="dark"] .app-sidebar .nav-item-link { color: #cbd5e1; }
  .app-sidebar .nav-item-link .sidebar-icon { width: 34px; height: 34px; border-radius: 9px; margin-right: 0.7rem; font-size: 1.05rem; background: rgba(100, 116, 139, 0.09); color: #64748b; }
  .app-sidebar .nav-item-link:active { background: rgba(100, 116, 139, 0.07); }
  .app-sidebar .nav-item-link.active { background: linear-gradient(90deg, rgba(37, 211, 102, 0.16), rgba(37, 211, 102, 0.05)); color: var(--wa-secondary-dark); font-weight: 600; }
  [data-bs-theme="dark"] .app-sidebar .nav-item-link.active { color: #6ee7a0; }
  .app-sidebar .nav-item-link.active .sidebar-icon { background: linear-gradient(135deg, var(--wa-primary), var(--wa-secondary)); color: #fff; box-shadow: 0 4px 10px rgba(37, 211, 102, 0.35); }
  .app-sidebar .nav-item-link.active::before { left: -0.85rem; }
}

@media (max-width: 767.98px) {
  /* 16px inputs stop iPhones from zooming into a field when it is tapped */
  .form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-text { font-size: 16px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; }
  .card-saas .card-body { padding: 0.9rem; }
  .fs-2 { font-size: 1.6rem !important; }
  .modal-footer { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  /* very narrow phones: keep BOTH wallet and days-left in the top bar by dropping the (duplicated) page title and tightening the chip */
  .navbar-page-title { display: none !important; }
  .hdr-wallet { font-size: 0.68rem !important; min-width: 0; }
  .hdr-wallet > a { padding: 0.25rem 0.45rem !important; }
}

@media (max-width: 575.98px) {
  /* Big form popups become full-screen sheets on a phone */
  .modal-dialog.modal-xl, .modal-dialog.modal-lg { width: 100vw; max-width: none; margin: 0; min-height: 100%; }
  .modal-dialog.modal-xl .modal-content, .modal-dialog.modal-lg .modal-content { min-height: 100%; border: 0; border-radius: 0 !important; }
  .modal-dialog.modal-xl.modal-dialog-scrollable, .modal-dialog.modal-lg.modal-dialog-scrollable { height: 100%; }
  .modal-dialog.modal-xl.modal-dialog-scrollable .modal-content, .modal-dialog.modal-lg.modal-dialog-scrollable .modal-content { max-height: 100%; }
}

/* Running as the installed app: no text-selection callouts on chrome, and the safe areas respected */
@media (display-mode: standalone) {
  .app-navbar, .bottom-nav, .app-sidebar { -webkit-user-select: none; user-select: none; }
}

/* Phone tables: keep rows on one line and let the table scroll sideways, with the first column pinned for context */
.mobile-full { }
@media (max-width: 767.98px) {
  table.dataTable.table-saas > thead > tr > th,
  table.dataTable.table-saas > tbody > tr > td,
  .table-saas > thead > tr > th, .table-saas > tbody > tr > td { white-space: nowrap; }
  table.dataTable.table-saas > tbody > tr > td:first-child,
  .table-saas > tbody > tr > td:first-child { white-space: normal; min-width: 130px; max-width: 190px; }
  table.dataTable.table-saas > tbody > tr > td:first-child,
  table.dataTable.table-saas > thead > tr > th:first-child {
    position: sticky; left: 0; z-index: 2; background-color: var(--wa-card-bg);
    box-shadow: 1px 0 0 var(--bs-border-color);
  }
  table.dataTable.table-saas > thead > tr > th:first-child {
    background-image: linear-gradient(rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.08));
  }
  .table-responsive { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 575.98px) {
  .mobile-full { width: 100% !important; flex: 1 1 100%; }
  .card-saas .card-body.d-flex { gap: .75rem !important; }
}


/* ==========================================================================
   Desktop polish (>= 992px only) - sidebar, top bar, dashboard cards.
   Everything is inside this media query so phones/tablets look exactly as before.
   ========================================================================== */
@media (min-width: 992px) {
  body { background: radial-gradient(1200px 500px at 100% -10%, rgba(37, 211, 102, 0.07), transparent 60%), var(--bs-body-bg); }

  /* ---- Sidebar ---- */
  .app-sidebar { width: 268px; min-width: 268px; box-shadow: 1px 0 0 var(--bs-border-color), 6px 0 24px -18px rgba(15, 23, 42, 0.25); }
  .app-sidebar.collapsed { width: 80px; min-width: 80px; }
  .sidebar-header { padding: 1.1rem 1.25rem; border-bottom: 0; }
  .sidebar-brand { font-size: 1.2rem; letter-spacing: -0.02em; }
  .sidebar-brand-icon { width: 40px; height: 40px; border-radius: 12px; }
  .sidebar-menu { padding: 0.25rem 0.85rem 1rem; }
  .sidebar-category { display: flex; align-items: center; gap: 0.6rem; padding: 1.1rem 0.5rem 0.4rem; font-size: 0.66rem; letter-spacing: 0.1em; }
  .sidebar-category::after { content: ''; flex: 1; height: 1px; background: var(--bs-border-color); opacity: 0.8; }
  .nav-item-link { padding: 0.5rem 0.65rem; margin-bottom: 0.2rem; border-radius: 12px; font-size: 0.88rem; color: #374151; }
  [data-bs-theme="dark"] .nav-item-link { color: #cbd5e1; }
  .nav-item-link .sidebar-icon { width: 32px; height: 32px; border-radius: 9px; margin-right: 0.7rem; font-size: 1rem; background: rgba(100, 116, 139, 0.09); color: #64748b; transition: all 0.2s ease; }
  .nav-item-link:hover { background: rgba(100, 116, 139, 0.07); color: var(--bs-body-color); }
  .nav-item-link:hover .sidebar-icon { background: var(--wa-primary-light); color: var(--wa-secondary); }
  .nav-item-link.active { background: linear-gradient(90deg, rgba(37, 211, 102, 0.16), rgba(37, 211, 102, 0.05)); color: var(--wa-secondary-dark); font-weight: 600; }
  [data-bs-theme="dark"] .nav-item-link.active { color: #6ee7a0; }
  .nav-item-link.active .sidebar-icon { background: linear-gradient(135deg, var(--wa-primary), var(--wa-secondary)); color: #fff; box-shadow: 0 4px 10px rgba(37, 211, 102, 0.35); }
  .nav-item-link.active::before { left: -0.85rem; }
  .app-sidebar.collapsed .nav-item-link { padding: 0.45rem 0; }
  .app-sidebar.collapsed .nav-item-link .sidebar-icon { margin-right: 0 !important; }

  /* plan card above the user footer */
  .sidebar-plan { margin: 0 0.85rem 0.75rem; padding: 0.8rem 0.9rem; border-radius: 14px; border: 1px solid var(--bs-border-color);
    background: linear-gradient(160deg, rgba(37, 211, 102, 0.10), rgba(18, 140, 126, 0.04)); }
  .sidebar-plan-name { font-size: 0.82rem; font-weight: 700; }
  .sidebar-plan-days { font-size: 0.75rem; font-weight: 700; }
  .sidebar-plan-bar { height: 6px; border-radius: 6px; background: rgba(100, 116, 139, 0.18); margin-bottom: 0.55rem; }
  .sidebar-plan-cta { font-size: 0.78rem; font-weight: 600; color: var(--wa-secondary); text-decoration: none; }
  .sidebar-plan-cta:hover { color: var(--wa-secondary-dark); }
  .app-sidebar.collapsed .sidebar-plan { display: none !important; }

  .sidebar-footer { margin: 0 0.85rem 0.85rem; padding: 0.6rem 0.75rem; border: 1px solid var(--bs-border-color); border-radius: 14px; background: rgba(100, 116, 139, 0.04); }
  .app-sidebar.collapsed .sidebar-footer { margin: 0 0.5rem 0.85rem; flex-direction: column; padding: 0.5rem 0; }

  /* ---- Top bar ---- */
  .app-navbar { height: 70px; padding: 0 2rem; box-shadow: 0 1px 0 var(--bs-border-color), 0 8px 24px -20px rgba(15, 23, 42, 0.3); }
  .page-header { display: none; }                         /* title now lives in the top bar, like on phones */
  .app-page-content { padding: 1.5rem 2rem 2rem !important; }
  .navbar-heading { min-width: 0; max-width: 46vw; }
  .navbar-heading-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .navbar-heading-title .nh-greet { font-weight: 500; color: var(--wa-text-muted); }
  .navbar-heading-title .nh-name { font-weight: 650; }
  .navbar-heading-sub { font-size: 0.74rem; color: var(--wa-text-muted); margin-top: 0.1rem; letter-spacing: 0.01em; }
  .wa-status-pill { padding: 0.4rem 0.85rem; box-shadow: 0 1px 2px rgba(34, 197, 94, 0.12); }
  .app-navbar .user-avatar-sm { box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); }

  /* ---- Dashboard cards ---- */
  .card-saas { border-radius: 16px; border-color: rgba(148, 163, 184, 0.28); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.14); }
  .card-saas:hover { box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 16px 32px -16px rgba(15, 23, 42, 0.22); }
  .card-saas > .card-body { padding: 1.15rem 1.25rem !important; }
  .card-saas .fs-2 { font-size: 1.85rem !important; letter-spacing: -0.03em; }
  .card-saas .text-muted.small.fw-medium { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem !important; font-weight: 600 !important; }
  .stat-card-icon { width: 52px; height: 52px; border-radius: 15px; font-size: 1.4rem; box-shadow: 0 8px 18px -8px rgba(15, 23, 42, 0.45); }

  /* quick actions (dashboard) */
  .quick-actions { align-items: center; flex-wrap: wrap; gap: 0.6rem; }
  .quick-actions-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--wa-text-muted); margin-right: 0.25rem; }
  .quick-action { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.95rem; border-radius: 999px; font-size: 0.83rem; font-weight: 600;
    color: var(--bs-body-color); text-decoration: none; background: var(--wa-card-bg); border: 1px solid var(--bs-border-color); transition: all 0.18s ease; }
  .quick-action i { color: var(--wa-secondary); font-size: 0.95rem; }
  .quick-action:hover { border-color: var(--wa-primary); background: var(--wa-primary-light); transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(37, 211, 102, 0.6); color: var(--bs-body-color); }
}

/* ---- Collapsed sidebar fixes (desktop only) ---- */
@media (min-width: 992px) {
  .sidebar-toggle { align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 11px; cursor: pointer; flex-shrink: 0;
    border: 1px solid var(--bs-border-color); background: var(--wa-card-bg); color: var(--bs-body-color); font-size: 1.35rem; transition: all 0.18s ease; }
  .sidebar-toggle:hover { border-color: var(--wa-primary); color: var(--wa-secondary); background: var(--wa-primary-light); }

  /* collapsed: stack logo above the toggle so they can't overlap, keep both centred */
  .app-sidebar.collapsed .sidebar-header { justify-content: center; padding: 1.1rem 0 0.6rem; }
  .app-sidebar.collapsed .sidebar-brand { gap: 0; justify-content: center; }
  .app-sidebar.collapsed .sidebar-menu { padding: 0.25rem 0.5rem 1rem; }
  .app-sidebar.collapsed .nav-item-link { justify-content: center; padding: 0.4rem 0; margin: 0 0 0.25rem; }
  .app-sidebar.collapsed .nav-item-link.active::before { left: -0.5rem; }
  .app-sidebar.collapsed .nav-item-link .badge { position: absolute; top: 1px; right: 7px; margin: 0 !important; padding: 0.2em 0.42em; font-size: 0.6rem; }
  .app-sidebar.collapsed .sidebar-footer .user-avatar-sm { margin: 0 auto; }
  .app-sidebar.collapsed .dropdown { padding-left: 0 !important; padding-right: 0 !important; }
}

/* ==========================================================================
   Live Chat - WhatsApp Web look (scoped to .wa-web so no other page is touched)
   ========================================================================== */
.wa-web { --wa-panel: #f0f2f5; --wa-hover: #f5f6f6; --wa-sel: #f0f2f5; --wa-in: #ffffff; --wa-out: #d9fdd3; --wa-sub: #667781; --wa-ico: #54656f; --wa-green: #008069; }
[data-bs-theme="dark"] .wa-web { --wa-panel: #202c33; --wa-hover: #202c33; --wa-sel: #2a3942; --wa-in: #202c33; --wa-out: #005c4b; --wa-sub: #8696a0; --wa-ico: #aebac1; --wa-green: #25D366; }

/* ---- left column ---- */
.wa-web .chat-sidebar-list { background: var(--wa-card-bg); }
.wa-list-head { padding: 12px 14px 6px; }
.wa-list-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.wa-seg { display: inline-flex; background: var(--wa-panel); border-radius: 999px; padding: 3px; }
.wa-seg button { border: 0; background: transparent; color: var(--wa-sub); font-size: 0.76rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 999px; display: inline-flex; align-items: center; gap: 0.35rem; }
.wa-seg button.active { background: var(--wa-card-bg); color: var(--wa-green); box-shadow: 0 1px 2px rgba(11, 20, 26, 0.15); }
.wa-search { position: relative; }
.wa-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--wa-sub); font-size: 0.85rem; }
.wa-search input { width: 100%; border: 0; outline: 0; background: var(--wa-panel); color: var(--bs-body-color); border-radius: 10px; padding: 0.5rem 0.75rem 0.5rem 2.2rem; font-size: 0.88rem; }
.wa-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.wa-chips::-webkit-scrollbar { display: none; }
.wa-chip { flex-shrink: 0; border: 0; border-radius: 999px; padding: 0.28rem 0.8rem; background: var(--wa-panel); color: var(--wa-ico); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.wa-chip.active { background: #d9fdd3; color: #008069; }
[data-bs-theme="dark"] .wa-chip.active { background: #103529; color: #25D366; }
.wa-chip-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: #25D366; color: #fff; font-size: 0.68rem; line-height: 18px; text-align: center; }

.wa-list { padding: 0; }
.wa-conv { display: flex; align-items: center; gap: 12px; padding: 0 14px; cursor: pointer; }
.wa-conv:hover { background: var(--wa-hover); }
.wa-conv.active { background: var(--wa-sel); }
.wa-conv-body { flex: 1; min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--bs-border-color); }
.wa-conv:last-child .wa-conv-body { border-bottom: 0; }
.wa-conv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wa-conv-name { font-size: 0.95rem; font-weight: 500; }
.wa-conv-time { font-size: 0.72rem; color: var(--wa-sub); flex-shrink: 0; }
.wa-conv.unread .wa-conv-time { color: #25D366; font-weight: 600; }
.wa-conv-preview { font-size: 0.83rem; color: var(--wa-sub); min-width: 0; margin-top: 1px; }
.wa-conv.unread .wa-conv-preview { color: var(--bs-body-color); font-weight: 500; }
.wa-conv-preview .wa-tick { font-size: 0.95rem; margin-right: 3px; vertical-align: -2px; }
.wa-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #25D366; color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 20px; text-align: center; flex-shrink: 0; }
.wa-expired-ic { font-size: 0.8rem; color: var(--wa-sub); }

.wa-avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.95rem; background: #94a3b8; }
.wa-avatar i { font-size: 1.3rem; }

/* ---- chat header ---- */
.wa-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px; background: var(--wa-panel); border-bottom: 1px solid var(--bs-border-color); }
.wa-chat-header .wa-avatar { width: 40px; height: 40px; }
.wa-chat-name { font-size: 1rem; font-weight: 600; line-height: 1.2; }
.wa-chat-sub { font-size: 0.76rem; color: var(--wa-sub); line-height: 1.2; margin-top: 2px; }
.wa-addcontact { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid #25D366; background: var(--wa-card-bg); color: var(--wa-green); border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.wa-addcontact:hover { background: #25D366; color: #fff; }
.wa-addcontact.d-none { display: none !important; }
.wa-icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--wa-ico); font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0; }
.wa-icon-btn:hover:not(:disabled) { background: rgba(100, 116, 139, 0.16); color: var(--bs-body-color); }
.wa-icon-btn:disabled { opacity: 0.45; }
.wa-session-bar { align-items: center; justify-content: center; padding: 5px 16px; font-size: 0.75rem; font-weight: 500; }
.wa-session-bar.active-session { background: #e7f8ee; color: #166534; }
.wa-session-bar.expired { background: #fef2f2; color: #991b1b; }
[data-bs-theme="dark"] .wa-session-bar.active-session { background: #10332a; color: #6ee7a0; }
[data-bs-theme="dark"] .wa-session-bar.expired { background: #3b1d1d; color: #fca5a5; }

/* ---- conversation pane ---- */
.wa-web .chat-area { background: #efeae2; }
[data-bs-theme="dark"] .wa-web .chat-area { background: #0b141a; }
.wa-wallpaper { background-color: #efeae2; background-image: radial-gradient(rgba(11, 20, 26, 0.045) 1.2px, transparent 1.2px); background-size: 20px 20px; }
[data-bs-theme="dark"] .wa-wallpaper { background-color: #0b141a; background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1.2px, transparent 1.2px); }
.wa-web .chat-messages-viewport { padding: 14px 5%; gap: 2px; }
.wa-empty { margin: auto; text-align: center; color: var(--wa-sub); max-width: 320px; }
.wa-empty-icon { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; color: #fff; background: linear-gradient(135deg, #25D366, #128C7E); box-shadow: 0 10px 24px -10px rgba(18, 140, 126, 0.7); }
.wa-web .wa-empty h5 { color: var(--bs-body-color); }

.wa-row { display: flex; }
.wa-row.out { justify-content: flex-end; }
.wa-web .msg-bubble { position: relative; max-width: 65%; padding: 6px 8px 6px 9px; border-radius: 8px; border: 0; font-size: 0.92rem; line-height: 1.35; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); display: flow-root; color: var(--bs-body-color); }
.wa-web .msg-in { background: var(--wa-in); }
.wa-web .msg-out { background: var(--wa-out); color: var(--bs-body-color); }
.wa-web .msg-bubble.wa-tail { margin-top: 8px; }
.wa-web .msg-in.wa-tail { border-top-left-radius: 0; }
.wa-web .msg-out.wa-tail { border-top-right-radius: 0; }
.wa-web .msg-bubble.wa-tail::before { content: ''; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.wa-web .msg-in.wa-tail::before { left: -8px; clip-path: polygon(100% 0, 100% 100%, 0 0); }
.wa-web .msg-out.wa-tail::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa-web .msg-text { white-space: pre-wrap; word-break: break-word; }
.wa-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 7px 0 -3px 12px; font-size: 0.68rem; color: var(--wa-sub); user-select: none; }
.wa-tick { font-size: 1.05rem; line-height: 1; color: #8696a0; }
.wa-tick-read { color: #53bdeb; }
.wa-tick-fail { color: #ef4444; font-size: 0.85rem; }
.wa-web .wa-date-sep { margin: 10px 0 6px; }
.wa-web .wa-date-sep span { background: #fff; color: #54656f; border: 0; font-weight: 500; padding: 0.3rem 0.8rem; border-radius: 8px; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); }
[data-bs-theme="dark"] .wa-web .wa-date-sep span { background: #182229; color: #8696a0; }

/* ---- composer ---- */
.wa-composer { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--wa-panel); }
.wa-input { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; max-height: 120px; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--bs-body-color); font-size: 0.95rem; line-height: 1.35; }
[data-bs-theme="dark"] .wa-input { background: #2a3942; }
.wa-input:disabled { background: rgba(255, 255, 255, 0.6); }
.wa-send { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #25D366; color: #fff; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s ease; }
.wa-send:hover:not(:disabled) { background: #1ebe56; }
.wa-send:disabled { opacity: 0.5; }
.wa-composer .wa-icon-btn { margin-bottom: 1px; }

.wa-emoji-pop { position: absolute; bottom: calc(100% + 6px); left: 14px; width: 340px; max-width: calc(100vw - 28px); background: var(--wa-card-bg); border: 1px solid var(--bs-border-color); border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(15, 23, 42, 0.35); z-index: 30; overflow: hidden; }
.wa-emoji-pop.d-none { display: none !important; }
.wa-emoji-tabs { display: flex; border-bottom: 1px solid var(--bs-border-color); background: var(--wa-panel); }
.wa-emoji-tabs button { flex: 1; border: 0; background: transparent; padding: 8px 0; font-size: 1.15rem; border-bottom: 3px solid transparent; }
.wa-emoji-tabs button.on { border-bottom-color: #25D366; background: var(--wa-card-bg); }
.wa-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; max-height: 220px; overflow-y: auto; }
.wa-emoji { border: 0; background: transparent; font-size: 1.4rem; line-height: 1; padding: 5px 0; border-radius: 8px; }
.wa-emoji:hover { background: rgba(100, 116, 139, 0.16); }

@media (max-width: 991.98px) {
  .wa-web .msg-bubble { max-width: 82%; }
  .wa-web .chat-messages-viewport { padding: 10px 3%; }
  .wa-conv { padding: 0 12px; }
}
/* Chat ticks: bolder strokes (the icon font is thin by default) */
.wa-tick { -webkit-text-stroke: 0.6px currentColor; font-size: 1.15rem; }
.wa-tick-read { color: #34b7f1; -webkit-text-stroke: 1px currentColor; }
.wa-tick-fail { -webkit-text-stroke: 0; }
.wa-conv-preview .wa-tick { font-size: 1.05rem; }

/* Chat ticks: smaller, still bold */
.wa-tick { font-size: 0.9rem; -webkit-text-stroke: 0.5px currentColor; }
.wa-tick-read { -webkit-text-stroke: 0.8px currentColor; }
.wa-tick-fail { font-size: 0.8rem; }
.wa-conv-preview .wa-tick { font-size: 0.85rem; margin-right: 2px; vertical-align: -1px; }
.wa-meta { gap: 2px; }

/* ==========================================================================
   Calling page
   ========================================================================== */
.call-stat { display: flex; align-items: center; gap: 0.85rem; padding: 0.9rem 1rem; background: var(--wa-card-bg); border: 1px solid var(--bs-border-color); border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.call-stat-ic { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.call-stat-n { font-size: 1.45rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.call-stat-l { font-size: 0.74rem; color: var(--wa-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

/* dialer */
.dial-display { display: flex; align-items: center; background: var(--bs-tertiary-bg, #f3f4f6); border-radius: 14px; padding: 0.35rem 0.5rem 0.35rem 1rem; }
.dial-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--bs-body-color); font-size: 1.35rem; font-weight: 600; letter-spacing: 0.04em; padding: 0.55rem 0; font-variant-numeric: tabular-nums; }
.dial-input::placeholder { font-size: 0.95rem; font-weight: 400; letter-spacing: 0; color: var(--wa-text-muted); }
.dial-back { border: 0; background: transparent; color: var(--wa-text-muted); font-size: 1.3rem; width: 40px; height: 40px; border-radius: 50%; }
.dial-back:hover { background: rgba(100, 116, 139, 0.15); color: var(--bs-body-color); }
.dial-hint { font-size: 0.74rem; color: var(--wa-text-muted); margin: 0.4rem 0.25rem 0.8rem; }
.dial-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; margin-bottom: 1rem; }
.dial-key { border: 1px solid var(--bs-border-color); background: var(--wa-card-bg); border-radius: 14px; padding: 0.7rem 0; font-size: 1.25rem; font-weight: 600; color: var(--bs-body-color); transition: all 0.12s ease; }
.dial-key:hover { background: var(--wa-primary-light); border-color: var(--wa-primary); }
.dial-key:active { transform: scale(0.96); }
.dial-call { border-radius: 14px; padding: 0.8rem; font-size: 1.05rem; font-weight: 700; box-shadow: 0 10px 22px -10px rgba(37, 211, 102, 0.8); }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 6px; animation: pulse-dot 2s infinite; }

/* recent calls */
.call-list { display: flex; flex-direction: column; max-height: 640px; overflow-y: auto; margin: 0 -0.25rem; padding: 0 0.25rem; }
.call-row { padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--bs-border-color); border-radius: 12px; transition: background 0.15s ease; }
.call-row:last-child { border-bottom: 0; }
.call-row:hover { background: rgba(100, 116, 139, 0.06); }
.call-row.is-live { background: rgba(37, 211, 102, 0.07); }
.call-row-main { display: flex; align-items: center; gap: 0.8rem; }
.call-av { width: 42px; height: 42px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.call-av i { font-size: 1.2rem; }
.call-who { flex: 1; min-width: 0; }
.call-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-dir { margin-right: 0.4rem; }
.call-num { color: inherit; text-decoration: none; border-bottom: 1px dashed transparent; cursor: pointer; }
.call-num:hover { color: #128C7E; border-bottom-color: #128C7E; }
.call-sub { font-size: 0.78rem; color: var(--wa-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-sub .call-num { color: var(--wa-text-muted); }
.call-sub .call-num:hover { color: #128C7E; }
.call-meta { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--wa-text-muted); flex-shrink: 0; }
.call-status { font-weight: 600; font-size: 0.72rem; padding: 0.35em 0.7em; border-radius: 999px; }
.call-cost { font-weight: 600; color: var(--bs-body-color); }
.call-again { border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--wa-primary-light); color: #128C7E; flex-shrink: 0; transition: all 0.15s ease; }
.call-again:hover { background: #25D366; color: #fff; }
.call-audio { padding: 0.45rem 0 0 calc(42px + 0.8rem); }
.call-audio:empty { display: none; }
.call-audio audio { width: 100%; max-width: 420px; height: 34px; display: block; }
.call-empty { text-align: center; padding: 3rem 1rem; color: var(--wa-text-muted); }
.call-empty i { font-size: 2.4rem; display: block; margin-bottom: 0.5rem; opacity: 0.5; }
.call-empty div { font-weight: 600; color: var(--bs-body-color); }
.call-empty span { font-size: 0.85rem; }

@media (max-width: 767.98px) {
  .call-row-main { flex-wrap: wrap; }
  .call-meta { order: 5; width: 100%; padding-left: calc(42px + 0.8rem); flex-wrap: wrap; }
  .call-audio { padding-left: 0; }
  .call-audio audio { max-width: 100%; }
  .call-stat { padding: 0.7rem; gap: 0.6rem; }
  .call-stat-n { font-size: 1.2rem; }
}

/* ==========================================================================
   Business profile page
   ========================================================================== */
.bp-cover { height: 96px; background: linear-gradient(135deg, #25D366 0%, #128C7E 55%, #075E54 100%); position: relative; }
.bp-cover::after { content: ''; position: absolute; inset: 0; background: radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.2px); background-size: 16px 16px; }
.bp-head { position: relative; display: flex; justify-content: center; margin-top: -48px; }
.bp-avatar { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--wa-card-bg); background: linear-gradient(135deg, #e2e8f0, #cbd5e1); color: #64748b;
  display: flex; align-items: center; justify-content: center; font-size: 2.4rem; overflow: hidden; box-shadow: 0 8px 20px -8px rgba(15, 23, 42, 0.4); }
.bp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bp-avatar-sm { width: 72px; height: 72px; font-size: 1.8rem; border-width: 3px; flex-shrink: 0; }
.bp-cam { position: absolute; bottom: 2px; left: calc(50% + 22px); width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--wa-card-bg); background: #25D366; color: #fff; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.bp-cam:hover { background: #1ebe56; }
.bp-about { color: var(--wa-text-muted); font-size: 0.9rem; font-style: italic; }
.bp-list { border-top: 1px solid var(--bs-border-color); margin-top: 1rem; }
.bp-row { display: flex; gap: 0.85rem; padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--bs-border-color); }
.bp-row:last-child { border-bottom: 0; }
.bp-row-ic { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--wa-primary-light); color: #128C7E; }
.bp-row-l { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--wa-text-muted); }
.bp-row-v { font-size: 0.9rem; font-weight: 500; word-break: break-word; }
.bp-link { color: #128C7E; text-decoration: none; }
.bp-link:hover { text-decoration: underline; }
.bp-progress { height: 8px; border-radius: 8px; background: rgba(100, 116, 139, 0.15); }
.bp-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--wa-text-muted); padding: 0.45rem 0.65rem; border-radius: 10px; background: rgba(100, 116, 139, 0.06); }
.bp-check.ok { color: var(--bs-body-color); background: var(--wa-primary-light); }
.bp-check.ok i { color: #16a34a; }
.bp-social { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--bs-border-color); border-radius: 14px; }
.bp-social.empty { border-style: dashed; opacity: 0.85; }
.bp-social-ic { width: 40px; height: 40px; border-radius: 12px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.bp-note { display: flex; gap: 0.6rem; padding: 0.75rem 0.9rem; border-radius: 12px; background: rgba(14, 165, 233, 0.08); color: var(--bs-body-color); font-size: 0.82rem; line-height: 1.45; }
.bp-note > i { color: #0ea5e9; margin-top: 2px; }
.bp-tips { padding-left: 1.1rem; font-size: 0.88rem; color: var(--wa-text-muted); }
.bp-tips li { margin-bottom: 0.4rem; }
.bp-tips strong { color: var(--bs-body-color); }
.bp-edit-pic { display: flex; align-items: center; gap: 1rem; padding: 0.85rem; border: 1px dashed var(--bs-border-color); border-radius: 14px; }

/* ==========================================================================
   Button green: white text on the bright WhatsApp green (#25D366) was hard to read. Solid buttons now use a deeper
   green with proper contrast; the bright green stays for accents, borders and light tints.
   ========================================================================== */
:root { --wa-btn: #0f7f6e; --wa-btn-hover: #0b6b5c; --wa-btn-active: #075E54; }
.btn-wa-primary { background-color: var(--wa-btn); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(15, 127, 110, 0.28); }
.btn-wa-primary:hover, .btn-wa-primary:focus { background-color: var(--wa-btn-hover); color: #fff; box-shadow: 0 4px 10px rgba(15, 127, 110, 0.35); }
.btn-wa-primary:active { background-color: var(--wa-btn-active) !important; color: #fff !important; transform: none; }
.btn-wa-primary:focus-visible { outline: 0; box-shadow: 0 0 0 0.2rem rgba(15, 127, 110, 0.35); }
.btn-wa-primary:disabled, .btn-wa-primary.disabled { background-color: var(--wa-btn); color: #fff; opacity: 0.55; box-shadow: none; transform: none; }
.btn-wa-outline:hover { border-color: var(--wa-btn); color: var(--wa-btn); background-color: rgba(15, 127, 110, 0.06); }
[data-bs-theme="dark"] .btn-wa-outline:hover { color: #6ee7a0; border-color: #25D366; }
.wa-send { background: var(--wa-btn); }
.wa-send:hover:not(:disabled) { background: var(--wa-btn-hover); }
.wa-addcontact:hover { background: var(--wa-btn); border-color: var(--wa-btn); color: #fff; }
.call-again:hover { background: var(--wa-btn); color: #fff; }
.bp-cam { background: var(--wa-btn); }
.bp-cam:hover { background: var(--wa-btn-hover); }
.wa-chip-n, .wa-unread { background: var(--wa-btn); }
.wa-chip.active { color: #075E54; }
.dial-call { box-shadow: 0 10px 22px -10px rgba(15, 127, 110, 0.8); }
.stat-card-icon.icon-gradient-green, .icon-gradient-green { background: linear-gradient(135deg, #16a765 0%, #0f7f6e 100%); }

/* Business WhatsApp profile picture inside the round header/sidebar avatar */
.user-avatar-sm .nav-biz-pic { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* ---------- dark mode: Bootstrap's "light" helpers stay bright in dark theme, so remap them ---------- */
[data-bs-theme="dark"] .bg-light { background-color: var(--bs-tertiary-bg) !important; color: var(--bs-body-color); }
[data-bs-theme="dark"] .bg-white { background-color: var(--wa-card-bg, #111b21) !important; color: var(--bs-body-color); }
[data-bs-theme="dark"] .badge.bg-light.text-dark { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .provider-btn { background: var(--wa-card-bg, #111b21) !important; border-color: var(--bs-border-color) !important; }
[data-bs-theme="dark"] .theme-toggle:hover { background: var(--wa-primary-light) !important; }
[data-bs-theme="dark"] .modal-content { background-color: var(--wa-card-bg, #111b21); }

/* Popups on phones: keep the Save row clear of the iPhone home indicator */
@media (max-width: 767.98px) {
  .modal-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .modal-dialog-scrollable .modal-body { -webkit-overflow-scrolling: auto; }
}

/* Top-right account menu: keep theme colours on hover/tap (no default blue link colour) */
.navbar-right .btn-link, .navbar-right .btn-link:hover, .navbar-right .btn-link:focus, .navbar-right .btn-link:active { color: inherit; }
.navbar-right .btn-link:hover .bi-chevron-down { color: var(--bs-secondary-color) !important; }
.navbar-right .dropdown-item.text-danger:hover, .navbar-right .dropdown-item.text-danger:focus { color: #dc3545; background: rgba(220,53,69,.08); }
.navbar-right .dropdown-item:hover:not(.text-danger), .navbar-right .dropdown-item:focus:not(.text-danger) { color: var(--bs-body-color); background: var(--wa-primary-light, rgba(37,211,102,.1)); }
.sidebar-footer .btn-outline-danger:hover { color: #fff; background: #dc3545; }

/* template footer + buttons inside a Live Chat bubble */
.wa-tpl-extra { margin-top: .25rem; }
.wa-tpl-foot { font-size: .72rem; opacity: .65; margin-bottom: .35rem; }
.wa-tpl-btns { display: flex; flex-direction: column; gap: 4px; margin: .35rem -.15rem .15rem; border-top: 1px solid rgba(100, 116, 139, .22); padding-top: .35rem; }
.wa-tpl-btn { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .42rem .6rem; border-radius: 8px; background: rgba(255, 255, 255, .7); color: #0a7cff !important; font-weight: 600; font-size: .84rem; text-decoration: none !important; }
.wa-tpl-btn:hover { background: #fff; }
[data-bs-theme="dark"] .wa-tpl-btn { background: rgba(255, 255, 255, .08); color: #53bdeb !important; }

/* ---- Live chat on phones: roomy name, compact controls, no page scroll behind the open chat ---- */
.wa-assign { width: auto; max-width: 170px; border-radius: 10px; }
@media (max-width: 991.98px) {
  body.chat-open-m { overflow: hidden; }
  .wa-chat-header { padding: 8px 10px; gap: 6px; flex-wrap: nowrap; }
  .wa-chat-header > div:first-child { flex: 1 1 auto; min-width: 0; }                 /* the name gets all the room that is left */
  .wa-chat-header > div:last-child { flex: 0 0 auto; gap: 0.35rem !important; }
  .wa-chat-header .wa-assign { width: 96px; max-width: 96px; font-size: 0.74rem; padding: 0.25rem 1.35rem 0.25rem 0.5rem; text-overflow: ellipsis; }
  .wa-chat-header .wa-addcontact { padding: 0.35rem 0.6rem; }
  .wa-chat-header .wa-addcontact span { display: none; }                               /* icon only on a phone */
  .wa-chat-header .wa-icon-btn { width: 36px; height: 36px; }
}

/* ---- WhatsApp-style system notice inside a chat (e.g. "Customer allowed calls"): soft yellow pill, like WhatsApp's own notices ---- */
.wa-sysnote { display: flex; justify-content: center; margin: 0.55rem 0; padding: 0 6%; }
.wa-sysnote > span { display: inline-block; max-width: 92%; text-align: center; background: #ffeecd; color: #54656f; font-size: 0.78rem; line-height: 1.35;
                   padding: 0.35rem 0.7rem; border-radius: 8px; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); }
.wa-sysnote > span > i { margin-right: 0.3rem; }
.wa-sysnote .t { display: inline; background: none; padding: 0; box-shadow: none; border-radius: 0; opacity: 0.75; margin-left: 0.35rem; font-size: 0.72rem; white-space: nowrap; }
[data-bs-theme="dark"] .wa-sysnote > span { background: #182229; color: #ffd279; box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.4); }

/* Colour variants of the in-chat notice, same palette as the session bar at the top of the chat: green = good, red = declined */
.wa-sysnote.ok > span { background: #e7f8ee; color: #166534; }
.wa-sysnote.bad > span { background: #fef2f2; color: #991b1b; }
[data-bs-theme="dark"] .wa-sysnote.ok > span { background: #10332a; color: #6ee7a0; }
[data-bs-theme="dark"] .wa-sysnote.bad > span { background: #3b1d1d; color: #fca5a5; }

/* "Free replies used up" warning: a full-width amber bar attached to the typing box (the same kind of bar as the session bar above the
   messages), outside the scrolling area so messages never run under it */
.wa-costbar { display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 6px 16px; font-size: 0.76rem; font-weight: 500; line-height: 1.3; text-align: center;
              background: #fff4d6; color: #7a4b00; border-top: 1px solid rgba(122, 75, 0, 0.18); }
.wa-costbar.d-none { display: none !important; }
.wa-costbar > span i { margin-right: 0.35rem; }
[data-bs-theme="dark"] .wa-costbar { background: #3a2f10; color: #ffd279; border-top-color: rgba(255, 210, 121, 0.18); }

/* Live Chat: 24-hour window closed bar (red variant of the amber bar) and the note under a message that failed to send */
.wa-costbar.wa-winclosed { background: #fef2f2; color: #991b1b; border-top-color: rgba(153, 27, 27, 0.18); flex-wrap: wrap; }
[data-bs-theme="dark"] .wa-costbar.wa-winclosed { background: #3b1d1d; color: #fca5a5; border-top-color: rgba(252, 165, 165, 0.2); }
.wa-failnote { margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px dashed rgba(220, 38, 38, 0.35); font-size: 0.74rem; line-height: 1.35; color: #b91c1c; }
.wa-failnote a { font-weight: 700; text-decoration: underline; color: inherit; }
[data-bs-theme="dark"] .wa-failnote { color: #fca5a5; border-top-color: rgba(252, 165, 165, 0.35); }

/* Live Chat "Send template" popup: header and buttons stay put, only the middle scrolls (and only when it has to), with a slim themed scrollbar */
.tpl-pop .modal-content { max-height: calc(100vh - 1.5rem); }
.tpl-pop .modal-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .55) transparent; padding-bottom: .75rem; }
.tpl-pop .modal-body::-webkit-scrollbar, .tpl-pop .tpl-preview::-webkit-scrollbar { width: 6px; }
.tpl-pop .modal-body::-webkit-scrollbar-thumb, .tpl-pop .tpl-preview::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .55); border-radius: 6px; }
.tpl-pop .tpl-preview { max-height: 170px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .55) transparent; }
.tpl-pop .modal-header, .tpl-pop .modal-footer { flex-shrink: 0; }
@media (max-width: 575.98px) { .tpl-pop { margin: .75rem; } }
