/* ══════════════════════════════════════════════════════════════════════════
   Asia Park — Componentes da Home (KPI cards v2, card do gráfico principal)
   Namespace `home-` — não reutiliza nem sobrescreve `.metric`/`.metric-grid`,
   que continuam servindo Operador, Vagas, Gestor de frota, etc. sem alteração.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── KPI card ─────────────────────────────────────────────────────────────── */
/* Fundo sólido (sem gradiente/glow): sobre quase-preto, gradientes muito
   sutis "chiam" (banding/dithering visível) em muitas telas Android com
   menos profundidade de cor — a identidade de cor de cada KPI já vem do
   ícone, sem precisar do brilho no canto. */
.home-kpi {
  position: relative; overflow: hidden; border-radius: 18px;
  border: 1px solid var(--borda);
  background: var(--branco);
  padding: 18px 20px 16px; min-height: 152px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.22);
  transition: transform var(--transicao), box-shadow var(--transicao), border-color var(--transicao);
}
.home-kpi:hover { transform: translateY(-3px);
  box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 16px 38px rgba(0,0,0,.32);
  border-color: rgba(255,255,255,.14); }
.home-kpi.cor-azul    { --kpi-cor: var(--azul-med); }
.home-kpi.cor-verde   { --kpi-cor: var(--verde); }
.home-kpi.cor-laranja { --kpi-cor: var(--laranja); }
.home-kpi.cor-vermelho{ --kpi-cor: var(--primary); }

.home-kpi-topo { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; position: relative; }
.home-kpi-icone { width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--kpi-cor, var(--azul-med)) 16%, transparent);
  color: var(--kpi-cor, var(--azul-med)); }
.home-kpi-icone svg { width: 18px; height: 18px; }
.home-kpi-tendencia { display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; padding: 3px 8px 3px 6px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-kpi-tendencia svg { width: 11px; height: 11px; }
.home-kpi-tendencia.sobe { background: rgba(74,222,128,.12); color: var(--verde); }
.home-kpi-tendencia.desce { background: rgba(248,113,113,.12); color: var(--verm); }
.home-kpi-tendencia.neutro { background: rgba(255,255,255,.06); color: var(--cinza); }

.home-kpi-corpo { position: relative; }
.home-kpi-valor { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; color: #fff;
  line-height: 1.15; font-variant-numeric: tabular-nums; }
.home-kpi-label { font-size: 12px; color: var(--cinza); margin-top: 4px; font-weight: 500; }

.home-kpi-spark { position: relative; height: 30px; margin-top: 2px; }
.home-kpi-spark canvas { display: block; width: 100%; height: 100%; }
/* Quando não há série histórica real, mostramos uma linha-base neutra em vez
   de inventar tendência — honesto e ainda assim elegante. */
.home-kpi-spark.sem-historico { height: 2px; border-radius: 2px; margin-top: 15px;
  background: var(--kpi-cor, var(--azul-med)); opacity: .3; }

/* ── Card do gráfico principal (protagonista) ────────────────────────────── */
.home-chart-card {
  border-radius: 18px; border: 1px solid var(--borda);
  background: var(--branco);
  padding: 22px 24px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.26);
  min-height: 380px; display: flex; flex-direction: column;
}
.home-chart-legenda { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px;
  color: var(--cinza); }
.home-chart-legenda .item { display: flex; align-items: center; gap: 7px; }
.home-chart-legenda .traco { width: 16px; height: 3px; border-radius: 2px; }
.home-chart-wrap { position: relative; flex: 1; min-height: 240px; margin-top: 6px; }
.home-chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0;
  transition: opacity .12s ease; transform: translate(-50%, -100%);
  background: var(--superficie-2); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: 9px 12px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0,0,0,.45);
}
.home-chart-tooltip .mes { color: var(--cinza); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 3px; }
.home-chart-tooltip .linha { display: flex; align-items: center; gap: 6px; font-weight: 650; }
.home-chart-tooltip .dot { width: 8px; height: 8px; border-radius: 50%; }
.home-chart-vazio { flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--cinza); font-size: 13px; }

@media (max-width: 900px) {
  .home-kpi { min-height: 136px; padding: 15px 16px 14px; }
  .home-kpi-valor { font-size: 22px; }
  .home-chart-card { min-height: 320px; padding: 18px 16px 14px; }
}

/* ══ Skin premium v2 (2026-07-24) — paleta #0B0B0C/#121417 + vermelho
   #D71920, radius 18/14, glow discreto. Só visual; ids/fluxos intactos. ══ */
#view-dashboard main { background: #0B0B0C; }
#view-dashboard {
  --dc-card: #121417; --dc-borda: rgba(255,255,255,.06);
  --dc-txt2: #A3A3A3; --dc-verm: #D71920; --dc-verm-hover: #B51218;
  --dc-glow: rgba(215,25,32,.20);
}
#view-dashboard .dash-chart-card, #view-dashboard .home-kpi,
#view-dashboard .dash-hero, #view-dashboard .card {
  background: var(--dc-card); border: 1px solid var(--dc-borda);
  border-radius: 18px; box-shadow: none; }

/* — Topbar — */
.dash-topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
               margin-bottom: 18px; }
.dash-busca-wrap { flex: 1; min-width: 240px; max-width: 420px; display: flex;
  align-items: center; gap: 10px; background: var(--dc-card);
  border: 1px solid var(--dc-borda); border-radius: 14px; padding: 10px 14px; }
.dash-busca-wrap svg { width: 16px; height: 16px; color: var(--dc-verm); flex: none; }
.dash-busca-wrap input { flex: 1; background: none; border: none; outline: none;
  color: #fff; font-family: inherit; font-size: 13px; }
.dash-busca-wrap .tecla { font-size: 10.5px; color: var(--dc-txt2);
  border: 1px solid var(--dc-borda); border-radius: 7px; padding: 2px 8px; }
.dash-top-dir { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                margin-left: auto; }
.dash-chip { display: flex; align-items: center; gap: 9px; padding: 7px 12px;
  background: var(--dc-card); border: 1px solid var(--dc-borda); border-radius: 14px; }
.dash-chip svg { width: 16px; height: 16px; color: var(--dc-verm); flex: none; }
.dash-chip b { display: block; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dash-chip span { display: block; font-size: 10px; color: var(--dc-txt2); }
.dash-perfil { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px;
  background: var(--dc-card); border: 1px solid var(--dc-borda); border-radius: 14px; }
.dash-perfil .avatar { width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(160deg, #2A3140, #1B202B);
  border: 1px solid rgba(255,255,255,.10); }
.dash-perfil b { display: block; font-size: 12px; max-width: 130px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dash-perfil span { display: block; font-size: 10px; color: #4ADE80; }

/* — Grid principal + coluna lateral — */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.dash-col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-col-lado { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1280px) { .dash-grid { grid-template-columns: 1fr; } }

/* — Hero — */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px;
  align-items: center; padding: 22px 24px; position: relative; overflow: hidden; }
.dash-hero::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(560px 190px at 82% 30%, var(--dc-glow), transparent); }
.dash-hero h1 { font-size: 26px; font-weight: 800; margin: 6px 0 4px; }
.dash-hero p { color: var(--dc-txt2); font-size: 13.5px; margin: 0 0 12px; }
.dash-hero-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--dc-txt2); }
.dash-hero-meta b { color: #fff; font-weight: 600; }
.dash-hero-meta .sep { width: 1px; height: 14px; background: var(--dc-borda); }
.ponto-verm { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--dc-verm); margin-right: 7px;
  box-shadow: 0 0 8px var(--dc-glow); animation: dashPulso 2.2s infinite; }
@keyframes dashPulso { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.dash-hero-arte { position: relative; z-index: 1; }
.dash-hero-arte svg { width: 100%; height: auto; display: block;
  border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.4); }
@media (max-width: 900px) { .dash-hero { grid-template-columns: 1fr; }
  .dash-hero-arte { display: none; } }

/* — KPIs (skin) — */
#view-dashboard .home-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; }
@media (max-width: 1100px) { #view-dashboard .home-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { #view-dashboard .home-kpi-grid { grid-template-columns: 1fr; } }
#view-dashboard .home-kpi { padding: 15px 16px 10px; transition: transform .25s ease,
  border-color .25s ease, box-shadow .25s ease; }
#view-dashboard .home-kpi:hover { transform: translateY(-2px);
  border-color: rgba(215,25,32,.35); box-shadow: 0 10px 26px rgba(0,0,0,.35),
  0 0 0 1px var(--dc-glow); }
#view-dashboard .home-kpi-icone { width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(215,25,32,.13); color: #FF6B70; }
#view-dashboard .home-kpi-valor { font-size: 25px; font-weight: 800;
  font-variant-numeric: tabular-nums; }
#view-dashboard .home-kpi-label { color: var(--dc-txt2); font-size: 11.5px; }
#view-dashboard .home-kpi-corpo.com-donut { display: flex; align-items: center; gap: 12px; }
.home-kpi-donut { width: 48px; height: 48px; flex: none; }

/* — Fileira de ações — */
.dash-acoes { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 1000px) { .dash-acoes { grid-template-columns: 1fr 1fr; } }
.dash-acao-primaria, .dash-acao { display: flex; align-items: center; justify-content:
  center; gap: 10px; min-height: 52px; border-radius: 14px; font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease; }
.dash-acao-primaria svg, .dash-acao svg { width: 18px; height: 18px; flex: none; }
.dash-acao-primaria { background: linear-gradient(180deg, #23AC59, #1F9D50);
  color: #fff; border: 1px solid rgba(74,222,128,.35);
  box-shadow: 0 4px 14px rgba(31,157,80,.20); }
.dash-acao-primaria:hover { transform: translateY(-1px);
  background: linear-gradient(180deg, #27BD62, #22A855);
  box-shadow: 0 8px 20px rgba(31,157,80,.32); }
.dash-acao-primaria .f2 { font-size: 10px; font-weight: 800; padding: 2px 7px;
  border-radius: 6px; background: rgba(255,255,255,.18); }
.dash-acao { background: #121417; color: #E4E7EC; border: 1px solid rgba(255,255,255,.06); }
.dash-acao:hover { background: #191C21; transform: translateY(-1px);
  border-color: rgba(255,255,255,.12); }

/* — Gráficos — */
.dash-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dash-charts-2 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .dash-charts, .dash-charts-2 { grid-template-columns: 1fr; } }
.dash-chart-card { padding: 16px 18px; min-width: 0; }
.dash-chart-mini { margin-top: 10px; }
.dash-tag { font-size: 10.5px; color: #A3A3A3; border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px; padding: 3px 9px; }
.dash-eixo { display: flex; justify-content: space-between; font-size: 10px;
  color: #A3A3A3; margin-top: 6px; }
.dash-ocupacao { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dash-ocupacao svg { width: 128px; height: 128px; }
.dash-ocupacao-legenda { display: flex; gap: 16px; font-size: 11px; color: #A3A3A3; }
.dash-ocupacao-legenda i { display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px; }
.dash-barras { display: flex; align-items: flex-end; gap: 8px; height: 140px;
  padding-top: 22px; }
.dash-barra-col { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 5px; height: 100%; position: relative; }
.dash-barra { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #E22730, #8E1015);
  transition: filter .2s ease; }
.dash-barra-col:hover .dash-barra { filter: brightness(1.25); }
.dash-barra-col > span { font-size: 9.5px; color: #A3A3A3; }
.dash-barra-tooltip { position: absolute; top: 0; font-size: 10px; font-weight: 700;
  background: #1B1E24; border: 1px solid rgba(255,255,255,.06); border-radius: 7px;
  padding: 2px 7px; white-space: nowrap; }

/* — Coluna lateral: últimos veículos e alertas — */
.dash-ultimo { display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid rgba(255,255,255,.06); }
.dash-ultimo:last-child { border-bottom: none; }
.dash-ultimo-ic { width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.05); color: #A3A3A3; }
.dash-ultimo-corpo { flex: 1; min-width: 0; }
.dash-ultimo-corpo b { display: block; font-size: 13px; letter-spacing: .5px; }
.dash-ultimo-corpo span { display: block; font-size: 10.5px; color: #A3A3A3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-ultimo-vaga { font-size: 10px; font-weight: 700; color: #FF6B70;
  border: 1px solid rgba(215,25,32,.35); background: rgba(215,25,32,.10);
  border-radius: 8px; padding: 3px 8px; white-space: nowrap; }
.dash-alerta { display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.03);
  cursor: pointer; font-family: inherit; color: #fff;
  transition: background .2s ease, transform .2s ease; }
.dash-alerta:hover { background: rgba(255,255,255,.06); transform: translateY(-1px); }
.dash-alerta:last-child { margin-bottom: 0; }
.dash-alerta-ic { width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center; }
.dash-alerta.cor-verm .dash-alerta-ic { background: rgba(215,25,32,.14); color: #FF6B70; }
.dash-alerta.cor-laranja .dash-alerta-ic { background: rgba(245,166,35,.14); color: #F5A623; }
.dash-alerta.cor-azul .dash-alerta-ic { background: rgba(122,167,255,.14); color: #7AA7FF; }
.dash-alerta b { display: block; font-size: 12.5px; }
.dash-alerta span { display: block; font-size: 11px; color: #A3A3A3; }

/* — Hero com foto real (img/hero-asiapark.jpg): imagem ancorada à direita,
   fade escuro à esquerda pro texto respirar. A .dash-hero-arte antiga saiu. — */
.dash-hero.dash-hero-foto { display: block; min-height: 200px; }
.dash-hero-fundo { position: absolute; inset: 0; border-radius: inherit;
  background: url(../img/hero-asiapark.jpg) right center / cover no-repeat; }
.dash-hero-fundo::after { content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #121417 6%, rgba(18,20,23,.88) 34%,
                              rgba(18,20,23,.25) 62%, rgba(18,20,23,0) 82%); }
.dash-hero-foto .dash-hero-texto { position: relative; z-index: 1; max-width: 58%; }
@media (max-width: 900px) {
  .dash-hero-foto .dash-hero-texto { max-width: 100%; }
  .dash-hero-fundo::after { background: rgba(18,20,23,.78); }
}

/* — Fix overflow (2026-07-24): grids com minmax(0,…) não estouram o quadro;
   em telas < 1450px a coluna lateral desce pra baixo do conteúdo. — */
.dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 330px); }
@media (max-width: 1450px) { .dash-grid { grid-template-columns: 1fr; } }
#view-dashboard .home-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { #view-dashboard .home-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-charts-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .dash-charts, .dash-charts-2 { grid-template-columns: 1fr; } }
.dash-acoes { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .dash-acoes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.home-raiz, .dash-topbar, .dash-hero, .dash-chart-card { min-width: 0; max-width: 100%; }
#view-dashboard .table-wrap { overflow-x: auto; max-width: 100%; }
#view-dashboard table { width: 100%; }
.home-feed-item, .home-feed-corpo, .dash-ultimo-corpo { min-width: 0; }
.home-feed-titulo, .home-feed-meta { overflow-wrap: anywhere; }
#view-dashboard main { overflow-x: hidden; }

/* — Toggle de tema: só ícone, neutro com sombra suave — */
.btn-tema { min-width: 44px; padding: 10px 12px; box-shadow: 0 4px 12px rgba(0,0,0,.22); }
body.tema-claro .btn-tema { box-shadow: 0 4px 12px rgba(15,23,42,.12); }

/* — Acabamento do tema claro no dashboard (cores fixas escuras) — */
body.tema-claro .home-card-head h2,
body.tema-claro .home-hero h1,
body.tema-claro .home-hero-competencia b,
body.tema-claro .home-kpi-valor,
body.tema-claro .home-feed-titulo,
body.tema-claro .home-feed-titulo b,
body.tema-claro .home-feed-valor,
body.tema-claro .op-card .placa { color: #111827; }
body.tema-claro .home-acao { background: #fff; color: #111827;
  border-color: rgba(15,23,42,.12); }
body.tema-claro .home-acao .rotulo { color: #111827; }
body.tema-claro #home-empresas th { background: #F3F4F6; color: #6B7280; }
body.tema-claro #home-empresas td { color: #111827; background: #fff; }
body.tema-claro .table-wrap { background: #fff; }
body.tema-claro .op-card { background: #fff; color: #111827;
  border-color: rgba(15,23,42,.12); }
body.tema-claro .home-feed-vazio, body.tema-claro .home-chart-vazio { color: #6B7280; }
body.tema-claro .home-feed-meta { color: #6B7280; }
body.tema-claro .home-hero-eyebrow { color: #6B7280; }
