/* CRM · Métricas (página só do Administrador).
   Usa a base visual do CRM (.crm-v2, em css/pages/crm/); aqui fica só o que é próprio da página. */

/* ── Filtros gerais ─────────────────────────────────────────────── */
.mx-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.crm-v2 .mx-toolbar .c-select {
  width: auto;
  max-width: 220px;
}

.mx-toolbar .v2-datepop {
  left: 0;
  right: auto;
  top: 42px;
}

.mx-clear {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}

.mx-clear:hover {
  color: var(--text);
}

.mx-clear[hidden] {
  display: none;
}

/* ── Estrutura ──────────────────────────────────────────────────── */
#mxContent {
  transition: opacity 0.15s ease;
}

#mxContent.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.mx-sec {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 26px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mx-sec .n {
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.mx-rule {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.mx-rule b {
  color: var(--ink-2);
  font-weight: 700;
}

.mx-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mx-localfilters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 24px;
}

.crm-v2 .mx-localfilters .c-select {
  width: auto;
  max-width: 230px;
}

.mx-card {
  padding: 18px 18px 16px;
  min-width: 0;
}

.mx-card .ch-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.mx-card .ch-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 12px;
}

.mx-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.mx-grid-21 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.mx-wrap {
  position: relative;
  height: 230px;
}

.mx-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.mx-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* ── Indicadores do topo ────────────────────────────────────────── */
.mx-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}

.mx-kpis .kpi {
  padding: 16px 16px 14px;
}

.mx-kpis .kpi .v {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 23px;
  letter-spacing: -0.01em;
  margin-top: 8px;
  white-space: nowrap;
}

.mx-kpis .kpi .m {
  font-size: 12px;
  margin-top: 5px;
}

.mx-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}

.mx-delta.up {
  color: var(--success);
}

.mx-delta.down {
  color: var(--error);
}

.mx-delta.flat {
  color: var(--muted);
}

/* ── Captação diária ────────────────────────────────────────────── */
.mx-daily-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
  text-align: right;
}

.mx-daily-stats div {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  font-weight: 700;
}

.mx-daily-stats b {
  display: block;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  margin-top: 2px;
}

.mx-daily-stats small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.mx-wrap.daily {
  height: 280px;
}

/* ── Andamento (Sankey) ─────────────────────────────────────────── */
.mx-funnel {
  padding: 20px 22px 16px;
  margin-bottom: 14px;
}

.mx-funnel .sankey-container {
  width: 100%;
  min-height: 430px;
  overflow-x: auto;
}

.mx-funnel .funnel-note {
  margin-top: 10px;
}

.mx-rates {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.mx-rate {
  padding: 14px 16px;
  border-left: 1px solid var(--line);
  min-width: 0;
}

.mx-rate:first-child {
  border-left: none;
}

.mx-rate .l,
.mx-tile .l {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  font-weight: 700;
}

.mx-rate .v {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.mx-rate .f {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mx-meter {
  height: 4px;
  border-radius: 999px;
  background: #efebe3;
  margin-top: 9px;
  overflow: hidden;
}

.mx-meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

/* ── Quadros pequenos ───────────────────────────────────────────── */
.mx-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mx-tiles.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mx-tile {
  padding: 14px 16px;
  min-width: 0;
}

.mx-tile .v {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 6px;
  white-space: nowrap;
}

.mx-tile .v.none {
  color: var(--ghost);
}

.mx-tile .m {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Lista de barras: uma cor por lista, valor escrito ao lado ──── */
.mx-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.mx-bar {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.mx-bars.wide .mx-bar {
  grid-template-columns: 150px 1fr auto;
}

.mx-bar .nm {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mx-bar .nm i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.mx-bar .tr {
  height: 14px;
  background: #f3f0ea;
  border-radius: 4px;
  overflow: hidden;
}

.mx-bar .tr b {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: #01696fbb;
}

.mx-bar .vl {
  text-align: right;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 64px;
}

.mx-bar .vl small {
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

.mx-foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mx-foot b {
  color: var(--text);
}

/* ── Lista "parados agora" e itens com número à direita ─────────── */
.mx-alerts {
  display: flex;
  flex-direction: column;
}

.mx-alert {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: var(--gap-ico-lg);
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.mx-alert.plain {
  grid-template-columns: 1fr auto;
}

.mx-alert:first-child {
  border-top: none;
  padding-top: 2px;
}

.mx-alert svg {
  width: var(--ico-only);
  height: var(--ico-only);
  color: #964219;
}

.mx-alert.zero svg {
  color: var(--ghost);
}

.mx-alert b {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 19px;
  font-weight: 800;
}

.mx-alert.zero b {
  color: var(--ghost);
}

.mx-alert small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

/* ── Tabelas com barra embutida ─────────────────────────────────── */

.mx-table th button {
  appearance: none;
  border: none;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.mx-table th button:hover,
.mx-table th.sorted button {
  color: var(--text);
}

.mx-table .who {
  font-weight: 700;
  color: var(--text);
}

.mx-table .who small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
}

.mx-table td small.extra {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.mx-cellbar {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.mx-cellbar span {
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mx-cellbar i {
  display: block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: #efebe3;
  overflow: hidden;
  flex: none;
}

.mx-cellbar i b {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #01696fbb;
}

.mx-goal i {
  width: 96px;
  height: 8px;
}

.mx-goal.hit i b {
  background: #437a22cc;
}

.mx-total td {
  font-weight: 700;
  background: #fbf9f5;
}

.mx-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.mx-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mx-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.mx-goalbar .tr {
  height: 12px;
  border-radius: 999px;
  background: #efebe3;
  overflow: hidden;
}

.mx-goalbar .tr b {
  display: block;
  height: 100%;
  background: #01696fcc;
  border-radius: 999px;
}

.mx-goalbar.hit .tr b {
  background: #437a22cc;
}

.mx-goalbar .ft {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Velocidade por horário de entrada ──────────────────────────── */
.mx-grid-12 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.mx-split {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 5px;
  overflow: hidden;
  background: #f3f0ea;
  margin: 6px 0 14px;
}

.mx-split b {
  display: block;
  height: 100%;
}

.mx-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.mx-two strong {
  display: block;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 4px;
}

.mx-two small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}

.mx-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.mx-speed td.num {
  font-size: 13.5px;
}

.mx-speed td small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.mx-speed tr.main td {
  background: #fbf9f5;
}

.mx-speed tr.main td.num b {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.mx-speed tr.ref td,
.mx-speed tr.ref td.who {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 1180px) {
  .mx-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mx-tiles,
  .mx-tiles.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mx-rates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mx-rate {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .mx-rate:nth-child(-n + 2) {
    border-top: none;
  }
}

@media (max-width: 980px) {

  .mx-grid2,
  .mx-grid-21,
  .mx-grid-12 {
    grid-template-columns: 1fr;
  }

  .mx-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mx-head {
    flex-direction: column;
  }

  .mx-localfilters {
    margin-top: 0;
    justify-content: flex-start;
  }
}

/* Filtros gerais com seleção múltipla (componente mf-* da página de Leads) */
.mx-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.mx-filters .mx-clear { margin-left: 2px; }
#mxPop.mf-pop { width: 340px; }
#mxPop[hidden] { display: none; }
.mx-pop-foot { gap: 12px; }
.mx-pop-foot .c-btn--link { white-space: nowrap; }
.mx-pop-foot span { flex: 1; }
.mx-pop-foot .mf-done[disabled] { opacity: .5; cursor: not-allowed; }
