/* =========================================================
   TAG Assistente IA – Dashboard CSS v2
   Paleta oficial: Bordô #7D0000 | Vermelho TAG #9B0000
   Design: Premium, moderno, minimalista
   ========================================================= */

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

:root {
  /* ── Cores TAG ───────────────────────────────── */
  --tag-red:      #9B0000;
  --tag-red-dk:   #7D0000;
  --tag-red-lt:   #C0392B;
  --tag-red-soft: rgba(155,0,0,.08);
  --tag-red-glow: rgba(155,0,0,.25);

  /* ── Sidebar ─────────────────────────────────── */
  --sidebar-w:    250px;
  --topbar-h:     64px;
  --sidebar-bg:   #0F0F0F;
  --sidebar-item: rgba(255,255,255,.07);
  --sidebar-text: rgba(255,255,255,.55);

  /* ── Background / Surface ────────────────────── */
  --bg:           #F0F2F7;
  --bg-deep:      #E8EBF2;
  --surface:      #FFFFFF;
  --surface-2:    #FAFBFD;
  --border:       #E4E8F0;
  --border-soft:  rgba(0,0,0,.06);

  /* ── Texto ───────────────────────────────────── */
  --text:         #111827;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;

  /* ── Cores de destaque ───────────────────────── */
  --blue:         #2563EB;
  --blue-lt:      #EFF6FF;
  --green:        #059669;
  --green-lt:     #ECFDF5;
  --orange:       #D97706;
  --orange-lt:    #FFFBEB;
  --purple:       #7C3AED;
  --purple-lt:    #F5F3FF;
  --teal:         #0891B2;
  --teal-lt:      #ECFEFF;
  --pink:         #DB2777;
  --pink-lt:      #FDF2F8;

  /* ── Métricas visuais ────────────────────────── */
  --radius:       16px;
  --radius-md:    12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow-xs:    0 1px 3px rgba(0,0,0,.07);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.08);
  --shadow:       0 4px 20px rgba(0,0,0,.09);
  --shadow-md:    0 8px 32px rgba(0,0,0,.12);
  --shadow-red:   0 8px 24px rgba(155,0,0,.25);
  --transition:   .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a  { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; outline: none; }
canvas { display: block; }

/* ── Scrollbar refinada ─────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: transform var(--transition-slow);
  box-shadow: 4px 0 40px rgba(0,0,0,.35);
}

/* ── Logo ──────────────────────────────────────────────── */
.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.sidebar-logo::after {
  content: '';
  position: absolute;
  bottom: 0; left: 1.25rem; right: 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(155,0,0,.6), transparent);
}
.logo-img-wrap {
  background: var(--tag-red-dk);
  border-radius: var(--radius-md);
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-red);
  position: relative;
}
.logo-img-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.12), transparent 60%);
  border-radius: var(--radius-md);
}
.logo-img-wrap img {
  width: 56px; height: 56px;
  object-fit: contain;
  filter: brightness(1.05);
  position: relative; z-index: 1;
}
.logo-tagline {
  text-align: center;
}
.logo-tagline .logo-brand {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.logo-tagline .logo-sub {
  display: block;
  font-size: .68rem;
  color: rgba(255,255,255,.38);
  letter-spacing: .05em;
  margin-top: .1rem;
}

/* ── Nav ────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem .75rem;
  overflow-y: auto;
}
.nav-section-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.22);
  padding: .5rem .5rem .4rem;
  margin-top: .5rem;
  margin-bottom: .15rem;
}
.sidebar-nav ul { display: flex; flex-direction: column; gap: .2rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .72rem 1rem;
  color: var(--sidebar-text);
  font-size: .855rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  pointer-events: all;
  -webkit-tap-highlight-color: transparent;
}
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: .9rem;
  flex-shrink: 0;
  transition: color var(--transition);
}
.nav-item span:not(.badge) { flex: 1; }

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}
.nav-item:hover i { color: rgba(255,255,255,.7); }

.nav-item.active {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(155,0,0,.35);
}
.nav-item.active i { color: rgba(255,255,255,.95); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -4px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 55%;
  background: rgba(255,255,255,.7);
  border-radius: 0 3px 3px 0;
  pointer-events: none;
}

.badge {
  margin-left: auto;
  background: var(--tag-red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(155,0,0,.4);
}
.nav-item.active .badge { background: rgba(255,255,255,.25); box-shadow: none; }

/* ── Footer ─────────────────────────────────────────────── */
.sidebar-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.assistant-status {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .78rem;
  color: rgba(255,255,255,.4);
  padding: .6rem .75rem;
  background: rgba(255,255,255,.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.06);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #374151;
  flex-shrink: 0;
}
.status-dot.online {
  background: #10B981;
  box-shadow: 0 0 0 2px rgba(16,185,129,.2), 0 0 8px rgba(16,185,129,.5);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.2), 0 0 8px rgba(16,185,129,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(16,185,129,.1), 0 0 14px rgba(16,185,129,.6); }
}
.assistant-name { font-weight: 600; color: rgba(255,255,255,.6); }

/* =========================================================
   MAIN WRAPPER
   ========================================================= */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky;
  top: 0; z-index: 100;
  box-shadow: var(--shadow-xs);
}
.hamburger { display: none; color: var(--text); font-size: 1.1rem; padding: .4rem; border-radius: var(--radius-xs); }
.hamburger:hover { background: var(--bg); }

.topbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.topbar-date {
  font-size: .75rem;
  color: var(--text-muted);
  padding: .2rem .6rem;
  background: var(--bg);
  border-radius: 99px;
  border: 1px solid var(--border);
  font-weight: 500;
}

.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  position: relative;
  transition: all var(--transition);
  background: transparent;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px;
  background: var(--tag-red);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  animation: notif-blink 2s infinite;
}
@keyframes notif-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}
.topbar-divider { width: 1px; height: 20px; background: var(--border); margin: 0 .15rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .75rem .3rem .35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
}
.user-chip:hover { border-color: var(--tag-red); background: var(--tag-red-soft); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(155,0,0,.3);
}
.user-chip-name { font-size: .78rem; font-weight: 600; color: var(--text); }

/* =========================================================
   PAGES
   ========================================================= */
.page {
  display: none;
  padding: 1.75rem 1.75rem 3rem;
  flex: 1;
  min-width: 0;
  animation: fadeIn .25s ease;
}
.page.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.2;
}
.page-header h2 span { color: var(--tag-red); }
.subtitle {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .3rem;
  font-weight: 400;
}

/* ── Date Filter ─────────────────────────────────────────── */
.date-filter { display: flex; gap: .35rem; }
.filter-btn {
  padding: .42rem .9rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
  letter-spacing: .01em;
}
.filter-btn:hover { border-color: var(--tag-red); color: var(--tag-red); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 12px rgba(155,0,0,.3);
}

/* =========================================================
   KPI CARDS
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .04;
  transform: translate(25px,-25px);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.kpi-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
/* Icon backgrounds */
.bg-blue   { background: linear-gradient(135deg, #1D4ED8, var(--blue)); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.bg-green  { background: linear-gradient(135deg, #047857, var(--green)); box-shadow: 0 4px 14px rgba(5,150,105,.35); }
.bg-orange { background: linear-gradient(135deg, #B45309, var(--orange)); box-shadow: 0 4px 14px rgba(217,119,6,.35); }
.bg-purple { background: linear-gradient(135deg, #6D28D9, var(--purple)); box-shadow: 0 4px 14px rgba(124,58,237,.35); }
.bg-teal   { background: linear-gradient(135deg, #0E7490, var(--teal)); box-shadow: 0 4px 14px rgba(8,145,178,.35); }
.bg-red    { background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red)); box-shadow: var(--shadow-red); }

.kpi-info { display: flex; flex-direction: column; gap: .18rem; min-width: 0; flex: 1; }
.kpi-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--text);
}
.kpi-delta {
  font-size: .72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: #EF4444; }
.kpi-delta i    { font-size: .7rem; }

/* =========================================================
   CHART CARDS
   ========================================================= */
.charts-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: stretch;
}
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
}
.chart-card.wide { flex: 2; min-width: 360px; }

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: .5rem;
  flex-shrink: 0;
}
.chart-title {
  font-size: .875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  letter-spacing: -.01em;
}
.chart-title i {
  color: var(--tag-red);
  font-size: .85rem;
  width: 20px; height: 20px;
  background: var(--tag-red-soft);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .73rem;
  color: var(--text-muted);
  font-weight: 500;
}
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
}
.dot.blue   { background: var(--blue); }
.dot.orange { background: var(--orange); }
.dot.green  { background: var(--green); }
.link-ver-tudo {
  font-size: .76rem;
  color: var(--tag-red);
  font-weight: 600;
  transition: opacity var(--transition);
}
.link-ver-tudo:hover { opacity: .75; }

/* ── Stat pill (dentro do chart card header) ─────────────── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  background: var(--tag-red-soft);
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--tag-red);
}

/* =========================================================
   DATA TABLE
   ========================================================= */
.table-wrapper { overflow-x: auto; flex: 1; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.data-table thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.data-table th {
  text-align: left;
  padding: .7rem .9rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.data-table td {
  padding: .8rem .9rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--transition);
}
.data-table tbody tr:hover td {
  background: var(--surface-2);
}

/* ── Status badges ──────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .22rem .7rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .01em;
}
.status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-badge.finalizado  { background: #D1FAE5; color: #065F46; }
.status-badge.finalizado::before  { background: #059669; }
.status-badge.andamento   { background: #DBEAFE; color: #1E40AF; }
.status-badge.andamento::before   { background: #2563EB; }
.status-badge.derivado    { background: #FEF3C7; color: #92400E; }
.status-badge.derivado::before    { background: #D97706; }
.status-badge.aguardando  { background: #FEF3C7; color: #92400E; }
.status-badge.aguardando::before  { background: #D97706; }
.status-badge.aprovado    { background: #D1FAE5; color: #065F46; }
.status-badge.aprovado::before    { background: #059669; }
.status-badge.recusado    { background: #FEE2E2; color: #991B1B; }
.status-badge.recusado::before    { background: #EF4444; }

/* =========================================================
   PRODUCTS LIST
   ========================================================= */
.products-list { display: flex; flex-direction: column; gap: .75rem; flex: 1; justify-content: center; }
.product-item {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.product-rank {
  width: 26px; height: 26px;
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.product-rank.gold   { background: #FEF3C7; color: #D97706; border-color: #FDE68A; }
.product-rank.silver { background: #F1F5F9; color: #64748B; border-color: #E2E8F0; }
.product-rank.bronze { background: #FEF0E7; color: #C2410C; border-color: #FDDCBC; }
.product-info { flex: 1; min-width: 0; }
.product-name { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.product-bar-wrap {
  background: var(--bg);
  border-radius: 99px;
  height: 5px;
  overflow: hidden;
}
.product-bar {
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--tag-red-dk), var(--tag-red));
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.product-pct {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* =========================================================
   CONVERSAS PAGE
   ========================================================= */
.conv-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  height: calc(100vh - var(--topbar-h) - 150px);
  min-height: 420px;
}
.conv-list {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.conv-list-header {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.conv-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active {
  background: var(--tag-red-soft);
  border-left: 3px solid var(--tag-red);
}
.conv-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.conv-meta { flex: 1; min-width: 0; }
.conv-name {
  font-size: .855rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .2rem;
}
.conv-time { font-size: .68rem; color: var(--text-light); flex-shrink: 0; }
.conv-preview {
  font-size: .775rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}
.conv-status-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ── Pill de orçamento na lista ──────────────────────────── */
.conv-orc-pill {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  font-size: .65rem;
  font-weight: 700;
  padding: .12rem .5rem;
  border-radius: 99px;
  background: rgba(155,0,0,.08);
  color: var(--tag-red);
  border: 1px solid rgba(155,0,0,.18);
  letter-spacing: .01em;
  white-space: nowrap;
}
.conv-orc-pill i { font-size: .6rem; }

/* ── Card de orçamento no detalhe da conversa ───────────── */
.conv-orc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: linear-gradient(135deg, rgba(155,0,0,.04), rgba(155,0,0,.02));
  border-bottom: 1px solid rgba(155,0,0,.12);
  border-top: 1px solid rgba(155,0,0,.08);
  flex-shrink: 0;
}
.conv-orc-card-left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.conv-orc-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(155,0,0,.25);
}
.conv-orc-card-label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .1rem;
}
.conv-orc-card-id {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--tag-red);
  font-family: monospace;
  letter-spacing: .02em;
}
.conv-orc-card-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.conv-orc-card-value {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.02em;
}

/* Conversa detalhe */
.conv-detail {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conv-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: .75rem;
}
.conv-detail-empty i { font-size: 3rem; opacity: .2; }
.conv-detail-empty p { font-size: .875rem; font-weight: 500; }
.conv-detail-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  background: var(--surface-2);
  flex-shrink: 0;
}
.conv-detail-header h4 { font-size: .93rem; font-weight: 700; margin-bottom: .2rem; }
.conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #F7F8FC;
}
.msg { display: flex; gap: .6rem; max-width: 80%; }
.msg.bot  { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  box-shadow: 0 2px 8px rgba(155,0,0,.25);
}
.msg.user .msg-avatar {
  background: linear-gradient(135deg, #1E3A5F, #2563EB);
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.msg-bubble {
  padding: .65rem 1rem;
  border-radius: 14px 14px 14px 4px;
  font-size: .82rem;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  border: none;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 4px 14px rgba(155,0,0,.25);
}
.msg-time {
  font-size: .64rem;
  color: var(--text-light);
  margin-top: .25rem;
}

/* =========================================================
   REPORTS PAGE
   ========================================================= */
.report-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.report-day-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem .75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  text-align: center;
  transition: all var(--transition);
  cursor: default;
}
.report-day-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.report-day-card.today {
  border-color: var(--tag-red);
  box-shadow: 0 0 0 2px var(--tag-red-soft), var(--shadow);
}
.rd-day  { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-light); }
.rd-date { font-size: 1rem;   font-weight: 800; margin: .2rem 0; }
.rd-conv { font-size: 1.4rem; font-weight: 800; color: var(--tag-red); line-height: 1; margin: .3rem 0; }
.rd-label { font-size: .6rem; color: var(--text-light); font-weight: 500; }
.rd-badges { display: flex; gap: .25rem; justify-content: center; margin-top: .5rem; flex-wrap: wrap; }
.rd-mini { font-size: .6rem; padding: .1rem .35rem; border-radius: 99px; font-weight: 700; }
.rd-mini.orc  { background: #DBEAFE; color: #1E40AF; }
.rd-mini.lead { background: #D1FAE5; color: #065F46; }

/* Insights */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.insight-card {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.insight-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.insight-card i { font-size: 1.25rem; flex-shrink: 0; margin-top: .05rem; }
.insight-card strong { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .25rem; }
.insight-card p { color: var(--text-muted); font-size: .78rem; line-height: 1.5; }
.insight-blue   { background: var(--blue-lt);   } .insight-blue   i { color: var(--blue); }
.insight-green  { background: var(--green-lt);  } .insight-green  i { color: var(--green); }
.insight-orange { background: var(--orange-lt); } .insight-orange i { color: var(--orange); }
.insight-purple { background: var(--purple-lt); } .insight-purple i { color: var(--purple); }

/* =========================================================
   SETTINGS PAGE
   ========================================================= */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.settings-card h3 {
  font-size: .9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.01em;
}
.settings-card h3 i {
  color: var(--tag-red);
  font-size: .85rem;
  width: 28px; height: 28px;
  background: var(--tag-red-soft);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
}
.form-group { margin-bottom: 1rem; }
.form-group > label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .4rem;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  padding: .58rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .855rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--tag-red);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--tag-red-soft);
}
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .35rem 0;
}
.toggle-group > label:first-child { margin: 0; text-transform: none; font-size: .84rem; font-weight: 500; color: var(--text); letter-spacing: 0; }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider-toggle {
  position: absolute;
  cursor: pointer; inset: 0;
  background: #D1D5DB;
  border-radius: 99px;
  transition: var(--transition);
}
.slider-toggle::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.toggle input:checked + .slider-toggle {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
}
.toggle input:checked + .slider-toggle::before { transform: translateX(18px); }

.time-range { display: flex; align-items: center; gap: .5rem; }
.time-range input { flex: 1; }
.time-range span { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.color-picker-row { display: flex; align-items: center; gap: .75rem; }
.form-color {
  width: 44px; height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 3px;
  background: var(--bg);
}
.color-hex-display {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: monospace;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .58rem 1.25rem;
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .855rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(155,0,0,.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(155,0,0,.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: none; box-shadow: 0 2px 8px rgba(155,0,0,.3); }

.btn-sm {
  padding: .32rem .75rem;
  border-radius: var(--radius-xs);
  font-size: .75rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: .01em;
}
.btn-sm:hover {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(155,0,0,.3);
}

/* ── Search / Filter ─────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .42rem .8rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar:focus-within {
  border-color: var(--tag-red);
  box-shadow: 0 0 0 3px var(--tag-red-soft);
  background: var(--surface);
}
.search-bar i { color: var(--text-light); font-size: .82rem; }
.search-bar input { border: none; background: none; font-size: .84rem; width: 180px; color: var(--text); }
.search-bar input::placeholder { color: var(--text-light); }

.filter-select {
  padding: .42rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--tag-red); box-shadow: 0 0 0 3px var(--tag-red-soft); }

/* ── Score badges ────────────────────────────────────────── */
.score-badge {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.score-hot  { background: #FEE2E2; color: var(--tag-red); }
.score-warm { background: #FEF3C7; color: #92400E; }
.score-cold { background: #EFF6FF; color: var(--blue); }

/* ── Dividers decorativos ────────────────────────────────── */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 1.5rem 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .report-week-grid { grid-template-columns: repeat(4, 1fr); }
  :root { --sidebar-w: 220px; }
}
@media (max-width: 960px) {
  .conv-layout { grid-template-columns: 1fr; height: auto; }
  .conv-detail { min-height: 420px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  .charts-row { flex-direction: column; }
  .chart-card.wide { flex: 1; min-width: 0; }
  .report-week-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 1rem 1rem 2rem; }
  .topbar { padding: 0 1rem; }
  .topbar-date { display: none; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .report-week-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Overlay mobile */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.overlay.visible { display: block; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-row td {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: .85rem;
}

/* =========================================================
   INSTAGRAM PAGE
   ========================================================= */

/* ── Profile pill (topbar da página) ───────────────────── */
.ig-profile-pill {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .6rem 1rem;
  background: linear-gradient(135deg, rgba(225,48,108,.08), rgba(131,58,180,.08));
  border: 1px solid rgba(225,48,108,.2);
  border-radius: 99px;
}
.ig-avatar-ring {
  width: 40px; height: 40px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #E1306C, #833AB4, #F77737);
  flex-shrink: 0;
}
.ig-avatar-ring img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  display: block;
}
.ig-handle {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  background: linear-gradient(135deg, #E1306C, #833AB4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ig-followers {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Posts efetivos list ───────────────────────────────── */
.ig-posts-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  flex: 1;
}
.ig-post-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem .9rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: default;
}
.ig-post-item:hover {
  border-color: rgba(225,48,108,.3);
  background: rgba(225,48,108,.03);
  transform: translateX(3px);
}
.ig-post-type {
  font-size: .65rem;
  font-weight: 800;
  padding: .2rem .5rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
}
.ig-post-type.foto     { background: rgba(225,48,108,.12); color: #E1306C; }
.ig-post-type.reels    { background: rgba(131,58,180,.12); color: #833AB4; }
.ig-post-type.carrossel{ background: rgba(247,119,55,.12); color: #F77737; }
.ig-post-type.story    { background: rgba(64,93,230,.12);  color: #405DE6; }
.ig-post-desc {
  flex: 1;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ig-post-stats {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
}
.ig-stat {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.ig-stat i { font-size: .7rem; }
.ig-stat.directs { color: #833AB4; }
.ig-post-date {
  font-size: .68rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* ── Directs Layout ────────────────────────────────────── */
.ig-directs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: 440px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ig-directs-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface-2);
}
.ig-direct-item {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .85rem .9rem;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--transition);
}
.ig-direct-item:hover { background: rgba(225,48,108,.04); }
.ig-direct-item.active {
  background: rgba(225,48,108,.08);
  border-left: 3px solid #E1306C;
}
.ig-direct-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.ig-direct-meta { flex: 1; min-width: 0; }
.ig-direct-user {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ig-direct-time { font-size: .65rem; color: var(--text-light); }
.ig-direct-preview {
  font-size: .74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .15rem;
}
.ig-direct-badges { display: flex; gap: .4rem; margin-top: .3rem; align-items: center; }
.ig-status-resp { font-size: .65rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; }
.ig-status-resp.respondido { background: #D1FAE5; color: #065F46; }
.ig-status-resp.aguardando { background: #FEF3C7; color: #92400E; }
.ig-status-resp.nao        { background: #FEE2E2; color: #991B1B; }
.ig-orc-pill {
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 99px;
  background: rgba(131,58,180,.12);
  color: #833AB4;
}

/* ── Direct Chat ────────────────────────────────────────── */
.ig-direct-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ig-chat-header {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.ig-chat-header-info { flex: 1; }
.ig-chat-handle { font-size: .85rem; font-weight: 700; }
.ig-chat-followers { font-size: .7rem; color: var(--text-muted); }
.ig-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  background: linear-gradient(180deg, rgba(225,48,108,.02) 0%, rgba(131,58,180,.02) 100%);
}
.ig-msg { display: flex; gap: .5rem; max-width: 78%; }
.ig-msg.bot  { align-self: flex-start; }
.ig-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ig-msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E1306C, #833AB4);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
.ig-msg.user .ig-msg-avatar {
  background: linear-gradient(135deg, #405DE6, #5851DB);
}
.ig-msg-bubble {
  padding: .6rem .9rem;
  border-radius: 18px 18px 18px 4px;
  font-size: .8rem;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.ig-msg.user .ig-msg-bubble {
  background: linear-gradient(135deg, #E1306C, #833AB4);
  color: #fff;
  border: none;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 3px 12px rgba(225,48,108,.3);
}
.ig-msg-time { font-size: .62rem; color: var(--text-light); margin-top: .2rem; }

/* =========================================================
   LEADS PREMIUM PAGE
   ========================================================= */

/* ── View toggle ────────────────────────────────────────── */
.leads-view-toggle {
  display: flex;
  gap: .3rem;
  background: var(--bg);
  padding: .3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.lv-btn {
  padding: .4rem .9rem;
  border-radius: var(--radius-xs);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.lv-btn:hover { color: var(--text); background: var(--surface); }
.lv-btn.active {
  background: linear-gradient(135deg, var(--tag-red-dk), var(--tag-red));
  color: #fff;
  box-shadow: 0 2px 8px rgba(155,0,0,.3);
}

/* ── Section title row ─────────────────────────────────── */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .75rem;
}
.section-title-row h3 {
  font-size: .95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.01em;
}
.section-title-row h3 i { color: var(--tag-red); }

/* ── Lead Ranking Grid ─────────────────────────────────── */
.lead-ranking-section {
  margin-bottom: 1.5rem;
}
.lead-ranking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.lead-rank-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.lead-rank-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.lead-rank-card.rank-1 {
  border-color: #FDE68A;
  background: linear-gradient(135deg, #FFFBEB, #FFFFFF);
  box-shadow: 0 4px 20px rgba(217,119,6,.15);
}
.lead-rank-card.rank-2 {
  border-color: #E2E8F0;
  background: linear-gradient(135deg, #F8FAFC, #FFFFFF);
}
.lead-rank-card.rank-3 {
  border-color: #FDDCBC;
  background: linear-gradient(135deg, #FFF7ED, #FFFFFF);
}

.lead-rank-badge {
  position: absolute;
  top: -1px; right: 1rem;
  font-size: .65rem;
  font-weight: 900;
  padding: .3rem .65rem;
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rank-1 .lead-rank-badge { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.rank-2 .lead-rank-badge { background: linear-gradient(135deg, #94A3B8, #64748B); color: #fff; }
.rank-3 .lead-rank-badge { background: linear-gradient(135deg, #F97316, #C2410C); color: #fff; }
.rank-other .lead-rank-badge { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.lead-rank-header {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1rem;
  margin-top: .35rem;
}
.lead-rank-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 900; color: #fff;
  flex-shrink: 0;
}
.lead-rank-info { flex: 1; min-width: 0; }
.lead-rank-name { font-size: .9rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-rank-empresa { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lead-rank-value {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: .35rem;
}
.rank-1 .lead-rank-value { color: #D97706; }
.rank-2 .lead-rank-value { color: #475569; }
.rank-3 .lead-rank-value { color: #C2410C; }
.rank-other .lead-rank-value { color: var(--tag-red); }

/* Barra de probabilidade */
.lead-prob-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}
.lead-prob-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.lead-prob-bar {
  height: 6px;
  border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.prob-high  { background: linear-gradient(90deg, #059669, #10B981); }
.prob-med   { background: linear-gradient(90deg, #D97706, #F59E0B); }
.prob-low   { background: linear-gradient(90deg, #9B0000, #E63946); }
.lead-prob-pct { font-size: .72rem; font-weight: 800; min-width: 30px; text-align: right; }
.lead-prob-label { font-size: .68rem; color: var(--text-muted); font-weight: 500; }

.lead-rank-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem;
}
.lead-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.lead-tag {
  font-size: .63rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.lead-vendedor { font-size: .7rem; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: .3rem; }

/* ── Kanban Leads ───────────────────────────────────────── */
.leads-kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .85rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}
.kanban-col {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: .85rem;
  min-width: 200px;
  border: 1px solid var(--border);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
  padding-bottom: .65rem;
  border-bottom: 2px solid var(--border);
}
.kanban-col-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.kanban-col-count {
  font-size: .68rem;
  font-weight: 800;
  padding: .1rem .4rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
/* Cor por etapa */
.kanban-col.col-contato .kanban-col-header { border-color: #CBD5E1; }
.kanban-col.col-orcamento .kanban-col-header { border-color: var(--blue); }
.kanban-col.col-proposta .kanban-col-header  { border-color: var(--purple); }
.kanban-col.col-negociacao .kanban-col-header{ border-color: var(--orange); }
.kanban-col.col-fechado .kanban-col-header   { border-color: var(--green); }

.kanban-cards { display: flex; flex-direction: column; gap: .6rem; }
.kanban-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: .85rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}
.kanban-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 3px 0 0 3px;
}
.kanban-card.pri-altissima::before { background: linear-gradient(180deg, #9B0000, #E63946); }
.kanban-card.pri-alta::before      { background: var(--orange); }
.kanban-card.pri-media::before     { background: var(--blue); }
.kanban-card.pri-baixa::before     { background: #CBD5E1; }

.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kanban-card-name { font-size: .82rem; font-weight: 700; margin-bottom: .2rem; }
.kanban-card-interesse { font-size: .72rem; color: var(--text-muted); margin-bottom: .55rem; line-height: 1.4; }
.kanban-card-value {
  font-size: .9rem;
  font-weight: 800;
  color: var(--tag-red);
  margin-bottom: .45rem;
  letter-spacing: -.01em;
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-prob {
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 99px;
}
.kanban-prob.high { background: #D1FAE5; color: #065F46; }
.kanban-prob.med  { background: #FEF3C7; color: #92400E; }
.kanban-prob.low  { background: #FEE2E2; color: #991B1B; }
.kanban-canal { font-size: .65rem; color: var(--text-light); display: flex; align-items: center; gap: .25rem; }

/* Prioridade label na tabela */
.pri-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.pri-badge.altissima { background: #FEE2E2; color: var(--tag-red); }
.pri-badge.alta      { background: #FEF3C7; color: #92400E; }
.pri-badge.media     { background: #DBEAFE; color: #1E40AF; }
.pri-badge.baixa     { background: #F1F5F9; color: #64748B; }

/* Barra de probabilidade inline */
.prob-inline {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 100px;
}
.prob-inline-bar {
  flex: 1;
  height: 4px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.prob-inline-fill {
  height: 4px;
  border-radius: 99px;
}

@media (max-width: 1100px) {
  .leads-kanban { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .ig-directs-layout { grid-template-columns: 1fr; height: auto; }
  .ig-direct-chat { min-height: 360px; }
  .leads-kanban { grid-template-columns: repeat(2, 1fr); }
  .lead-ranking-grid { grid-template-columns: 1fr; }
  .ig-posts-list .ig-post-stats { display: none; }
}
