/* ==========================================================================
   V4 COMPANY DESIGN SYSTEM — INSTAGRAM ANALYTICS & INTELLIGENCE
   Diretrizes Visuais Estritas:
   - Cor Primária: Vermelho Vibrante (#E51E2B)
   - Fundo Seção 1: Cinza Neutro Ultra-Claro (#F8F9FA)
   - Fundo Seção 2 (Intermediária): Gradiente V4 (180deg, #3B0206 0%, #800010 50%, #D0001A 100%)
   - Fundo Seção 3: Branco Puro (#FFFFFF)
   - Cards/Containers: Branco (#FFFFFF) com bordas suaves (#E5E7EB) e radius 12-16px
   - Títulos: Cinza Escuro (#111827)
   - Textos de Apoio: Cinza Médio (#6B7280)
   - Badges de Status: Verde Pastel (#D1FAE5) com texto Verde Escuro (#059669)
   - Zero menus de navegação. Zero emojis na interface.
   ========================================================================== */

:root {
  --v4-primary: #E51E2B;
  --v4-primary-hover: #c81521;
  --v4-primary-light: #FEE2E2;

  --v4-bg-light: #F8F9FA;
  --v4-bg-slate: #EEF2F6;
  --v4-bg-white: #FFFFFF;

  --v4-card-bg: #FFFFFF;
  --v4-border: #E5E7EB;
  --v4-border-subtle: #F3F4F6;

  --v4-text-title: #111827;
  --v4-text-body: #6B7280;
  --v4-text-muted: #9CA3AF;

  --v4-status-bg: #D1FAE5;
  --v4-status-text: #059669;

  --v4-gradient: linear-gradient(180deg, #3B0206 0%, #800010 50%, #D0001A 100%);

  --v4-gold: #D97706;
  --v4-silver: #64748B;
  --v4-bronze: #B45309;

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

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --font-main: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--v4-bg-light);
  color: var(--v4-text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

canvas {
  max-width: 100% !important;
}

.hidden {
  display: none !important;
}

/* ================================================================
   CONTAINER E LAYOUT GERAL
   ================================================================ */
.content-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.main-content {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ================================================================
   HEADER SUPERIOR FIXO (SEM MENUS)
   ================================================================ */
.app-header {
  height: 76px;
  width: 100%;
  max-width: 100vw;
  background: var(--v4-bg-white);
  border-bottom: 1px solid var(--v4-border);
  position: sticky;
  top: 0;
  z-index: 10000;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  box-sizing: border-box;
  overflow: visible !important;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: visible !important;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-v4-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--v4-text-title);
  line-height: 1.1;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--v4-primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* AÇÕES E CONTROLES GLOBAIS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  overflow: visible !important;
}

/* BADGE DE STATUS */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--v4-status-bg);
  color: var(--v4-status-text);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--v4-status-text);
}

/* VARIANTES DO BADGE DE STATUS
   O verde e reservado para dados reais vindos do Supabase. Demonstracao,
   sincronizacao e falha usam cores proprias para nao passarem por producao. */
.status-badge.warning {
  background: #FEF3C7;
  color: #B45309;
}

.status-badge.syncing {
  background: var(--v4-bg-slate);
  color: var(--v4-text-body);
}

.status-badge.error {
  background: var(--v4-primary-light);
  color: var(--v4-primary-hover);
}

.status-badge.warning .status-dot,
.status-badge.syncing .status-dot,
.status-badge.error .status-dot {
  background: currentColor;
}

/* FAIXA DE DADOS FICTICIOS
   Aparece so quando o Fetcher nao encontra as tabelas no Supabase e cai no
   dataset de demonstracao. Precisa ser impossivel de ignorar numa reuniao. */
.mock-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  max-width: 1280px;
  margin: 1.25rem auto 0;
  padding: 0.9rem 1.15rem;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-left: 5px solid #B45309;
  border-radius: var(--radius-md, 10px);
  color: #78350F;
}

.mock-banner > i {
  font-size: 1.15rem;
  line-height: 1.4;
  color: #B45309;
  flex-shrink: 0;
}

.mock-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mock-banner-text strong {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.mock-banner-text span {
  font-size: 0.82rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .mock-banner {
    margin: 1rem 1rem 0;
  }
}

/* SELECTS FORMATO PÍLULA */
.select-pill-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  position: relative;
  overflow: visible !important;
}

.select-pill-wrap:has(.v4-custom-dropdown.active),
.filter-pill-gradient:has(.v4-custom-dropdown.active) {
  z-index: 9999999 !important;
}

.select-pill-wrap label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  text-transform: uppercase;
}

.v4-select-pill {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--v4-text-title);
  cursor: pointer;
  padding-right: 0.25rem;
}

.btn-refresh {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  color: var(--v4-text-title);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

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

.btn-refresh.rotating i {
  animation: v4Spin 0.8s linear infinite;
}

@keyframes v4Spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ================================================================
   CUSTOM DROPDOWN ENGINE — V4 DESIGN SYSTEM
   ================================================================ */
.v4-native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.v4-custom-dropdown {
  position: relative;
  display: inline-block;
  font-family: var(--font-main);
  z-index: 10;
}

.v4-custom-dropdown.active {
  z-index: 9999999 !important;
}

.v4-dropdown-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--v4-text-title);
  padding: 0;
  transition: var(--transition);
  user-select: none;
}

/* Quando isolado (ex: na barra da galeria) */
.v4-custom-dropdown.standalone .v4-dropdown-btn {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.v4-custom-dropdown.standalone .v4-dropdown-btn:hover {
  border-color: var(--v4-primary);
  background: #FFFFFF;
}

/* Dropdown sobre o gradiente na Seção 2 */
.filter-pill-gradient .v4-dropdown-btn {
  color: #FFFFFF;
}

.v4-dropdown-chevron {
  font-size: 0.72rem;
  color: var(--v4-text-muted);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.filter-pill-gradient .v4-dropdown-chevron {
  color: rgba(255, 255, 255, 0.75);
}

.v4-custom-dropdown.active .v4-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--v4-primary);
}

.filter-pill-gradient .v4-custom-dropdown.active .v4-dropdown-chevron {
  color: #FFFFFF;
}

/* Menu Flutuante Sem Scroll e Por Cima de Tudo — Padrão Imagem 1 */
.v4-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 100%;
  width: max-content;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.16), 0 6px 16px -2px rgba(0, 0, 0, 0.08);
  padding: 8px;
  z-index: 9999999 !important;
  display: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 420px;
  overflow-y: auto;
}

.v4-custom-dropdown.active .v4-dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
  z-index: 9999999 !important;
}

/* Itens da Lista — Padrão Imagem 1 */
.v4-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #1E293B;
  background: transparent;
  border: none;
  outline: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.v4-dropdown-item:hover {
  background-color: #F1F5F9;
  color: #0F172A;
}

.v4-dropdown-item.selected {
  background-color: #D0001A !important;
  color: #FFFFFF !important;
  font-weight: 600;
}

.v4-dropdown-item.selected:hover {
  background-color: #B00016 !important;
  color: #FFFFFF !important;
}

.v4-dropdown-item .v4-dropdown-check {
  font-size: 0.85rem;
  color: #FFFFFF;
  margin-left: 12px;
}

/* DEGRADÊ SEÇÃO 1 (Funil Geral) */
.bg-funil-gradient {
  background: linear-gradient(180deg, #3B0206 0%, #800010 50%, #D0001A 100%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  color: #FFFFFF;
}

.bg-funil-gradient .section-kicker {
  color: #FCA5A5 !important;
}

.bg-funil-gradient .section-title {
  color: #FFFFFF !important;
}

.bg-funil-gradient .section-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
}

.bg-funil-gradient .periodo-rotulo {
  color: #FFFFFF !important;
  font-weight: 700;
}

.bg-funil-gradient .tile {
  background: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.25) !important;
}

.bg-funil-gradient .tile-rotulo {
  color: #4B5563 !important;
}

.bg-funil-gradient .tile-valor {
  color: #111827 !important;
}

.bg-funil-gradient .tile-nota {
  color: #6B7280 !important;
}

.bg-funil-gradient .tile-destaque {
  border-top: 4px solid #D0001A !important;
}

.bg-funil-gradient .card-container {
  background: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.25) !important;
}

/* SEÇÃO MANYCHAT: GRID 3x2 */
.tiles-mc-3x2 {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 992px) {
  .tiles-mc-3x2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 580px) {
  .tiles-mc-3x2 {
    grid-template-columns: 1fr !important;
  }
}

.tile-badge-anterior {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: 4px;
  width: fit-content;
}

/* SEÇÃO VTURB: GRID 6x2 E SELETOR DE VÍDEO */
.tiles-vturb-6x2 {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .tiles-vturb-6x2 {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .tiles-vturb-6x2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.select-pill-dark {
  background: #171A1E !important;
  border-color: #2D333B !important;
}

.select-pill-dark label {
  color: #9CA3AF !important;
}

.select-pill-dark .v4-dropdown-btn {
  color: #FFFFFF !important;
}

.select-pill-dark .v4-dropdown-chevron {
  color: #9CA3AF !important;
}

.vturb-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ================================================================
   SEÇÕES EM FAIXAS COM FUNDOS CONTRASTANTES E ESPAÇAMENTO EQUILIBRADO
   ================================================================ */
.section-band {
  width: 100%;
  max-width: 100%;
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--v4-border);
  box-sizing: border-box;
  overflow-x: hidden;
}

#sec-visao-geral {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

.bg-light {
  background-color: var(--v4-bg-light); /* #F8F9FA */
}

/* SEÇÃO 2 INTERMEDIÁRIA COM O GRADIENTE V4 */
.bg-gradient-v4 {
  background: var(--v4-gradient); /* 180deg: #3B0206 -> #800010 -> #D0001A */
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.bg-white {
  background-color: var(--v4-bg-white); /* #FFFFFF */
}

/* CABEÇALHO DAS SEÇÕES */
.section-header-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.50rem;
  text-align: left;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.section-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--v4-primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.section-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--v4-text-title);
  line-height: 1.2;
}

.section-subtitle {
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--v4-text-body);
  /* max-width: 680px; */
}

/* TEXTOS DE ALTO CONTRASTE NA SEÇÃO COM GRADIENTE */
.kicker-white {
  color: #FCA5A5;
}

.title-white {
  color: #FFFFFF;
}

.subtitle-white {
  color: rgba(255, 255, 255, 0.9);
}

/* ================================================================
   SEÇÃO 1: VISÃO GERAL (CARDS, GRIDS E GRÁFICOS)
   ===================================/* GRID 6 CARDS MACRO — 2 LINHAS DE 3 */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .kpi-grid-4 {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #D1D5DB;
}

.kpi-card.highlighted-card {
  border-left: 4px solid var(--v4-primary);
}

.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--v4-text-body);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  background: var(--v4-bg-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.kpi-card-tag.red-tag {
  background: var(--v4-primary-light);
  color: var(--v4-primary);
}

.kpi-card-number {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--v4-text-title);
  line-height: 1.1;
}

.kpi-card-number.red-number {
  color: var(--v4-primary);
}

.kpi-card-note {
  font-size: 0.78rem;
  color: var(--v4-text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-comparison {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.kpi-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  line-height: 1;
}

.kpi-trend-badge.positive {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

.kpi-trend-badge.negative {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.kpi-trend-badge.neutral {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
}

.kpi-trend-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--v4-text-muted);
}

/* SUB-MÉTRICAS BAR */
.sub-metrics-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sub-metric-item {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sub-metric-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sub-metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--v4-primary-light);
  color: var(--v4-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.sub-metric-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--v4-text-body);
}

.sub-metric-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--v4-text-title);
}

/* CARDS DE GRÁFICOS */
.charts-row-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.charts-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.card-container {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.card-container-sm {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.card-container-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.card-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--v4-text-title);
  letter-spacing: -0.3px;
}

.card-subheading {
  font-size: 0.78rem;
  color: var(--v4-text-body);
}

.mini-chart-heading {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--v4-text-title);
}

.chart-box-main {
  position: relative;
  height: 290px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.chart-box-sm {
  position: relative;
  height: 220px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* DEMOGRAFIA */
.demographics-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.demographics-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ================================================================
   SEÇÃO 2: HIERARQUIA & RANKINGS (PÓDIO E TABELA)
   ================================================================ */
.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 50;
}

.ranking-filters-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 60;
}

.filter-pill-gradient {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  position: relative;
  z-index: 70;
}

.filter-pill-gradient label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
}

.v4-select-pill.pill-light {
  color: #FFFFFF;
}

/* PÓDIO TOP 3 */
.podium-container {
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.podium-card {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.podium-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.podium-card.rank-1 {
  border-top: 5px solid var(--v4-gold);
}

.podium-card.rank-2 {
  border-top: 5px solid var(--v4-silver);
}

.podium-card.rank-3 {
  border-top: 5px solid var(--v4-bronze);
}

.podium-thumb-container {
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio como na foto */
  position: relative;
  background: var(--v4-bg-slate);
}

.podium-thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium-badge-tag {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tag-gold   { background: #FEF3C7; color: var(--v4-gold); border: 1px solid #FCD34D; }
.tag-silver { background: #F1F5F9; color: #475569; border: 1px solid #CBD5E1; }
.tag-bronze { background: #FFEDD5; color: #C2410C; border: 1px solid #FDBA74; }

.podium-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.podium-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.podium-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--v4-text-muted);
}

.podium-caption-snippet {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--v4-text-title);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2.4rem;
}

.podium-metrics-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--v4-border-subtle);
}

.mini-stat-num.red-metric {
  color: var(--v4-primary);
}

/* TOOLBAR EXPANDIDA EM 100% DE LARGURA */
.gallery-toolbar-full {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
}

.gallery-toolbar-full .search-box-pill {
  flex: 1;
  min-width: 260px;
  max-width: 100%;
  box-sizing: border-box;
}

/* ================================================================
   TABELAS DE DADOS (V4-TABLE)
   ================================================================ */
.card-container-table {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.table-card-header {
  padding: 1.35rem 1.75rem;
  border-bottom: 1px solid var(--v4-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.counter-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--v4-text-body);
  background: var(--v4-bg-light);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.table-overflow-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

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

.v4-table th {
  background: var(--v4-bg-light);
  padding: 0.9rem 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--v4-border);
  transition: background 0.15s ease, color 0.15s ease;
}

.v4-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.v4-table th.sortable:hover {
  background: #EEF2F6;
  color: var(--v4-text-title);
}

.v4-table th.sortable.active-sort {
  background: #FEF2F2;
  color: var(--v4-primary);
  font-weight: 800;
  border-bottom-color: rgba(229, 30, 43, 0.3);
}

.th-sort-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
}

.sort-icon {
  font-size: 0.72rem;
  color: #94A3B8;
  transition: transform 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.v4-table th.sortable:hover .sort-icon {
  color: var(--v4-text-body);
}

.sort-icon.active {
  color: var(--v4-primary);
  font-size: 0.8rem;
}

.v4-table td {
  padding: 0.9rem 1.25rem;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--v4-border-subtle);
  vertical-align: middle;
}

.v4-table tr:hover td {
  background: #FAFAFA;
}

.rank-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--v4-bg-slate);
  color: var(--v4-text-title);
}

.rank-circle.pos-1 { background: #FEF3C7; color: var(--v4-gold); }
.rank-circle.pos-2 { background: #F1F5F9; color: var(--v4-silver); }
.rank-circle.pos-3 { background: #FFEDD5; color: var(--v4-bronze); }

.table-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--v4-bg-slate);
}

.table-caption-truncate {
  font-weight: 600;
  color: var(--v4-text-title);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.progress-metric-box {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.progress-metric-num {
  font-weight: 800;
  color: var(--v4-text-title);
}

.progress-track {
  height: 6px;
  width: 100%;
  background: var(--v4-border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--v4-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ================================================================
   SEÇÃO 3: GALERIA / FEED DE PUBLICAÇÕES RECENTES
   ================================================================ */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-box-pill {
  position: relative;
  min-width: 260px;
}

.search-box-pill .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--v4-text-muted);
  font-size: 0.8rem;
}

.search-input {
  width: 100%;
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem 0.5rem 2.4rem;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--v4-text-title);
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--v4-primary);
  background: #ffffff;
}

/* TOGGLE TABS (CARDS / LISTA) */
.view-toggle-tab {
  display: flex;
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.toggle-tab-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--v4-text-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.toggle-tab-btn.active {
  background: var(--v4-primary);
  color: #ffffff;
}

/* GRADE 4 COLUNAS DE CARDS */
.cards-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.post-item-card {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.post-item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #D1D5DB;
}

.item-thumb-container {
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  position: relative;
  background: var(--v4-bg-slate);
}

.item-thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-date-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--v4-text-muted);
}

.item-caption-snippet {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--v4-text-title);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2.3rem;
}

.item-metrics-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid var(--v4-border-subtle);
}

.mini-stat-group {
  display: flex;
  flex-direction: column;
}

.mini-stat-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  text-transform: uppercase;
}

.mini-stat-num {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--v4-text-title);
}

.gallery-summary-bar {
  display: flex;
  justify-content: flex-end;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--v4-text-muted);
  padding-top: 1rem;
}

/* ================================================================
   BOTÕES DO SISTEMA
   ================================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--v4-primary);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--v4-primary-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--v4-text-title);
  border: 1px solid var(--v4-border);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--v4-bg-light);
  border-color: #D1D5DB;
}

/* ================================================================
   MODAL DE DETALHAMENTO DO POST (Estilo Instagram / V4)
   ================================================================ */
.post-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.post-overlay.visible {
  opacity: 1;
}

.post-overlay.hidden {
  display: none;
}

.post-modal {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 980px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
}

.post-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  color: var(--v4-text-title);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  z-index: 20;
  transition: var(--transition);
}

.post-modal-close:hover {
  background: var(--v4-primary);
  color: #ffffff;
  border-color: var(--v4-primary);
}

.post-modal-inner {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  width: 100%;
  max-height: 90vh;
}

.post-media-col {
  background: #0B0F19;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.post-media-wrap {
  width: 100%;
  height: 100%;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.post-detail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-format-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(17, 24, 39, 0.85);
  color: #ffffff;
}

.post-info-col {
  padding: 1.35rem 1.65rem;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  max-height: 88vh;
}

.post-info-col::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.post-modal-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.post-modal-page.hidden {
  display: none !important;
}

.post-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 2.75rem; /* Folga garantida para o botão fechar */
}

.post-detail-account {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.post-account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--v4-primary-light);
  color: var(--v4-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.post-account-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--v4-text-title);
  display: block;
  line-height: 1.2;
}

.post-account-date {
  font-size: 0.72rem;
  color: var(--v4-text-muted);
}

.post-detail-header .btn-secondary {
  padding: 0.38rem 0.75rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.post-caption-wrap {
  background: var(--v4-bg-light);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  max-height: 64px;
  overflow-y: auto;
}

.post-caption-text {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--v4-text-body);
  white-space: pre-wrap;
}

.post-divider {
  height: 1px;
  background: var(--v4-border-subtle);
}

.post-metrics-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.post-metrics-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--v4-text-title);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.post-kpi-box {
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.post-kpi-box.red-accent .kpi-box-val {
  color: var(--v4-primary);
}

.kpi-box-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--v4-text-title);
  line-height: 1.2;
}

.kpi-box-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  text-transform: uppercase;
}

.post-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.breakdown-pill {
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breakdown-name {
  font-size: 0.7rem;
  color: var(--v4-text-body);
  font-weight: 600;
}

.breakdown-num {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--v4-text-title);
}

.tech-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  background: var(--v4-bg-light);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

.tech-spec-item {
  display: flex;
  flex-direction: column;
}

.tech-spec-key {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--v4-text-muted);
  text-transform: uppercase;
}

.tech-spec-val {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--v4-text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   PÁGINA 2 DO MODAL: PERFORMANCE & TAXAS COMPARADAS (LINHA ÚNICA)
   ================================================================ */
.post-perf-page-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.perf-page-kicker {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--v4-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perf-page-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--v4-text-title);
}

.perf-page-sub {
  font-size: 0.72rem;
  color: var(--v4-text-body);
}

.post-all-rates-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.perf-rate-card {
  background: var(--v4-bg-light);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.perf-rate-card:hover {
  background: #FFFFFF;
  border-color: var(--v4-primary);
  box-shadow: var(--shadow-sm);
}

.perf-rate-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--v4-text-title);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.perf-rate-values {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.perf-rate-pct {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--v4-primary);
}

.perf-rate-raw {
  font-size: 0.72rem;
  color: var(--v4-text-muted);
  font-weight: 600;
}

/* ================================================================
   RODAPÉ DE NAVEGAÇÃO DISCRETO (SETA NO CANTO INFERIOR DIREITO)
   ================================================================ */
.post-modal-footer-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 0.65rem;
  border-top: 1px solid var(--v4-border-subtle);
  margin-top: auto;
}

.btn-modal-page-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--v4-primary);
  color: #FFFFFF;
  border: none;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(229, 30, 43, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-modal-page-nav:hover {
  background: var(--v4-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 30, 43, 0.35);
}

.btn-modal-page-nav:active {
  transform: scale(0.97);
}

/* ================================================================
   RODAPÉ GERAL
   ================================================================ */
.app-footer {
  background: var(--v4-bg-white);
  border-top: 1px solid var(--v4-border);
  padding: 2.25rem 0;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
}

.footer-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--v4-text-title);
}

.footer-desc {
  font-size: 0.75rem;
  color: var(--v4-text-body);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--v4-text-muted);
}

/* ================================================================
   RESPONSIVIDADE COMPLETA E REFINADA (MOBILE, PHABLETS E TABLETS)
   ================================================================ */

/* TABLETS LANDSCAPE E NOTEBOOKS COMPACTOS (<= 1200px) */
@media (max-width: 1200px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .charts-row-2 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .charts-row-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .podium-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .cards-grid-4 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

/* TABLETS PORTRAIT E DISPOSITIVOS MÉDIOS (<= 992px) */
@media (max-width: 992px) {
  .section-band {
    padding: 2.75rem 0;
  }

  #sec-visao-geral {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
  }

  .content-container {
    padding: 0 1.5rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .sub-metrics-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }

  .charts-row-3 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .podium-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .cards-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .section-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .ranking-filters-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .filter-pill-gradient {
    flex: 1;
    min-width: 220px;
    justify-content: space-between;
  }

  /* MODAL */
  .post-modal-inner {
    grid-template-columns: 1fr;
    max-height: 88vh;
  }

  .post-media-col {
    max-height: 340px;
    min-height: 240px;
  }

  .post-media-wrap {
    min-height: 240px;
    max-height: 340px;
  }

  .post-info-col {
    max-height: none;
    padding: 1.25rem 1.35rem;
  }
}

/* DISPOSITIVOS MÓVEIS / SMARTPHONES (<= 768px) */
@media (max-width: 768px) {
  /* HEADER MOBILE FLUIDO */
  .app-header {
    height: auto;
    min-height: 64px;
    padding: 0.65rem 0;
  }

  .header-container {
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .brand-group {
    gap: 0.65rem;
  }

  .header-v4-logo {
    height: 26px;
  }

  .brand-name {
    font-size: 0.88rem;
  }

  .brand-tag {
    font-size: 0.58rem;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
  }

  .status-badge {
    padding: 0.25rem 0.55rem;
    font-size: 0.68rem;
  }

  .select-pill-wrap {
    padding: 0.25rem 0.55rem;
  }

  .select-pill-wrap label {
    display: none;
  }

  .v4-select-pill {
    font-size: 0.76rem;
  }

  .btn-refresh {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  /* CONTEÚDO PRINCIPAL */
  .content-container {
    padding: 0 1rem;
  }

  .section-band {
    padding: 2.25rem 0;
  }

  #sec-visao-geral {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
  }

  .section-header-block {
    margin-bottom: 1.25rem;
  }

  .section-kicker {
    font-size: 0.68rem;
  }

  .section-title {
    font-size: 1.45rem;
    letter-spacing: -0.4px;
  }

  .section-subtitle {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  /* 6 CARDS MACRO */
  .kpi-grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .kpi-card {
    padding: 1.25rem 1.15rem;
    gap: 0.45rem;
  }

  .kpi-card-number {
    font-size: 1.95rem;
  }

  .kpi-card-note {
    font-size: 0.74rem;
  }

  /* SUB-MÉTRICAS BAR */
  .sub-metrics-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .sub-metric-item {
    padding: 0.65rem 0.75rem;
  }

  .sub-metric-item:nth-child(5) {
    grid-column: span 2;
  }

  .sub-metric-icon {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .sub-metric-title {
    font-size: 0.72rem;
  }

  .sub-metric-value {
    font-size: 1.05rem;
  }

  /* GRÁFICOS */
  .card-container {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  .card-container-sm {
    padding: 1.15rem;
  }

  .chart-box-main {
    height: 250px;
  }

  .chart-box-sm {
    height: 200px;
  }

  /* PÓDIO SECTION */
  .ranking-filters-strip {
    flex-direction: column;
    width: 100%;
    gap: 0.6rem;
  }

  .filter-pill-gradient {
    width: 100%;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
  }

  .podium-card-body {
    padding: 1rem;
    gap: 0.65rem;
  }

  .podium-caption-snippet {
    font-size: 0.8rem;
    height: 2.2rem;
  }

  .podium-metrics-strip {
    padding-top: 0.6rem;
  }

  .mini-stat-num {
    font-size: 0.85rem;
  }

  /* GALERIA TOOLBAR */
  .gallery-toolbar-full {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .gallery-toolbar-full .search-box-pill {
    min-width: 100%;
    width: 100%;
    order: 1;
  }

  .gallery-toolbar-full .v4-custom-dropdown.standalone {
    flex: 1;
    min-width: 130px;
    order: 2;
  }

  .gallery-toolbar-full .v4-custom-dropdown.standalone .v4-dropdown-btn {
    width: 100%;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
  }

  .gallery-toolbar-full .view-toggle-tab {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .toggle-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
  }

  /* TABELA MOBILE */
  .table-overflow-box {
    -webkit-overflow-scrolling: touch;
  }

  .v4-table th,
  .v4-table td {
    padding: 0.75rem 0.85rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .table-caption-truncate {
    max-width: 220px;
    font-size: 0.78rem;
  }

  .table-thumb {
    width: 40px;
    height: 40px;
  }

  /* CARDS GRID */
  .cards-grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .item-card-body {
    padding: 1rem;
  }

  /* MODAL MOBILE */
  .post-overlay {
    padding: 0.5rem;
  }

  .post-modal {
    max-height: 94vh;
    border-radius: var(--radius-md);
    overflow-y: auto;
  }

  .post-modal-inner {
    max-height: none;
  }

  .post-modal-close {
    top: 0.65rem;
    right: 0.65rem;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .post-info-col {
    padding: 1rem;
    gap: 0.75rem;
  }

  .post-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .post-kpi-box {
    padding: 0.45rem 0.35rem;
  }

  .kpi-box-val {
    font-size: 0.98rem;
  }

  .kpi-box-label {
    font-size: 0.58rem;
  }

  .post-breakdown-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .breakdown-pill {
    padding: 0.38rem 0.55rem;
  }

  .breakdown-name {
    font-size: 0.68rem;
  }

  .breakdown-num {
    font-size: 0.82rem;
  }

  .tech-spec-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .tech-spec-item:nth-child(3) {
    grid-column: span 2;
  }

  /* FAB MOBILE */
  .floating-tools-widget {
    bottom: 1.25rem;
    right: 1.25rem;
  }

  .fab-tools-btn {
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
  }

  .tool-card-item {
    width: 155px;
    height: 46px;
    padding: 0 0.85rem;
    font-size: 0.82rem;
  }

  /* FOOTER MOBILE */
  .app-footer {
    padding: 1.75rem 0;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* DROPDOWNS EM DISPOSITIVOS MÓVEIS */
  .v4-dropdown-menu {
    max-width: calc(100vw - 2rem);
    min-width: 180px;
  }
}

/* SMARTPHONES PEQUENOS (<= 480px) */
@media (max-width: 480px) {
  .sub-metrics-bar {
    grid-template-columns: 1fr;
  }

  .sub-metric-item:nth-child(5) {
    grid-column: span 1;
  }

  .kpi-card-number {
    font-size: 1.75rem;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .podium-metrics-strip {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .filter-pill-gradient label {
    font-size: 0.68rem;
  }
}

/* ================================================================
   BOTÃO FLUTUANTE DE FERRAMENTAS (FAB) & CARDS ISOLADOS
   ================================================================ */
.floating-tools-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
}

/* Menu de Ferramentas (Sem fundo geral - apenas cards flutuantes isolados) */
.floating-tools-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-tools-widget.open .floating-tools-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Card Isolado da Ferramenta (Tamanho Padronizado e Limpo) */
.tool-card-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 170px;
  height: 50px;
  box-sizing: border-box;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 0 1rem;
  text-decoration: none;
  color: var(--v4-text-title);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card-item:hover {
  background: #FFFFFF;
  border-color: var(--v4-primary);
  transform: translateX(-4px) translateY(-2px);
  box-shadow: 0 14px 28px -4px rgba(229, 30, 43, 0.18), 0 4px 10px rgba(0, 0, 0, 0.05);
}

.tool-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--v4-primary-light);
  color: var(--v4-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.tool-card-item:hover .tool-icon-box {
  background: var(--v4-primary);
  color: #FFFFFF;
  transform: scale(1.05);
}

.tool-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--v4-text-title);
  letter-spacing: -0.2px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.tool-card-item:hover .tool-name {
  color: var(--v4-primary);
}

/* Botão Redondo com Ícone de Chave Inglesa / X */
.fab-tools-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--v4-primary);
  border: none;
  color: #FFFFFF;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -3px rgba(229, 30, 43, 0.45), 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fab-tools-btn:hover {
  background: var(--v4-primary-hover);
  transform: scale(1.06);
  box-shadow: 0 14px 30px -3px rgba(229, 30, 43, 0.55);
}

.fab-tools-btn:active {
  transform: scale(0.96);
}

.fab-icon-main {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.fab-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  transition: transform 0.25s ease, opacity 0.25s ease;
  font-size: 1.35rem;
}

.floating-tools-widget.open .fab-icon-main {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.floating-tools-widget.open .fab-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.floating-tools-widget.open .fab-tools-btn {
  background: #111827;
  box-shadow: 0 10px 25px -3px rgba(17, 24, 39, 0.4), 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   INTEGRIDADE DE DADOS
   Elementos que tornam visível a diferença entre "medido", "medido e é zero"
   e "não coletado". Sem eles, um número velho ou parcial tem exatamente a
   mesma aparência de um número atual e completo.
   ============================================================================ */

/* Aviso de cobertura / conta sem sincronização */
.data-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid #D97706;
  border-radius: 0 6px 6px 0;
  background: #FEF6E7;
  color: #7C4A03;
  font-size: 0.82rem;
  line-height: 1.5;
}

.data-warning::before {
  content: "\f071";                      /* triangle-exclamation */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  flex: none;
  opacity: 0.75;
}

.data-warning.hidden { display: none; }

/* Origem do número no card de alcance */
.kpi-source-hint {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--v4-text-muted, #64748B);
}

.kpi-source-hint.is-warning {
  color: #B45309;
  font-weight: 500;
}

/* Selo de frescor por publicação */
.freshness-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
}

.freshness-badge.aging { background: #FEF3C7; color: #92400E; }
.freshness-badge.stale { background: #FEE2E2; color: #B91C1C; }

/* Estado vazio de gráfico — substitui o canvas quando não há dado.
   O gráfico de gênero preenchia esse caso com 88/12 fixos. */
.chart-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  height: 100%;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--v4-text-muted, #64748B);
  background: repeating-linear-gradient(
    45deg,
    transparent, transparent 8px,
    rgba(100, 116, 139, 0.045) 8px,
    rgba(100, 116, 139, 0.045) 16px
  );
  border: 1px dashed rgba(100, 116, 139, 0.3);
  border-radius: 8px;
}

/* Procedência da métrica dentro do modal de publicação */
.post-provenance {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(100, 116, 139, 0.25);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--v4-text-muted, #64748B);
}

/* ============================================================================
   V4 CAMPAIGN & CUSTOMER JOURNEY DASHBOARD STYLES (v5.0)
   ============================================================================ */

/* Tags das plataformas.
   O design system da casa é vermelho + neutros. Azul, roxo, laranja e verde
   convivendo na mesma tela vinham de fora dele e faziam a interface parecer
   de outro produto. Todas as tags passam a ser neutras: a plataforma é
   identificada pelo texto da tag, que é o que a pessoa lê de fato. */
.blue-tag,
.purple-tag,
.orange-tag,
.green-tag {
  background: var(--v4-bg-slate);
  color: var(--v4-text-body);
}

/* Badges de tendência e metas.
   Sobra exatamente uma cor com significado — o verde pastel de status, que o
   design system já prevê, reservado para meta atingida/conversão. O resto é
   neutro, porque "0% da meta" em azul e "19% chegaram ao pitch" em roxo não
   comunicavam nada além de ruído. */
.kpi-trend-badge.purple,
.kpi-trend-badge.info,
.kpi-trend-badge.neutral {
  background: var(--v4-bg-slate);
  color: var(--v4-text-body);
}

/* Amarelo fica só onde é alerta de verdade (dado incompleto, meta em risco). */
.kpi-trend-badge.warning {
  background: #FEF3C7;
  color: #B45309;
}

.kpi-trend-badge.success {
  background: var(--v4-status-bg);
  color: var(--v4-status-text);
}

/* ================================================================
   FUNIL DA JORNADA PASSO A PASSO
   ================================================================ */
.journey-funnel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .journey-funnel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .journey-funnel-grid {
    grid-template-columns: 1fr;
  }
}

.funnel-step-card {
  background: #F9FAFB;
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.funnel-step-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: #FFFFFF;
}

.funnel-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.funnel-step-icon {
  font-size: 1.2rem;
}

.funnel-step-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--v4-text-title);
  background: #E5E7EB;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.funnel-step-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--v4-text-title);
  margin-bottom: 0.2rem;
}

.funnel-step-sub {
  font-size: 0.8rem;
  color: var(--v4-text-body);
  margin-bottom: 1rem;
}

.funnel-step-count {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--v4-text-title);
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.funnel-step-bar-wrap {
  width: 100%;
  height: 6px;
  background: #E5E7EB;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.funnel-step-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.funnel-step-rates {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px dashed #E5E7EB;
}

.funnel-pass-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
}

.funnel-drop-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: #DC2626;
}

.funnel-badge-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--v4-text-body);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
}
.legend-dot.blue { background-color: #3B82F6; }
.legend-dot.purple { background-color: #8B5CF6; }
.legend-dot.red { background-color: #E30613; }

/* ================================================================
   SEÇÃO DARK DO VTURB ANALYTICS
   ================================================================ */
.bg-dark {
  background-color: #0F1113 !important;
  border-top: 1px solid #1E232A;
  border-bottom: 1px solid #1E232A;
}

.text-light {
  color: #F9FAFB !important;
}

.title-light {
  color: #FFFFFF !important;
}

.subtitle-light {
  color: #9CA3AF !important;
}

.kicker-red {
  color: #EF4444 !important;
}

.vturb-analytics-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 992px) {
  .vturb-analytics-layout {
    grid-template-columns: 1fr;
  }
}

.dark-card {
  background: #171A1E !important;
  border: 1px solid #282E38 !important;
}

.chart-dark-box {
  min-height: 280px;
  height: 320px;
  position: relative;
}

.vsl-pitch-indicator {
  background: rgba(227, 6, 19, 0.15);
  border: 1px solid rgba(227, 6, 19, 0.3);
  color: #F87171;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vturb-side-stats {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dark-mini-card {
  background: #171A1E;
  border: 1px solid #282E38;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.dark-mini-card:hover {
  border-color: #3B4452;
  transform: translateX(4px);
}

.mini-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Ícones das mini-stats sobre a faixa escura.
   Antes cada métrica tinha sua cor (roxo, laranja, verde, vermelho), o que
   dava quatro sinais de cor competindo sem que a cor significasse nada — o
   número já está escrito ao lado. Agora todos usam o mesmo tratamento neutro
   e só o CTA, que é a métrica de conversão, carrega o vermelho da marca.
   As classes antigas continuam existindo para não quebrar o HTML. */
.purple-bg,
.orange-bg,
.green-bg,
.mini-stat-icon {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

.red-bg {
  background: rgba(229, 30, 43, 0.18);
  color: #FCA5A5;
}

.mini-stat-info {
  display: flex;
  flex-direction: column;
}

.mini-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mini-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
}

/* ================================================================
   TABELA DE TRAJETÓRIA E RASTREAMENTO INDIVIDUAL
   ================================================================ */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 450px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
  font-size: 0.9rem;
}

.v4-search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-full);
  background: #FFFFFF;
  font-family: var(--font-main);
  font-size: 0.88rem;
  color: var(--v4-text-title);
  outline: none;
  transition: var(--transition);
}

.v4-search-input:focus {
  border-color: var(--v4-primary);
  box-shadow: 0 0 0 3px rgba(229, 30, 43, 0.12);
}

.filter-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  border: 1px solid var(--v4-border);
  background: #FFFFFF;
  color: var(--v4-text-body);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: #CBD5E1;
  color: var(--v4-text-title);
}

.filter-btn.active {
  background: #111827;
  color: #FFFFFF;
  border-color: #111827;
}

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

.v4-table th {
  background: #F8F9FA;
  color: #4B5563;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--v4-border);
}

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

.v4-table tbody tr:hover {
  background: #F9FAFB;
}

.table-lead-phone {
  font-weight: 700;
  color: var(--v4-text-title);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.whatsapp-icon {
  color: #22C55E;
  font-size: 1rem;
}

.table-lead-name {
  font-weight: 500;
  color: #374151;
}

.table-lead-date {
  font-size: 0.8rem;
  color: #6B7280;
}

.table-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.table-progress-bar {
  flex: 1;
  height: 6px;
  background: #E5E7EB;
  border-radius: 999px;
  overflow: hidden;
}

.table-progress-fill {
  height: 100%;
  background: #8B5CF6;
  border-radius: 999px;
}

.table-progress-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4B5563;
  width: 35px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill-success {
  background: #D1FAE5;
  color: #047857;
}

.status-pill-muted {
  background: #F3F4F6;
  color: #6B7280;
}

.status-pill-pupila {
  background: #FEE2E2;
  color: #B91C1C;
}

.badge-stage {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.stage-manychat { background: #DBEAFE; color: #1E40AF; }
.stage-vturb    { background: #F3E8FF; color: #6B21A8; }
.stage-pitch    { background: #FEF3C7; color: #92400E; }
.stage-pupila   { background: #E30613; color: #FFFFFF; }

.table-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: #FFFFFF;
  border-top: 1px solid var(--v4-border);
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--v4-text-body);
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-page {
  background: #FFFFFF;
  border: 1px solid var(--v4-border);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--v4-text-title);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-page:hover:not(:disabled) {
  background: #F9FAFB;
  border-color: #CBD5E1;
}

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

.table-empty-message {
  text-align: center;
  padding: 3rem 1rem !important;
  color: #9CA3AF;
}

.table-empty-message i {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* ================================================================
   CENTRAL DE DIAGNÓSTICOS & INSIGHTS ACIONÁVEIS
   ================================================================ */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

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

.insight-card {
  border-radius: var(--radius-md);
  padding: 1.35rem;
  border-left: 4px solid;
  transition: var(--transition);
}

.insight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.insight-card-success {
  background: #F0FDF4;
  border-color: #22C55E;
}

.insight-card-warning {
  background: #FFFBEB;
  border-color: #F59E0B;
}

.insight-card-alert {
  background: #FEF2F2;
  border-color: #EF4444;
}

.insight-card-neutral {
  background: #F8FAFC;
  border-color: #64748B;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.insight-icon {
  font-size: 1.15rem;
}

.insight-card-success .insight-icon { color: #16A34A; }
.insight-card-warning .insight-icon { color: #D97706; }
.insight-card-alert .insight-icon   { color: #DC2626; }
.insight-card-neutral .insight-icon { color: #475569; }

.insight-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--v4-text-title);
}

.insight-desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #4B5563;
}


/* ============================================================================
   SEÇÃO DE ORIGEM DOS CONTATOS (v5.1)
   Substitui a antiga tabela de trajetória individual, que lia customer_journeys
   linha a linha — tabela fechada para `anon` por conter nome, telefone e
   e-mail. Aqui tudo vem de views agregadas.
   ============================================================================ */

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

.card-title-sm {
  font-size: 1rem;
  font-weight: 700;
  color: var(--v4-text-title);
  margin: 0 0 4px;
}

.card-subtitle-sm {
  font-size: 0.8125rem;
  color: var(--v4-text-body);
  margin: 0 0 16px;
  line-height: 1.5;
}

.text-right { text-align: right; }

/* A lista de DDDs pode passar de 60 linhas em campanha nacional. Sem altura
   máxima ela empurraria o resto da página para muito longe. */
.table-scroll {
  max-height: 420px;
  overflow-y: auto;
}

.table-empty {
  text-align: center;
  color: var(--v4-text-muted);
  padding: 28px 12px;
  font-size: 0.875rem;
}

.insight-empty {
  color: var(--v4-text-body);
  font-size: 0.9375rem;
  margin: 0;
}

/* ── Etapas do funil ────────────────────────────────────────────────────────
   O card não tem mais cor nem ícone próprios. O que muda entre as etapas é a
   UNIDADE: as pontas contam pessoas, o miolo conta sessões de vídeo, porque a
   API do VTurb só entrega totais. Essa diferença é a informação — a barra
   lateral distingue as duas, e o rótulo diz qual é qual em texto. */
.funnel-step-card {
  border-top: none;
  border-left: 3px solid var(--v4-border);
}

.funnel-step-card.is-pessoa  { border-left-color: var(--v4-primary); }
.funnel-step-card.is-sessao  { border-left-color: var(--v4-text-muted); }

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

.funnel-step-unidade {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v4-text-muted);
}

.funnel-step-fonte {
  font-size: 0.6875rem;
  color: var(--v4-text-muted);
  background: var(--v4-bg-slate);
  border-radius: var(--radius-full);
  padding: 2px 10px;
}

.funnel-step-card.is-pessoa .funnel-step-unidade { color: var(--v4-primary); }

.funnel-step-bar {
  background-color: var(--v4-border);
}

.funnel-step-card.is-pessoa .funnel-step-bar {
  background-color: var(--v4-primary);
}

.funnel-pass-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--v4-text-body);
  background: var(--v4-bg-slate);
  border-radius: var(--radius-full);
  padding: 3px 10px;
}

/* Insights sem ícone: a severidade fica na borda esquerda. */
.insight-card { border-left: 3px solid var(--v4-border); }
.insight-card-success { border-left-color: var(--v4-status-text); }
.insight-card-warning { border-left-color: #B45309; }
.insight-card-alert   { border-left-color: var(--v4-primary); }
.insight-card-neutral { border-left-color: var(--v4-border); }

/* ============================================================================
   PAINEL v6 — funil geral, seções por fonte, gráficos e tabelas
   ============================================================================ */

/* O atributo hidden só esconde pelo estilo padrão do navegador, que qualquer
   display de classe sobrescreve. Sem esta regra o .mock-banner (display:
   flex) ficava visível para sempre com o texto padrão do HTML — que era o
   aviso "NENHUM CONTATO DO MANYCHAT AINDA" aparecendo com a base cheia. */
[hidden] { display: none !important; }

/* Recarga mantém o quadro anterior, esmaecido, em vez de piscar vazio. */
.main-content.atualizando { opacity: 0.6; transition: opacity 0.2s; }

.status-group { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
/* A linha de atualização quebra em duas antes de espremer a marca e os
   seletores do cabeçalho — são eles que não podem quebrar. */
.status-atualizacao { font-size: 0.6875rem; color: var(--v4-text-muted); text-align: right; max-width: 340px; line-height: 1.35; }
.brand-tag, .v4-dropdown-label { white-space: nowrap; }
/* Com três seletores no topo (fluxo, vídeo, período), o selo de status não
   pode quebrar em duas linhas e o nome do fluxo não pode empurrar o resto:
   nome comprido termina em reticências. */
.status-badge { white-space: nowrap; }
.v4-dropdown-label { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1200px) { .v4-dropdown-label { max-width: 170px; } }
.periodo-rotulo { font-weight: 600; color: var(--v4-text-title); }

.section-band .card-container { margin-bottom: 24px; }

.grid-2, .grid-3 { display: grid; gap: 24px; margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ── Tiles (números de destaque) ─────────────────────────────────────────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.tile {
  background: var(--v4-card-bg);
  border: 1px solid var(--v4-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tile-destaque { border-top: 3px solid var(--v4-primary); }
.tile-rotulo { font-size: 0.75rem; font-weight: 600; color: var(--v4-text-body); }
.tile-valor { font-size: 1.75rem; font-weight: 700; color: var(--v4-text-title); line-height: 1.15; }
.tile-nota { font-size: 0.75rem; color: var(--v4-text-muted); }
.tile-pendente .tile-valor { color: var(--v4-text-muted); }

.tiles-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 992px) { .tiles-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .tiles-3 { grid-template-columns: 1fr; } }

.tiles-escuros .tile { background: #171A1E; border-color: #262B33; }
.tiles-escuros .tile-rotulo { color: #9CA3AF; }
.tiles-escuros .tile-valor { color: #FFFFFF; }
.tiles-escuros .tile-nota { color: #6B7280; }
.tiles-escuros .tile-destaque { border-top-color: #F05A63; }

/* ── Funil geral ─────────────────────────────────────────────────────────── */
.funil-legenda { display: flex; gap: 16px; font-size: 0.75rem; color: var(--v4-text-body); }
.funil-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.leg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.leg-pessoa { background: var(--v4-primary); }
.leg-sessao { background: #9CA3AF; }

.funil-lista { display: flex; flex-direction: column; gap: 2px; }
.funil-linha {
  display: grid;
  grid-template-columns: minmax(200px, 1.3fr) minmax(120px, 2fr) 130px minmax(180px, 1.3fr);
  align-items: center;
  gap: 16px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--v4-border-subtle);
}
.funil-linha:last-child { border-bottom: none; }
.funil-rotulo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.funil-rotulo strong { display: block; font-size: 0.875rem; color: var(--v4-text-title); font-weight: 600; }
.funil-rotulo small { display: block; font-size: 0.6875rem; color: var(--v4-text-muted); }
.funil-ordem {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700;
  background: var(--v4-bg-slate); color: var(--v4-text-body);
}
.funil-barra-wrap { height: 12px; background: var(--v4-bg-slate); border-radius: 3px; overflow: hidden; }
.funil-barra { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.is-pessoa .funil-barra { background: var(--v4-primary); }
.is-sessao .funil-barra { background: #9CA3AF; }
.funil-valor { text-align: right; font-size: 1rem; font-weight: 700; color: var(--v4-text-title); font-variant-numeric: tabular-nums; }
.funil-passagem { font-size: 0.75rem; color: var(--v4-text-body); }
.is-pendente .funil-rotulo strong, .is-pendente .funil-valor { color: var(--v4-text-muted); }
.is-pendente .funil-passagem { color: #B45309; font-style: italic; }
.is-pendente .funil-barra-wrap {
  background: repeating-linear-gradient(135deg, var(--v4-bg-slate) 0 6px, transparent 6px 12px);
}
.funil-nota { margin: 12px 0 0; font-size: 0.75rem; color: var(--v4-text-muted); line-height: 1.5; }

@media (max-width: 760px) {
  .funil-linha { grid-template-columns: 1fr 70px; }
  .funil-barra-wrap { grid-column: 1 / -1; order: 3; }
  .funil-passagem { grid-column: 1 / -1; order: 4; }
}

/* ── Gráficos ────────────────────────────────────────────────────────────── */
/* Altura inclui a faixa do eixo X — sem isso o rótulo do eixo cai fora e
   o card ganha uma rolagem interna. */
.grafico-caixa { position: relative; height: 240px; }
.grafico-alto { height: 300px; }

.tabela-dados { margin-top: 12px; }
.tabela-dados summary { cursor: pointer; font-size: 0.75rem; font-weight: 600; color: var(--v4-text-body); }
.tabela-dados[open] summary { margin-bottom: 8px; }
.tabela-dados.escura summary { color: #9CA3AF; }

/* ── Barras em HTML (listas curtas) ──────────────────────────────────────── */
.barras { display: flex; flex-direction: column; gap: 10px; }
.barra-item {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr minmax(56px, auto);
  align-items: center;
  gap: 12px;
}
.barra-rotulo { font-size: 0.8125rem; color: var(--v4-text-title); overflow-wrap: anywhere; }
.barra-trilho { height: 10px; background: var(--v4-bg-slate); border-radius: 3px; overflow: hidden; }
.barra-preenchida { height: 100%; background: var(--v4-primary); border-radius: 0 4px 4px 0; min-width: 2px; }
.barra-valor { text-align: right; font-size: 0.8125rem; font-weight: 700; color: var(--v4-text-title); font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra-valor small { font-weight: 500; color: var(--v4-text-muted); }
.barras-vazio { font-size: 0.8125rem; color: var(--v4-text-muted); margin: 0; }

.barras.escuras .barra-rotulo, .barras.escuras .barra-valor { color: #E5E7EB; }
.barras.escuras .barra-trilho { background: #262B33; }
.barras.escuras .barra-preenchida { background: #F05A63; }
.barras.escuras .barra-valor small, .barras.escuras .barras-vazio { color: #9CA3AF; }

/* ── Tabelas e selos ─────────────────────────────────────────────────────── */
.v4-table td, .v4-table th { font-variant-numeric: tabular-nums; }
.celula-nota { color: var(--v4-text-muted); font-weight: 400; }
.linha-pendente td { color: var(--v4-text-muted); }

.selo { display: inline-block; font-size: 0.6875rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.selo-ok { background: var(--v4-status-bg); color: var(--v4-status-text); }
.selo-pendente { background: #FEF3C7; color: #B45309; }

.tabela-escura th { color: #9CA3AF; border-bottom-color: #262B33; background: transparent; }
.tabela-escura td { color: #E5E7EB; border-bottom-color: #1F242B; }
.tabela-escura .table-empty { color: #6B7280; }

.tabela-escura tr:hover td,
.tabela-escura tbody tr:hover,
.dark-card .v4-table tr:hover td,
.dark-card .v4-table tbody tr:hover {
  background: #22272E !important;
  color: #FFFFFF !important;
}

.tabela-escura tr:hover td *,
.dark-card .v4-table tr:hover td * {
  color: #FFFFFF !important;
}

/* ── Bloco VTurb: contatos rastreados e momentos de clique ───────────────── */
.mini-funil { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.mini-funil-item { background: #171A1E; border: 1px solid #262B33; border-radius: 10px; padding: 10px 12px; }
.mini-funil-item span { display: block; font-size: 0.6875rem; color: #9CA3AF; }
.mini-funil-item strong { font-size: 1.25rem; color: #FFFFFF; }

.subtitulo-escuro { margin: 20px 0 8px; font-size: 0.8125rem; font-weight: 700; color: #E5E7EB; }
.aviso-escuro { font-size: 0.8125rem; color: #9CA3AF; line-height: 1.5; margin: 0; }
.aviso-escuro code, .card-subtitle-sm code {
  font-size: 0.75rem; background: rgba(127, 127, 127, 0.15); padding: 1px 5px; border-radius: 4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 4px 10px; border-radius: 999px;
  background: #262B33; color: #D1D5DB;
}
.chip-destaque { background: rgba(240, 90, 99, 0.18); color: #FCA5A5; }

/* Títulos dos cards escuros. .text-white nunca foi definida, e o título
   herdava a cor de texto do tema claro: escuro sobre escuro. */
.dark-card .card-heading, .dark-card .card-title-sm { color: #FFFFFF; }
.dark-card .card-subheading, .dark-card .card-subtitle-sm { color: #9CA3AF; }

/* Unidade ao lado do número no funil: envios, cliques, dispositivos. */
.funil-unidade { font-size: 0.6875rem; font-weight: 500; color: var(--v4-text-muted); }

/* ── O que ainda não é medido ────────────────────────────────────────────── */
.pendencias { list-style: none; margin: 0; padding: 0; }
.pendencia {
  display: grid;
  grid-template-columns: 18px minmax(200px, 1fr) minmax(240px, 1.6fr);
  gap: 16px;
  align-items: start;
  padding: 12px 4px;
  border-bottom: 1px solid var(--v4-border-subtle);
}
.pendencia:last-child { border-bottom: none; }
.pendencia-marca { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; border: 2px solid #B45309; }
.pendencia strong { display: block; font-size: 0.875rem; font-weight: 600; color: var(--v4-text-title); }
.pendencia small { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--v4-text-muted); }
.pendencia-acao { font-size: 0.8125rem; line-height: 1.5; color: var(--v4-text-body); }
@media (max-width: 760px) {
  .pendencia { grid-template-columns: 18px 1fr; }
  .pendencia-acao { grid-column: 2; }
}

/* ── Etapa sem medição: o motivo aparece no lugar do número ──────────────── */
.tile-pendente .tile-nota, .celula-pendente { color: #B45309; }
.celula-pendente { font-style: italic; font-size: 0.75rem; }
.tiles-escuros .tile-pendente .tile-valor { color: #6B7280; }
.tiles-escuros .tile-pendente .tile-nota { color: #FBBF24; }
