/* ===========================
   SalesBot AI Dashboard v4.0
   Premium Dark Glassmorphism
   =========================== */

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

/* ===== THEME TOKENS ===== */
[data-theme="dark"] {
  --bg: #060610;
  --bg2: rgba(12, 13, 28, 0.88);
  --bg3: rgba(18, 20, 40, 0.92);
  --bg4: #1e2142;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text1: #eef0fa;
  --text2: #8a93b8;
  --text3: #4d5578;
  --sidebar-bg: rgba(8, 9, 20, 0.97);
  --topbar-bg: rgba(8, 9, 18, 0.75);
  --card-bg: rgba(12, 14, 30, 0.55);
  --input-bg: rgba(255, 255, 255, 0.035);
  --login-bg: rgba(6, 6, 16, 0.98);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] {
  --bg: #f2f3f8;
  --bg2: rgba(255, 255, 255, 0.94);
  --bg3: rgba(240, 242, 248, 0.96);
  --bg4: #dfe1ea;
  --border: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.14);
  --text1: #15172a;
  --text2: #5a6280;
  --text3: #969db8;
  --sidebar-bg: rgba(255, 255, 255, 0.97);
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --card-bg: rgba(255, 255, 255, 0.72);
  --input-bg: rgba(0, 0, 0, 0.025);
  --login-bg: rgba(242, 243, 248, 0.98);
  --glass: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.7);
}

:root {
  --accent: #f57c20;
  --accent-light: #ffa44e;
  --accent-glow: rgba(245, 124, 32, 0.12);
  --accent-gradient: linear-gradient(135deg, #f57c20, #ffa44e);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.1);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.1);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.1);
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(245, 124, 32, 0.08);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --sidebar-width: 230px;
  --sidebar-collapsed: 68px;
  --topbar-height: 58px;
}

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

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(245, 124, 32, 0.15);
  }

  50% {
    box-shadow: 0 0 30px rgba(245, 124, 32, 0.25);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

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

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 90% 60% at 20% -20%, rgba(245, 124, 32, 0.05), transparent),
    radial-gradient(ellipse 70% 50% at 80% 10%, rgba(96, 165, 250, 0.04), transparent),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(167, 139, 250, 0.03), transparent);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(138, 147, 184, 0.15);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 147, 184, 0.3);
}

/* ===== LOGIN ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--login-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}

[data-theme="dark"] .login-overlay::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 124, 32, 0.08), transparent 70%);
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-card {
  text-align: center;
  padding: 52px 44px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  width: 380px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: slideUp 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.7;
}

.login-logo {
  font-size: 52px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(245, 124, 32, 0.2));
}

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text1) 20%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-card p {
  color: var(--text3);
  font-size: 13px;
  margin-bottom: 32px;
  letter-spacing: 0.3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form input {
  padding: 15px 20px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  text-align: center;
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(245, 124, 32, 0.08);
  background: rgba(245, 124, 32, 0.03);
}

.login-form input::placeholder {
  color: var(--text3);
}

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

/* ===== APP SHELL ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -1px;
  width: 1px;
  background: linear-gradient(180deg, rgba(245, 124, 32, 0.15), transparent 30%, transparent 70%, rgba(96, 165, 250, 0.1));
  pointer-events: none;
}

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

.sidebar-logo .logo-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(245, 124, 32, 0.12), rgba(255, 164, 78, 0.06));
  border-radius: 12px;
  border: 1px solid rgba(245, 124, 32, 0.12);
  box-shadow: 0 0 20px rgba(245, 124, 32, 0.06);
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text1) 20%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
  width: 100%;
  position: relative;
}

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text1);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(245, 124, 32, 0.12), rgba(245, 124, 32, 0.04));
  color: var(--accent-light);
  font-weight: 600;
  border: 1px solid rgba(245, 124, 32, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-gradient);
  box-shadow: 0 0 12px rgba(245, 124, 32, 0.3);
}

.nav-icon {
  font-size: 17px;
  min-width: 24px;
  text-align: center;
  filter: grayscale(0.3);
  transition: var(--transition-fast);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  filter: none;
  transform: scale(1.08);
}

.nav-label {
  white-space: nowrap;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  gap: 14px;
}

[data-theme="dark"] .topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 124, 32, 0.1) 30%, rgba(96, 165, 250, 0.08) 70%, transparent);
  pointer-events: none;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text1);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.mobile-menu-btn:hover {
  background: var(--input-bg);
}

/* Theme Toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--glass);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.08) rotate(15deg);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Notification Bell */
.notification-bell {
  position: relative;
}

.bell-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.bell-btn:hover {
  border-color: var(--accent);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 340px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  z-index: 500;
  backdrop-filter: blur(20px);
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.notif-list {
  padding: 4px;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.notif-item:hover {
  background: var(--input-bg);
}

.notif-item.unread {
  background: var(--accent-glow);
}

.notif-item .notif-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.notif-item .notif-body {
  flex: 1;
}

.notif-item .notif-title {
  font-weight: 600;
  color: var(--text1);
}

.notif-item .notif-msg {
  color: var(--text2);
  margin-top: 2px;
}

.notif-item .notif-time {
  color: var(--text3);
  font-size: 10px;
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}

.btn-accent {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(245, 124, 32, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245, 124, 32, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  filter: brightness(1.08);
}

.btn-accent:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(245, 124, 32, 0.2);
}

.btn-outline {
  background: var(--glass);
  color: var(--text2);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-outline:hover {
  border-color: var(--border-hover);
  color: var(--text1);
  background: var(--glass-hover);
  transform: translateY(-1px);
}

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

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-xs);
}

.btn-voice {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-voice:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-voice.recording {
  background: var(--red);
  border-color: var(--red);
  animation: recordPulse 1s infinite;
}

@keyframes recordPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

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

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  transition: var(--transition);
}

.stat-card:nth-child(1)::before {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.stat-card:nth-child(2)::before {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.stat-card:nth-child(3)::before {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.stat-card:nth-child(4)::before {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.stat-card:nth-child(5)::before {
  background: var(--accent-gradient);
}

.stat-card:nth-child(6)::before {
  background: linear-gradient(90deg, #a78bfa, #8b5cf6);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

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

.stat-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
  transition: var(--transition);
}

.stat-card:hover .stat-icon {
  transform: scale(1.12) rotate(3deg);
}

.stat-total .stat-icon {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
}

.stat-total::before {
  background: linear-gradient(90deg, var(--blue), transparent);
}

.stat-confirmed .stat-icon {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
}

.stat-confirmed::before {
  background: linear-gradient(90deg, var(--green), transparent);
}

.stat-confirmed .stat-value {
  color: var(--green);
}

.stat-pending .stat-icon {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(234, 179, 8, 0.05));
}

.stat-pending::before {
  background: linear-gradient(90deg, var(--yellow), transparent);
}

.stat-pending .stat-value {
  color: var(--yellow);
}

.stat-cancelled .stat-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
}

.stat-cancelled::before {
  background: linear-gradient(90deg, var(--red), transparent);
}

.stat-cancelled .stat-value {
  color: var(--red);
}

.stat-rate .stat-icon {
  background: linear-gradient(135deg, rgba(245, 124, 32, 0.15), rgba(245, 124, 32, 0.05));
}

.stat-rate::before {
  background: linear-gradient(90deg, var(--accent), transparent);
}

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

.stat-messages .stat-icon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
}

.stat-messages::before {
  background: linear-gradient(90deg, var(--purple), transparent);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ===== ESCALATION BAR ===== */
.escalation-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  animation: escalPulse 2s infinite;
}

@keyframes escalPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.85;
  }
}

.escalation-icon {
  font-size: 18px;
}

.escalation-text {
  flex: 1;
  color: var(--red);
}

/* ===== CONTENT GRID ===== */
.content-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  min-height: 0;
}

/* ===== PANELS ===== */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.panel-header h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-actions select {
  padding: 6px 12px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.panel-actions select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ===== LKLAB (Blocked) BUTTON ===== */
.lklab-btn {
  background: var(--input-bg);
  color: var(--text2);
  border: 1px solid var(--border);
  position: relative;
  transition: var(--transition);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.lklab-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.lklab-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.lklab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  line-height: 1;
}

.lklab-btn.active .lklab-badge {
  background: rgba(255, 255, 255, 0.3);
}

.blocked-lead-item {
  opacity: 0.85;
}

.blocked-lead-item:hover {
  opacity: 1;
}

/* ===== LEADS ===== */
.leads-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
}

.leads-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.leads-search input {
  width: 100%;
  padding: 10px 16px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.leads-search input:focus {
  border-color: rgba(245, 124, 32, 0.4);
  background: rgba(245, 124, 32, 0.03);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.leads-search input::placeholder {
  color: var(--text3);
}

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

.lead-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.lead-item:hover {
  background: var(--glass-hover);
  transform: translateX(2px);
}

.lead-item.active {
  background: linear-gradient(135deg, rgba(245, 124, 32, 0.08), rgba(245, 124, 32, 0.02));
  border-left: 3px solid var(--accent);
}

.lead-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.lead-item:hover .lead-avatar {
  transform: scale(1.05);
}

.avatar-initials {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}

.avatar-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg2);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.lead-info {
  flex: 1;
  min-width: 0;
}

.lead-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-preview {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.lead-meta {
  text-align: right;
  flex-shrink: 0;
}

.lead-time {
  font-size: 10px;
  color: var(--text3);
}

.lead-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.tag-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.lead-unread {
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(245, 124, 32, 0.3);
}

/* ===== CHAT PANEL ===== */
.chat-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
}

.chat-tag-bar {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}

.chat-welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.chat-welcome p {
  font-size: 12px;
  max-width: 260px;
  line-height: 1.5;
}

.chat-bubble {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.55;
  position: relative;
  animation: msgSlide 0.3s ease-out;
}

@keyframes msgSlide {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.chat-bubble.customer {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(245, 124, 32, 0.2);
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--glass);
  color: var(--text1);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(8px);
}

.chat-bubble .meta {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 3px;
  text-align: right;
}

.chat-bubble.bot .meta {
  color: var(--text3);
}

.chat-bubble .action-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.action-tag.confirm {
  background: var(--green-bg);
  color: var(--green);
}

.action-tag.cancel {
  background: var(--red-bg);
  color: var(--red);
}

.chat-bubble .delete-msg {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-bubble:hover .delete-msg {
  opacity: 1;
}

/* Audio in chat */
.chat-bubble audio {
  max-width: 100%;
  height: 32px;
  margin-top: 6px;
  border-radius: 8px;
}

/* Chat Input */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input-row input {
  flex: 1;
  padding: 10px 16px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.chat-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.chat-input-row input::placeholder {
  color: var(--text3);
}

/* Voice Recording */
.voice-recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--red-bg);
  border-radius: 10px;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: recordPulse 1s infinite;
}

/* ===== CHARTS ===== */
.charts-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}

.chart-card {
  min-height: 320px;
}

.chart-container {
  padding: 16px;
  height: 280px;
  position: relative;
}

/* ===== CRM DRAWER ===== */
.crm-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.crm-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.crm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 500;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.crm-drawer.active {
  transform: translateX(0);
}

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

.crm-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.crm-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.crm-field {
  margin-bottom: 14px;
}

.crm-field label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.crm-field input,
.crm-field textarea,
.crm-field select {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.crm-field input:focus,
.crm-field textarea:focus {
  border-color: var(--accent);
}

.crm-timeline {
  margin-top: 16px;
}

.crm-timeline h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text2);
}

.timeline-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 4px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-time {
  color: var(--text3);
  font-size: 10px;
}

/* ===== TAG PICKER ===== */
.tag-picker {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 300;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tag-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.tag-picker-item:hover {
  background: var(--input-bg);
}

.tag-picker-check {
  width: 16px;
}

/* ===== FORM STYLES ===== */
.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.form-row input,
.form-row textarea,
.form-row select {
  flex: 1;
  padding: 8px 12px;
  background: var(--input-bg);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
}

.form-row input::placeholder,
.form-row textarea::placeholder {
  color: var(--text3);
}

/* ===== KNOWLEDGE PANEL ===== */
.knowledge-product-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.knowledge-count {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
}

.knowledge-images {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.knowledge-images h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-area {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-formats {
  font-size: 11px;
  color: var(--text3);
}

.upload-hint {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
}

.product-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.product-img-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
}

.product-img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-img-card .delete-img {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-img-card:hover .delete-img {
  opacity: 1;
}

.knowledge-upload {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.knowledge-upload h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.knowledge-text {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.knowledge-text h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.knowledge-entries {
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.knowledge-entry {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.knowledge-entry .entry-type {
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.knowledge-entry .entry-text {
  flex: 1;
  color: var(--text2);
  line-height: 1.4;
}

.knowledge-entry .entry-delete {
  color: var(--red);
  cursor: pointer;
  opacity: 0.5;
  font-size: 11px;
  background: none;
  border: none;
  padding: 0;
}

.knowledge-entry:hover .entry-delete {
  opacity: 1;
}

/* ===== AUDIO LIBRARY ===== */
.audio-upload-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.audio-upload-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.audio-entries {
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.audio-entry {
  display: flex;
  gap: 8px;
  padding: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.audio-entry .audio-key {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  min-width: 80px;
}

.audio-entry .audio-desc {
  flex: 1;
  color: var(--text2);
  font-size: 12px;
}

.audio-entry audio {
  height: 28px;
  max-width: 150px;
}

.audio-entry .audio-delete {
  color: var(--red);
  cursor: pointer;
  opacity: 0.5;
  font-size: 11px;
  background: none;
  border: none;
  padding: 4px;
}

.audio-entry:hover .audio-delete {
  opacity: 1;
}

/* ===== SELF-LEARNING PATTERNS ===== */
.learned-patterns {
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.pattern-card {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  direction: rtl;
  text-align: right;
}

.pattern-source {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--accent-bg, rgba(59, 130, 246, 0.1));
  color: var(--accent);
}

.pattern-qa {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pattern-q {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  padding: 6px 10px;
  background: var(--input-bg);
  border-radius: 8px;
}

.pattern-a {
  font-size: 12px;
  color: var(--green, #22c55e);
  line-height: 1.5;
  padding: 6px 10px;
  background: rgba(34, 197, 94, 0.05);
  border-radius: 8px;
  border-right: 3px solid var(--green, #22c55e);
}

.pattern-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text3);
  direction: ltr;
}

.pattern-meta .delete-msg {
  margin-left: auto;
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 16px;
  opacity: 0.4;
  transition: var(--transition);
  padding: 0 4px;
}

.pattern-card:hover .delete-msg {
  opacity: 1;
}

/* ===== FOLLOW-UP ===== */
.followup-form {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.followup-form h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.followup-rules {
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.followup-rule {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.followup-rule .rule-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.followup-rule .rule-meta {
  font-size: 11px;
  color: var(--text2);
}

.followup-rule .rule-actions {
  display: flex;
  gap: 4px;
}

/* ===== PROGRESS BAR ===== */
.upload-progress {
  padding: 10px 0;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg4);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 50px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ===== STATUS BADGE & DOT ===== */
.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--green-bg);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 50px;
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px var(--green);
}

@keyframes pulse {

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

  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

.status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-new {
  background: var(--blue-bg);
  color: var(--blue);
}

.status-hot {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-sold {
  background: var(--green-bg);
  color: var(--green);
}

.status-lost {
  background: var(--red-bg);
  color: var(--red);
}

.status-manual {
  background: rgba(168, 85, 247, 0.1);
  color: var(--purple);
}

/* ===== EMPTY TEXT ===== */
.empty-text {
  text-align: center;
  padding: 24px;
  color: var(--text3);
  font-size: 13px;
}

/* ===== SETTINGS ===== */
.settings-group {
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.settings-group h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* ===== SCHEDULED MESSAGES ===== */
.scheduled-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.scheduled-item .sched-time {
  font-weight: 600;
  color: var(--accent);
  min-width: 120px;
}

.scheduled-item .sched-phone {
  color: var(--text2);
  min-width: 100px;
}

.scheduled-item .sched-msg {
  flex: 1;
  color: var(--text1);
}

.scheduled-item .sched-status {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.scheduled-item .sched-cancel {
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 12px;
}

/* ===== TEMPLATE LIST ===== */
.template-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.template-item .tpl-name {
  font-weight: 600;
  color: var(--accent);
  min-width: 100px;
}

.template-item .tpl-cat {
  font-size: 10px;
  color: var(--text3);
  min-width: 60px;
}

.template-item .tpl-msg {
  flex: 1;
  color: var(--text2);
}

.template-item .tpl-delete {
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 12px;
}

/* ===== AI PERFORMANCE ===== */
.perf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.perf-card {
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}

.perf-card .perf-value {
  font-size: 28px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.perf-card .perf-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
}

.stage-bar .stage-name {
  min-width: 100px;
  color: var(--text2);
}

.stage-bar .stage-fill-bg {
  flex: 1;
  height: 8px;
  background: var(--bg4);
  border-radius: 50px;
  overflow: hidden;
}

.stage-bar .stage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 50px;
  transition: width 0.5s ease;
}

.stage-bar .stage-pct {
  min-width: 45px;
  text-align: right;
  font-weight: 600;
  color: var(--text1);
}

/* ===== MOBILE NAV (BOTTOM) ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  z-index: 300;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  backdrop-filter: blur(20px);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-nav-item small {
  font-size: 9px;
  font-weight: 500;
}

.mobile-nav-item.active {
  color: var(--accent);
}

.mobile-nav-item:hover {
  color: var(--text1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-wrapper {
    margin-left: 0;
    padding-bottom: 64px;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

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

  .chat-panel {
    max-height: calc(100vh - 360px);
  }

  .leads-panel {
    max-height: 300px;
  }

  .topbar-actions .btn {
    display: none;
  }

  .topbar-actions .bell-btn,
  .topbar-actions .theme-toggle {
    display: flex;
  }

  .tab-content {
    padding: 12px;
  }

  .crm-drawer {
    width: 100%;
  }

  .notif-dropdown {
    width: 280px;
    right: -40px;
  }

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

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

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

  .stat-card {
    padding: 12px 10px;
  }

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

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

/* ===== AGENT MANAGEMENT ===== */
.agent-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.agent-card:hover {
  border-color: var(--border-hover);
}

.agent-card.inactive {
  opacity: 0.5;
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-info small {
  display: block;
  color: var(--text2);
  font-size: 12px;
}

.agent-role {
  font-size: 24px;
}

.agent-actions {
  display: flex;
  gap: 6px;
}

.agent-quota {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.quota-bar {
  flex: 1;
  height: 8px;
  background: var(--bg4);
  border-radius: 4px;
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #8b5cf6);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.quota-label {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
}

.agent-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
}

.agent-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-tag {
  background: var(--bg4);
  color: var(--text2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  min-width: 350px;
  max-width: 450px;
  width: 90%;
}

.modal-card h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-stack input,
.form-stack textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text1);
  font-size: 14px;
}

.form-stack input:focus,
.form-stack textarea:focus {
  border-color: var(--accent, #8b5cf6);
  outline: none;
}

.perm-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.perm-toggles>label:first-child {
  width: 100%;
  font-weight: 600;
  margin-bottom: 4px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
}

/* ===== USER INFO IN SIDEBAR ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg4);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.user-role {
  font-size: 18px;
}

.user-name {
  color: var(--text2);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text2);
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* ===== ORDERS TABLE ===== */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.orders-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg4);
  color: var(--text2);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.orders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text1);
}

.orders-table tr:hover td {
  background: var(--bg3);
}

.status-badge-pending {
  color: #eab308;
}

.status-badge-approved {
  color: #22c55e;
}

.status-badge-rejected {
  color: #ef4444;
}

/* ===== CONFIRM ORDER BUTTON ===== */
.btn-confirm-order {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-confirm-order:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* ===== EXTRA BUTTON SIZES ===== */
.btn-xs {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-height: auto !important;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

/* ===== AUDIO OWNERSHIP BADGES ===== */
.audio-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.audio-badge.shared {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.audio-badge.mine {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* ===== FEATURE 3: ANIMATED MESH GRADIENT BACKGROUND ===== */
[data-theme="dark"] .main-wrapper::before {
  content: '';
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 400px at 15% 20%, rgba(245, 124, 32, 0.04), transparent),
    radial-gradient(ellipse 500px 500px at 85% 60%, rgba(96, 165, 250, 0.035), transparent),
    radial-gradient(ellipse 400px 300px at 50% 90%, rgba(167, 139, 250, 0.03), transparent);
  animation: meshFloat 20s ease-in-out infinite;
}

@keyframes meshFloat {

  0%,
  100% {
    opacity: 1;
  }

  33% {
    opacity: 0.7;
  }

  66% {
    opacity: 0.9;
  }
}

/* ===== FEATURE 2: SKELETON LOADING SHIMMER ===== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--card-bg) !important;
  color: transparent !important;
  border-radius: var(--radius-sm);
  pointer-events: none;
  user-select: none;
}

.skeleton * {
  visibility: hidden !important;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.04) 40%,
      rgba(255, 255, 255, 0.06) 50%,
      rgba(255, 255, 255, 0.04) 60%,
      transparent 100%);
  background-size: 200% 100%;
  animation: shimmerMove 1.5s infinite;
}

@keyframes shimmerMove {
  0% {
    background-position: 200% 0;
  }

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

.skeleton-text {
  display: inline-block;
  height: 14px;
  width: 80px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.skeleton-text::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmerMove 1.5s infinite;
}

.skeleton-circle {
  display: inline-block;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.skeleton-circle::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmerMove 1.5s infinite;
}

/* ===== FEATURE 4: AVATAR GRADIENT RINGS ===== */
.lead-avatar.ring-hot {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #f59e0b, 0 0 12px rgba(245, 158, 11, 0.3);
  animation: ringPulse 2s ease-in-out infinite;
}

.lead-avatar.ring-sold {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #34d399, 0 0 12px rgba(52, 211, 153, 0.3);
}

.lead-avatar.ring-new {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #60a5fa, 0 0 12px rgba(96, 165, 250, 0.2);
}

.lead-avatar.ring-lost {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #6b7280;
  opacity: 0.7;
}

@keyframes ringPulse {

  0%,
  100% {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #f59e0b, 0 0 12px rgba(245, 158, 11, 0.3);
  }

  50% {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px #f59e0b, 0 0 20px rgba(245, 158, 11, 0.45);
  }
}

/* ===== FEATURE 5: SMOOTH THEME TRANSITION ===== */
html,
body,
.sidebar,
.main-wrapper,
.topbar,
.panel,
.stat-card,
.lead-item,
.chat-bubble,
.nav-item,
.login-overlay,
.login-card,
input,
textarea,
select,
button,
.btn {
  transition: background-color 0.4s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ===== FEATURE 1: ANIMATED COUNTER ===== */
.stat-value.counting {
  animation: countPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes countPop {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  60% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== FEATURE 6: TOAST NOTIFICATION SYSTEM ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  min-width: 300px;
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: none;
  }

  to {
    opacity: 0;
    transform: translateX(80px) scale(0.9);
  }
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.toast.toast-success::before {
  background: linear-gradient(180deg, #34d399, #10b981);
}

.toast.toast-error::before {
  background: linear-gradient(180deg, #f87171, #ef4444);
}

.toast.toast-info::before {
  background: linear-gradient(180deg, #60a5fa, #3b82f6);
}

.toast.toast-warning::before {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text1);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 0 var(--radius);
  animation: toastProgress 4s linear forwards;
}

.toast.toast-success .toast-progress {
  background: #34d399;
}

.toast.toast-error .toast-progress {
  background: #f87171;
}

.toast.toast-info .toast-progress {
  background: #60a5fa;
}

.toast.toast-warning .toast-progress {
  background: #fbbf24;
}

@keyframes toastProgress {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* ===== FEATURE 7: REAL-TIME ACTIVITY FEED ===== */
.activity-feed {
  margin-bottom: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.activity-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.activity-feed-header .live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  margin-right: 6px;
  animation: liveDotPulse 2s infinite;
}

@keyframes liveDotPulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 4px #34d399;
  }

  50% {
    opacity: 0.4;
    box-shadow: none;
  }
}

.activity-feed-list {
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  font-size: 12px;
  color: var(--text2);
  transition: background 0.2s;
  animation: fadeIn 0.3s ease;
}

.activity-item:hover {
  background: var(--glass-hover);
}

.activity-item .activity-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.activity-item .activity-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-item .activity-time {
  font-size: 10px;
  color: var(--text3);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}

/* ===== FEATURE 11: AI INSIGHTS PANEL ===== */
.ai-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.3s;
}

.insight-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.insight-card.insight-up::before {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.insight-card.insight-down::before {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.insight-card.insight-neutral::before {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.insight-card.insight-warning::before {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.insight-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.insight-card.insight-up .insight-icon {
  background: rgba(52, 211, 153, 0.1);
}

.insight-card.insight-down .insight-icon {
  background: rgba(248, 113, 113, 0.1);
}

.insight-card.insight-neutral .insight-icon {
  background: rgba(96, 165, 250, 0.1);
}

.insight-card.insight-warning .insight-icon {
  background: rgba(251, 191, 36, 0.1);
}

.insight-body {
  flex: 1;
}

.insight-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 4px;
}

.insight-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}

.insight-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 18px;
  margin-top: 4px;
}

.insight-card.insight-up .insight-value {
  color: #34d399;
}

.insight-card.insight-down .insight-value {
  color: #f87171;
}

.insight-card.insight-neutral .insight-value {
  color: #60a5fa;
}

.insight-card.insight-warning .insight-value {
  color: #fbbf24;
}

/* ===== FEATURE 12: DRAG & DROP AUDIO ===== */
.audio-entry {
  position: relative;
  transition: var(--transition);
}

.audio-entry.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

.audio-entry.drag-over {
  border-top: 2px solid var(--accent);
  padding-top: 6px;
}

.drag-handle {
  cursor: grab;
  font-size: 14px;
  color: var(--text3);
  padding: 4px;
  margin-right: 4px;
  user-select: none;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--text1);
}

.drag-handle:active {
  cursor: grabbing;
}