/* ==============================================================================
   MEDIAFLUX DESIGN SYSTEM - OFFICIAL IDENTITY TOKENS (INSTAGRAM MODULE)
   ============================================================================== */
:root {
  /* Brand Attributes & Core Hues */
  --mf-dynamic: #0038FF;               /* Dinâmico: Royal Electric Blue */
  --mf-dynamic-light: #2563EB;
  --mf-dynamic-hover: #1A54FF;
  --mf-dynamic-active: #002ECC;
  --mf-dynamic-glow: rgba(0, 56, 255, 0.4);
  --mf-dynamic-subtle: rgba(0, 56, 255, 0.12);

  --mf-friendly: #38BDF8;              /* Amigável: Sky Cyan Blue */
  --mf-friendly-hover: #7DD3FC;
  --mf-friendly-soft: rgba(56, 189, 248, 0.12);
  --mf-friendly-glow: rgba(56, 189, 248, 0.28);

  --mf-robust: #07090E;                /* Robusto: Deep Pitch Obsidian */
  --mf-robust-canvas: #090B12;
  --mf-robust-elevated: #0E131E;        /* Sidebar / Headers */
  --mf-robust-surface: #131926;         /* Elevated surfaces */
  --mf-robust-card: rgba(14, 19, 29, 0.88);

  --mf-reliable: #1C2436;              /* Confiável: Slate Charcoal */
  --mf-reliable-border: #232E45;
  --mf-reliable-light: #344463;
  --mf-reliable-divider: rgba(255, 255, 255, 0.08);

  --mf-objective: #FFFFFF;             /* Objetivo: Crisp Pure White */
  --mf-objective-light: #F8FAFC;
  --mf-objective-muted: #94A3B8;
  --mf-objective-dim: #64748B;
  --mf-objective-dark: #334155;

  /* Status Feedback */
  --status-success: #10B981;
  --status-success-soft: rgba(16, 185, 129, 0.14);
  --status-success-border: rgba(16, 185, 129, 0.35);

  --status-danger: #EF4444;
  --status-danger-soft: rgba(239, 68, 68, 0.14);
  --status-danger-border: rgba(239, 68, 68, 0.35);

  --status-warning: #F59E0B;
  --status-warning-soft: rgba(245, 158, 11, 0.14);
  --status-warning-border: rgba(245, 158, 11, 0.35);

  --status-purple: #A855F7;
  --status-purple-soft: rgba(168, 85, 247, 0.14);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

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

body {
  background-color: var(--mf-robust-canvas);
  color: var(--mf-objective-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glow */
body::before {
  content: "";
  position: fixed;
  top: -120px;
  left: 20%;
  width: 700px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 56, 255, 0.12) 0%, rgba(56, 189, 248, 0.04) 50%, transparent 80%);
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--mf-robust);
}
::-webkit-scrollbar-thumb {
  background: var(--mf-reliable-border);
  border-radius: var(--radius-full);
}

.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--mf-robust-elevated);
  border-right: 1px solid var(--mf-reliable-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.brand-logo-badge {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--mf-dynamic), #8B5CF6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 16px var(--mf-dynamic-glow);
}

.brand-info h1 {
  color: var(--mf-objective);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-info span {
  font-size: 11px;
  color: var(--mf-friendly);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--mf-objective-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--mf-robust-surface);
  color: var(--mf-objective);
}

.nav-item.active {
  background-color: var(--mf-dynamic-subtle);
  color: var(--mf-objective);
  border-color: rgba(0, 56, 255, 0.3);
}

.nav-item.active svg {
  color: var(--mf-friendly);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  transition: color 0.2s;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--mf-reliable-divider);
  font-size: 12px;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--mf-robust-surface);
  border: 1px solid var(--mf-reliable-border);
  border-radius: var(--radius-full);
}

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

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.topbar {
  height: 70px;
  border-bottom: 1px solid var(--mf-reliable-border);
  background-color: rgba(14, 19, 29, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--mf-objective);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--mf-dynamic), var(--mf-dynamic-light));
  color: #fff;
  box-shadow: 0 4px 14px var(--mf-dynamic-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--mf-dynamic-hover), var(--mf-dynamic));
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--mf-robust-surface);
  border: 1px solid var(--mf-reliable-border);
  color: var(--mf-objective-muted);
}

.btn-secondary:hover {
  background-color: var(--mf-reliable);
  color: var(--mf-objective);
}

.content-body {
  padding: 32px;
}

/* Cards & Layout */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--mf-robust-card);
  border: 1px solid var(--mf-reliable-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--mf-friendly), transparent);
  opacity: 0.6;
}

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

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--mf-objective-dim);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--mf-robust-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mf-friendly);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--mf-objective);
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
}

.stat-sub {
  font-size: 12px;
  color: var(--status-success);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Charts and Two Column Sections */
.grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.panel-card {
  background: var(--mf-robust-card);
  border: 1px solid var(--mf-reliable-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

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

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mf-objective);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mf-objective-dim);
  border-bottom: 1px solid var(--mf-reliable-border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--mf-reliable-divider);
  color: var(--mf-objective-muted);
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-lead {
  background: var(--mf-dynamic-subtle);
  color: #60A5FA;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-qualificado {
  background: var(--status-warning-soft);
  color: #FBBF24;
  border: 1px solid var(--status-warning-border);
}

.badge-cliente {
  background: var(--status-success-soft);
  color: #34D399;
  border: 1px solid var(--status-success-border);
}

.badge-tag {
  background: var(--mf-robust-surface);
  color: var(--mf-objective-muted);
  border: 1px solid var(--mf-reliable-border);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Chat view styles */
.chat-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  height: 600px;
  border: 1px solid var(--mf-reliable-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--mf-robust-card);
}

.chat-list {
  border-right: 1px solid var(--mf-reliable-border);
  overflow-y: auto;
  background-color: var(--mf-robust-surface);
}

.chat-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--mf-reliable-divider);
  cursor: pointer;
  transition: background 0.15s;
}

.chat-item:hover, .chat-item.active {
  background-color: var(--mf-robust-elevated);
}

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

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.5;
}

.bubble-incoming {
  align-self: flex-start;
  background-color: var(--mf-robust-surface);
  border: 1px solid var(--mf-reliable-border);
  color: var(--mf-objective-light);
  border-bottom-left-radius: 4px;
}

.bubble-outgoing {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--mf-dynamic), #1D4ED8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--mf-reliable-border);
  display: flex;
  gap: 12px;
  background: var(--mf-robust-elevated);
}

.input-field {
  flex: 1;
  background-color: var(--mf-robust-canvas);
  border: 1px solid var(--mf-reliable-border);
  color: var(--mf-objective);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.input-field:focus {
  outline: none;
  border-color: var(--mf-friendly);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--mf-robust-elevated);
  border: 1px solid var(--mf-reliable-border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
