/* ==========================================================================
   NEXUS INFOHUB - MODERN DARK GLASSMORPHISM DESIGN SYSTEM
   ========================================================================== */

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

:root {
  --bg-main: #090d16;
  --bg-sidebar: #0e1322;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 54, 0.85);
  --bg-card-solid: #131a2b;
  --bg-input: rgba(13, 19, 32, 0.8);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(99, 102, 241, 0.35);
  --border-accent: rgba(99, 102, 241, 0.5);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --secondary: #8b5cf6;

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px var(--primary-glow);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 45%);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: #818cf8;
}

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

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  transition: transform var(--transition-normal);
}

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

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.sidebar-brand span {
  color: var(--primary);
  font-weight: 800;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 12px 4px;
  letter-spacing: 0.05em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.nav-link i {
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
  transition: transform var(--transition-fast);
}

.nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}
.nav-link:hover i {
  transform: translateX(2px);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
  border-left: 3px solid var(--primary);
  box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.1);
}
.nav-link.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}
.user-details {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.user-avatar.suporte {
  background: linear-gradient(135deg, #a855f7, #6366f1);
}
.user-role.suporte {
  color: #c084fc;
  font-weight: 600;
}
.user-role.admin {
  color: #38bdf8;
}
.btn-logout {
  color: var(--text-dim);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-wrapper {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 70px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title-box h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.page-title-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.content-body {
  padding: 32px;
  flex: 1;
}

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.glass-card:hover {
  border-color: var(--border-color-hover);
}

/* Grid System */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}
.grid-cols-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

/* Stat Cards */
.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.primary {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}
.stat-icon.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  box-shadow: 0 0 20px var(--success-glow);
}
.stat-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}
.stat-icon.info {
  background: rgba(6, 182, 212, 0.15);
  color: var(--info);
}
.stat-info {
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
  color: #fff;
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.form-label .required {
  color: var(--danger);
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(18, 25, 42, 0.95);
}
.form-control::placeholder {
  color: var(--text-dim);
}
textarea.form-control {
  resize: vertical;
  min-height: 110px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.input-group {
  display: flex;
  align-items: center;
  position: relative;
}
.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
}
.input-with-icon {
  padding-left: 42px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.table td {
  padding: 14px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}
.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-success .badge-dot { background: #10b981; }

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

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-warning .badge-dot { background: #f59e0b; }

.badge-info {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-info .badge-dot { background: #06b6d4; }

/* Alerts / Flashes */
.flash-messages {
  margin-bottom: 24px;
}
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  animation: slideDown 0.3s ease;
}
.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}
.alert-info {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.3);
  color: #7dd3fc;
}
.alert-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.7;
}
.alert-close:hover {
  opacity: 1;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}
.modal-dialog {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: zoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* WhatsApp Live Preview Simulator */
.wa-preview-card {
  background: #0b141a;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  max-width: 380px;
  margin: 0 auto;
}
.wa-preview-header {
  background: #202c33;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e9edef;
}
.wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #00a884;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}
.wa-user-info {
  display: flex;
  flex-direction: column;
}
.wa-user-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.wa-user-status {
  font-size: 0.72rem;
  color: #8696a0;
}
.wa-preview-body {
  padding: 20px 14px;
  min-height: 240px;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.wa-bubble {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  padding: 8px 12px;
  border-radius: 8px 8px 0px 8px;
  max-width: 85%;
  font-size: 0.88rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.wa-bubble-time {
  font-size: 0.68rem;
  color: #8696a0;
  text-align: right;
  margin-top: 4px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.pulsing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  animation: pulseGlow 1.5s infinite;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .grid-cols-1-2 {
    grid-template-columns: 1fr;
  }
}

/* Media Upload Zone & Cards */
.media-upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.media-upload-zone:hover, .media-upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.media-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 10px;
}
.media-preview-container {
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* ==========================================================================
   CRM KANBAN BOARD SYSTEM
   ========================================================================== */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 24px;
  align-items: flex-start;
  min-height: calc(100vh - 280px);
}

.kanban-column {
  min-width: 300px;
  max-width: 320px;
  flex: 1 0 300px;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition-fast);
}

.kanban-column-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.kanban-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.kanban-stage-pill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.kanban-stage-badge {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  font-size: 0.72rem;
  padding: 2px 8px;
  color: var(--text-muted);
  font-weight: 600;
}

.kanban-stage-total {
  font-size: 0.78rem;
  color: #10b981;
  font-weight: 600;
}

.kanban-cards-container {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 140px;
  transition: all 0.2s ease;
}

.kanban-cards-container.drag-over {
  background: rgba(99, 102, 241, 0.12);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
}

.deal-card {
  background: rgba(26, 34, 54, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.deal-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.6);
}

.deal-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.deal-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.3;
}

.deal-contact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.deal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.deal-value {
  font-weight: 700;
  color: #10b981;
  font-size: 0.92rem;
}

.deal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deal-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.deal-btn-icon:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.deal-btn-icon.wa:hover {
  background: #25d366;
  border-color: #25d366;
}

/* ==========================================================================
   LIVE WHATSAPP INBOX SYSTEM
   ========================================================================== */
.inbox-layout {
  display: grid;
  grid-template-columns: 330px 1fr 310px;
  height: calc(100vh - 180px);
  min-height: 580px;
  background: rgba(14, 19, 34, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

/* 1. Left Sidebar: Conversations */
.inbox-sidebar {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: rgba(14, 19, 34, 0.9);
  height: 100%;
}

.inbox-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.inbox-filter-slots {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 2px 0;
}

.inbox-slot-pill {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.inbox-slot-pill:hover, .inbox-slot-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.inbox-conversations-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.conv-item {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.conv-item.active {
  background: rgba(99, 102, 241, 0.14);
  border-left: 4px solid var(--primary);
}

.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #38bdf8;
  position: relative;
  flex-shrink: 0;
}

.conv-avatar .presence-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #0e1322;
  background: #64748b;
}

.conv-avatar .presence-dot.online {
  background: #22c55e;
}

.conv-details {
  flex: 1;
  min-width: 0;
}

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

.conv-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.conv-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.conv-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-preview.typing {
  color: #25d366;
  font-weight: 600;
}

.conv-badge {
  background: #25d366;
  color: #0b141a;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* 2. Center: Chat Stream & Composer */
.inbox-chat-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #090e17;
  position: relative;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 24, 38, 0.85);
  backdrop-filter: blur(10px);
}

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

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.msg-bubble {
  max-width: 68%;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.92rem;
  position: relative;
  word-wrap: break-word;
  line-height: 1.45;
}

.msg-bubble.inbound {
  align-self: flex-start;
  background: #182236;
  color: #f1f5f9;
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.msg-bubble.outbound {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.msg-sender-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
}

.msg-text {
  white-space: pre-wrap;
}

.msg-media-preview {
  margin-top: 4px;
  margin-bottom: 4px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 320px;
}

.msg-media-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

.msg-media-preview video {
  width: 100%;
  max-height: 280px;
  border-radius: 8px;
}

.msg-audio-player {
  margin: 6px 0;
  width: 250px;
}

.msg-doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin: 4px 0;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 0.68rem;
  opacity: 0.75;
  margin-top: 4px;
}

.msg-tick-read {
  color: #38bdf8;
}

.msg-reaction-badge {
  position: absolute;
  bottom: -9px;
  right: 12px;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1px 6px;
  font-size: 0.82rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}

.chat-composer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: rgba(18, 24, 38, 0.95);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-composer textarea {
  flex: 1;
  background: rgba(13, 19, 32, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  resize: none;
  height: 42px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-composer textarea:focus {
  border-color: var(--primary);
}

/* 3. Right Sidebar: CRM Quick Panel */
.inbox-crm-sidebar {
  border-left: 1px solid var(--border-color);
  background: rgba(14, 19, 34, 0.9);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.crm-panel-card {
  background: rgba(26, 34, 54, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.crm-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 1100px) {
  .inbox-layout {
    grid-template-columns: 280px 1fr;
  }
  .inbox-crm-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .inbox-layout {
    grid-template-columns: 1fr;
  }
  .inbox-sidebar {
    display: none;
  }
}
