/* ================================================================
   SG Lead Pro — Design System
   Modern SaaS CRM for Real Estate
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  --primary:        #003875; /* Navy Blue from logo */
  --primary-dark:   #00244d;
  --primary-light:  #E6F0FA;
  --primary-50:     rgba(0, 56, 117, 0.05);
  --accent-gold:    #F39C12; /* Orange Gold from logo */
  --accent-gold-light: #FEF5E7;

  --success:        #16A34A;
  --success-light:  #DCFCE7;
  --warning:        #D97706;
  --warning-light:  #FEF3C7;
  --danger:         #DC2626;
  --danger-light:   #FEE2E2;
  --info:           #2563EB;
  --info-light:     #DBEAFE;

  --sidebar-bg:     #FFFFFF;
  --sidebar-text:   #475569;
  --sidebar-hover:  #E7F3EF;
  --sidebar-active: #003875;
  --sidebar-width:  200px; /* Compact executive sidebar */

  --body-bg:        #FAFAFA; /* Off-white for clean contrast */
  --card-bg:        #FFFFFF;
  --border-color:   #D1D5DB; /* Defined border lines */
  --text-primary:   #111827;
  --text-secondary: #4B5563;
  --text-muted:     #9CA3AF;

  --navbar-height:  56px; /* Slimmer navbar */
  --border-radius:  2px; /* Very boxxy clean layout */
  --border-radius-sm: 1px;
  --border-radius-lg: 3px;

  --shadow-sm:   none;
  --shadow:      none;
  --shadow-md:   none;
  --shadow-lg:   none;
  --shadow-xl:   none;

  --transition: all 0.15s ease;
  --transition-slow: all 0.25s ease;
}

/* ── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  margin: 0; padding: 0;
}

/* Numeric / tabular values use mono for alignment */
.font-mono, .stat-value, .badge-count, td.numeric {
  font-family: 'DM Mono', 'SF Mono', 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: none;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text .app-name {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.sidebar-logo-text .app-tagline {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 400;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  margin: 1px 6px;
  border-radius: var(--border-radius-sm);
}

.sidebar-item:hover {
  color: var(--primary);
  background: var(--sidebar-hover);
  text-decoration: none;
}

.sidebar-item.active {
  color: #FFFFFF;
  background: var(--primary);
  box-shadow: none;
}

.sidebar-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.sidebar-item .badge-count {
  margin-left: auto;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-item.active .badge-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.sidebar-item.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--sidebar-text);
}

.sidebar-user:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Navbar ─────────────────────────────────────────────────────── */
.main-navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 1030;
  transition: var(--transition-slow);
}

.navbar-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.navbar-spacer { flex: 1; }

.navbar-action-btn {
  width: 32px; height: 32px;
  border-radius: var(--border-radius-sm); /* Boxy */
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-size: 14px;
  position: relative;
}

.navbar-action-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.navbar-notification-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid white;
}

/* ── Main Content ───────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

.page-content {
  padding: 20px;
  max-width: 1440px;
}

/* ── Page Header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-title h1 {
  font-size: 18px; /* Clean & smaller */
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 3px;
  letter-spacing: -0.01em;
}

.page-header-title p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body { padding: 16px; }

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--stat-color, var(--primary));
  border-radius: 0;
}

.stat-card:hover {
  transform: none; /* Flat design */
  box-shadow: none;
  border-color: var(--stat-color, var(--primary));
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--border-radius-sm); /* Boxy icons */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--stat-bg, var(--primary-light));
  color: var(--stat-color, var(--primary));
}

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 3px; white-space: nowrap; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text-primary); line-height: 1; letter-spacing: -0.02em; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--border-radius-sm); /* Sharp boxy badges */
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── Role Badges ─────────────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.role-super-admin      { background: #F5F3FF; color: #7C3AED; }
.role-company-admin    { background: #EFF6FF; color: #2563EB; }
.role-manager          { background: #DCFCE7; color: #16A34A; }
.role-relationship-manager { background: #FEF3C7; color: #D97706; }
.role-sales-executive  { background: #FEE2E2; color: #DC2626; }
.role-telecaller       { background: #F0FDF4; color: #16A34A; }

/* ── Avatar ─────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px; /* Smaller default */
  border-radius: var(--border-radius-sm); /* Boxy avatars */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  text-transform: uppercase;
}

.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }

.avatar-primary  { background: var(--primary-light); color: var(--primary); }
.avatar-success  { background: var(--success-light); color: var(--success); }
.avatar-warning  { background: var(--warning-light); color: var(--warning); }
.avatar-info     { background: var(--info-light);    color: var(--info); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn { border-radius: var(--border-radius-sm); font-weight: 500; font-size: 12.5px; transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: #F1F5F9; border-color: var(--border-color); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-sm { font-size: 11.5px; padding: 4px 10px; }
.btn-xs { font-size: 11px; padding: 2px 8px; }

.btn-icon {
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 13px;
}

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

/* ── Forms ───────────────────────────────────────────────────────── */
.form-control {
  border-radius: var(--border-radius-sm);
  border-color: var(--border-color);
  font-size: 12.5px;
  padding: 6px 10px;
  color: var(--text-primary);
  transition: var(--transition);
}

.form-select {
  border-radius: var(--border-radius-sm);
  border-color: var(--border-color);
  font-size: 12.5px;
  padding: 6px 2.25rem 6px 10px !important;
  background-position: right 0.6rem center !important;
  background-size: 14px 10px !important;
  color: var(--text-primary);
  transition: var(--transition);
}

.form-select-sm {
  padding: 4px 1.75rem 4px 8px !important;
  background-position: right 0.45rem center !important;
  background-size: 12px 9px !important;
}

.form-select.text-white,
.form-select.status-select-badge {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.form-label { font-size: 12px; font-weight: 500; color: var(--text-primary); margin-bottom: 5px; }
.form-text  { font-size: 11.5px; color: var(--text-muted); }

/* ── Tables ──────────────────────────────────────────────────────── */
.table-container {
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.table { margin: 0; }
.table th {
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 10px 14px;
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  font-size: 12.5px;
  color: var(--text-primary);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFBFF; }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert { border-radius: var(--border-radius-sm); font-size: 12.5px; border: none; padding: 10px 14px; }
.alert-success { background: var(--success-light); color: #166534; }
.alert-danger  { background: var(--danger-light);  color: #991B1B; }
.alert-warning { background: var(--warning-light); color: #854D0E; }
.alert-info    { background: var(--info-light);    color: #1E40AF; }

/* ── Breadcrumb ──────────────────────────────────────────────────── */
.breadcrumb { margin: 0; padding: 0; background: none; font-size: 12px; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-secondary); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ── Filter Bar ──────────────────────────────────────────────────── */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ── Auth Pages ──────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background: #F8FAFC;
}

.auth-panel-left {
  flex: 1;
  background: #0F172A;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.auth-panel-left::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.auth-panel-right {
  width: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  background: #fff;
  border-left: 1px solid var(--border-color);
}

.auth-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.auth-form-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 28px; }

/* ── Super Admin Sidebar Override ────────────────────────────────── */
.sidebar-superadmin .sidebar-logo-icon { background: #6D28D9; box-shadow: none; }
.sidebar-superadmin .sidebar-item.active { background: #6D28D9; box-shadow: none; }

/* ── Utility ─────────────────────────────────────────────────────── */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-soft { background: var(--primary-light) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: 8px; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }

/* ── Dropdown Menus ──────────────────────────────────────────────── */
.dropdown-menu {
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 4px;
  min-width: 160px;
  font-size: 12.5px;
}
.dropdown-item { border-radius: 0; font-size: 12.5px; padding: 7px 12px; color: var(--text-primary); }
.dropdown-item:hover { background: var(--primary); color: #fff; }
.dropdown-divider { margin: 3px 0; border-color: var(--border-color); }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination { gap: 3px; }
.page-link { border-radius: var(--border-radius-sm) !important; border-color: var(--border-color); color: var(--text-secondary); font-size: 12px; padding: 5px 10px; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Sidebar Collapsed State (Mobile) ───────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { 
    position: fixed !important;
    top: 0 !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    height: calc(100vh - 64px - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px)) !important;
    width: min(275px, 84vw) !important;
    max-width: 320px !important;
    z-index: 1050 !important;
    background: #ffffff !important;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid var(--border-color) !important;
    transform: translateX(-105%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .sidebar.open { 
    transform: translateX(0) !important; 
  }
  .sidebar-nav {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    padding-top: 10px !important;
    padding-bottom: 24px !important;
    display: block !important;
  }
  .sidebar-item {
    padding: 10px 18px !important;
    font-size: 13.5px !important;
    white-space: nowrap !important;
  }
  .sidebar-section-label {
    padding: 14px 18px 4px !important;
    font-size: 10px !important;
  }
  .mobile-bottom-nav {
    z-index: 1060 !important;
  }
  .mobile-sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    z-index: 1045 !important;
  }
  .main-content { margin-left: 0; }
  .main-navbar { left: 0; padding: 0 14px; }
  .page-content { padding: 14px 10px; }
  .auth-panel-right { width: 100%; padding: 40px 24px; border-left: none; }
}

@media (max-width: 576px) {
  .auth-panel-right { padding: 30px 16px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
}

@media (max-width: 991.98px) {
  .page-header-actions,
  .page-header .d-flex { 
    width: 100%; 
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
  }
  .page-header-actions::-webkit-scrollbar,
  .page-header .d-flex::-webkit-scrollbar {
    display: none;
  }
  .page-header-actions .btn,
  .page-header .btn { 
    flex: 1 0 auto !important; 
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 6px 10px !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    line-height: 1 !important;
    text-align: center;
    box-sizing: border-box !important;
  }
  .page-header-actions .btn i,
  .page-header .btn i {
    font-size: 13px !important;
    margin-right: 4px !important;
    flex-shrink: 0;
  }
}

/* ── Modern Touch-Friendly Pagination ── */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 8px;
}
.pagination-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.pagination-nav {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}
.pagination-nav::-webkit-scrollbar {
  display: none;
}
.pagination-nav .pagination {
  margin-bottom: 0;
  gap: 4px;
  flex-wrap: nowrap;
}
.pagination-nav .page-item .page-link {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px !important;
  transition: all 0.15s ease;
  text-decoration: none;
}
.pagination-nav .page-item.active .page-link {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(13, 110, 253, 0.25);
}
.pagination-nav .page-item.disabled .page-link {
  color: #94a3b8;
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.6;
  pointer-events: none;
}
.pagination-nav .page-item .page-link:hover:not(.disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
}
@media (max-width: 576px) {
  .pagination-wrapper {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
  .pagination-nav {
    width: 100%;
    justify-content: center !important;
  }
  .pagination-nav .pagination {
    margin: 0 auto;
  }
}

/* ── Lead Type Tabs (Segmented Control - Never Clips on Mobile) ── */
.lead-type-tabs-card .card-body {
  display: flex;
  width: 100%;
}
.lead-type-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  height: 34px;
}
.lead-type-tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}
.lead-type-tab-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(13, 110, 253, 0.2);
}
.lead-type-tab-btn .tab-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}
.lead-type-tab-btn .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 576px) {
  .lead-type-tab-btn {
    padding: 6px 14px;
    font-size: 13px;
    flex: 0 0 auto;
  }
}

/* ── Responsive Table Container ────────────────────────────────── */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ── Divider ─────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-color); margin: 12px 0; }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 32px; display: block; margin-bottom: 8px; color: #D1D5DB; }
.empty-state p { font-size: 13px; margin: 0; }

/* ── Data Labels ─────────────────────────────────────────────────── */
.data-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.data-value { font-size: 12.5px; font-weight: 500; color: var(--text-primary); }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.2s ease both; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.pulse { animation: pulse-dot 2s ease-in-out infinite; }

/* ── Sidebar logo padding ─────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
}

/* -------------------------------------------------------------------
   MOBILE CARD SYSTEM  � shared across all list pages
   Cards visible only on <768px; tables show on >=768px
   ------------------------------------------------------------------- */
@media (max-width: 767.98px) {

  .page-content { padding: 12px 10px !important; }

  /* Base card */
  .mobile-lead-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px 14px 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }

  /* Top row */
  .mlc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }
  .mlc-name a,
  a.mlc-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
  }
  .mlc-actions-top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .mlc-del-btn {
    width: 28px; height: 28px;
    border: 1px solid #FEE2E2;
    background: #FEF2F2;
    color: #DC2626;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
  }

  /* Status dropdown */
  .mlc-status-row { margin-bottom: 8px; }
  .mlc-status-btn {
    border: none;
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    line-height: 1.6;
  }

  /* Chips row */
  .mlc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
  }
  .mlc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 5px;
  }
  .mlc-chip-source  { background: #FEF3C7; color: #92400E; }
  .mlc-chip-project { background: #EDE9FE; color: #5B21B6; }

  /* Action button grid */
  .mlc-action-btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .d-contents { display: contents; }

  .mlc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 7px 4px;
    border-radius: 7px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
  }
  .mlc-btn-call  { background:#F0FDF4; color:#16A34A; border-color:#BBF7D0; }
  .mlc-btn-wa    { background:#F0FDF4; color:#15803D; border-color:#86EFAC; }
  .mlc-btn-email { background:#EFF6FF; color:#2563EB; border-color:#BFDBFE; }
  .mlc-btn-open  { background:#F8FAFC; color:#475569; border-color:#E2E8F0; }
  .mlc-btn-impersonate { background:#FEF3C7; color:#D97706; border-color:#FDE68A; }

  .mlc-btn-call:hover  { background:#16A34A; color:#fff; border-color:#16A34A; }
  .mlc-btn-wa:hover    { background:#15803D; color:#fff; border-color:#15803D; }
  .mlc-btn-email:hover { background:#2563EB; color:#fff; border-color:#2563EB; }
  .mlc-btn-open:hover  { background:var(--primary); color:#fff; border-color:var(--primary); }
  .mlc-btn-impersonate:hover { background:#D97706; color:#fff; border-color:#D97706; }
}

/* ─── PWA & Mobile Navigation ──────────────────────────────────────────────── */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1040;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  padding: 0 8px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 500;
  gap: 2px;
  flex: 1;
  transition: color 0.15s;
}

.mobile-nav-item i {
  font-size: 19px;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.mobile-nav-fab-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mobile-nav-fab {
  position: absolute;
  top: -24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  border: 4px solid #FFFFFF;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.mobile-nav-fab:active {
  transform: scale(0.92);
}

/* Offline Mode Banner */
.offline-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #D97706;
  color: #FFFFFF;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1095;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: slideInDown 0.25s ease;
}

@media (max-width: 767.98px) {
  /* Prevent bottom nav from covering content */
  body {
    padding-bottom: 74px !important;
  }
  .main-content {
    padding-bottom: 40px !important;
  }

  /* Bottom sheet style for modals on mobile */
  .modal-bottom-sheet .modal-dialog {
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    transform: translate(0, 100%);
    transition: transform 0.25s ease-out;
  }
  .modal-bottom-sheet.show .modal-dialog {
    transform: none;
  }
  .modal-bottom-sheet .modal-content {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 85vh;
  }
}

/* ─── SG Assistant Chatbot Widget ─────────────────────────────────────────── */
.sg-chatbot-fab {
  display: none !important;
}

.sg-chatbot-card {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 48px);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18), 0 5px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1060;
  overflow: hidden;
  animation: chatSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sg-chat-header {
  background: linear-gradient(135deg, #003875, #00244d);
  color: #FFFFFF;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sg-chat-avatar-header {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sg-chat-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.sg-chat-subtitle {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.85);
}

.sg-chat-header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.sg-chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sg-chat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8FAFC;
}

.sg-chat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #E6F0FA;
  color: #003875;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.sg-chat-msg-user {
  display: flex;
  justify-content: flex-end;
}

.sg-chat-bubble {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
}

.sg-chat-bubble-bot {
  background: #FFFFFF;
  color: #1E293B;
  border: 1px solid #E2E8F0;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.sg-chat-bubble-user {
  background: #003875;
  color: #FFFFFF;
  border-top-right-radius: 4px;
  font-weight: 500;
}

.sg-chat-footer {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
}

.sg-chat-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

.sg-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sg-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.sg-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.sg-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 767.98px) {
  .sg-chatbot-fab {
    bottom: 76px;
    right: 16px;
    width: 46px;
    height: 46px;
    font-size: 19px;
  }
  .sg-chatbot-card {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top, 12px)) !important;
    bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    z-index: 1080 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28) !important;
  }
  .sg-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
}

/* ─── PWA & Mobile Safe Area Enhancements ────────────────────────────────── */
@media (max-width: 767.98px) {
  /* Support status bar on notched devices */
  body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  .main-navbar {
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(var(--navbar-height) + env(safe-area-inset-top, 0px)) !important;
  }
  
  .sidebar {
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  /* Prevent the chat assistant FAB from overlapping bottom navigation */
  .sg-chatbot-fab {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ─── Scrollbar Hiding Utility ───────────────────────────────────────────── */
.hide-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
  display: none !important;  /* Chrome, Safari, Opera */
  width: 0 !important;
  height: 0 !important;
}

/* ─── Mobile Filters Drawer Custom Styling ───────────────────────────────── */
@media (max-width: 767.98px) {
  .w-100-mobile {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-top: 10px;
  }
  .w-100-mobile.d-none {
    display: none !important;
  }
  .w-100-mobile > select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-size: 12px !important;
  }
  .w-100-mobile > button,
  .w-100-mobile > a {
    grid-column: span 2 !important;
    width: 100% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Compact calendar day cells */
  .cal-day {
    min-height: 58px !important;
    padding: 4px !important;
  }
  .cal-num {
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }
  .cal-pill {
    font-size: 9px !important;
    padding: 1px 4px !important;
    margin-top: 1px !important;
    gap: 2px !important;
  }
  .cal-head-cell {
    padding: 6px 4px !important;
    font-size: 10px !important;
  }

  /* Compact stat cards */
  .stat-card {
    padding: 8px 10px !important;
    gap: 8px !important;
    min-height: 78px !important;
    height: auto !important;
  }
  .stat-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 13px !important;
    border-radius: 4px !important;
  }
  .stat-label {
    font-size: 9.5px !important;
    margin-bottom: 1px !important;
  }
  .stat-value {
    font-size: 14px !important;
  }
  .stat-sub {
    font-size: 8.5px !important;
    margin-top: 1px !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
  }
}

/* ── Bulk Action Floating Bar & Mobile Select All Toolbar ── */
.bulk-action-floating-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1070;
  max-width: calc(100vw - 20px);
  width: max-content;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .bulk-action-floating-bar {
    bottom: 24px;
  }
}

@media (max-width: 767.98px) {
  .bulk-action-floating-bar {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

.bulk-action-inner {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

.bulk-floating-divider {
  width: 1px;
  height: 18px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.mobile-bulk-bar {
  background: #ffffff;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 12px;
}

/* ── SG AI Styles & Pulse Animations ── */
.animate-pulse {
  animation: sgPulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes sgPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.05); }
}

.bg-purple { background-color: #8B5CF6 !important; }
.bg-purple-light { background-color: #F5F3FF !important; }
.text-purple { color: #8B5CF6 !important; }
.bg-danger-light { background-color: #FEF2F2 !important; }
.bg-success-light { background-color: #F0FDF4 !important; }
.bg-primary-light { background-color: #EEF2FF !important; }
.bg-info-light { background-color: #ECFEFF !important; }
.bg-secondary-light { background-color: #F8FAFC !important; }

/* ==========================================================================
   Small Desktop & Laptop Responsiveness (13", 14", 15" screens / 1024px - 1440px)
   Prevents content from getting pushed off-screen or hidden towards the right.
   ========================================================================== */

/* ── 1. Desktop Collapsible Sidebar (Toggles 240px to 64px Icon Rail) ── */
@media (min-width: 992px) {
  :root {
    --sidebar-collapsed-width: 64px;
  }

  /* Smooth layout transitions */
  .sidebar {
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .main-navbar {
    transition: left 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .main-content {
    transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  /* Collapsed layout states */
  .sidebar.collapsed,
  html.sidebar-is-collapsed .sidebar {
    width: var(--sidebar-collapsed-width, 64px) !important;
  }

  .main-navbar.sidebar-collapsed,
  html.sidebar-is-collapsed .main-navbar {
    left: var(--sidebar-collapsed-width, 64px) !important;
  }

  .main-content.sidebar-collapsed,
  html.sidebar-is-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width, 64px) !important;
  }

  /* Collapsed Logo */
  .sidebar.collapsed .sidebar-logo,
  html.sidebar-is-collapsed .sidebar .sidebar-logo {
    padding: 12px 6px !important;
    justify-content: center !important;
    gap: 0 !important;
  }

  .sidebar.collapsed .sidebar-logo img,
  html.sidebar-is-collapsed .sidebar .sidebar-logo img {
    height: 34px !important;
    width: auto !important;
    margin: 0 !important;
  }

  .sidebar.collapsed .sidebar-logo-text,
  html.sidebar-is-collapsed .sidebar .sidebar-logo-text {
    display: none !important;
  }

  /* Collapsed Section Labels */
  .sidebar.collapsed .sidebar-section-label,
  html.sidebar-is-collapsed .sidebar .sidebar-section-label {
    display: none !important;
  }

  /* Collapsed Sidebar Items (Icon Rail) */
  .sidebar.collapsed .sidebar-item,
  html.sidebar-is-collapsed .sidebar .sidebar-item {
    padding: 9px 0 !important;
    justify-content: center !important;
    margin: 3px 6px !important;
    position: relative !important;
    text-align: center !important;
  }

  .sidebar.collapsed .sidebar-item .nav-icon,
  html.sidebar-is-collapsed .sidebar .sidebar-item .nav-icon {
    margin: 0 !important;
    font-size: 18px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
  }

  /* Hide labels, badges, and trailing icons in collapsed state */
  .sidebar.collapsed .sidebar-item .sidebar-item-text,
  html.sidebar-is-collapsed .sidebar .sidebar-item .sidebar-item-text,
  .sidebar.collapsed .sidebar-item .badge,
  html.sidebar-is-collapsed .sidebar .sidebar-item .badge,
  .sidebar.collapsed .sidebar-item .badge-count,
  html.sidebar-is-collapsed .sidebar .sidebar-item .badge-count,
  .sidebar.collapsed .sidebar-item > i.ms-auto,
  html.sidebar-is-collapsed .sidebar .sidebar-item > i.ms-auto {
    display: none !important;
  }

  /* Hide complex nested teams list when collapsed */
  .sidebar.collapsed .sidebar-teams-section,
  html.sidebar-is-collapsed .sidebar .sidebar-teams-section {
    display: none !important;
  }

  /* Superadmin sidebar user profile in footer */
  .sidebar.collapsed .sidebar-footer,
  html.sidebar-is-collapsed .sidebar .sidebar-footer {
    padding: 8px 4px !important;
    text-align: center !important;
  }

  .sidebar.collapsed .sidebar-user,
  html.sidebar-is-collapsed .sidebar .sidebar-user {
    padding: 6px 0 !important;
    justify-content: center !important;
  }

  .sidebar.collapsed .sidebar-user-info,
  html.sidebar-is-collapsed .sidebar .sidebar-user-info {
    display: none !important;
  }

  /* Dedicated bottom sidebar collapse trigger */
  .sidebar-collapse-trigger {
    border-top: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--sidebar-text);
    cursor: pointer;
    align-items: center;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
  }
  .sidebar-collapse-trigger:hover {
    background: var(--sidebar-hover);
    color: var(--primary);
  }
  .sidebar.collapsed .sidebar-collapse-trigger,
  html.sidebar-is-collapsed .sidebar .sidebar-collapse-trigger {
    justify-content: center !important;
    padding: 10px 0 !important;
  }
  .sidebar.collapsed .sidebar-collapse-trigger .sidebar-item-text,
  html.sidebar-is-collapsed .sidebar .sidebar-collapse-trigger .sidebar-item-text {
    display: none !important;
  }
}



/* ── 2. Sticky Action Columns for All Data Tables ── */
.table-container {
  position: relative !important;
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  scrollbar-color: #94A3B8 #F1F5F9 !important;
}

.table-container::-webkit-scrollbar,
.kanban-scroll-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 6px !important;
  width: 6px !important;
}
.table-container::-webkit-scrollbar-track,
.kanban-scroll-container::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: #F1F5F9 !important;
  border-radius: 3px !important;
}
.table-container::-webkit-scrollbar-thumb,
.kanban-scroll-container::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: #94A3B8 !important;
  border-radius: 3px !important;
}
.table-container::-webkit-scrollbar-thumb:hover,
.kanban-scroll-container::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #64748B !important;
}

/* Make table actions sticky on the right */
.table-container table,
.table-responsive table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

.table-container th:last-child:not([colspan]),
.table-container td:last-child:not([colspan]),
.table-responsive th:last-child:not([colspan]),
.table-responsive td:last-child:not([colspan]) {
  position: sticky !important;
  right: 0 !important;
  background-color: #FFFFFF !important;
  z-index: 5 !important;
  box-shadow: -4px 0 6px -2px rgba(0, 0, 0, 0.07) !important;
  overflow: visible !important;
}

.table-container thead th:last-child:not([colspan]),
.table-responsive thead th:last-child:not([colspan]) {
  background-color: #F8FAFC !important;
  z-index: 6 !important;
}

.table-container tbody tr:hover td:last-child:not([colspan]),
.table-responsive tbody tr:hover td:last-child:not([colspan]) {
  background-color: #F1F5F9 !important;
}

/* Table dropdown stacking context fix: ensure active dropdowns and their row/cell sit above all sticky rows */
.table-container tr:has(.show),
.table-container td:has(.show),
.table-responsive tr:has(.show),
.table-responsive td:has(.show),
.table tr:has(.show),
.table td:has(.show),
.table-container tr:has([aria-expanded="true"]),
.table-container td:has([aria-expanded="true"]),
.table-responsive tr:has([aria-expanded="true"]),
.table-responsive td:has([aria-expanded="true"]) {
  z-index: 1060 !important;
}

.table-container .dropdown-menu,
.table-responsive .dropdown-menu,
.table .dropdown-menu {
  z-index: 1065 !important;
}

/* ── 3. High-Density Compact Layout for 13" - 15" Laptops (≤ 1440px) ── */
@media (max-width: 1440px) {
  .page-content {
    padding: 14px 12px !important;
    max-width: 100% !important;
  }

  .main-navbar {
    padding: 0 14px !important;
    gap: 8px !important;
  }

  .main-navbar .navbar-ai-search {
    max-width: 280px !important;
  }

  /* Table density on laptop */
  .table th, 
  .table td {
    padding: 7px 8px !important;
    font-size: 12px !important;
  }
  .table th {
    font-size: 10.5px !important;
    letter-spacing: 0.03em !important;
  }

  /* Status badge compactness */
  .badge-status-modern {
    min-width: 90px !important;
    max-width: 120px !important;
    padding: 3px 6px !important;
    font-size: 11px !important;
  }

  .lead-filter-toolbar select {
    font-size: 11.5px !important;
    height: 30px !important;
    padding: 2px 6px !important;
    min-width: 90px !important;
  }

  .page-header {
    margin-bottom: 16px !important;
  }
  .page-header-title h1 {
    font-size: 17px !important;
  }
  .page-header-actions .btn {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }
}

/* ── 4. Medium Laptop Breakpoints (≤ 1280px, e.g. 15" at 150% Windows scaling) ── */
@media (max-width: 1280px) {
  .main-navbar .navbar-ai-search {
    max-width: 200px !important;
  }
  .main-navbar .navbar-title {
    font-size: 13px !important;
    max-width: 140px !important;
  }

  /* Lead type tabs */
  .lead-type-tab-btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
  }

  /* Stat cards responsive scaling */
  .stat-card-value {
    font-size: 18px !important;
  }
}
