/* ============================================================================
   ONDA 24 — DASHBOARD PREMIUM (redesign Dra. Sharon Raicher)
   ----------------------------------------------------------------------------
   Escopo: SOMENTE dentro de .dash-v10. Complementa onda-10-dashboard.css
   (que carrega a paleta bordô em --dash-*). Componentes novos:
     · .dash-kpi-card  — KPI premium (filete bordô, chip de ícone, sparkline)
     · .dash-skeleton  — loading shimmer (substitui o spinner)
     · .dash-origem    — barras horizontais CSS (origem dos contatos)
     · hero do "Hoje"  — contador grande + borda bordô (override da onda-19)
     · .dash-empty-rich — empty states com ícone + frase humana
   Carregar DEPOIS de onda-10 e onda-19.
   ============================================================================ */

/* ===========================================================================
   KPI CARD PREMIUM
   =========================================================================== */
.dash-v10 .dash-kpi-card {
  position: relative;
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 16px 18px 14px;
  box-shadow: var(--dash-shadow-sm);
  overflow: hidden;            /* filete superior respeita o radius */
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
.dash-v10 .dash-kpi-card:hover {
  box-shadow: var(--dash-shadow-hover);
  transform: translateY(-2px);
}
/* Filete superior 3px em gradiente bordô */
.dash-v10 .dash-kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--dash-brand-deep), var(--dash-brand) 40%, var(--dash-ramp-3));
}

.dash-v10 .dash-kpi-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Chip de ícone 32px com fundo tint bordô */
.dash-v10 .dash-kpi-card__icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--dash-tint-08);
  color: var(--dash-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dash-v10 .dash-kpi-card__icon svg { width: 16px; height: 16px; }

/* Label eyebrow */
.dash-v10 .dash-kpi-card__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--dash-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.25;
  margin: 0;
}

/* Linha do valor + delta */
.dash-v10 .dash-kpi-card__value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-v10 .dash-kpi-card__value {
  font-size: 30px;
  font-weight: 700;
  color: var(--dash-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1.1;
  margin: 0;
}

/* Delta pill (verde/vermelho/neutro dessaturados) */
.dash-v10 .dash-kpi-card__delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.dash-v10 .dash-kpi-card__delta--pos {
  color: var(--dash-pos);
  background: var(--dash-pos-soft);
}
.dash-v10 .dash-kpi-card__delta--neg {
  color: var(--dash-neg);
  background: var(--dash-neg-soft);
}
.dash-v10 .dash-kpi-card__delta--neutral {
  color: var(--dash-text-soft);
  background: var(--dash-surface-2);
}

.dash-v10 .dash-kpi-card__meta {
  font-size: 12px;
  color: var(--dash-text-soft);
  margin: 0;
  line-height: 1.3;
}

/* Wrap do sparkline (canvas 120x36 via atributos HTML) */
.dash-v10 .dash-kpi-card__spark {
  margin-top: auto;            /* cola no rodapé do card */
  height: 36px;
  display: flex;
  align-items: flex-end;
}
.dash-v10 .dash-kpi-card__spark canvas {
  max-width: 100%;
}

/* ===========================================================================
   SKELETON (shimmer) — substitui o spinner do load inicial
   =========================================================================== */
.dash-v10 .dash-skeleton {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}
.dash-v10 .dash-skeleton__kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.dash-v10 .dash-skeleton__charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-v10 .dash-skeleton__card {
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  background: var(--dash-surface);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-v10 .dash-skeleton__card--kpi   { min-height: 130px; }
.dash-v10 .dash-skeleton__card--chart { min-height: 260px; }
.dash-v10 .dash-skeleton__bone {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--dash-surface-2) 25%,
    var(--dash-tint-08)   50%,
    var(--dash-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: dash-skeleton-shimmer 1.4s ease-in-out infinite;
}
.dash-v10 .dash-skeleton__bone--label { height: 12px; width: 55%; }
.dash-v10 .dash-skeleton__bone--value { height: 30px; width: 40%; }
.dash-v10 .dash-skeleton__bone--spark { height: 36px; width: 100%; margin-top: auto; }
.dash-v10 .dash-skeleton__bone--title { height: 14px; width: 35%; }
.dash-v10 .dash-skeleton__bone--chart { flex: 1; width: 100%; min-height: 160px; }
@keyframes dash-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===========================================================================
   ORIGEM DOS CONTATOS — barras horizontais CSS
   =========================================================================== */
.dash-v10 .dash-origem {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-v10 .dash-origem__row {
  display: grid;
  grid-template-columns: 140px 1fr 44px;
  align-items: center;
  gap: 12px;
}
.dash-v10 .dash-origem__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--dash-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-v10 .dash-origem__track {
  height: 22px;
  background: var(--dash-surface-2);
  border-radius: 6px;
  overflow: hidden;
}
.dash-v10 .dash-origem__fill {
  height: 100%;
  min-width: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--dash-brand), var(--dash-ramp-2));
  transition: width 400ms cubic-bezier(.2, .7, .2, 1);
}
.dash-v10 .dash-origem__count {
  font-size: 13px;
  font-weight: 700;
  color: var(--dash-text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ===========================================================================
   HERO "O QUE FAZER HOJE" — override da onda-19 (mesma especificidade + after)
   =========================================================================== */
:root[data-theme="light"] .dash-v10 .dash-hoje {
  background: #FDF9FA;
  border: 1px solid var(--dash-border, #DCCBD1);
  border-left: 4px solid var(--dash-brand, #7A0F2E);
  border-radius: var(--dash-radius, 10px);
  padding: 18px 20px;
  margin-bottom: 28px;
}
:root[data-theme="light"] .dash-v10 .dash-hoje__hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
/* Contador grande de ações pendentes */
:root[data-theme="light"] .dash-v10 .dash-hoje__hero-count {
  flex: 0 0 auto;
  min-width: 52px;
  height: 52px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--dash-tint-12, rgba(122, 15, 46, 0.12));
  color: var(--dash-brand, #7A0F2E);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
:root[data-theme="light"] .dash-v10 .dash-hoje__hero-text { min-width: 0; }
:root[data-theme="light"] .dash-v10 .dash-hoje__titulo {
  margin: 0;
  font-size: 17px;
}
:root[data-theme="light"] .dash-v10 .dash-hoje__hero-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--dash-text-soft, #5C4A50);
}
/* Grupos internos ficam "flutuando" sobre o fundo do hero */
:root[data-theme="light"] .dash-v10 .dash-hoje__grupo {
  box-shadow: var(--dash-shadow-sm);
}

/* ===========================================================================
   EMPTY STATES RICOS (ícone + frase humana)
   =========================================================================== */
.dash-v10 .dash-empty-rich {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 36px 24px;
  color: var(--dash-text-soft);
}
.dash-v10 .dash-empty-rich__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--dash-tint-08);
  color: var(--dash-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dash-v10 .dash-empty-rich__icon svg { width: 22px; height: 22px; }
.dash-v10 .dash-empty-rich__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dash-text);
  margin: 0;
}
.dash-v10 .dash-empty-rich__hint {
  font-size: 12.5px;
  color: var(--dash-text-soft);
  margin: 0;
  max-width: 360px;
  line-height: 1.45;
}

/* ===========================================================================
   RESPONSIVO
   =========================================================================== */
@media (max-width: 1280px) {
  .dash-v10 .dash-skeleton__kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .dash-v10 .dash-skeleton__charts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-v10 .dash-skeleton__kpis { grid-template-columns: 1fr; }
  .dash-v10 .dash-kpi-card__spark { display: none; }  /* sparkline some se apertar */
  .dash-v10 .dash-kpi-card { min-height: 0; }
  .dash-v10 .dash-origem__row { grid-template-columns: 100px 1fr 40px; }
}

/* ===========================================================================
   prefers-reduced-motion
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .dash-v10 .dash-skeleton__bone { animation: none; }
  .dash-v10 .dash-kpi-card,
  .dash-v10 .dash-origem__fill { transition: none; }
}
