/* Google Material 3 Design System - Sender Pool Platform */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500;600&display=swap');

:root {
  /* Google Color Palette */
  --google-blue: #1a73e8;
  --google-blue-hover: #1557b0;
  --google-blue-light: #e8f0fe;
  --google-blue-dark: #174ea6;
  
  --google-green: #1e8e3e;
  --google-green-hover: #137333;
  --google-green-light: #e6f4ea;
  --google-green-dark: #0d652d;

  --google-red: #d93025;
  --google-red-hover: #b31412;
  --google-red-light: #fce8e6;

  --google-amber: #f9ab00;
  --google-amber-hover: #e37400;
  --google-amber-light: #fef7e0;
  --google-amber-dark: #b06000;

  --google-purple: #9334e6;
  --google-purple-light: #f3e8fd;

  /* Neutral Slate Surface & Text Colors */
  --surface-bg: #f8fafd;
  --surface-card: #ffffff;
  --surface-hover: #f1f3f4;
  --surface-active: #e8eaed;
  
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --text-on-primary: #ffffff;
  
  --border-subtle: #dadce0;
  --border-light: #e8eaed;
  --border-focus: #1a73e8;

  /* Google Material Elevations */
  --elevation-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --elevation-2: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --elevation-3: 0 2px 6px 2px rgba(60,64,67,.15), 0 1px 2px 0 rgba(60,64,67,.3);
  --elevation-modal: 0 8px 24px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Theme Design Tokens ────────────────────────────────────────────── */
body.dark-mode, [data-theme="dark"] {
  --surface-bg: #0f1117;
  --surface-card: #181b22;
  --surface-hover: #222734;
  --surface-active: #2d3345;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-on-primary: #ffffff;
  
  --border-subtle: #334155;
  --border-light: #232836;
  --border-focus: #3b82f6;

  --google-blue: #3b82f6;
  --google-blue-hover: #2563eb;
  --google-blue-light: rgba(59, 130, 246, 0.15);
  --google-blue-dark: #93c5fd;

  --google-green: #10b981;
  --google-green-hover: #059669;
  --google-green-light: rgba(16, 185, 129, 0.15);
  --google-green-dark: #6ee7b7;

  --google-red: #ef4444;
  --google-red-hover: #dc2626;
  --google-red-light: rgba(239, 68, 68, 0.15);

  --google-amber: #f59e0b;
  --google-amber-hover: #d97706;
  --google-amber-light: rgba(245, 158, 11, 0.15);
  --google-amber-dark: #fcd34d;

  --elevation-1: 0 1px 3px rgba(0,0,0,0.4);
  --elevation-2: 0 4px 12px rgba(0,0,0,0.5);
  --elevation-3: 0 8px 24px rgba(0,0,0,0.6);
  --elevation-modal: 0 16px 40px rgba(0,0,0,0.7);
}

body.dark-mode .form-control {
  background: #111319;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-mode .form-control:focus {
  background: #151821;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

body.dark-mode .google-table th {
  background: #13151c;
  color: #94a3b8;
  border-bottom-color: #232836;
}

body.dark-mode .google-table td {
  border-bottom-color: #232836;
  color: #e2e8f0;
}

body.dark-mode .google-table tr:hover td {
  background: #1c202a;
}

body.dark-mode .modal-box {
  background: #181b22;
  border: 1px solid #334155;
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  background: #13151c;
  border-color: #232836;
}

body.dark-mode .modal-body {
  background: #181b22;
}

body.dark-mode .tenant-chip {
  background: #232836;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .tenant-chip strong {
  color: #f1f5f9;
}

body.dark-mode .toast {
  background: #1c202a;
  color: #f1f5f9;
  border-color: #334155;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--surface-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* App Bar / Top Navigation */
.google-appbar {
  background: var(--surface-card);
  height: 64px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.06);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 4px rgba(26,115,232,0.3);
}

.brand-logo.crm {
  background: linear-gradient(135deg, #1e8e3e 0%, #137333 100%);
  box-shadow: 0 2px 4px rgba(30,142,62,0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tenant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--google-blue-light);
  color: var(--google-blue-dark);
  border: 1px solid rgba(26,115,232,0.2);
}

.tenant-chip.company {
  background: var(--google-green-light);
  color: var(--google-green-dark);
  border-color: rgba(30,142,62,0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Layout container */
.app-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* Sidebar Navigation Rail */
.nav-sidebar {
  width: 260px;
  background: var(--surface-card);
  border-right: 1px solid var(--border-light);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 600;
  border-left: 3.5px solid #1a73e8;
  border-radius: 4px var(--radius-xl) var(--radius-xl) 4px;
}

.nav-item.active svg,
.nav-item.active .icon-svg {
  stroke: #1a73e8;
}

.nav-item.crm-active {
  background: #e6f4ea;
  color: #137333;
  font-weight: 600;
  border-left: 3.5px solid #1e8e3e;
  border-radius: 4px var(--radius-xl) var(--radius-xl) 4px;
}

.nav-item.crm-active svg,
.nav-item.crm-active .icon-svg {
  stroke: #1e8e3e;
}

body.dark-mode .nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.08) 100%) !important;
  color: #93c5fd !important;
  font-weight: 600 !important;
  border-left: 3.5px solid #3b82f6 !important;
  box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.12);
}

body.dark-mode .nav-item.active svg,
body.dark-mode .nav-item.active .icon-svg {
  stroke: #60a5fa !important;
}

body.dark-mode .nav-item.crm-active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.22) 0%, rgba(16, 185, 129, 0.08) 100%) !important;
  color: #6ee7b7 !important;
  font-weight: 600 !important;
  border-left: 3.5px solid #10b981 !important;
  box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.12);
}

body.dark-mode .nav-item.crm-active svg,
body.dark-mode .nav-item.crm-active .icon-svg {
  stroke: #34d399 !important;
}

/* Scalable Vector Icons */
.icon-svg {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-svg.sm {
  width: 16px;
  height: 16px;
}

.icon-svg.lg {
  width: 28px;
  height: 28px;
}

.icon-svg.xl {
  width: 48px;
  height: 48px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Google Cards */
.google-card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--elevation-1);
  padding: 24px;
  margin-bottom: 24px;
  transition: box-shadow var(--transition-fast);
}

.google-card:hover {
  box-shadow: var(--elevation-2);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat Metric Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--elevation-1);
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--text-tertiary);
}

.stat-card.green::before { background: var(--google-green); }
.stat-card.blue::before { background: var(--google-blue); }
.stat-card.amber::before { background: var(--google-amber); }
.stat-card.red::before { background: var(--google-red); }
.stat-card.purple::before { background: var(--google-purple); }

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

.stat-card.green .stat-value { color: var(--google-green-dark); }
.stat-card.blue .stat-value { color: var(--google-blue-dark); }
.stat-card.amber .stat-value { color: var(--google-amber-dark); }
.stat-card.red .stat-value { color: var(--google-red); }

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

/* Tables */
.table-container {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--elevation-1);
  overflow: hidden;
}

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

.google-table thead {
  background-color: var(--surface-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.google-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.google-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.google-table tbody tr:hover {
  background-color: #f8fafc;
}

.google-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-free     { background: var(--google-green-light); color: var(--google-green-dark); }
.badge-assigned { background: var(--google-blue-light); color: var(--google-blue-dark); }
.badge-warming  { background: var(--google-amber-light); color: var(--google-amber-dark); }
.badge-cooldown { background: var(--google-red-light); color: var(--google-red); }
.badge-unlinked { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

.badge-waba     { background: var(--google-blue-light); color: var(--google-blue-dark); border: 1px solid var(--border-subtle); }
.badge-baileys  { background: var(--google-purple-light); color: var(--google-purple); border: 1px solid var(--border-subtle); }

/* Badges in Dark Mode */
body.dark-mode .badge-free     { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
body.dark-mode .badge-assigned { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
body.dark-mode .badge-warming  { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
body.dark-mode .badge-cooldown { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }
body.dark-mode .badge-unlinked { background: #20242e; color: #94a3b8; border: 1px solid #334155; }

body.dark-mode .badge-waba     { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
body.dark-mode .badge-baileys  { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.35); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.38);
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-success:hover {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.38);
  color: #ffffff;
}

.btn-danger {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  font-weight: 600;
}
.btn-danger:hover {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.35);
}

body.dark-mode .btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}
body.dark-mode .btn-danger:hover {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.45);
}

.btn-outline {
  background: var(--surface-card);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
}
.btn-outline:hover {
  background: var(--google-blue-light);
  border-color: var(--google-blue);
  color: var(--google-blue);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.18);
}

.btn-secondary {
  background: var(--surface-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
}
.btn-secondary:hover {
  background: var(--surface-active);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Dark Mode Outline & Secondary Buttons */
body.dark-mode .btn-outline {
  background: #181d28;
  border-color: #2d4a77;
  color: #93c5fd;
}
body.dark-mode .btn-outline:hover {
  background: #1e293b;
  border-color: #3b82f6;
  color: #bfdbfe;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}

body.dark-mode .btn-secondary {
  background: #1e222d;
  border-color: #334155;
  color: #cbd5e1;
}
body.dark-mode .btn-secondary:hover {
  background: #282f3d;
  border-color: #475569;
  color: #f1f5f9;
}

.btn-text {
  background: transparent;
  color: var(--google-blue);
  padding: 6px 12px;
  font-weight: 600;
  box-shadow: none;
}
.btn-text:hover {
  background: var(--google-blue-light);
  color: var(--google-blue-hover);
  transform: none;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-pill {
  border-radius: var(--radius-full);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Pagination Component */
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: var(--google-blue-light);
  border-color: var(--google-blue);
  color: var(--google-blue);
}

.pagination-btn.active {
  background: var(--google-blue);
  border-color: var(--google-blue);
  color: #ffffff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color 0.2s ease, color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--google-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.font-mono {
  font-family: 'Roboto Mono', monospace !important;
}

/* Explicit Dark Mode Input Overrides (Guaranteed High Contrast) */
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select,
body.dark-mode .form-control {
  background-color: #141720 !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="time"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2);
  cursor: pointer;
  opacity: 0.9;
}

body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus,
body.dark-mode .form-control:focus {
  background-color: #181c26 !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3) !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #64748b !important;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-modal);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(15px) scale(0.98);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  line-height: 1;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-bg);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--elevation-2);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideUp 200ms ease-out forwards;
}

.toast.success { background: #137333; }
.toast.error   { background: #c5221f; }
.toast.info    { background: #1a73e8; }

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

/* Progress bar */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #f1f3f4;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--google-amber);
  border-radius: 3px;
  transition: width var(--transition-normal);
}

/* QR Code Display Container */
.qr-scanner-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

.qr-frame {
  position: relative;
  display: inline-block;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-1);
  border: 2px dashed var(--google-blue);
  margin: 16px 0;
}

.qr-frame img {
  display: block;
  border-radius: var(--radius-sm);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner.dark {
  border-color: rgba(0,0,0,0.2);
  border-top-color: var(--google-blue);
}

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

/* Variable Pills */
.var-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: #e8f0fe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  transition: all 0.15s ease;
}
.var-pill:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-1px);
}
body.dark-mode .var-pill {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
body.dark-mode .var-pill:hover {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* WhatsApp Live Preview & Chat Viewer */
.wa-preview-wrap {
  background: #efeae2;
  border: 1px solid #dcd7ce;
  border-radius: 12px;
  padding: 18px 16px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.wa-bubble-preview {
  max-width: 82%;
  margin-left: auto;
  background: #d9fdd3;
  color: #111b21;
  border: 1px solid #c4e9be;
  border-radius: 10px 10px 2px 10px;
  padding: 12px 16px 8px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

.chat-window {
  background: #efeae2;
  border-radius: var(--radius-md);
  padding: 16px;
  height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  position: relative;
  word-break: break-word;
}

.chat-bubble.inbound {
  align-self: flex-start;
  background: #ffffff;
  color: #111b21;
  border-top-left-radius: 2px;
}

.chat-bubble.outbound {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111b21;
  border-top-right-radius: 2px;
}

.chat-bubble-meta {
  font-size: 10px;
  color: #667781;
  text-align: right;
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* Dark Mode Chat & Preview Overrides */
body.dark-mode .wa-preview-wrap {
  background: #0b141a;
  border: 1px solid #1f2c34;
}

body.dark-mode .wa-bubble-preview {
  background: linear-gradient(180deg, #005c4b 0%, #004d3e 100%);
  color: #e9edef;
  border: 1px solid rgba(0, 168, 132, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.dark-mode .wa-bubble-preview strong {
  color: #ffffff;
}

body.dark-mode .chat-window {
  background: #0b141a;
}

body.dark-mode .chat-bubble.inbound {
  background: #202c33;
  color: #e9edef;
}

body.dark-mode .chat-bubble.outbound {
  background: linear-gradient(180deg, #005c4b 0%, #004d3e 100%);
  color: #e9edef;
  border: 1px solid rgba(0, 168, 132, 0.3);
}

body.dark-mode .chat-bubble-meta {
  color: #8696a0;
}

/* Responsive Hamburger & Drawer */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  color: var(--text-primary);
  border-radius: var(--radius-xs);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .menu-toggle {
    display: block;
  }

  .nav-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    z-index: 95;
    transform: translateX(-100%);
    box-shadow: var(--elevation-2);
  }

  .nav-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    padding: 20px 16px;
  }
}

@media (max-width: 768px) {
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 12px auto;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
  }

  .google-card {
    padding: 16px;
  }

  #c-onboarding-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .google-appbar {
    padding: 0 14px;
  }

  .brand-title {
    font-size: 15px;
  }

  .tenant-chip {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

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

  .google-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .btn {
    padding: 7px 14px;
    font-size: 12.5px;
  }
}

/* ── Interactive Info Tip (i) Component ───────────────────────────────────── */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  color: var(--text-tertiary);
  margin-left: 4px;
  vertical-align: middle;
  transition: color var(--transition-fast);
}

.info-tip:hover {
  color: var(--google-blue);
}

.info-tip .tip-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  pointer-events: none;
}

.info-tip .tip-box {
  display: none; /* Handled by global floating tooltip to prevent container clipping */
}

/* Global Floating Tooltip (renders at document.body level) */
.global-floating-tooltip {
  position: fixed;
  z-index: 999999;
  background: #202124;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 280px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  white-space: normal;
  text-align: left;
}

.global-floating-tooltip.arrow-down::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #202124 transparent transparent transparent;
}

.global-floating-tooltip.arrow-up::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent #202124 transparent;
}
