/* ═══════════════════════════════════════════════════════════════
   CALL COMMAND CENTER - Unified Dashboard Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Color Palette - Professional Dark */
  --bg-primary: #0b0d12;
  --bg-secondary: #111318;
  --bg-card: rgba(17, 19, 24, 0.85);
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-elevated: rgba(255, 255, 255, 0.06);
  
  /* Accent Colors */
  --accent-cyan: #38bdf8;
  --accent-magenta: #c084fc;
  --accent-yellow: #fbbf24;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-orange: #fb923c;
  
  /* Text */
  --text-primary: #e8eaed;
  --text-secondary: #8b92a5;
  --text-muted: #525868;
  
  /* Borders */
  --border-color: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(56, 189, 248, 0.25);
  
  /* Shadows */
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.1);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  
  /* Spacing */
  --header-height: 70px;
  --content-padding: 28px;
  
  /* Fonts */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Unbounded', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 350ms ease;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 14px;
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════════
   Background Effects
   ═══════════════════════════════════════════════════════════════ */

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(200px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  animation: float 30s ease-in-out infinite;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: #38bdf8;
  top: -250px;
  left: -250px;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: #c084fc;
  bottom: -200px;
  right: -200px;
  animation-delay: -10s;
}

.bg-glow-3 {
  width: 400px;
  height: 400px;
  background: #fbbf24;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.08;
  animation-delay: -20s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.95); }
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar Navigation
   ═══════════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: rgba(11, 13, 18, 0.97);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-color);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
}

.logo-icon {
  color: var(--accent-cyan);
  font-size: 1.4rem;
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.logo-text {
  transition: opacity 0.2s ease, width 0.2s ease;
}

.logo-text .accent {
  color: var(--accent-cyan);
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.sidebar.collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.sidebar-toggle-icon {
  display: inline-block;
  transition: transform 0.25s ease;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-group {
  margin-bottom: 8px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-group-label {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  text-align: left;
}

.nav-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-btn.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
}

.sidebar.collapsed .nav-btn {
  justify-content: center;
  padding: 10px 0;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding: 8px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}

.sidebar.collapsed .sidebar-user .user-info,
.sidebar.collapsed .sidebar-user .user-logout-btn {
  display: none;
}

/* Mobile Header (hidden on desktop) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(11, 13, 18, 0.97);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-color);
  z-index: 150;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-menu-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

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

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

/* ═══════════════════════════════════════════════════════════════
   User elements
   ═══════════════════════════════════════════════════════════════ */

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-tenant {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.5;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.user-logout-btn:hover {
  opacity: 1;
  background: rgba(255, 68, 68, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   Main Content
   ═══════════════════════════════════════════════════════════════ */

.main {
  position: relative;
  margin-left: var(--sidebar-width);
  padding: var(--content-padding);
  max-width: 1600px;
  z-index: 1;
  transition: margin-left 0.25s ease;
}

body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed);
}

.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

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

.section-header {
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.title-icon {
  font-size: 1.8rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════
   Stats Grid
   ═══════════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(12px);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.stat-card-in {
  border-left: 3px solid var(--accent-green);
}

.stat-card-out {
  border-left: 3px solid var(--accent-orange);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 22px;
}

/* ═══════════════════════════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════════════════════════ */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  font-family: var(--font-body);
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table td.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* ═══════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #0b0d12;
}

.btn-primary:hover {
  background: #60ccf8;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-warning {
  background: var(--accent-orange);
  color: #0b0d12;
}

.btn-warning:hover {
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.3);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--accent-red);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(248, 113, 113, 0.3);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  font-size: 1.1em;
}

/* ═══════════════════════════════════════════════════════════════
   Inputs
   ═══════════════════════════════════════════════════════════════ */

.input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.input::placeholder {
  color: var(--text-muted);
}

.input-lg {
  padding: 16px 20px;
  font-size: 1.2rem;
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   Filters
   ═══════════════════════════════════════════════════════════════ */

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   Connection Status
   ═══════════════════════════════════════════════════════════════ */

.connection-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 24px;
}

.connection-status .status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
}

.connection-status.connected .status-indicator {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.connection-status.error .status-indicator {
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
}

.connection-status .status-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   Dialer Grid
   ═══════════════════════════════════════════════════════════════ */

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

/* ═══════════════════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════════════════ */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 200;
  padding: 40px;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 40px;
}

.modal-lg {
  max-width: 800px;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   Tags & Badges
   ═══════════════════════════════════════════════════════════════ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 0.8rem;
}

.tag-success {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
}

.tag-warning {
  background: rgba(255, 140, 0, 0.15);
  color: var(--accent-orange);
}

.tag-danger {
  background: rgba(255, 51, 102, 0.15);
  color: var(--accent-red);
}

.tag-info {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
}

.direction-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.direction-badge.in {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
}

.direction-badge.out {
  background: rgba(255, 140, 0, 0.15);
  color: var(--accent-orange);
}

/* ═══════════════════════════════════════════════════════════════
   Transcript
   ═══════════════════════════════════════════════════════════════ */

.transcript-container {
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  margin-top: 16px;
}

.transcript-message {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
}

.transcript-message.user {
  background: rgba(0, 240, 255, 0.1);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.transcript-message.agent {
  background: rgba(255, 0, 170, 0.1);
  border-bottom-left-radius: 4px;
}

.transcript-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.transcript-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   Analysis Result
   ═══════════════════════════════════════════════════════════════ */

.analysis-outcome {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 16px;
  margin-bottom: 20px;
}

.outcome-emoji {
  font-size: 3rem;
}

.outcome-label {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

.outcome-confidence {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   Audio Player
   ═══════════════════════════════════════════════════════════════ */

.audio-player {
  width: 100%;
  margin: 16px 0;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 4px solid var(--accent-green);
}

.toast.error {
  border-left: 4px solid var(--accent-red);
}

.toast.info {
  border-left: 4px solid var(--accent-cyan);
}

.toast-icon {
  font-size: 1.5rem;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root {
    --content-padding: 16px;
  }

  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

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

  .sidebar.collapsed {
    width: var(--sidebar-width);
  }

  .main {
    margin-left: 0;
    padding-top: calc(56px + 16px);
  }

  body.sidebar-collapsed .main {
    margin-left: 0;
  }

  .section-title {
    font-size: 1.5rem;
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  .filters-row {
    flex-direction: column;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .dialer-grid {
    grid-template-columns: 1fr;
  }
  
  .modal {
    padding: 16px;
  }
  
  .modal-content {
    margin-top: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   WhatsApp/Telegram Messenger Styles
   ═══════════════════════════════════════════════════════════════ */

.wa-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0;
  height: calc(100vh - 120px);
  min-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
}

.wa-sidebar {
  grid-row: 1 / 3;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.wa-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-sidebar-actions {
  display: flex;
  gap: 8px;
}

.wa-chat-filters {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.wa-chat-filters .filter-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.wa-chat-filters .filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.wa-chat-filters .filter-btn.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--bg-primary);
}

.wa-chats-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.wa-chat-item {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  position: relative;
}

.wa-chat-item:hover {
  background: var(--bg-hover);
}

.wa-chat-item.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(255, 0, 170, 0.15));
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.wa-chat-item.selected {
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.wa-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-green);
  cursor: pointer;
}

.wa-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.wa-chat-avatar.whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
}

.wa-chat-avatar.telegram {
  background: linear-gradient(135deg, #0088cc, #229ED9);
}

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

.wa-chat-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.wa-chat-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.wa-chat-time {
  font-size: 11px;
  color: var(--text-muted);
}

.wa-unread-badge {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}

.wa-chat-delete {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: var(--accent-red);
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-chat-item:hover .wa-chat-delete {
  opacity: 1;
}

.wa-chat-delete:hover {
  background: #dc2626;
}

.wa-badge {
  background: var(--accent-red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Chat Window */
.wa-chat-window {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  grid-row: 1;
  grid-column: 2;
  overflow: hidden;
  min-height: 0; /* Important for flex child to shrink */
}

.wa-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
  padding: 20px;
}

.wa-chat-header {
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wa-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.wa-chat-header-avatar.whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
}

.wa-chat-header-avatar.telegram {
  background: linear-gradient(135deg, #0088cc, #229ED9);
}

.wa-chat-header-name {
  font-size: 15px;
  font-weight: 600;
}

.wa-chat-header-status {
  font-size: 12px;
  color: var(--accent-green);
}

.wa-chat-header-actions {
  display: flex;
  gap: 8px;
}

.wa-bot-toggle {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.wa-bot-toggle.active {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.wa-bot-toggle.inactive {
  background: rgba(255, 51, 102, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.wa-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* Important for scrolling to work */
  max-height: 100%;
}

.wa-message {
  display: flex;
  max-width: 65%;
  animation: waFadeIn 0.3s ease;
}

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

.wa-message.incoming {
  align-self: flex-start;
}

.wa-message.outgoing {
  align-self: flex-end;
}

.wa-message-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.wa-message.incoming .wa-message-content {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.wa-message.outgoing .wa-message-content {
  background: #1a472a;
  color: #e8f5e9;
  border-bottom-right-radius: 4px;
}

.wa-message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.wa-message.outgoing .wa-message-time {
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
}

.wa-typing-indicator .wa-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
}

.wa-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: waTypingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes waTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.wa-msg-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 12px;
  vertical-align: middle;
}

.wa-msg-status.sent { color: var(--text-muted); }
.wa-msg-status.delivered { color: var(--text-muted); }
.wa-msg-status.read { color: #53BDEB; }

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

.wa-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.wa-search-input:focus {
  border-color: var(--accent-cyan);
}

.wa-search-input::placeholder {
  color: var(--text-muted);
}

.wa-search-wrapper {
  position: relative;
}

.wa-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  color: var(--text-muted);
}

.wa-input-container {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: center;
}

.wa-message-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.wa-message-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.wa-message-input::placeholder {
  color: var(--text-muted);
}

.wa-send-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.wa-attach-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wa-attach-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
}

/* Controls Panel */
.wa-controls {
  grid-column: 2;
  grid-row: 2;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* WhatsApp Modals */
.wa-file-upload {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
  color: var(--text-secondary);
}

.wa-file-upload:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.wa-file-upload.drag-over {
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.1);
}

.wa-broadcast-info {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-broadcast-info strong {
  color: var(--accent-cyan);
}

/* Tab Content */
#whatsapp .tab-content {
  display: none;
}

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

/* Responsive */
@media (max-width: 768px) {
  .wa-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .wa-sidebar {
    grid-row: auto;
    max-height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .wa-chat-window {
    min-height: 400px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Automation Styles
   ═══════════════════════════════════════════════════════════════ */

.auto-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 140, 0, 0.1);
  border: 1px solid var(--accent-orange);
  border-radius: 12px;
  margin-bottom: 24px;
  color: var(--accent-orange);
}

.auto-warning-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.auto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

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

.auto-template {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auto-template:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
  transform: translateX(4px);
}

.auto-template-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: 10px;
  flex-shrink: 0;
}

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

.auto-template-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.auto-template-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.auto-scenarios {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auto-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.auto-scenario {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.auto-scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.auto-scenario-title {
  font-weight: 600;
  font-size: 15px;
}

.auto-scenario-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.auto-scenario-message {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: 8px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.auto-scenario-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.form-row {
  display: flex;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

.form-hint code {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.auto-test-message {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.tag-secondary {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   Home Dashboard Styles
   ═══════════════════════════════════════════════════════════════ */

.home-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .home-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.home-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.home-stat-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.home-stat-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  flex-shrink: 0;
}

.home-stat-calls .home-stat-icon {
  background: rgba(56, 189, 248, 0.12);
}

.home-stat-messages .home-stat-icon {
  background: rgba(52, 211, 153, 0.12);
}

.home-stat-ai .home-stat-icon {
  background: rgba(192, 132, 252, 0.12);
}

.home-stat-clients .home-stat-icon {
  background: rgba(251, 191, 36, 0.12);
}

.home-stat-content {
  flex: 1;
}

.home-stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.home-stat-trend {
  font-size: 11px;
  margin-top: 4px;
  min-height: 16px;
}

.trend-up {
  color: var(--accent-green);
}

.trend-up::before {
  content: '↑ ';
}

.trend-down {
  color: var(--accent-red);
}

.trend-down::before {
  content: '↓ ';
}

.trend-neutral {
  color: var(--text-muted);
}

.home-stat-sub {
  font-size: 11px;
  margin-top: 2px;
  min-height: 14px;
}

.home-stat-sub.sub-warn {
  color: var(--accent-orange);
}

.home-stat-sub.sub-good {
  color: var(--accent-green);
}

.stat-unavailable {
  opacity: 0.4;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.skeleton-pulse {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  display: inline-block;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.home-attention-card {
  grid-column: 1 / 2;
}

.home-activity-card {
  grid-column: 1 / 2;
}

.home-attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-attention-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.home-attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.home-attention-item:hover {
  background: var(--bg-elevated);
  transform: translateX(3px);
}

.home-attention-warning {
  border-left-color: var(--accent-orange);
}

.home-attention-error {
  border-left-color: var(--accent-red);
}

.home-attention-info {
  border-left-color: var(--accent-cyan);
}

.home-attention-success {
  border-left-color: var(--accent-green);
}

.home-attention-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.home-attention-text {
  flex: 1;
  font-size: 14px;
}

.home-attention-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

.home-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .home-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

.home-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-family: var(--font-body);
}

.home-action-btn:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

.home-action-icon {
  font-size: 24px;
}

.home-action-btn span:last-child {
  font-size: 12px;
  color: var(--text-secondary);
}

.home-activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.home-activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.home-activity-item:hover {
  background: var(--bg-elevated);
  transform: translateX(2px);
}

.home-activity-whatsapp { border-left-color: #25D366; }
.home-activity-call { border-left-color: var(--accent-cyan); }
.home-activity-ai { border-left-color: #FF00AA; }
.home-activity-log { border-left-color: var(--text-muted); }

.home-activity-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.home-activity-text {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-activity-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.home-recommendations {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-rec-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.home-rec-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.home-rec-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.home-rec-content {
  flex: 1;
}

.home-rec-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.home-rec-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.home-rec-item .btn {
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   Unified Customer Card Styles
   ═══════════════════════════════════════════════════════════════ */

.customer-stats-bar {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-hover);
  border-radius: 12px;
  margin-bottom: 16px;
}

.customer-stat {
  flex: 1;
  text-align: center;
}

.customer-stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.customer-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.customer-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-hover);
  border-radius: 10px;
  margin-bottom: 16px;
}

.customer-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.customer-tab:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.customer-tab.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
}

.customer-tab-content {
  min-height: 200px;
}

.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .customer-info-grid {
    grid-template-columns: 1fr;
  }
}

.customer-info-section h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.customer-info-block {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 14px;
}

.customer-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.customer-info-row:last-child {
  border-bottom: none;
}

.customer-info-row span {
  color: var(--text-muted);
  font-size: 13px;
}

.customer-info-row strong {
  color: var(--text-primary);
  font-size: 13px;
}

.customer-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Timeline */
.customer-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-hover);
  border-radius: 10px;
  border-left: 3px solid var(--border-color);
}

.timeline-item.incoming {
  border-left-color: var(--accent-cyan);
}

.timeline-item.outgoing {
  border-left-color: var(--accent-green);
}

.timeline-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

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

.timeline-direction {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
}

.timeline-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

/* Lessons */
.customer-lessons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-lesson-item {
  display: flex;
  gap: 16px;
  padding: 14px;
  background: var(--bg-hover);
  border-radius: 10px;
}

.customer-lesson-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: 10px;
  flex-shrink: 0;
}

.customer-lesson-day {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.customer-lesson-month {
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
}

.customer-lesson-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.customer-lesson-time {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.customer-lesson-group {
  font-size: 12px;
  color: var(--text-muted);
}

/* Actions */
.customer-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.customer-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: inherit;
}

.customer-action-btn:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
  transform: translateY(-2px);
}

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

.customer-action-icon {
  font-size: 28px;
}

.customer-action-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   Activity Log Styles
   ═══════════════════════════════════════════════════════════════ */

/* Period Bar */
.log-period-bar {
  margin-bottom: 20px;
}

.log-period-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.log-period-btn {
  padding: 10px 24px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.log-period-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.log-period-btn.active {
  background: var(--accent-cyan);
  color: #0b0d12;
  font-weight: 600;
}

/* Summary Cards */
.log-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1200px) {
  .log-summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .log-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

.log-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.log-summary-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.log-summary-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.log-summary-main {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.log-summary-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.log-summary-extra {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 16px;
}

/* Charts Row */
.log-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .log-charts-row { grid-template-columns: 1fr; }
}

/* Details Row */
.log-details-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .log-details-row { grid-template-columns: 1fr; }
}

/* Filters */
.log-filters {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.log-filters .input {
  flex: 1;
  min-width: 140px;
}

.log-filters .input:last-child {
  flex: 2;
}

.log-count-badge {
  font-size: 11px;
  color: var(--text-muted);
}

/* Pagination */
.log-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--border-color);
}

.log-page-info {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Log Entries */
.log-entries {
  max-height: 600px;
  overflow-y: auto;
}

.log-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.log-entry {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.log-entry:hover {
  background: var(--bg-hover);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.log-content {
  flex: 1;
  min-width: 0;
}

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

.log-action {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.log-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.log-message {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.log-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.log-detail {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 4px 8px;
  border-radius: 4px;
}

.log-detail strong {
  color: var(--text-secondary);
}

/* Log type colors */
.log-whatsapp .log-icon { color: #25D366; }
.log-telegram .log-icon { color: #0088cc; }
.log-call .log-icon { color: var(--accent-cyan); }
.log-task .log-icon { color: var(--accent-yellow); }
.log-ai .log-icon { color: var(--accent-magenta); }
.log-system .log-icon { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════
   Analytics Dashboard Styles
   ═══════════════════════════════════════════════════════════════ */

.analytics-section {
  margin-bottom: 28px;
}

.analytics-section:last-child {
  margin-bottom: 0;
}

.analytics-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.analytics-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-color);
  transition: all var(--transition-fast);
}

.analytics-card:hover {
  background: var(--bg-elevated);
}

.analytics-card-primary {
  border-left-color: var(--accent-cyan);
}

.analytics-card-success {
  border-left-color: var(--accent-green);
}

.analytics-card-warning {
  border-left-color: var(--accent-yellow);
}

.analytics-card-danger {
  border-left-color: var(--accent-red);
}

.analytics-card-info {
  border-left-color: var(--accent-magenta);
}

.analytics-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.analytics-content {
  flex: 1;
}

.analytics-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.analytics-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Chart Container */
.chart-container {
  background: var(--bg-hover);
  border-radius: 12px;
  padding: 20px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
  margin-bottom: 16px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chart-bar-fill {
  width: 100%;
  max-width: 50px;
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
  position: relative;
}

.chart-bar-fill::after {
  content: attr(data-value);
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Hours Chart */
.chart-hours {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
  background: var(--bg-hover);
  border-radius: 12px;
  padding: 16px;
}

.chart-hour-bar {
  flex: 1;
  background: var(--accent-cyan);
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
  position: relative;
}

.chart-hour-bar:hover {
  background: var(--accent-magenta);
}

.chart-hour-bar::after {
  content: attr(data-hour);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  display: none;
}

.chart-hour-bar:nth-child(4n+1)::after {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   Sandbox Modal (AI Testing Playground)
   ═══════════════════════════════════════════════════════════════ */

#wa-sandbox-modal .modal-content {
  max-width: 700px;
  width: 95%;
  max-height: 90vh;
}

#wa-sandbox-modal .sandbox-tab:hover {
  background: rgba(var(--accent-cyan-rgb), 0.1);
}

#wa-sandbox-modal .sandbox-panel {
  overflow-y: auto;
}

#wa-sandbox-modal .sandbox-messages::-webkit-scrollbar,
#wa-sandbox-modal .sandbox-panel::-webkit-scrollbar {
  width: 6px;
}

#wa-sandbox-modal .sandbox-messages::-webkit-scrollbar-track,
#wa-sandbox-modal .sandbox-panel::-webkit-scrollbar-track {
  background: transparent;
}

#wa-sandbox-modal .sandbox-messages::-webkit-scrollbar-thumb,
#wa-sandbox-modal .sandbox-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#wa-sandbox-modal .sandbox-messages::-webkit-scrollbar-thumb:hover,
#wa-sandbox-modal .sandbox-panel::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════════ */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  cursor: pointer;
}

/* Settings Users List */
.settings-users-list {
  display: flex;
  flex-direction: column;
}

.settings-user-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.settings-user-row:last-child {
  border-bottom: none;
}

.settings-user-row:hover {
  background: var(--bg-hover);
}

.settings-user-row.inactive {
  opacity: 0.5;
}

.settings-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}

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

.settings-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-user-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-user-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  font-weight: 600;
}

.settings-user-badge.inactive {
  background: rgba(255, 68, 68, 0.2);
  color: #ff6b6b;
}

.settings-user-role {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.settings-user-actions {
  display: flex;
  gap: 8px;
}

.settings-empty,
.settings-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.settings-error {
  color: var(--accent-red);
}

/* Danger buttons */
.btn-danger {
  background: rgba(255, 68, 68, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 68, 68, 0.3);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   BI AGENT CHAT
   ═══════════════════════════════════════════════════════════════ */

.bia-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 120px);
  min-height: 400px;
  position: relative;
}

.bia-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ── Profile Panel ── */

.bia-profile-panel {
  width: 0;
  overflow: hidden;
  transition: width 0.3s ease, padding 0.3s ease;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-right: 0;
  flex-shrink: 0;
}

.bia-profile-panel.open {
  width: 320px;
  margin-right: 12px;
  overflow-y: auto;
}

.bia-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  white-space: nowrap;
}

.bia-profile-toggle {
  font-size: 11px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.bia-profile-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bia-profile-field label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 3px;
  font-weight: 600;
}

.bia-profile-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: var(--transition-fast);
  resize: vertical;
}

.bia-profile-input:focus {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.bia-profile-input::placeholder {
  color: var(--text-muted);
  font-size: 11px;
}

.bia-profile-status {
  font-size: 11px;
  text-align: center;
  margin-top: 4px;
  min-height: 16px;
}

.bia-profile-status.success { color: var(--accent-green); }
.bia-profile-status.error { color: var(--accent-red); }

.bia-profile-btn {
  cursor: pointer !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px dashed var(--border-color) !important;
  color: var(--text-secondary) !important;
  transition: var(--transition-fast);
}

.bia-profile-btn:hover {
  border-color: rgba(0, 240, 255, 0.3) !important;
  color: var(--accent-cyan) !important;
}

.bia-sources {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bia-source {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.bia-source.active {
  background: rgba(0, 255, 136, 0.1);
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.3);
}

.bia-source.inactive {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  opacity: 0.6;
}

.bia-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px 16px 0 0;
  scroll-behavior: smooth;
}

.bia-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  height: 100%;
}

.bia-welcome-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: biaPulse 3s ease-in-out infinite;
}

@keyframes biaPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.bia-welcome h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.bia-welcome p {
  color: var(--text-secondary);
  font-size: 13px;
  max-width: 500px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.bia-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 600px;
}

.bia-chip {
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.2);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.bia-chip:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

/* Messages */
.bia-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bia-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  align-items: flex-start;
}

.bia-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bia-msg-assistant {
  align-self: flex-start;
}

.bia-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.bia-msg-user .bia-msg-avatar {
  background: rgba(0, 240, 255, 0.15);
}

.bia-msg-assistant .bia-msg-avatar {
  background: linear-gradient(135deg, rgba(255, 0, 170, 0.2), rgba(0, 240, 255, 0.2));
}

.bia-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.7;
  position: relative;
}

.bia-msg-user .bia-msg-bubble {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 16px 16px 4px 16px;
  color: var(--text-primary);
}

.bia-msg-assistant .bia-msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 16px 16px 16px 4px;
  color: var(--text-primary);
}

.bia-msg-bubble h2, .bia-msg-bubble h3, .bia-msg-bubble h4 {
  font-family: var(--font-display);
  margin: 12px 0 6px;
  font-size: 14px;
  color: var(--accent-cyan);
}

.bia-msg-bubble h2:first-child, .bia-msg-bubble h3:first-child, .bia-msg-bubble h4:first-child {
  margin-top: 0;
}

.bia-msg-bubble strong {
  color: var(--accent-cyan);
  font-weight: 700;
}

.bia-msg-bubble ul, .bia-msg-bubble ol {
  padding-left: 18px;
  margin: 8px 0;
}

.bia-msg-bubble li {
  margin-bottom: 4px;
}

.bia-msg-bubble code {
  background: rgba(0, 240, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.bia-msg-bubble pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.bia-msg-bubble pre code {
  background: none;
  padding: 0;
}

.bia-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

.bia-msg-animate {
  animation: biaSlideIn 0.3s ease-out;
}

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

/* Thinking dots */
.bia-thinking {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.bia-thinking span {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: biaThinkBounce 1.4s infinite ease-in-out both;
}

.bia-thinking span:nth-child(1) { animation-delay: -0.32s; }
.bia-thinking span:nth-child(2) { animation-delay: -0.16s; }
.bia-thinking span:nth-child(3) { animation-delay: 0s; }

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

.bia-thinking-bubble {
  min-width: 60px;
}

/* Follow-up suggestion chips */
.bia-followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-left: 44px;
}

.bia-followup-chip {
  padding: 6px 14px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 16px;
  color: var(--accent-cyan);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.bia-followup-chip:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* Morning digest banner */
.bia-digest-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px 0;
  background: linear-gradient(135deg, rgba(255, 0, 170, 0.08), rgba(0, 240, 255, 0.08));
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.bia-digest-banner:hover {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(255, 0, 170, 0.12), rgba(0, 240, 255, 0.12));
}

.bia-digest-banner .bia-digest-icon {
  font-size: 24px;
}

.bia-digest-banner .bia-digest-text {
  flex: 1;
}

.bia-digest-banner .bia-digest-text strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
}

.bia-digest-banner .bia-digest-text span {
  font-size: 11px;
  color: var(--text-secondary);
}

.bia-digest-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* Input area */
.bia-input-area {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 12px 16px;
}

.bia-input-row {
  display: flex;
  gap: 8px;
}

.bia-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 10px 20px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: var(--transition-fast);
}

.bia-input:focus {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.1);
}

.bia-input::placeholder {
  color: var(--text-muted);
}

.bia-input:disabled {
  opacity: 0.5;
}

.bia-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.bia-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.bia-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bia-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: biaSpin 0.6s linear infinite;
}

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

.bia-input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.bia-hint {
  font-size: 10px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .bia-layout {
    height: calc(100vh - 100px);
  }

  .bia-profile-panel.open {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    z-index: 10;
    margin-right: 0;
  }

  .bia-msg {
    max-width: 95%;
  }

  .bia-chips {
    gap: 6px;
  }

  .bia-chip {
    font-size: 11px;
    padding: 6px 12px;
  }

  .bia-welcome h2 {
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Customer 360° Card
   ═══════════════════════════════════════════════════════════════ */

.c360-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: flex-end;
}

.c360-overlay.visible {
  display: flex;
}

.c360-panel {
  width: 520px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  animation: c360-slide-in 0.25s ease;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}

@keyframes c360-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

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

.c360-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.c360-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.c360-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.c360-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.c360-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.c360-name {
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.c360-phone {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.c360-email {
  font-size: 12px;
  color: var(--text-muted);
}

.c360-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.c360-status-active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
}

.c360-status-lead {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-yellow);
}

/* Stats Bar */
.c360-stats-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0;
}

.c360-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid var(--border-color);
}

.c360-stat:last-child {
  border-right: none;
}

.c360-stat-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.c360-stat-lbl {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Tabs */
.c360-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
}

.c360-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.c360-tab:hover {
  color: var(--text-primary);
}

.c360-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* Body */
.c360-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.c360-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
}

.c360-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: c360-spin 0.8s linear infinite;
}

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

.c360-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* Timeline */
.c360-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.c360-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  border-left: 3px solid transparent;
}

.c360-tl-item:hover {
  background: var(--bg-hover);
}

.c360-tl-msg { border-left-color: #34d399; }
.c360-tl-call { border-left-color: #38bdf8; }
.c360-tl-task { border-left-color: #c084fc; }

.c360-tl-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.c360-tl-content {
  flex: 1;
  min-width: 0;
}

.c360-tl-text {
  font-size: 13px;
  color: var(--text-primary);
}

.c360-tl-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c360-tl-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Messages */
.c360-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.c360-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.c360-msg-in {
  background: var(--bg-elevated);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.c360-msg-out {
  background: rgba(56, 189, 248, 0.12);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.c360-msg-text {
  word-break: break-word;
}

.c360-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Calls list */
.c360-calls-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.c360-call-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.c360-call-dir {
  font-size: 13px;
  flex: 1;
}

.c360-call-dur {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.c360-call-outcome {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.c360-outcome-booked { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.c360-outcome-callback { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); }
.c360-outcome-refused { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }
.c360-outcome-interested { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }
.c360-outcome-no_answer { background: rgba(82, 88, 104, 0.3); color: var(--text-secondary); }

.c360-call-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* CRM */
.c360-crm-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.c360-crm-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.c360-crm-row:nth-child(odd) {
  background: var(--bg-hover);
}

.c360-crm-key {
  font-size: 13px;
  color: var(--text-secondary);
}

.c360-crm-val {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.c360-crm-section {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 20px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.c360-crm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.c360-tag {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
}

/* Phone link styling (clickable phone numbers) */
.phone-link {
  color: var(--accent-cyan);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dotted rgba(56, 189, 248, 0.3);
  transition: all var(--transition-fast);
}

.phone-link:hover {
  color: #60ccf8;
  border-bottom-color: #60ccf8;
}

@media (max-width: 600px) {
  .c360-panel {
    width: 100vw;
  }
  .c360-header {
    flex-wrap: wrap;
  }
  .c360-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}