:root {
  /* Premium Dashboard Colors (Reference from Image) */
  --primary: #4318FF; /* Royal Blue */
  --primary-hover: #3311db;
  --primary-light: #e9e3ff;
  
  --accent: #FFB547; /* Yellow Accent */
  --success: #05CD99; /* Green Accent */
  --danger: #EE5D50; /* Red Accent */
  --info: #39B8FF; /* Light Blue Accent */

  /* Light Theme Backgrounds & Surfaces */
  --bg-color: #F4F7FE; /* Very light gray/blue */
  --surface: #ffffff; /* Pure White Cards */
  --surface-raised: #ffffff;
  --glass: rgba(255, 255, 255, 0.7);

  /* Text */
  --text-main: #2B3674; /* Deep Navy Blue for main text (Premium) */
  --text-muted: #A3AED0; /* Soft Gray for subtitles */
  --border: #E0E5F2; /* Soft Border */

  /* Layout & Shadows */
  --sidebar-w: 260px;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 14px 24px rgba(112, 144, 176, 0.08); /* Soft diffuse shadow */
  --shadow-lg: 0 18px 40px rgba(112, 144, 176, 0.12);
  --shadow-primary: 0 10px 20px rgba(67, 24, 255, 0.25); /* Glow for primary buttons */

  /* Legacy variables mappings to not break existing JS if any */
  --ink: var(--text-main);
  --ink-soft: var(--text-muted);
  --paper: var(--bg-color);
  --paper-raised: var(--surface);
  --indigo: var(--primary);
  --indigo-soft: var(--primary-hover);
  --mustard: var(--accent);
  --line: var(--border);
  --bg: var(--bg-color);
  --text: var(--text-main);
}

body.dark-theme {
  --primary: #4318FF;
  --primary-hover: #7551FF;
  --primary-light: rgba(67, 24, 255, 0.2);

  --bg-color: #0B1437;
  --surface: #111C44;
  --surface-raised: #1B254B;
  --glass: rgba(17, 28, 68, 0.8);

  --text-main: #FFFFFF;
  --text-muted: #A3AED0;
  --border: #2B3674;

  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 14px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.4);
  --shadow-primary: 0 10px 20px rgba(67, 24, 255, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
.brand-name,
.nav-item {
  font-family: 'Space Grotesk', sans-serif;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- LOGIN SCREEN ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(80px);
  -webkit-backdrop-filter: blur(80px);
  z-index: 1;
}

.login-card {
  position: relative;
  z-index: 2;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 48px 40px;
  border-radius: 24px;
  width: 420px;
  max-width: 90vw;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-3d);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  0% {
    transform: translateY(40px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.login-logo {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 0 auto 2rem;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

.login-card h3 {
  font-size: 24px;
  margin: 0 0 8px;
  color: var(--text-main);
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 32px;
}

.login-card input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-main);
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
  font-weight: 500;
}

/* ---- BUTTONS ---- */
button {
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  border: none;
  background: none;
  outline: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7551FF 100%);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.5);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-logout-premium {
  margin-top: auto;
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(239, 68, 68, 0.1);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Space Grotesk', sans-serif;
}

.btn-logout-premium:hover {
  background: var(--danger);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: var(--border);
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--primary-light);
}

.btn-icon.danger {
  color: var(--danger);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}


/* ---- APP LAYOUT ---- */
.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg-color);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: none;
  box-shadow: 4px 0 24px rgba(112, 144, 176, 0.08);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 0 8px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0 4px 4px 0;
}

.nav-item:hover {
  background: rgba(67, 24, 255, 0.04);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, #7551FF 100%);
  color: white;
  box-shadow: var(--shadow-primary);
  transform: translateY(-2px);
}

.nav-item.active::before {
  display: none;
}

.nav-item.active .nav-num {
  color: white;
  opacity: 0.8;
}

.sidebar-foot {
  margin-top: auto;
  padding: 20px 10px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: center;
  font-weight: 500;
}

/* Mobile Header (Hamburger) */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.hamburger-btn {
  background: var(--bg-color);
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.hamburger-btn:hover {
  background: var(--surface);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.main {
  flex: 1;
  padding: 40px 48px;
  overflow-y: auto;
  position: relative;
  margin-left: var(--sidebar-w);
}

.view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.view-header h2 {
  font-size: 28px;
  margin: 0;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.view-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

/* ---- STAT CARDS (3D & Glass) ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-value.accent {
  color: var(--primary);
}

/* ---- TABLES ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px; /* Adds space between rows to make them look like cards */
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  background: var(--surface);
  transition: transform 0.2s, box-shadow 0.2s;
}

tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  z-index: 1;
  position: relative;
}

tbody td {
  padding: 16px;
  color: var(--text-main);
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

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

tr {
  transition: background 0.2s;
}

tr:hover td {
  background: var(--bg-color);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: capitalize;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

.badge-paid {
  background: rgba(59, 130, 246, 0.15); /* Blue */
  color: #2563eb;
}

.badge-confirmed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-delivered {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* Specific Order status fixes */
.badge-status-new {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

.badge-status-sourcing {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-status-found {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-status-fulfilled {
  background: var(--bg-color);
  color: var(--text-muted);
}

/* ---- CONVERSATIONS (Split Screen) ---- */
.conv-layout {
  display: flex;
  gap: 24px;
  height: calc(100vh - 120px);
}

.conv-list-wrap {
  width: 350px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
}

.conv-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.conv-item:hover {
  background: var(--bg-color);
}

.conv-item.active {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}

.conv-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--text-main);
}

.conv-phone {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}

.conv-thread-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.conv-thread-header {
  padding: 16px 24px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-thread {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
}

.conv-empty {
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
  margin-bottom: auto;
  font-size: 15px;
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.chat-bubble.customer {
  align-self: flex-start;
  background: var(--bg-color);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-bubble.ai {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble-time {
  font-size: 11px;
  margin-top: 6px;
  text-align: right;
  opacity: 0.7;
}

/* ---- INSIGHTS & CARDS ---- */
.insights-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.insights-section h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text-main);
}

.lead-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--bg-color);
  transition: all 0.2s ease;
}

.lead-card:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.lead-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.lead-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.lead-reason {
  font-size: 13px;
  color: var(--text-muted);
}

.lead-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
}

.lead-badge.juu {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.lead-badge.wastani {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

.lead-badge.chini {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.modal {
  background: var(--surface);
  padding: 32px;
  border-radius: 24px;
  width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-3d);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: scale(1) translateY(0);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.hidden .modal {
  transform: scale(0.95) translateY(20px);
}

.modal h3 {
  margin: 0 0 24px;
  color: var(--text-main);
  font-size: 22px;
}

.modal label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text-main);
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- WHATSAPP STATUS CARD ---- */
.whatsapp-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.ws-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.ws-body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

#whatsappStatusCard {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(30, 41, 59, 0.5) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

#whatsappStatusCard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--indigo));
  opacity: 0.8;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
  padding: 32px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

#qrcode img {
  border: 8px solid white;
  border-radius: 16px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

#qrcode img:hover {
  transform: scale(1.02);
}

.pairing-code-section input {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pairing-code-section #pairCodeDisplay {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Add a pulse animation to the badge when connecting or waiting */
@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); }
  100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}
.badge.disconnected {
  animation: pulseGlow 2s infinite;
}

/* BOT TOGGLE */
.bot-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.bot-toggle-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-toggle-icon {
  font-size: 24px;
}

.bot-toggle-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.bot-toggle-sublabel {
  font-size: 13px;
  color: var(--text-muted);
}

.bot-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 12px;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.bot-toggle-btn.bot-toggle-active {
  background: var(--success);
  color: white;
}

.bot-toggle-btn.bot-toggle-paused {
  background: var(--danger);
  color: white;
}

.bot-toggle-pill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
}

/* ---- MOBILE RESPONSIVENESS (Hamburger Menu Strategy) ---- */
@media (max-width: 1024px) {
  .main {
    padding: 32px 24px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .conv-layout {
    flex-direction: column;
    height: auto;
  }

  .conv-list-wrap {
    width: 100%;
    height: 350px;
    margin-bottom: 20px;
  }

  .conv-thread-wrap {
    height: 500px;
  }

  .view-header .btn-primary {
    position: static;
    margin-top: 16px;
    display: inline-block;
  }
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  /* Mobile Header overrides */
  .mobile-header {
    display: flex;
  }

  /* Sidebar off-canvas */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-3d);
    z-index: 999;
  }

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

  /* Overlay for sidebar */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
  }

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

  .main {
    padding: 24px 16px;
    margin-top: 0;
    margin-left: 0;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .whatsapp-status-card {
    padding: 20px;
  }

  .qr-container {
    padding: 20px 10px;
  }

  .pairing-code-section {
    padding-top: 20px !important;
  }

  /* Modal responsive */
  .modal {
    width: 95%;
    padding: 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
/* --- TERMS AND CONDITIONS PREMIUM STYLING --- */
.terms-modal {
  max-width: 700px !important;
  border-top: 5px solid var(--primary);
  border-radius: var(--radius) var(--radius) var(--radius) var(--radius);
  overflow: hidden;
}

.terms-modal .modal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px;
}

.terms-modal .modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  color: var(--primary-hover);
}

.terms-modal .modal-header h3::before {
  content: '🛡️';
  font-size: 26px;
}

.terms-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-color);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-main);
}

.terms-body h4 {
  color: var(--text-main);
  font-family: 'Space Grotesk', sans-serif;
  margin-top: 24px;
  margin-bottom: 10px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.terms-body h4::before {
  content: '✓';
  color: var(--primary);
  background: var(--primary-light);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.terms-body ul {
  list-style: none;
  padding-left: 10px;
}

.terms-body ul li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.terms-body ul li::before {
  content: '•';
  color: var(--primary);
  position: absolute;
  left: 0;
  top: -2px;
  font-size: 20px;
  font-weight: bold;
}

.terms-modal .modal-footer {
  background: var(--surface);
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

/* ---- ONBOARDING WIZARD ---- */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.onboarding-modal {
  transition: all 0.3s ease;
}

.ob-step {
  width: 100%;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}
.stat-value.accent {
  color: var(--primary);
}

/* ---- PREMIUM UI ADDITIONS ---- */
.premium-hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, #7551FF 100%);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-primary);
  position: relative;
  overflow: hidden;
  border: none !important;
}
.premium-hero-card > div {
  position: relative;
  z-index: 2;
}
.premium-hero-card * {
  color: white;
}
.premium-hero-card .muted {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Glass effect for hero card accents */
.premium-hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  backdrop-filter: blur(20px);
  z-index: 1;
  pointer-events: none;
}

.premium-hero-card::before {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -10%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  backdrop-filter: blur(20px);
  z-index: 1;
  pointer-events: none;
}

/* Clean Cards */
.card {
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Icon Boxes */
.icon-box-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 600px) {
  .icon-box-grid { grid-template-columns: repeat(2, 1fr); }
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}
.icon-item:hover {
  transform: scale(1.05);
}

.icon-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.icon-box-danger { background: rgba(238, 93, 80, 0.1); color: var(--danger); }
.icon-box-primary { background: rgba(67, 24, 255, 0.1); color: var(--primary); }
.icon-box-accent { background: rgba(255, 181, 71, 0.1); color: var(--accent); }
.icon-box-success { background: rgba(5, 205, 153, 0.1); color: var(--success); }
.icon-box-info { background: rgba(57, 184, 255, 0.1); color: var(--info); }

.icon-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
}

/* Clean Lists (Recent Transactions style) */
.clean-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.clean-list-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
  border: 1px solid var(--border);
}
.clean-list-item:hover {
  transform: translateX(4px);
  border-color: var(--primary-light);
}
.cli-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 16px;
}
.cli-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.cli-details {
  flex: 1;
}
.cli-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.cli-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.cli-value {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  text-align: right;
}
.cli-value-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
