/* ==========================================================================
   OmniFlow AI - Meta Coexistence Hub & Omnichannel Viewer Stylesheet
   Modern Glassmorphism Design System with Dynamic Theming
   ========================================================================== */

:root {
  /* Dark Theme Palette (Default) */
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2234;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --bg-glass-card: rgba(26, 34, 52, 0.6);
  --bg-glass-input: rgba(11, 15, 25, 0.7);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-highlight: rgba(99, 102, 241, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4; /* Cyan */
  --accent-whatsapp: #25d366;
  --accent-whatsapp-dark: #128c7e;
  --accent-instagram: #e1306c;
  --accent-instagram-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);

  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-card: rgba(255, 255, 255, 0.7);
  --bg-glass-input: rgba(241, 245, 249, 0.9);
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.15);
  --border-highlight: rgba(99, 102, 241, 0.3);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 30px rgba(0, 0, 0, 0.12);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Animated Mesh Background */
.background-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.mesh-blob {
  position: absolute;
  filter: blur(100px);
  opacity: 0.18;
  border-radius: 50%;
  animation: floatBlobs 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-primary);
  top: -100px;
  left: 10%;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: var(--accent-secondary);
  bottom: -50px;
  right: 15%;
  animation-duration: 25s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: var(--accent-whatsapp);
  top: 40%;
  left: 50%;
  animation-duration: 18s;
}

@keyframes floatBlobs {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 80px) scale(0.95); }
}

/* Layout Grid */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow);
}

.brand-text h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge-coex {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-pill {
  margin-left: auto;
  font-size: 0.65rem;
  background: rgba(37, 211, 102, 0.15);
  color: var(--accent-whatsapp);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-pill-live {
  margin-left: auto;
  font-size: 0.65rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  animation: pulseLive 2s infinite;
}

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

.nav-badge-count {
  margin-left: auto;
  font-size: 0.75rem;
  background: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: 8px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-success);
}

.status-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-sub {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.theme-toggle {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

body.dark-theme .sun-icon { display: block; }
body.dark-theme .moon-icon { display: none; }
body.light-theme .sun-icon { display: none; }
body.light-theme .moon-icon { display: block; }

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  max-width: 1550px;
}

/* Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.header-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.header-titles p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.env-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: #38bdf8;
  font-weight: 500;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: white;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-text-action:hover {
  color: var(--accent-danger);
}

/* Glass Cards */
.card-glass {
  background: var(--bg-glass-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition-fast);
}

.card-glass.highlight-border {
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-glow);
}

.card-glass.no-padding {
  padding: 0;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.card-title h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.card-body {
  padding: 1.5rem;
}

/* Info Banner */
.info-card-glass {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.info-card-icon {
  width: 48px;
  height: 48px;
  background: rgba(37, 211, 102, 0.15);
  color: var(--accent-whatsapp);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-card-body h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.info-card-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.coex-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.rule-chip i {
  color: var(--accent-whatsapp);
  width: 15px;
  height: 15px;
}

/* Tabs */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

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

/* Onboarding Grid */
.onboarding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.15rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.5rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* Meta Buttons Stack */
.section-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.onboarding-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn-meta-whatsapp {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #1f9d55, #128c7e);
  color: white;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.25);
  text-align: left;
}

.btn-meta-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

.btn-meta-instagram {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--accent-instagram-gradient);
  color: white;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 16px rgba(225, 48, 108, 0.25);
  text-align: left;
}

.onboarding-step-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.onboarding-step-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.step-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.step-detail strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.step-detail p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
}

.btn-meta-instagram:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(225, 48, 108, 0.4);
}

.btn-google-calendar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(66, 133, 244, 0.4);
  color: white;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.15);
  text-align: left;
}

.btn-google-calendar:hover {
  transform: translateY(-2px);
  border-color: #4285f4;
  box-shadow: 0 8px 24px rgba(66, 133, 244, 0.35);
}

.btn-meta-icon.google-icon {
  background: rgba(66, 133, 244, 0.2);
  color: #4285f4;
}

.btn-meta-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-meta-content {
  flex: 1;
}

.btn-meta-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
}

.btn-meta-sub {
  display: block;
  font-size: 0.78rem;
  opacity: 0.85;
}

.arrow-icon {
  opacity: 0.7;
}

/* Demo Simulator Box */
.demo-simulator-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.simulator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.sim-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-secondary);
}

.btn-sim-trigger {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sim-trigger:hover {
  background: var(--accent-secondary);
  color: black;
}

.sim-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Console Output */
.console-output {
  background: #060911;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.log-entry {
  line-height: 1.4;
  word-break: break-all;
}

.log-system { color: #818cf8; }
.log-info { color: #38bdf8; }
.log-success { color: #34d399; font-weight: bold; }
.log-warn { color: #fbbf24; }
.log-error { color: #f87171; }

/* Table Component */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  width: 360px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  width: 100%;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-surface-elevated);
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.badge-tag.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-tag.coex {
  background: rgba(37, 211, 102, 0.15);
  color: var(--accent-whatsapp);
  border: 1px solid rgba(37, 211, 102, 0.3);
}

.badge-tag.cloud-only {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

/* Visor Omnicanal Layout */
.chat-viewer-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 180px);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-sidebar-header h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.filter-channel-pills {
  display: flex;
  gap: 0.4rem;
}

.filter-channel-pills .pill {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.filter-channel-pills .pill.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.chat-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chat-list-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.item-avatar.whatsapp { color: var(--accent-whatsapp); border: 2px solid rgba(37, 211, 102, 0.4); }
.item-avatar.instagram { color: var(--accent-instagram); border: 2px solid rgba(225, 48, 108, 0.4); }

.channel-mini-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.channel-mini-badge.wa { background: var(--accent-whatsapp); color: black; }
.channel-mini-badge.ig { background: var(--accent-instagram); color: white; }

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

.item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.item-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.item-msg-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Main View */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-main-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.user-meta h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
}

.user-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-metrics-bar {
  display: flex;
  gap: 0.6rem;
}

.metric-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.metric-chip strong {
  color: var(--text-primary);
}

.chat-messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.15);
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  max-width: 320px;
  color: var(--text-muted);
}

.chat-empty-state i {
  width: 50px;
  height: 50px;
  margin-bottom: 0.8rem;
  opacity: 0.5;
}

/* Chat Message Bubbles */
.message-bubble {
  max-width: 68%;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: msgPop 0.2s ease-out;
}

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

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

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

.bubble-content {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.message-bubble.outgoing .bubble-content {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  padding: 0 4px;
}

.audio-player-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  margin-top: 0.4rem;
}

.btn-play-audio {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-whatsapp);
  border: none;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.audio-waveform {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  position: relative;
}

.audio-waveform-fill {
  width: 45%;
  height: 100%;
  background: var(--accent-whatsapp);
  border-radius: 2px;
}

.chat-audit-footer {
  padding: 0.75rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-title-group h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface-elevated);
}

/* Docs Step */
.doc-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.step-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.step-content pre {
  background: #060911;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: #38bdf8;
  overflow-x: auto;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  animation: slideToast 0.2s ease-out;
}

.toast.success { border-color: var(--accent-success); color: var(--accent-success); }
.toast.error { border-color: var(--accent-danger); color: var(--accent-danger); }
.toast.info { border-color: var(--accent-secondary); color: var(--accent-secondary); }

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