/* ── Painéis Gerenciais · Dashboard de vendas (prefixo dv-) ──
   Reaproveita crm-metricas.css (mx-*), captacao.css (cp-*, barra "De onde vêm os dados",
   #cpPop e #cpContent) e o filtro mf-* da página de Leads. */
:root {
  --dv-lead: #00909a;
  --dv-sale: #c95b10;
}

/* KPIs */
.dv-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dv-kpis .kpi .m b { color: var(--text); font-weight: 600; }
.dv-kpis .kpi.hl { border-color: color-mix(in srgb, var(--dv-sale) 40%, var(--line)); background: color-mix(in srgb, var(--dv-sale) 4%, #fff); }
.dv-kpis .kpi.hl .v { color: #a2470b; }

/* Faixa do mês atual */
.dv-month { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin: 12px 0 4px; overflow: hidden; }
.dv-month > div { padding: 13px 16px; border-right: 1px solid var(--line); min-width: 0; }
.dv-month > div:last-child { border-right: 0; }
.dv-month .l { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #9a9891; }
.dv-month .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dv-month .m { font-size: 12px; color: var(--muted); margin-top: 3px; }
.dv-month .m b { color: var(--text); }
.up { color: #2f7a35 !important; }
.down { color: #a13544 !important; }

/* Funil */
.dv-funnel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 16px; align-items: stretch; }
.dv-stage { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: center; cursor: pointer; display: flex; flex-direction: column; min-width: 0; border-radius: 8px; }
.dv-stage:hover .shape svg { filter: brightness(1.06); }
.dv-stage:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dv-stage .shape { height: 128px; display: flex; align-items: center; justify-content: center; position: relative; }
.dv-stage .shape svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dv-stage .shape .n { position: relative; z-index: 1; color: #fff; font-weight: 700; font-size: 21px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.18); white-space: nowrap; }
.dv-stage .lb { padding: 10px 6px 0; }
.dv-stage .lb b { display: block; font-size: 13px; }
.dv-stage .lb span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.dv-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.dv-steps > div { text-align: center; font-size: 12px; color: var(--muted); position: relative; }
.dv-steps > div:first-child { visibility: hidden; }
.dv-steps .r { display: inline-block; font-weight: 700; color: var(--text); font-size: 13px; padding: 2px 8px; border-radius: 999px; background: #f3f1ec; }
.dv-steps .r.bad { background: #fbe9e7; color: #a13544; }
.dv-steps small { display: block; margin-top: 3px; }
.dv-steps > div::before { content: "→"; position: absolute; left: -6px; top: 3px; color: #b9b4aa; }

.dv-side { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.dv-drop { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.dv-drop .k { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: #fbe9e7; color: #a13544; }
.dv-drop b { font-size: 13px; display: block; }
.dv-drop small { font-size: 12px; color: var(--muted); }
.dv-drop .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.dv-drop .v small { display: block; font-weight: 500; }
.dv-hero { display: flex; gap: 18px; padding: 12px 2px 2px; border-top: 1px solid var(--line); margin-top: 12px; }
.dv-hero div { flex: 1; min-width: 0; }
.dv-hero b { font-size: 22px; font-weight: 700; display: block; white-space: nowrap; }
.dv-hero span { font-size: 12px; color: var(--muted); }

.mx-wrap.dv-h260 { height: 260px; }

/* Por produto */
.dv-pbar { grid-template-columns: 110px 1fr auto; }
.dv-pmeta { font-size: 12px; color: var(--muted); margin: -4px 0 6px 120px; }
.dv-pmeta b { color: var(--text); }

/* Rosca */
.dv-donut { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 10px; }
.dv-donut .mx-wrap { height: 180px; }

/* Tabelas de calor */
.dv-heat th { text-align: center; }
.dv-heat th:first-child { text-align: left; }
.dv-heat th small { font-weight: 500; }
.dv-heat td.h { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.dv-heat td.h span { display: inline-block; min-width: 52px; padding: 4px 6px; border-radius: 6px; background: #f3f1ec; }
.dv-heat td.h span.good { background: #e3f1e3; color: #2f7a35; }
.dv-heat td.h span.bad { background: #fbe5e3; color: #a13544; }
.dv-heat td.h span.z { background: none; color: #b5b0a5; font-weight: 500; }
.dv-heat tr.mx-total td.h { font-weight: 700; }
.dv-mini { display: flex; gap: 2px; align-items: flex-end; height: 26px; width: 100px; }
.dv-mini i { flex: 1; border-radius: 2px 2px 0 0; background: var(--dv-lead); }
.dv-mini i:last-child { background: var(--dv-sale); }

/* Detalhamento */
.dv-dt-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dv-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 10px; background: #fff; min-width: 240px; color: var(--muted); }
.dv-search svg { width: var(--ico); height: var(--ico); flex: none; }
.dv-search input { border: 0; outline: 0; background: none; font: inherit; font-size: 12.5px; padding: 7px 0; width: 100%; color: var(--text); }
.dv-search:focus-within { border-color: var(--primary); }
.dv-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #f3f1ec; color: var(--muted); white-space: nowrap; }
.dv-tag.ok { background: #e6f2e6; color: #2f7a35; }
.dv-tag.no { background: #fbe9e7; color: #a13544; }
.dv-tag.mid { background: #e6f1f2; color: #0b5d63; }
.dv-dots { display: inline-flex; gap: 4px; }
.dv-dots i { width: 9px; height: 9px; border-radius: 50%; background: #e4e0d8; }
.dv-dots i.on { background: var(--dv-lead); }
.dv-dots i.on.s { background: var(--dv-sale); }
#tblDet { font-size: 12.5px; }
#tblDet th, #tblDet td { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
#tblDet td.who { white-space: normal; min-width: 150px; }
#dtWrap.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
.dv-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 12px; color: var(--muted); }
.dv-pager b { color: var(--text); }
.dv-pages { display: inline-flex; align-items: center; gap: 8px; }
.dv-err { color: #a13544; }

@media (max-width: 1200px) {
  .dv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dv-month { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dv-month > div:nth-child(2) { border-right: 0; }
  .dv-month > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .dv-funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .dv-steps { display: none; }
  .dv-stage .shape { height: 84px; }
  .dv-stage .shape .n { font-size: 16px; }
}
@media (max-width: 640px) {
  .dv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dv-month { grid-template-columns: 1fr; }
  .dv-month > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .dv-search { min-width: 0; flex: 1; }
  .dv-dt-tools { width: 100%; }
  .dv-pmeta { margin-left: 0; }
  .dv-hero b { font-size: 19px; }
}
