/* ═══════════════════════════════════════════════════════════
   FaceSign Corporate Analytics — Design System
   Poppins Font • Professional Light Theme Default
   ═══════════════════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

:root {
  /* Colors - FaceSign Corporate Identity (Light Theme Default) */
  --bg-primary:     #f4f6fa; /* Fundo cinza claro */
  --bg-secondary:   #ffffff; /* Fundo de containers/cabeçalho */
  --bg-card:        #ffffff; /* Fundo dos cards */
  --bg-card-hover:  #fafbfc;

  /* Thin Borders */
  --border-light:   #e4ebf4;
  --border-medium:  #cbd5e1;

  /* Typography Colors */
  --text-primary:   #445062; /* Slate/Navy */
  --text-secondary: #697588; /* Cinza médio */
  --text-muted:     #a0aec0;

  /* Accent - FaceSign Blue */
  --accent:         #4093c2;
  --accent-hover:   #2b82c4;
  --accent-glow:    rgba(64, 147, 194, 0.05);

  --success:        #35a34b;
  --success-dim:    rgba(53, 163, 75, 0.05);
  --error:          #bd1939;
  --error-dim:      rgba(189, 25, 57, 0.05);
  --warning:        #d97706;
  --warning-dim:    rgba(217, 119, 6, 0.05);

  /* Layout */
  --sidebar-w:      240px;
  --radius:         20px;
  --radius-sm:      12px;
  --radius-xs:      8px;

  /* Smooth Timing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
/* Forçando fonte Poppins e correções globais */
html {
  /* Raiz em 16px (era 14px — issue #34: encolhia todo rem e derrubava
     rótulos do funil e badges de conversão para 8-10px). Os font-size em
     rem deste arquivo e de index.html foram recalculados junto: piso de
     0.6875rem (11px) onde o resultado ficaria menor, e ×0,875 nos demais
     para preservar o tamanho visual atual. */
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif !important;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

* {
  font-family: 'Poppins', sans-serif !important;
}

/* Material icons exception */
.material-icons {
  font-family: 'Material Icons' !important;
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.6); }

/* ── CARD STYLING ─────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.77rem;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn:active { transform: scale(0.98); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-hover);
}
.btn-sm { padding: 6px 12px; font-size: 0.72rem; }

/* Botão "Ciclo de Faturamento" — outline por padrão, preenchido quando o ciclo está ativo */
.btn-billing-cycle {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.btn-billing-cycle:hover {
  background: rgba(37, 99, 235, 0.06);
}
.btn-billing-cycle.active {
  background: var(--accent);
  color: #fff;
}
.btn-billing-cycle.active:hover {
  background: var(--accent-hover);
}

.btn-danger-sm {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  font-family: inherit;
  font-size: 0.6875rem;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s var(--ease);
}
.btn-danger-sm:hover {
  background: var(--error-dim);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ── INPUTS ───────────────────────────────────────────────── */
.input-text, .input-date {
  font-family: inherit;
  font-size: 0.77rem;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  transition: all 0.15s;
}
.input-text:focus, .input-date:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}
.input-date { cursor: pointer; }
.input-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
}
/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════ */
.app-loader {
  position: fixed; inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.3s var(--ease);
}
.app-loader.hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-spinner {
  width: 36px; height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { color: var(--text-secondary); font-size: 0.74rem; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE (Clean & Centered UI)
   ═══════════════════════════════════════════════════════════ */
.page-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
}
.login-wrapper { width: 100%; max-width: 380px; padding: 16px; }
.login-card {
  padding: 36px 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════
   APP SHELL — SIDEBAR + MAIN (FaceSign Official Layout)
   ═══════════════════════════════════════════════════════════ */
/* ── PORTAL SHELL & GRID LAYOUT ─────────────────────────────── */
.portal-shell {
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 78px;
  --portal-content-offset: var(--sidebar-width);
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg-primary);
  overflow: hidden;
  transition: grid-template-columns .22s var(--ease);
}

.portal-shell.portal-shell--collapsed {
  --portal-content-offset: var(--sidebar-width-collapsed);
  grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
}

@media (max-width: 991px) {
  .portal-shell {
    display: block;
    position: relative;
  }
  .portal-shell--sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .32);
    z-index: 20;
  }
}

/* ── PORTAL SIDEBAR ───────────────────────────────────────── */
.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  min-width: 0;
  background: #4093c2; /* Azul celeste oficial */
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .22s var(--ease);
}

/* Container Brand & Toggle */
.container-sidebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1rem 1.2rem;
  min-height: 66px;
}

.portal-sidebar.portal-sidebar--collapsed .container-sidebar {
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-brand {
  align-items: center;
}

.sidebar-brand-img {
  height: 28px;
  max-width: 100%;
  object-fit: contain;
  transition: width 0.2s ease;
}

.brand-text {
  color: #fff;
  font-weight: 600;
  font-size: 0.83rem;
  white-space: nowrap;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-brand {
  display: none;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-brand-img {
  width: 28px;
}

/* Toggle Button */
.menu-toggle {
  color: #fff;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(0, 0, 0, .16);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.portal-sidebar.portal-sidebar--collapsed .menu-toggle {
  display: flex; /* Mantém o botão de colapso visível no modo colapsado */
}

.menu-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(42, 84, 120, 0.12);
  background: rgba(0, 0, 0, .24);
}

.menu-toggle span {
  font-size: 1.05rem;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 0.65rem 0.6rem;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-nav {
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

.menu-group-label {
  padding: 0 0.75rem 0.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.portal-sidebar.portal-sidebar--collapsed .menu-group-label {
  display: none;
}

.sidebar-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav ul li {
  margin-bottom: 0.2rem;
}

.sidebar-nav ul li a {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85); /* Cinza bem claro / quase branco */
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 10px;
  padding: 0.68rem 0.8rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-nav ul li a {
  justify-content: center;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.sidebar-nav ul li a span:not(.material-icons) {
  color: inherit;
  font-size: 0.79rem;
  font-weight: 500;
  white-space: nowrap;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-nav ul li a span:not(.material-icons) {
  display: none;
}

.sidebar-nav ul li a .material-icons {
  color: inherit;
  font-size: 1.09rem;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover e Active - Fundo azul marinho #0b1d41 */
.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
  background: #0b1d41;
  color: #ffffff;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 0.7rem 1rem 1rem;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-footer {
  padding: 0.7rem 0.4rem;
}

.portal-sidebar.portal-sidebar--collapsed .sidebar-footer div {
  display: none;
}

@media (max-width: 991px) {
  .portal-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    height: 100dvh;
    z-index: 30;
    transform: translate(-100%);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
  }
  .portal-sidebar.portal-sidebar--open {
    transform: translate(0);
  }
}

/* ── PORTAL MAIN ────────────────────────────────────────────── */
.portal-main {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

/* ── PORTAL HEADER ──────────────────────────────────────────── */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e4e9f2;
}

.header-title-wrap h1 {
  margin: 0;
  font-size: 1.01rem;
  font-weight: 500;
  color: #1f2937;
}

.user-content {
  display: flex;
  align-items: center;
}

.user-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: #4b5563;
}

@media (max-width: 991px) {
  .portal-header {
    padding: .6rem .8rem;
  }
}

/* ── PAGE ROUTER OUTLET ─────────────────────────────────────── */
.page-router-outlet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── DASHBOARD PAGE & SCOPE ─────────────────────────────────── */
.dashboard-page {
  padding: 0 1.5rem 1.5rem;
  background: #f3f5f9;
  min-height: calc(100vh - 66px);
  animation: fadeUp 0.3s var(--ease);
}

.dashboard-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-top: 1.25rem;
  margin-bottom: .9rem;
  background: linear-gradient(90deg, #eef4ff 0%, #f7f9ff 100%);
  border: 1px solid #e2e8f0;
}

.dashboard-scope .info-scope {
  color: #2a3f73;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-scope .info-scope .material-icons {
  color: #2a3f73;
  font-size: 20px;
}

@media (max-width: 991px) {
  .dashboard-page {
    padding: 1rem 1rem 1.5rem;
  }
  .dashboard-scope {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Date range */
.date-range-picker {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.date-field { display: flex; flex-direction: column; gap: 4px; }
.date-field label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Section */
.section { margin-bottom: 24px; }
.section-title {
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   UPLOAD ZONE
   ═══════════════════════════════════════════════════════════ */
.upload-zone {
  padding: 36px 24px;
  text-align: center;
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
  cursor: pointer;
  position: relative;
  background: var(--bg-secondary);
}
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.03);
}
.upload-zone:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.upload-icon {
  color: var(--accent);
  margin-bottom: 12px;
  opacity: 0.85;
}
.upload-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 4px; }
.upload-desc { color: var(--text-secondary); font-size: 0.72rem; margin-bottom: 16px; }

.upload-progress { margin-top: 18px; }
.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
}
.upload-status-text {
  display: block;
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* Upload history table */
.upload-history table {
  width: 100%;
  border-collapse: collapse;
}
.upload-history th,
.upload-history td {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
}
.upload-history th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.6875rem;
  border-bottom: 1px solid var(--border-light);
}
.upload-history td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.upload-history tr:hover td {
  background: var(--bg-card-hover);
}

/* ═══════════════════════════════════════════════════════════
   KPIs (FaceSign Official Metric Cards)
   ═══════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem; /* Menor espaçamento para caber melhor no celular */
  }
}

.metric-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-height: 124px;
  padding: 1.2rem;
  border-radius: 20px;
  background: radial-gradient(circle at top right,rgba(55,116,220,.08),transparent 32%),linear-gradient(180deg,#ffffff 0%,#fbfdff 100%);
  border: 1px solid #e4ebf4;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  transition: transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.1rem;
  right: 1.1rem;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg,#6aa8ff 0%,#2f5ec4 100%);
  opacity: .95;
}

/* Realce sutil no hover (cards informativos, sem ação de clique) */
.metric-card--clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.12);
  border-color: #cfdcf2;
}

/* Indicador de seta removido: os cards não são clicáveis */
.metric-state {
  display: none;
}

/* Variantes de cores do :before e icones */
.metric-card.success::before {
  background: linear-gradient(90deg,#8add92 0%,#2fae4d 100%);
}
.metric-card.success .metric-icon {
  background: linear-gradient(180deg,#e6f8ea 0%,#c6eecf 100%);
}
.metric-card.success .metric-icon mat-icon,
.metric-card.success .metric-icon span {
  color: #35a34b;
}
.metric-card.success .metric-content strong {
  color: #35a34b;
}

/* Variante âmbar — issue #37: index.html usa .metric-card.warning no card
   "Conversas Abertas" (Atendimento), mas a classe não existia no CSS e o
   cartão saía com o azul padrão em vez de âmbar. Segue o mesmo padrão das
   variantes acima, com os tokens de aviso já definidos em :root. */
.metric-card.warning::before {
  background: linear-gradient(90deg,#fbbf24 0%,#d97706 100%);
}
.metric-card.warning .metric-icon {
  background: linear-gradient(180deg,#fffbeb 0%,#fef3c7 100%);
}
.metric-card.warning .metric-icon mat-icon,
.metric-card.warning .metric-icon span {
  color: var(--warning);
}
.metric-card.warning .metric-content strong {
  color: var(--warning);
}

.metric-card.teal::before {
  background: linear-gradient(90deg,#74d9d1 0%,#0f9c92 100%);
}
.metric-card.teal .metric-icon {
  background: linear-gradient(180deg,#e5faf8 0%,#c5efea 100%);
}
.metric-card.teal .metric-icon mat-icon,
.metric-card.teal .metric-icon span {
  color: #0f9c92;
}
.metric-card.teal .metric-content strong {
  color: #0f9c92;
}

.metric-card.error::before {
  background: linear-gradient(90deg,#f87171 0%,#bd1939 100%);
}
.metric-card.error .metric-icon {
  background: linear-gradient(180deg,#fef2f2 0%,#fee2e2 100%);
}
.metric-card.error .metric-icon mat-icon,
.metric-card.error .metric-icon span {
  color: #bd1939;
}
.metric-card.error .metric-content strong {
  color: #bd1939;
}

/* Ícone da esquerda */
.metric-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 18px;
  background: linear-gradient(180deg,#eef5ff 0%,#dce8fb 100%);
  box-shadow: inset 0 1px rgba(255,255,255,0.9);
}

.metric-icon img {
  max-width: 42px;
  max-height: 42px;
}

.metric-icon svg,
.metric-icon .material-icons {
  font-size: 28px;
  width: 28px;
  height: 28px;
  color: #2f91e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Conteúdo */
.metric-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.metric-content strong {
  color: #0b1d41; /* Navy profundo oficial */
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 4px;
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.15rem;
}

.metric-header h2 {
  margin: 0;
  color: #6b7280;
  font-size: 0.70rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

/* Indicador de estado (seta ↗) */
.metric-state {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #9ca3af;
}

.metric-state .material-icons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* ═══════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════ */
.chart-card { padding: 20px; position: relative; }
.chart-title { font-size: 0.83rem; font-weight: 600; color: var(--text-primary); }
.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 280px;
}

/* Gráfico Unificado - Abas de controle */
.chart-tabs {
  display: inline-flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.chart-tab-btn {
  border: none;
  background: transparent;
  color: #64748b;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.70rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Poppins', sans-serif !important;
}
.chart-tab-btn.active {
  background: #ffffff;
  color: #1f2937;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
/* ═══════════════════════════════════════════════════════════
   FULLSCREEN CARD SYSTEM
   ═══════════════════════════════════════════════════════════ */

/* Botão de fullscreen no canto superior direito de cada card */
.card-fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, transform 0.15s;
  z-index: 5;
}
.chart-card:hover .card-fullscreen-btn,
.chart-card.is-fullscreen .card-fullscreen-btn {
  opacity: 1;
}
.card-fullscreen-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.1);
}
.card-fullscreen-btn .material-icons {
  font-size: 18px;
}

/* Overlay escuro atrás do card em tela cheia */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.fullscreen-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Card em modo tela cheia */
.chart-card.is-fullscreen {
  position: fixed !important;
  inset: 24px !important;
  z-index: 9999 !important;
  overflow: auto !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3) !important;
  animation: cardExpandIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  grid-column: unset !important;
}
.chart-card.is-fullscreen .chart-wrapper {
  height: calc(100vh - 180px) !important;
  min-height: 400px !important;
  overflow: hidden;
}
.chart-card.is-fullscreen .heatmap-scroll {
  max-height: calc(100vh - 180px) !important;
}
.chart-card.is-fullscreen .chart-scroll {
  height: calc(100vh - 180px) !important;
}
/* Dentro do scroll, o wrapper preserva a altura dinâmica (uma altura por barra)
   definida inline via JS — a regra genérica acima não deve esmagá-lo */
.chart-card.is-fullscreen .chart-scroll .chart-wrapper {
  height: auto !important;
  min-height: 100% !important;
  overflow: visible;
}

@keyframes cardExpandIn {
  from { opacity: 0.8; transform: scale(0.95); }
  to   { opacity: 1;   transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════
   CHART SCROLL (scroll vertical interno para gráficos de barras
   horizontais com muitas categorias — ex.: Reincidência de Falhas)
   ═══════════════════════════════════════════════════════════ */
.chart-scroll {
  height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}
/* Card que preenche a altura da linha do grid: em telas grandes o grid estica
   o card, e a área de scroll do gráfico cresce junto em vez de ficar em 380px
   fixos com metade do card vazia */
.chart-card--fill {
  display: flex;
  flex-direction: column;
}
.chart-card--fill .chart-scroll {
  flex: 1 1 380px;
  height: auto;
  min-height: 380px;
}
/* O wrapper interno cresce conforme o nº de barras (altura via JS),
   mas nunca fica menor que a área visível do scroll */
.chart-scroll .chart-wrapper {
  min-height: 100%;
}
.chart-scroll::-webkit-scrollbar {
  width: 6px;
}
.chart-scroll::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}
.chart-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 4px;
}
.chart-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.65);
}

/* ═══════════════════════════════════════════════════════════
   HEATMAP TABLE (Clean Data Grid)
   ═══════════════════════════════════════════════════════════ */
.heatmap-scroll {
  overflow: auto;
  margin-top: 4px;
  max-height: 420px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}
.heatmap-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.heatmap-scroll::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}
.heatmap-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 4px;
}
.heatmap-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.65);
}
/* Coluna de motivos "sticky" ao rolar horizontalmente */
.heatmap-table th:first-child,
.heatmap-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-card, #fff);
}
.heatmap-table thead th:first-child {
  background: var(--bg-secondary);
  z-index: 3;
}
/* Header sticky ao rolar verticalmente */
.heatmap-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.70rem;
  min-width: 600px;
}
.heatmap-table th {
  padding: 8px 10px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  background: var(--bg-secondary);
}
.heatmap-table th:first-child {
  text-align: left;
  min-width: 160px;
}
.heatmap-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.heatmap-table td:first-child {
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.heatmap-cell {
  border-radius: 3px;
  padding: 3px 6px;
  display: inline-block;
  min-width: 28px;
  font-weight: 500;
}
.journey-distribution {
  margin-top: 12px;
  font-size: 0.6875rem;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

/* Distribution bars */
.dist-bar-group { margin-top: 8px; }
.dist-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.dist-bar-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}
.dist-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}
.dist-bar-value {
  font-size: 0.6875rem;
  color: var(--text-primary);
  width: 35px;
  flex-shrink: 0;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   ADMIN
   ═══════════════════════════════════════════════════════════ */
.admin-invite { padding: 20px; margin-bottom: 20px; }
.invite-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.invite-form .input-text { flex: 1; }

.users-list table {
  width: 100%;
  border-collapse: collapse;
}
.users-list th,
.users-list td {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
}
.users-list th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.6875rem;
  border-bottom: 1px solid var(--border-light);
}
.users-list td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.users-list tr:hover td { background: var(--bg-card-hover); }
.badge-admin {
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.app-footer {
  text-align: center;
  padding: 24px 0 16px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  margin-top: 32px;
}

/* ═══════════════════════════════════════════════════════════
   TOASTS (Clean & Minimalist Box)
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  animation: toastIn 0.3s var(--ease);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  max-width: 360px;
  border: 1px solid var(--border-light);
}
.toast.toast-success { background: #064e3b; color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.toast.toast-error { background: #7f1d1d; color: #fca5a5; border-color: rgba(252, 165, 165, 0.2); }
.toast.toast-info { background: #1e3a8a; color: #93c5fd; border-color: rgba(147, 197, 253, 0.2); }
.toast.toast-out { animation: toastOut 0.25s var(--ease) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ── SKELETON LOADING ── */
.skeleton-table { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.skeleton-row {
  height: 14px;
  background: linear-gradient(90deg,
    rgba(148,163,184,0.12) 25%,
    rgba(148,163,184,0.28) 50%,
    rgba(148,163,184,0.12) 75%
  );
  background-size: 200% 100%;
  border-radius: 3px;
  animation: shimmer 1.5s infinite;
}
.skeleton-row:nth-child(2) { width: 85%; }
.skeleton-row:nth-child(3) { width: 70%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .date-range-picker { flex-wrap: wrap; }
}

/* ── UTILITY ANIMATIONS ── */
.animate-in {
  animation: fadeUp 0.4s var(--ease) both;
}
.animate-in:nth-child(1) { animation-delay: 0.03s; }
.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.09s; }
.animate-in:nth-child(4) { animation-delay: 0.12s; }
.animate-in:nth-child(5) { animation-delay: 0.15s; }
.animate-in:nth-child(6) { animation-delay: 0.18s; }

/* Journey details layout */
.journey-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.journey-details-card {
  padding: 20px;
}
.details-card-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.details-card-desc {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Behavior metrics list */
.behavior-metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.behavior-metric-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}
.behavior-icon {
  font-size: 1.14rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.metric-info {
  flex: 1;
}
.metric-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.metric-main-value {
  font-size: 1.01rem;
  font-weight: 700;
  color: var(--text-primary);
}
.metric-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.metric-tag.error-bg { background: var(--error-dim); color: var(--error); }
.metric-tag.warning-bg { background: var(--warning-dim); color: var(--warning); }
.metric-label {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}
.metric-subtext {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Responsive adjust for funnel and journey grid */
@media (max-width: 900px) {
  .journey-details-grid {
    grid-template-columns: 1fr;
  }
}

.badge-user {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── PREMIUM PIPELINE FLOW ── */
.funnel-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.funnel-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  transition: all 0.25s var(--ease);
}
.funnel-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--border-medium);
}
.funnel-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.83rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.funnel-step-content {
  flex: 1;
}
.funnel-step-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.funnel-step-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.funnel-step-sub {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 500;
}

.funnel-flow-arrow {
  font-size: 1.31rem;
  color: var(--text-muted);
  user-select: none;
  animation: pulseArrow 2s infinite ease-in-out;
}
@keyframes pulseArrow {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  50% { transform: translateX(4px); opacity: 1; }
}

@media (max-width: 900px) {
  .funnel-flow {
    flex-direction: column;
    align-items: stretch;
  }
  .funnel-flow-arrow {
    transform: rotate(90deg);
    text-align: center;
    margin: 8px 0;
  }
  @keyframes pulseArrow {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(4px); opacity: 1; }
  }
}
.global-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
}

/* Facesign Filter Container & Bar */
.facesign-filter-container {
  margin-bottom: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
}
.facesign-filter-bar {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.facesign-filter-bar:hover {
  background: var(--bg-secondary);
}
.filter-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.83rem;
}
.filter-arrow {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.facesign-filter-content {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  animation: slideDown 0.2s var(--ease);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Final do arquivo CSS - Estilos adicionais limpos */
.facesign-filter-content select,
.facesign-filter-content input {
  height: 40px;
  border-radius: 8px;
  border: 1px solid #d6d6d6;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.77rem;
  outline: none;
}

.facesign-filter-content select:focus,
.facesign-filter-content input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(64, 147, 194, 0.15);
}

/* ── BI GRID LAYOUT (Gráficos lado a lado) ─────────────────── */
.bi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 24px;
}

/* Impede que filhos do grid ultrapassem sua célula ao expandir conteúdo (ex: % no heatmap) */
.bi-grid > * {
  min-width: 0;
  overflow: hidden;
}

.bi-grid > .chart-card .chart-wrapper {
  overflow: hidden;
}

/* Cards de largura total dentro da bi-grid (Evolução dos Erros e Top 5 Erros
   ficam empilhados, cada um ocupando a linha inteira) */
.chart-card--wide {
  grid-column: 1 / -1;
}
/* Com a largura total, o heatmap ganha respiro: coluna de motivos mais larga,
   células com mais padding e mais área vertical antes do scroll */
.chart-card--wide .heatmap-table th:first-child,
.chart-card--wide .heatmap-table td:first-child {
  min-width: 260px;
}
.chart-card--wide .heatmap-table th,
.chart-card--wide .heatmap-table td {
  padding: 9px 12px;
}
.chart-card--wide .heatmap-scroll {
  max-height: 480px;
}

@media (max-width: 991px) {
  .bi-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* ==========================================================================
   CORRECOES DE UI/UX - AUDITORIA FACESIGN
   ========================================================================== */

/* 1. Responsividade de Tabelas */
.upload-history, .users-list {
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}
.upload-history table, .users-list table {
  min-width: 550px;
}

/* 2. Suporte Responsivo a Elementos Mobile/Desktop Only */
@media (min-width: 992px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 991px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }

  /* Ajuste no posicionamento do header no mobile */
  .portal-header {
    padding: 0.6rem 1rem !important;
  }
}

/* 5. Suavizacao Visual Adicional */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 6. Layout Estatico no Desktop (Evita rolagem da sidebar e header) */
@media (min-width: 992px) {
  html, body {
    height: 100vh !important;
    overflow: hidden !important;
  }
  .portal-shell {
    height: 100vh !important;
    overflow: hidden !important;
  }
  .portal-main {
    height: 100vh !important;
    overflow: hidden !important;
  }
  .page-router-outlet {
    height: calc(100vh - 66px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── DASHBOARD LOADING STATE ── */
.dashboard-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(244, 246, 250, 0.7);
  z-index: 1000;
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  border-radius: var(--radius);
}.dashboard-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin-dash 0.8s linear infinite;
}
@keyframes spin-dash {
  to { transform: rotate(360deg); }
}

/* ── PEAK HOURS RANKING (TOP 3) ────────────────────────────── */
.peak-container {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.peak-ranking {
  width: 260px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-light);
  padding-left: 1.5rem;
}

.peak-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.peak-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
}

.peak-badge {
  font-weight: 800;
  font-size: 0.88rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.peak-badge.rank-1 {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.peak-badge.rank-2 {
  background: rgba(43, 130, 196, 0.15);
  color: #2b82c4;
  border: 1px solid rgba(43, 130, 196, 0.3);
}

.peak-badge.rank-3 {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.peak-details {
  flex: 1;
  min-width: 0;
}

.peak-time {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peak-val {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .peak-ranking {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-light);
    padding-left: 0;
    padding-top: 1.5rem;
    margin-top: 1rem;
  }
}

#peak-ranking-list {
  padding: 0;
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── CHART CARD HEADER (chips de ícone e títulos, cientes do tema) ── */
.chart-title--lg {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-icon-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chart-icon-chip .material-icons {
  font-size: 18px;
}
.chip-blue  { background: rgba(47, 145, 232, 0.12); color: #2f91e8; }
.chip-red   { background: rgba(239, 68, 68, 0.12);  color: #ef4444; }
.chip-amber { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.chip-green { background: rgba(22, 163, 74, 0.12);  color: #16a34a; }
/* ── SELETOR GLOBAL TRANSAÇÕES / CPFs ───────────────────────── */
.chart-mode-selector {
  display: flex;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}
.chart-mode-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.70rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.chart-mode-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* ── ESTADO VAZIO DOS GRÁFICOS ──────────────────────────────── */
.chart-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-align: center;
  pointer-events: none;
}
.chart-empty-state .material-icons {
  font-size: 32px;
  opacity: 0.5;
}

/* Feed de Conversas (Atendimento) removido na Fase 5 por LGPD (ver comentário
   em index.html). CSS morto confirmado por grep em index.html e frontend/js/
   e removido na issue #37: .search-input-wrap/.search-input/.filter-select/
   .custom-table e as variantes .badge-open/.badge-resolved/.badge-channel.
   .badge e .badge-label seguem: js/dashboard.js ainda gera
   `class="badge badge-label"` na tabela de motivos do Atendimento. */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-label {
  background: rgba(64, 147, 194, 0.08);
  color: #4093c2;
  border: 1px solid rgba(64, 147, 194, 0.15);
}

/* ── Funnel 1D Component (Paralelogramo com Barra de Retenção - 100% Fluido) ── */
.funnel-container-1d {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  overflow: hidden;
  padding: 0.5rem 0;
  box-sizing: border-box;
}

.funnel-step-1d {
  flex: 1 1 0px;
  min-width: 0;
  padding: 0.9rem 0.4rem;
  border-radius: 8px;
  transform: skewX(-12deg);
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  position: relative;
  text-align: center;
  box-sizing: border-box;
}

.funnel-step-1d > * {
  transform: skewX(12deg);
}

.funnel-step-1d:hover {
  transform: skewX(-12deg) translateY(-3px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.funnel-step-1d.s1 { background: #e0f2fe; }
.funnel-step-1d.s2 { background: #e2e8f0; }
.funnel-step-1d.s3 { background: #e0f2fe; }
.funnel-step-1d.s4 { background: #e2e8f0; }
.funnel-step-1d.s5 { background: #ede9fe; }
.funnel-step-1d.s6 { background: #ddd6fe; }

.funnel-val-1d {
  font-size: clamp(0.95rem, 1.25vw, 1.25rem);
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  letter-spacing: -0.02em;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-lbl-1d {
  /* Piso subido para 0.6875rem (11px a 16px de raiz) — issue #34: o rótulo
     do funil chegava a 9px com a raiz antiga de 14px. */
  font-size: clamp(0.6875rem, 0.75vw, 0.74rem);
  font-weight: 600;
  color: #475569;
  margin-top: 3px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-bar-bg-1d {
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.funnel-bar-fill-1d {
  height: 100%;
  background: #0f172a;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.funnel-arrow-1d {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0 1px;
}

.funnel-badge-1d {
  /* Piso e teto subidos (mesma folga original de 0.10rem) — issue #34: o
     badge de conversão chegava a 8,1px com a raiz antiga de 14px; o teto
     também precisou subir porque ficava abaixo do novo piso de 11px. */
  font-size: clamp(0.6875rem, 0.68vw, 0.79rem);
  font-weight: 700;
  color: #2563eb;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.08);
  white-space: nowrap;
}

.funnel-arrow-1d span.material-icons {
  font-size: clamp(0.85rem, 1.1vw, 1.1rem);
  color: #94a3b8;
}

@media (max-width: 1024px) {
  .funnel-container-1d {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    overflow: visible;
  }
  .funnel-step-1d {
    transform: none;
  }
  .funnel-step-1d > * {
    transform: none;
  }
  .funnel-step-1d:hover {
    transform: translateY(-3px);
  }
  .funnel-arrow-1d {
    display: none;
  }
}

@media (max-width: 640px) {
  .funnel-container-1d {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}




/* ========================================================
   ALERTAS E WEBHOOKS - FACESIGN
   ======================================================== */
.badge-status-ativo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  transition: all 0.2s ease;
}
.badge-status-ativo:hover {
  background: rgba(34, 197, 94, 0.22);
}
.badge-status-inativo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  transition: all 0.2s ease;
}
.badge-status-inativo:hover {
  background: rgba(148, 163, 184, 0.25);
}
.badge-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}
.badge-dot-gray {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #94a3b8;
}
/* ═══════════════════════════════════════════════════════════
   ACESSIBILIDADE — INDICAÇÃO DE FOCO
   Sem isto, quem navega por teclado não enxerga onde está: os botões
   zeravam o contorno sem colocar substituto. Fica no fim do arquivo
   de propósito, para vencer por ordem os `outline: none` de mesma
   especificidade. `:focus-visible` só marca a navegação por teclado —
   o clique de mouse continua sem contorno.
   (Os campos de .facesign-filter-content mantêm o próprio anel de
   box-shadow no :focus e por isso seguem sem outline.)
   ═══════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   ACESSIBILIDADE — prefers-reduced-motion (issue #36)
   Não existia nenhuma regra para isso: a seta ➔ da Jornada de Conversão
   pulsava indefinidamente (@keyframes pulseArrow) e as demais
   transições/animações do arquivo rodavam sem exceção para quem pediu
   menos movimento ao sistema operacional.
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
