/* Estatísticas — redesign visual mais leve, alinhado ao tom da aba Pedido/Formal */
#statsView.stats-view{
  --st-blue:#1a73e8;
  --st-blue-2:#2b7de9;
  --st-soft-blue:rgba(26,115,232,.075);
  --st-soft-blue-2:rgba(26,115,232,.045);
  --st-ink:var(--text);
  --st-muted:var(--muted);
  --st-line:color-mix(in srgb,var(--border) 84%,transparent);
  background:
    radial-gradient(circle at 18% -8%, rgba(26,115,232,.08), transparent 34%),
    linear-gradient(180deg,#f6f9fe 0%,#f8fafc 42%,var(--bg) 100%) !important;
  padding:20px 22px 32px !important;
}
#statsView .stats-wrap{
  max-width:1280px !important;
  gap:15px !important;
}

/* HERO com identidade azul, mas discreto */
#statsView .stats-hero{
  position:relative;
  overflow:hidden;
  padding:18px 20px !important;
  border-radius:24px !important;
  border:1px solid rgba(26,115,232,.16) !important;
  background:
    linear-gradient(135deg,rgba(26,115,232,.10),rgba(255,255,255,.92) 34%,rgba(255,255,255,.96)) !important;
  box-shadow:0 1px 2px rgba(60,64,67,.04),0 14px 32px rgba(26,115,232,.06) !important;
}
#statsView .stats-hero::before{
  content:"";
  position:absolute;
  left:20px;
  right:20px;
  top:0;
  height:4px;
  border-radius:0 0 999px 999px;
  background:linear-gradient(90deg,#1a73e8,#4285f4,#7baaf7);
}
#statsView .stats-title{
  font-size:21px !important;
  line-height:1.08 !important;
  color:#202124 !important;
  letter-spacing:-.055em !important;
  font-weight:850 !important;
}
#statsView .stats-sub{
  font-size:12px !important;
  max-width:70ch !important;
  line-height:1.5 !important;
  color:#5f6368 !important;
}
#statsView .stats-sync-chip{
  background:rgba(26,115,232,.08) !important;
  border-color:rgba(26,115,232,.18) !important;
  color:#1a73e8 !important;
  box-shadow:none !important;
}

/* Filtros em uma faixa limpa */
#statsView .stats-filters{
  padding:10px 12px !important;
  border-radius:20px !important;
  border:1px solid rgba(26,115,232,.10) !important;
  background:rgba(255,255,255,.82) !important;
  backdrop-filter:blur(10px);
  box-shadow:0 1px 2px rgba(60,64,67,.035),0 10px 26px rgba(60,64,67,.035) !important;
}
#statsView .st-filter-label{
  color:#80868b !important;
}
#statsView .st-pill,
#statsView .st-select,
#statsView .st-date{
  color:#3c4043 !important;
  background:#fff !important;
  border-color:#dfe5ef !important;
  min-height:30px !important;
  font-weight:750 !important;
  transition:background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease !important;
}
#statsView .st-pill:hover,
#statsView .st-select:hover,
#statsView .st-date:hover{
  border-color:rgba(26,115,232,.22) !important;
  background:#f8fbff !important;
}
#statsView .st-pill.active{
  background:#e8f0fe !important;
  border-color:rgba(26,115,232,.28) !important;
  color:#1a73e8 !important;
  box-shadow:inset 0 0 0 1px rgba(26,115,232,.04) !important;
}

/* KPIs: todos no mesmo sistema azul/neutro; sem verde/vermelho dominando */
#statsView .stats-kpis{
  gap:10px !important;
}
#statsView .st-kpi{
  min-height:92px !important;
  padding:13px 14px 12px !important;
  border-radius:20px !important;
  border:1px solid #e3e8f1 !important;
  background:
    linear-gradient(180deg,#fff,#fbfdff) !important;
  box-shadow:0 1px 2px rgba(60,64,67,.035),0 8px 24px rgba(60,64,67,.04) !important;
  transform:translateY(0);
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease,background .18s ease !important;
}
#statsView .st-kpi:hover{
  transform:translateY(-2px);
  border-color:rgba(26,115,232,.20) !important;
  box-shadow:0 2px 5px rgba(60,64,67,.055),0 16px 34px rgba(26,115,232,.075) !important;
}
#statsView .st-kpi::before{
  height:3px !important;
  background:linear-gradient(90deg,#1a73e8,#5e97f6) !important;
  opacity:.9 !important;
}
#statsView .st-kpi-label{
  font-size:9.5px !important;
  color:#8a94a3 !important;
}
#statsView .st-kpi-value{
  font-size:21px !important;
  color:#1a73e8 !important;
  font-weight:900 !important;
}
#statsView .st-kpi.st-color-neutral .st-kpi-value,
#statsView .st-color-neutral .st-kpi-value{
  color:#202124 !important;
}
#statsView .st-kpi-sub{
  font-size:10.5px !important;
  color:#6f7782 !important;
}

/* Remove a leitura de "semáforo" nos cards principais */
#statsView .st-color-green,
#statsView .st-color-red,
#statsView .st-color-orange,
#statsView .st-color-blue{
  --st-color:#1a73e8 !important;
}
#statsView .st-kpi.st-color-red .st-kpi-value,
#statsView .st-kpi.st-color-green .st-kpi-value,
#statsView .st-kpi.st-color-orange .st-kpi-value{
  color:#1a73e8 !important;
}

/* Cards: mais ar, menos borda pesada */
#statsView .stats-grid{
  gap:12px !important;
}
#statsView .st-card{
  border-radius:22px !important;
  border:1px solid #e3e8f1 !important;
  background:#fff !important;
  box-shadow:0 1px 2px rgba(60,64,67,.035),0 10px 28px rgba(60,64,67,.04) !important;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease !important;
}
#statsView .st-card:hover{
  transform:translateY(-1px);
  border-color:rgba(26,115,232,.16) !important;
  box-shadow:0 2px 5px rgba(60,64,67,.05),0 14px 34px rgba(60,64,67,.055) !important;
}
#statsView .st-card-head{
  padding:13px 16px !important;
  border-bottom:1px solid #edf1f7 !important;
  background:linear-gradient(180deg,#fff,#fbfdff) !important;
}
#statsView .st-card-title{
  font-size:13px !important;
  font-weight:850 !important;
  color:#202124 !important;
}
#statsView .st-card-sub{
  font-size:10.8px !important;
  color:#6f7782 !important;
}
#statsView .st-card-badge{
  color:#1a73e8 !important;
  background:#e8f0fe !important;
  border-color:rgba(26,115,232,.16) !important;
  font-size:9px !important;
  padding:3px 8px !important;
}
#statsView .st-card-body{
  padding:12px 15px !important;
}

/* Gráficos em tom único; barras mais elegantes */
#statsView .st-bar-track,
#statsView .st-progress{
  height:7px !important;
  border:none !important;
  background:#eef3f9 !important;
}
#statsView .st-bar-fill,
#statsView .st-progress span{
  background:linear-gradient(90deg,#1a73e8,#6ea8fe) !important;
  box-shadow:0 0 0 1px rgba(255,255,255,.35) inset;
}
#statsView .st-bar-label{
  color:#3c4043 !important;
  font-weight:780 !important;
}
#statsView .st-bar-val{
  color:#1a73e8 !important;
}

/* Tabelas: números com cor só no faturamento/lucro; custo menos agressivo */
#statsView .st-table th{
  background:#fbfdff !important;
  color:#8a94a3 !important;
  border-bottom:1px solid #edf1f7 !important;
  padding:8px 10px !important;
}
#statsView .st-table td{
  border-bottom:1px solid #eef2f7 !important;
  padding:8.5px 10px !important;
  color:#202124 !important;
}
#statsView .st-table .blue{
  color:#1a73e8 !important;
}
#statsView .st-table .green{
  color:#188038 !important;
}
#statsView .st-table .red{
  color:#5f6368 !important;
}
#statsView .st-table tbody tr{
  transition:background .14s ease;
}
#statsView .st-table tbody tr:hover td{
  background:#f8fbff !important;
}
#statsView .st-name-main{
  color:#202124 !important;
  font-weight:850 !important;
}
#statsView .st-name-sub{
  color:#6f7782 !important;
}

/* Auxiliares */
#statsView .st-mini,
#statsView .st-abc-row{
  background:#f8fbff !important;
  border-color:#e6edf7 !important;
  border-radius:16px !important;
}
#statsView .st-mini-value,
#statsView .st-mini-value.green,
#statsView .st-mini-value.red{
  color:#1a73e8 !important;
}
#statsView .st-mini-label{
  color:#8a94a3 !important;
}
#statsView .st-abc-class{
  background:linear-gradient(135deg,#1a73e8,#5e97f6) !important;
}
#statsView .st-abc-row:nth-child(2) .st-abc-class,
#statsView .st-abc-row:nth-child(3) .st-abc-class{
  background:linear-gradient(135deg,#1a73e8,#5e97f6) !important;
}
#statsView .st-note{
  background:#f8fbff !important;
  border-color:#e6edf7 !important;
}

/* Animação sutil em cascata ao abrir */
#statsView.active .stats-hero,
#statsView.active .stats-filters,
#statsView.active .st-kpi,
#statsView.active .st-card{
  animation:statsSoftRise .34s cubic-bezier(.2,.8,.2,1) both;
}
#statsView.active .stats-filters{animation-delay:.03s}
#statsView.active .st-kpi:nth-child(1){animation-delay:.04s}
#statsView.active .st-kpi:nth-child(2){animation-delay:.06s}
#statsView.active .st-kpi:nth-child(3){animation-delay:.08s}
#statsView.active .st-kpi:nth-child(4){animation-delay:.10s}
#statsView.active .st-kpi:nth-child(5){animation-delay:.12s}
#statsView.active .st-kpi:nth-child(6){animation-delay:.14s}
#statsView.active .st-card{animation-delay:.12s}
@keyframes statsSoftRise{
  from{opacity:0;transform:translateY(8px)}
  to{opacity:1;transform:translateY(0)}
}

/* Alguns cards podem ficar mais proporcionais em telas largas */
@media(min-width:1180px){
  #statsView .st-card.span-6{
    min-height:176px;
  }
}

/* Dark mode não recebe branco forçado */
body:not([data-theme="light"]) #statsView.stats-view{
  background:
    radial-gradient(circle at 18% -8%, color-mix(in srgb,var(--accent) 10%,transparent), transparent 34%),
    var(--bg) !important;
}
body:not([data-theme="light"]) #statsView .stats-hero,
body:not([data-theme="light"]) #statsView .stats-filters,
body:not([data-theme="light"]) #statsView .st-kpi,
body:not([data-theme="light"]) #statsView .st-card{
  background:linear-gradient(180deg,color-mix(in srgb,var(--surface) 96%,var(--accent) 4%),var(--surface)) !important;
  border-color:var(--border) !important;
}
body:not([data-theme="light"]) #statsView .stats-title,
body:not([data-theme="light"]) #statsView .st-card-title,
body:not([data-theme="light"]) #statsView .st-table td,
body:not([data-theme="light"]) #statsView .st-name-main{
  color:var(--text) !important;
}
