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

:root {
  /* --- PALETTE (TWINNIE) --- */
  --brand-primary: #0033D9;
  /* Twinnie Blue */
  --brand-accent: #14C9C9;
  /* Intelligence Teal */

  /* --- LIGHT THEME (ARTIC HORIZON) --- */
  --bg-main: #f8fafc;
  /* Pale Arctic Blue-Grey */
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-nav: #ffffff;
  /* White Sidebar */
  --border-glass: rgba(0, 51, 217, 0.08);
  --border-active: rgba(20, 201, 201, 0.4);
  --text-main: #0f172a;
  /* Slate 900 */
  --text-dim: #475569;
  /* Slate 600 */
  --text-muted: #64748b;
  /* Slate 500 */
  --shadow-immersive: 0 20px 50px -12px rgba(0, 51, 217, 0.08);
  --shadow-tactile: 0 4px 15px rgba(0, 51, 217, 0.04);
  --shadow-vr: 20px 40px 80px -20px rgba(0, 51, 217, 0.05);
  --aura-color: rgba(0, 51, 217, 0.02);
  --input-bg: #ffffff;
  --card-bg: #ffffff;

  /* --- THEME-AWARE COMPONENTS --- */
  --sidebar-text: #64748b;
  --sidebar-active-text: #0f172a;
  --sidebar-active-bg: rgba(0, 51, 217, 0.06);
  --sidebar-label: #94a3b8;
  --logo-primary: #0033D9;
  --logo-accent: #14C9C9;
}

[data-theme="dark"] {
  --bg-main: #020617;
  /* Midnight Navy */
  --bg-card: rgba(15, 23, 42, 0.6);
  --bg-nav: #010413;
  /* Deeper Midnight */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(20, 201, 201, 0.5);
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #475569;
  --shadow-immersive: 0 20px 60px -12px rgba(0, 0, 0, 0.8);
  --shadow-tactile: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-vr: 0 40px 100px -20px rgba(0, 51, 217, 0.2);
  --aura-color: rgba(0, 51, 217, 0.15);
  --input-bg: rgba(255, 255, 255, 0.03);
  --card-bg: rgba(255, 255, 255, 0.02);

  /* --- THEME-AWARE COMPONENTS (DARK) --- */
  --sidebar-text: rgba(255, 255, 255, 0.5);
  --sidebar-active-text: #ffffff;
  --sidebar-active-bg: rgba(0, 51, 217, 0.15);
  --sidebar-label: rgba(255, 255, 255, 0.25);
  --logo-primary: #ffffff;
  --logo-accent: #14C9C9;
}

/* --- THE NEURAL GRID (GENERIC GLASS CLASSES) --- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: var(--shadow-immersive);
}

.glass-input {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
}

.glass-input:focus {
  outline: none;
  border-color: var(--brand-accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(20, 201, 201, 0.1);
}

.neural-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

/* Cinematic Reveal Animations */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- RESET & GLOBAL --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

h1,
h2,
h3,
.logo-font {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

.logo-themed {
  transition: all 0.4s ease;
  filter: none;
}

[data-theme="dark"] .logo-themed {
  /* Invert brand blue to high-contrast white for dark mode */
  filter: brightness(0) invert(1);
}

/* --- MAD DESIGN VR COMPONENTS --- */

/* Immersive Mesh Glow (Neural Tracker) */
.mesh-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--aura-color), transparent 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: background 0.5s ease;
}

/* 3D VR Tilt Card */
.tilt-card {
  transition: transform 0.1s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
}

/* Glass Panel (Immersive Luxe) */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 32px;
  box-shadow: var(--shadow-immersive);
  position: relative;
  z-index: 1;
}

/* --- THE NEURAL AMBIENCE (AUTH BG) --- */
.neural-bg {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  overflow: hidden;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.5;
  animation: float 20s infinite alternate ease-in-out;
}

.orb-primary {
  width: 600px;
  height: 600px;
  background: var(--brand-primary);
  top: -200px;
  left: -200px;
}

.orb-accent {
  width: 500px;
  height: 500px;
  background: var(--brand-accent);
  bottom: -200px;
  right: -200px;
  animation-delay: -5s;
}

@keyframes float {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(100px, -50px) scale(1.1);
  }
}

/* Premium Buttons */
.btn-premium {
  background: var(--brand-primary);
  color: white;
  padding: 16px 36px;
  border-radius: 100px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 15px 35px rgba(0, 51, 217, 0.15);
}

.btn-premium:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 51, 217, 0.25);
}

.btn-secondary {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 16px 36px;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: var(--shadow-tactile);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

[data-theme="light"] .btn-secondary {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.btn-glass-primary {
  background: var(--brand-primary);
  color: white;
  padding: 14px 28px;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 51, 217, 0.2);
}

.btn-glass-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0, 51, 217, 0.3);
  filter: brightness(1.1);
}

.btn-glass-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-glass-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Theme Toggle Button */
#theme-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

#theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
  border-color: var(--brand-accent);
}

/* --- HERO & VR EFFECTS --- */
.hero-visual-box {
  position: relative;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: var(--shadow-vr);
}

.hero-visual-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 51, 217, 0.2), transparent);
}

.headline-giant {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
}

/* Chat Demo (Neural) */
.chat-demo-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  padding: 18px 24px;
  border-radius: 20px;
  max-width: 80%;
  font-size: 1rem;
  animation: slide-up-fade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(30px) translateZ(50px);
  }

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

.bubble-customer {
  align-self: flex-start;
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.bubble-ai {
  align-self: flex-end;
  background: var(--brand-primary);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 10px 20px rgba(0, 51, 217, 0.3);
}

/* --- UTILS --- */
.grid-gap-xl {
  display: grid;
  gap: 64px;
}

.text-gradient {
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pain-header {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 800;
  font-size: 0.75rem;
  margin-bottom: 16px;
}

/* --- LANDING PAGE EXTENSIONS --- */

.process-step {
  position: relative;
  padding: 60px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 48px;
  box-shadow: var(--shadow-tactile);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.process-step:hover {
  transform: translateY(-12px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-vr);
}

.step-number {
  position: absolute;
  top: -24px;
  left: 60px;
  background: var(--brand-primary);
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 12px 24px rgba(0, 51, 217, 0.2);
}

.glow-icon-box {
  width: 90px;
  height: 90px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-tactile);
  cursor: pointer;
}

.glow-icon-box:hover {
  transform: translateY(-5px) rotate(3deg);
  border-color: var(--brand-accent);
  box-shadow: 0 10px 25px rgba(20, 201, 201, 0.15);
}

.testimonial-card {
  padding: 48px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 40px;
  box-shadow: var(--shadow-tactile);
  position: relative;
  transition: all 0.4s;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 24px 0;
  cursor: pointer;
  transition: all 0.3s;
}

.faq-item:hover {
  padding-left: 12px;
  border-color: var(--brand-primary);
}

.faq-question {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin-top 0.4s ease;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0;
}

.faq-active .faq-answer {
  max-height: 200px;
  margin-top: 16px;
}

.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 24px;
  color: var(--text-main);
  font-weight: 800;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 14px;
}

.footer-col ul li a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.footer-col ul li a:hover {
  color: var(--brand-primary);
}

/* Auth Pages (Tactile Form Styling) */
.neural-form-container {
  max-width: 480px;
  width: 100%;
}

/* ==========================================
   V4.6: THE SCALING PULSE (MOBILE OVERHAUL)
   ========================================== */

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sidebar {
    width: 280px;
    position: fixed;
    left: -280px;
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
  }

  .sidebar.active {
    left: 0;
  }

  .main-content {
    padding: 20px;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 11, 14, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
  }

  .mobile-nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
  }

  /* Tab Layouts */
  .tab-content[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Chat UI Mobile */
  .chat-interface {
    height: calc(100vh - 140px);
  }

  .chat-panel {
    display: none;
    /* Hide chat list by default on small mobile */
  }

  .chat-panel.active {
    display: flex;
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: var(--bg-dark);
  }

  .message {
    max-width: 90%;
  }
}

/* Sidebar Overlay for Mobile */
#sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1500;
}

#sidebar-overlay.active {
  display: block;
}

.neural-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--input-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  color: var(--text-main);
  font-size: 1rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.3s;
}

.neural-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(0, 51, 217, 0.05), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ==========================================
   DASHBOARD: PREMIUM SIDEBAR
   ========================================== */
.dash-sidebar {
  width: 260px;
  background: var(--bg-nav);
  border-right: 1px solid var(--border-glass);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.02);

  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Brand Header */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* Brand gem shape (diamond icon from brand) */
.brand-gem {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0033D9, #14C9C9);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  flex-shrink: 0;
}

/* Close button — only visible on mobile */
.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #888;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sidebar-label);
  padding: 12px 8px 6px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 12px 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Nav Tabs */
.queue-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.queue-tab i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.queue-tab:hover {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.queue-tab:hover i {
  opacity: 1;
}

.queue-tab.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-color: var(--border-active);
  font-weight: 600;
}

.queue-tab.active i {
  opacity: 1;
  color: var(--brand-accent);
}

/* Main content */
.crm-feed-container {
  margin-left: 260px;
  padding: 52px 64px;
  min-height: 100vh;
  background: var(--bg-main);
  transition: background 0.4s ease;
}

/* Mobile top header — hidden on desktop */
.mobile-header {
  display: none;
}

/* Sidebar backdrop — hidden on desktop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 900;
}

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

.intent-badge {
  padding: 4px 12px;
  border-radius: 40px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.intent-hot {
  background: rgba(20, 201, 201, 0.1);
  color: var(--brand-accent);
  border: 1px solid rgba(20, 201, 201, 0.2);
}

.intent-stale {
  background: rgba(244, 63, 94, 0.1);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.intent-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

.hud-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 32px;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'Outfit';
  color: var(--text-main);
}

/* ==========================================
   DASHBOARD: REDESIGNED LAYOUT COMPONENTS
   ========================================== */

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

.dash-page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.dash-page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* WhatsApp Status Pill */
.meta-handshake-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 40px;
  border: 1px solid rgba(20, 201, 201, 0.25);
  background: rgba(20, 201, 201, 0.04);
}

.meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.meta-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  }

  50% {
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.9);
  }
}

/* AI Brief Banner */
.ai-brief-banner {
  padding: 20px 28px;
  margin-bottom: 32px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(20, 201, 201, 0.05), rgba(0, 51, 217, 0.04));
  border: 1px solid rgba(20, 201, 201, 0.15);
  border-left: 3px solid var(--brand-accent);
}

/* Quick Stats Grid */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* --- UX RESPONSIVENESS/* --- NEURAL ONBOARDING ORCHESTRATION --- */
.onboarding-stepper {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.step-dot {
  flex: 1;
  height: 4px;
  background: var(--border-glass);
  border-radius: 10px;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-dot.active {
  background: var(--brand-accent);
  box-shadow: 0 0 15px var(--brand-accent);
}

.step-container {
  display: none;
  animation: step-reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-container.step-active {
  display: block;
}

@keyframes step-reveal {
  0% {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }

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

#onboarding-card {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#draft-result {
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 4px solid var(--brand-accent);
  transition: all 0.3s ease;
}

[data-theme="light"] #draft-result {
  background: rgba(255, 255, 255, 0.5);
  border-left: 4px solid var(--brand-primary);
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-loading span {
  visibility: hidden;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: calc(50% - 10px);
  left: calc(50% - 10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--brand-accent);
  animation: button-spin 0.6s linear infinite;
}

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

.btn-pulse {
  animation: pulse-neural 2s infinite;
}

@keyframes pulse-neural {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 51, 217, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(0, 51, 217, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 51, 217, 0);
  }
}

.stat-card-value {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  line-height: 1;
  color: var(--text-main);
}

/* Deep Metrics Grid */
.dash-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

/* Section header with count badge */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.feed-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--border-glass);
  padding: 4px 14px;
  border-radius: 40px;
  border: 1px solid var(--border-subtle);
}

/* Empty feed state */
.empty-feed-state {
  padding: 80px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================
   V4.6: MOBILE OVERHAUL — THE SCALING PULSE
   ========================================== */

@media (max-width: 900px) {

  /* Show the sticky mobile top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 800;
    background: #0a0a0e;
    border-bottom: 1px solid rgba(0, 51, 217, 0.12);
  }

  .mobile-header-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
  }

  .mobile-hamburger {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 51, 217, 0.1);
    border: 1px solid rgba(0, 51, 217, 0.2);
    border-radius: 10px;
    cursor: pointer;
    color: #ffffff;
  }

  /* Show close button inside sidebar on mobile */
  .sidebar-close-btn {
    display: flex;
  }

  /* Sidebar slides off-canvas */
  .dash-sidebar {
    transform: translateX(-260px);
    box-shadow: none;
  }

  .dash-sidebar.active {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.8);
  }

  .crm-feed-container {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  /* Stats: 2x2 on tablet */
  .dash-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Metrics: 1 column */
  .dash-metrics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dash-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
  }

  .meta-handshake-pill {
    width: 100%;
    justify-content: space-between;
  }

  .dash-page-title {
    font-size: 1.6rem;
  }

  .stat-card-value {
    font-size: 1.8rem;
  }

  .hud-panel {
    padding: 20px;
  }

  .metric-value {
    font-size: 2rem;
  }

  .message,
  .bubble-ai,
  .bubble-customer {
    max-width: 88% !important;
  }
}

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

  .crm-feed-container {
    padding: 16px 14px 60px;
  }

  .stat-card {
    padding: 18px 14px;
  }

  .stat-card-value {
    font-size: 1.6rem;
  }
}

/* ==========================================
   V4.6: MOBILE OVERHAUL — THE SCALING PULSE
   ========================================== */

@media (max-width: 900px) {

  /* Show mobile header, hide desktop sidebar logo area */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 800;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(16px);
  }

  /* Disable sidebar hamburger icon on desktop */
  .mobile-header-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-accent);
  }

  .mobile-hamburger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-main);
  }

  /* Sidebar slides off-screen by default */
  .dash-sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.4);
  }

  /* Sidebar open state */
  .dash-sidebar.active {
    transform: translateX(0);
  }

  /* Main content takes full width */
  .crm-feed-container {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  /* Stack stats grid */
  .grid-4 {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* Header actions wrap */
  header[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
    margin-bottom: 28px !important;
  }

  /* Header Meta widget full width */
  header .glass-panel {
    width: 100%;
    justify-content: space-between;
  }

  /* Tab content grids stack */
  .tab-content [style*="display: grid"],
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Instrument cards */
  .instrument-card {
    padding: 20px !important;
  }

  /* Instrument value font size */
  .instrument-value {
    font-size: 1.8rem !important;
  }

  /* HUD Panels */
  .hud-panel {
    padding: 20px;
    border-radius: 16px;
  }

  /* Page headings */
  h1[style*="2.2rem"] {
    font-size: 1.6rem !important;
  }

  /* Conversation cards */
  .conv-card {
    padding: 16px !important;
  }

  /* Chat max width */
  .message,
  .bubble-ai,
  .bubble-customer {
    max-width: 88% !important;
  }
}

@media (max-width: 480px) {

  /* Single column stats on very small phones */
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .crm-feed-container {
    padding: 16px 14px 60px;
  }
}

/* ==========================================
   NEURAL LANDING: MOBILE OPTIMIZATION
   ========================================== */

@media (max-width: 1024px) {
  nav {
    padding: 12px 6% !important;
  }

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

  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-main);
    cursor: pointer;
  }

  section {
    padding: 80px 6% !important;
  }

  /* Stack Grids */
  .grid-hero,
  .grid-3,
  .grid-footer {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
  }

  .headline-giant {
    font-size: 3.2rem !important;
    line-height: 1.1;
  }

  .hero-visual-box {
    min-height: 380px !important;
    padding: 24px !important;
    border-radius: 32px !important;
  }

  .btn-premium,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 18px 32px !important;
  }

  .hero-visual-box {
    margin-top: 40px;
  }

  /* Features */
  .process-step {
    padding: 40px 32px !important;
  }

  /* Onboarding Card Reset */
  #onboarding-card {
    padding: 40px 20px !important;
    border-radius: 0;
    min-height: 100vh;
    border: none;
  }
}

/* Neural Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  height: 100%;
  background: var(--bg-nav);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 3000;
  transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 120px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
  border-left: 1px solid var(--border-glass);
}

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

.mobile-drawer a {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

.mobile-drawer .drawer-close {
  position: absolute;
  top: 40px;
  right: 40px;
  color: var(--text-muted);
}