/* Métricas. Só tokens do app.css (Ultramar e Marfim, claro e escuro). Sem cor fixa, sem biblioteca de gráfico. */

.met-barra-periodo { margin-bottom: 20px; }
.met-abas { display: inline-flex; max-width: 100%; }
.met-abas button { min-height: 40px; padding: 0 18px; font-size: 14px; }

/* ---------- tiles ---------- */
.met-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.met-tile { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio-md); padding: 16px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.met-tile dt { font-size: 13px; font-weight: 600; color: var(--texto-fraco); }
.met-tile dd { margin: 0; }
.met-tile .valor { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.met-tile .sub { font-size: 13px; color: var(--texto-tenue); }
.met-tile-metas { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; }
.met-tile-metas .sub { font-size: 13px; color: var(--texto-fraco); font-weight: 600; }
.met-tiles.pq .met-tile { background: var(--fundo); }
.met-tiles.pq .valor { font-size: 22px; }

/* números soltos em linha */
.met-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 14px 20px; margin: 0; }
.met-mini > div { min-width: 0; }
.met-mini dt { font-size: 12px; font-weight: 600; color: var(--texto-tenue); }
.met-mini dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }

.met-grade-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.met-grade-2.igual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.met-grade-2 .cartao-cab { margin-bottom: 0; }

/* ---------- barras simples ---------- */
.met-barras { display: flex; flex-direction: column; margin-top: 4px; }
.met-linha { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 4px 12px; align-items: baseline; padding: 8px 0; }
.met-linha .rotulo { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 14px; min-width: 0; }
.met-linha .texto { grid-column: 2; grid-row: 1; font-size: 13px; color: var(--texto-fraco); text-align: right; min-width: 0; }
.met-linha .trilho, .met-etapa .trilho { grid-column: 1 / -1; grid-row: 2; display: block; height: 8px; border-radius: 4px; background: var(--superficie-2); overflow: hidden; }
.met-linha .trilho i, .met-etapa .trilho i { display: block; height: 100%; border-radius: 4px; background: var(--destaque); }
.met-linha .trilho i.alt, .met-etapa .trilho i.alt { opacity: .55; }
.met-linha .trilho i.ok, .met-etapa .trilho i.ok { background: var(--ok); }
.met-linha .trilho i.aviso, .met-etapa .trilho i.aviso { background: var(--alerta); }
.met-linha .trilho i.ruim, .met-etapa .trilho i.ruim { background: var(--perigo); }

/* ---------- esperando agora ---------- */
.met-espera { margin-top: 16px; }
.met-espera > li { padding: 12px 0; border-top: 1px solid var(--linha); display: flex; flex-direction: column; gap: 8px; }
.met-espera > li:first-child { border-top: 0; padding-top: 0; }
.met-espera .quem { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.met-espera .espera { display: inline-flex; align-items: center; gap: 4px; color: var(--perigo); font-weight: 700; font-size: 14px; }
.met-espera .btn { min-height: 40px; }

/* ---------- funil horizontal ---------- */
.met-funil { display: flex; flex-direction: column; }
.met-funil .cab, .met-etapa { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(100px, 2fr) 84px 84px 104px 124px 76px; gap: 0 12px; align-items: center; }
.met-funil .cab { padding: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--texto-tenue); }
.met-etapa { padding: 10px 0; border-top: 1px solid var(--linha); min-height: 48px; }
.met-etapa .nome { display: flex; align-items: center; gap: 8px; min-width: 0; }
.met-etapa .trilho { grid-column: auto; grid-row: auto; height: 14px; border-radius: 4px; }
.met-etapa .cel { min-width: 0; font-size: 14px; }
.met-etapa .rot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.met-etapa .cel strong { font-weight: 800; }

/* ---------- gráfico por dia ---------- */
.met-grafico { width: 100%; min-height: 210px; margin-top: 8px; }
.met-svg { display: block; max-width: 100%; overflow: visible; }
.met-svg .grade { stroke: var(--linha); stroke-width: 1; }
.met-svg .eixo { stroke: var(--linha-forte); stroke-width: 1; }
.met-svg .rot-x, .met-svg .rot-y { fill: var(--texto-tenue); font-size: 12px; font-family: var(--fonte); }
.met-svg .barra { fill: var(--destaque); opacity: .85; }
.met-svg .barra:hover { opacity: 1; }
.met-svg .linha-leads { stroke: var(--ok); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.met-svg .ponto-leads { fill: var(--ok); stroke: var(--superficie); stroke-width: 1.5; }
.met-legenda { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--texto-fraco); margin-top: 8px; }
.met-legenda .amostra-barra { width: 12px; height: 12px; border-radius: 2px; background: var(--destaque); opacity: .85; }
.met-legenda .amostra-linha { width: 18px; height: 0; border-top: 2px solid var(--ok); margin-left: 10px; }
.met-legenda i[class^="n"] { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }

.met-detalhes { margin-top: 8px; }
.met-detalhes summary { min-height: 40px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--destaque); }
.met-rolagem { overflow-x: auto; }
.met-detalhes .met-rolagem { max-height: 320px; overflow-y: auto; }
.met-tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.met-tabela th, .met-tabela td { padding: 8px 10px; border-bottom: 1px solid var(--linha); text-align: left; }
.met-tabela thead th { position: sticky; top: 0; background: var(--superficie); font-size: 12px; color: var(--texto-tenue); }
.met-tabela td.num { text-align: right; }

/* ---------- mapa de calor: dia da semana x hora ---------- */
.met-calor { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 2px; }
.met-calor th { font-size: 11px; font-weight: 600; color: var(--texto-tenue); padding: 0; white-space: nowrap; }
.met-calor thead th { text-align: left; height: 18px; overflow: visible; }
.met-calor thead td, .met-calor tbody th { width: 38px; }
.met-calor tbody th { text-align: left; font-size: 12px; padding-right: 4px; }
.met-calor thead th.oculta span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.met-calor td { height: 26px; border-radius: 3px; padding: 0; }
.met-calor td:hover { outline: 2px solid var(--foco); outline-offset: 0; }
.met-calor td.n0, .met-legenda i.n0 { background: var(--superficie-2); }
.met-calor td.n1, .met-legenda i.n1 { background: color-mix(in srgb, var(--destaque) 24%, var(--superficie-2)); }
.met-calor td.n2, .met-legenda i.n2 { background: color-mix(in srgb, var(--destaque) 46%, var(--superficie-2)); }
.met-calor td.n3, .met-legenda i.n3 { background: color-mix(in srgb, var(--destaque) 70%, var(--superficie-2)); }
.met-calor td.n4, .met-legenda i.n4 { background: var(--destaque); }

/* ---------- responsivo ---------- */
@media (max-width: 1180px) {
  .met-grade-2, .met-grade-2.igual { grid-template-columns: minmax(0, 1fr); }
  .met-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .met-funil .cab { display: none; }
  .met-etapa { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px 12px; }
  .met-etapa .nome, .met-etapa .trilho { grid-column: 1 / -1; grid-row: auto; }
  .met-etapa .rot { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; font-size: 12px; color: var(--texto-tenue); }
}
@media (max-width: 820px) {
  .met-abas { display: flex; width: 100%; }
  .met-tile { padding: 14px; }
  .met-tile .valor { font-size: 24px; }
  .met-grade-2 { gap: 16px; }
}
@media (max-width: 560px) {
  .met-linha { grid-template-columns: minmax(0, 1fr); }
  .met-linha .rotulo, .met-linha .texto, .met-linha .trilho { grid-column: 1; }
  .met-linha .rotulo { grid-row: 1; }
  .met-linha .trilho { grid-row: 2; }
  .met-linha .texto { grid-row: 3; text-align: left; }
  .met-calor { border-spacing: 1px; }
  .met-calor thead td, .met-calor tbody th { width: 32px; }
  .met-calor td { height: 24px; border-radius: 2px; }
}
