/* ============================================================
   Indicadores de manutenção (2026-09-15)
   Terceira visão da aba Manutenção e conformidade do Dashboard da frota.
   docs/dashboard-frota/27-indicadores-de-manutencao.md

   Reaproveita cards, KPIs, filtros e pílulas de fleet-dashboard.css; aqui
   só a grade dos blocos, os estados (esqueleto, vazio, erro) e os
   componentes próprios (legenda, métricas, recomendações).
   ============================================================ */

/* ---- Grade: 4 colunas em telas largas, 2 no notebook, 1 no estreito ---- */
body.ui-new-nav .hg-ma__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
body.ui-new-nav .hg-ma__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

body.ui-new-nav .hg-ma__block { display: flex; flex-direction: column; min-height: 300px; }
body.ui-new-nav .hg-ma__block--wide { min-height: 0; margin-bottom: 12px; }
body.ui-new-nav .hg-ma__body { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }

@media (max-width: 1599px) {
    body.ui-new-nav .hg-ma__grid,
    body.ui-new-nav .hg-ma__grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    body.ui-new-nav .hg-ma__grid,
    body.ui-new-nav .hg-ma__grid--3 { grid-template-columns: minmax(0, 1fr); }
    body.ui-new-nav .hg-ma__block { min-height: 0; }
}

/* ---- Filtros e recorte ---- */
body.ui-new-nav .hg-ma__filters .hg-fd__filter { min-width: 130px; flex: 0 1 160px; }
body.ui-new-nav .hg-ma__filters .hg-fd__filter--search { flex: 1 1 200px; }
body.ui-new-nav .hg-ma__filters .hg-fd__field.is-active {
    border-color: var(--color-primary, #05617a);
    box-shadow: inset 0 0 0 1px var(--color-primary, #05617a);
}
body.ui-new-nav .hg-ma__scope {
    margin: -4px 2px 10px;
    font-size: var(--hg-ui-font-xs, 11px);
    color: var(--color-text-secondary, #5b636e);
}

body.ui-new-nav .hg-ma__ignored {
    margin: -6px 0 8px;
    font-size: var(--hg-ui-font-2xs, 10px);
    color: var(--color-text-secondary, #5b636e);
    font-style: italic;
}

/* ---- Estados ---- */
body.ui-new-nav .hg-ma__skeleton { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
body.ui-new-nav .hg-ma__skeleton i {
    display: block;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--color-surface-2, #f0f2f5) 25%, var(--color-border-neutral, #e5e7eb) 50%, var(--color-surface-2, #f0f2f5) 75%);
    background-size: 200% 100%;
    animation: hg-ma-shimmer 1.2s ease-in-out infinite;
}
body.ui-new-nav .hg-ma__skeleton i:nth-child(1) { width: 55%; }
body.ui-new-nav .hg-ma__skeleton i:nth-child(2) { height: 120px; }
body.ui-new-nav .hg-ma__skeleton i:nth-child(3) { width: 80%; }
body.ui-new-nav .hg-ma__kpi-skeleton .hg-ma__skeleton i:nth-child(2) { height: 22px; width: 40%; }

@keyframes hg-ma-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

body.ui-new-nav .hg-ma__kpis.is-loading { opacity: .55; transition: opacity .2s; }
body.ui-new-nav .hg-ma__kpi-error { grid-column: 1 / -1; }

body.ui-new-nav .hg-ma__state {
    margin: auto 0;
    padding: 18px 14px;
    border-radius: var(--hg-ui-radius, 8px);
    font-size: var(--hg-ui-font-sm, 12px);
    line-height: 1.5;
    text-align: center;
    color: var(--color-text-secondary, #5b636e);
    background: var(--color-surface-2, #f0f2f5);
}
body.ui-new-nav .hg-ma__state--info { background: rgba(5, 97, 122, .06); color: var(--color-text-primary, #12313f); }
body.ui-new-nav .hg-ma__state--error { background: rgba(223, 75, 75, .08); color: var(--color-danger, #df4b4b); }
body.ui-new-nav .hg-ma__state .hg-fd__mini { margin-top: 8px; }

/* ---- Gráficos ---- */
body.ui-new-nav .hg-ma__canvas { position: relative; width: 100%; }
body.ui-new-nav .hg-ma__canvas--chart { height: 210px; }
body.ui-new-nav .hg-ma__canvas--rank { height: 250px; }
body.ui-new-nav .hg-ma__canvas--donut { width: 140px; height: 140px; flex: 0 0 140px; }
body.ui-new-nav .hg-ma__canvas--spark { height: 44px; margin-top: 6px; }

body.ui-new-nav .hg-ma__foot {
    margin: 8px 0 0;
    font-size: var(--hg-ui-font-2xs, 10px);
    color: var(--color-text-secondary, #5b636e);
    line-height: 1.45;
}
body.ui-new-nav .hg-ma__foot--warn { color: var(--color-warning, #eca426); }

body.ui-new-nav .hg-ma__toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--color-border-neutral, #e5e7eb); border-radius: 6px; overflow: hidden; }
body.ui-new-nav .hg-ma__toggle button {
    border: 0;
    background: transparent;
    padding: 2px 9px;
    font-size: var(--hg-ui-font-2xs, 10px);
    color: var(--color-text-secondary, #5b636e);
    cursor: pointer;
}
body.ui-new-nav .hg-ma__toggle button.is-on { background: var(--color-primary, #05617a); color: var(--color-surface, #fff); }

body.ui-new-nav .hg-ma__cum-select { margin-left: auto; width: auto; max-width: 180px; padding-top: 2px; padding-bottom: 2px; }

/* ---- Rosca + legenda ---- */
body.ui-new-nav .hg-ma__donut { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: auto 0; }
body.ui-new-nav .hg-ma__legend { list-style: none; margin: 0; padding: 0; flex: 1 1 140px; min-width: 0; }
body.ui-new-nav .hg-ma__legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: var(--hg-ui-font-sm, 12px);
    border-bottom: 1px solid var(--color-surface-2, #f0f2f5);
}
body.ui-new-nav .hg-ma__legend li[data-ma-kind],
body.ui-new-nav .hg-ma__legend li[data-ma-orders] { cursor: pointer; }
body.ui-new-nav .hg-ma__legend li[data-ma-kind]:hover span,
body.ui-new-nav .hg-ma__legend li[data-ma-orders]:hover span { color: var(--color-primary, #05617a); text-decoration: underline; }
body.ui-new-nav .hg-ma__legend em { font-style: normal; color: var(--color-text-secondary, #5b636e); min-width: 34px; text-align: right; }
body.ui-new-nav .hg-ma__legend--inline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
body.ui-new-nav .hg-ma__legend--inline li { grid-template-columns: 10px auto auto; border: 0; padding: 0; }

body.ui-new-nav .hg-ma__dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
body.ui-new-nav .hg-ma__dot--acc  { background: var(--color-primary, #05617a); }
body.ui-new-nav .hg-ma__dot--warn { background: var(--color-warning, #eca426); }
body.ui-new-nav .hg-ma__dot--neg  { background: var(--color-danger, #df4b4b); }
body.ui-new-nav .hg-ma__dot--pos  { background: var(--color-success, #31b057); }
body.ui-new-nav .hg-ma__dot--mut  { background: var(--color-border-neutral, #d5dae1); }

/* ---- Estatísticas e métricas ---- */
body.ui-new-nav .hg-ma__stats { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
body.ui-new-nav .hg-ma__stats li { display: flex; flex-direction: column; gap: 2px; }
body.ui-new-nav .hg-ma__stats span { font-size: var(--hg-ui-font-2xs, 10px); color: var(--color-text-secondary, #5b636e); text-transform: uppercase; letter-spacing: .04em; }
body.ui-new-nav .hg-ma__stats b { font-size: var(--hg-ui-font-md, 14px); color: var(--color-text-primary, #12313f); }

body.ui-new-nav .hg-ma__metrics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
body.ui-new-nav .hg-ma__metric { padding: 8px 0; border-bottom: 1px solid var(--color-surface-2, #f0f2f5); }
body.ui-new-nav .hg-ma__metric:last-child { border-bottom: 0; }
body.ui-new-nav .hg-ma__metric-title { display: flex; align-items: baseline; gap: 6px; }
body.ui-new-nav .hg-ma__metric-title b { font-size: var(--hg-ui-font-sm, 12px); color: var(--color-text-primary, #12313f); }
body.ui-new-nav .hg-ma__metric-title span { font-size: var(--hg-ui-font-2xs, 10px); color: var(--color-text-secondary, #5b636e); }
body.ui-new-nav .hg-ma__metric-value { font-size: 20px; font-weight: 600; color: var(--color-text-primary, #12313f); line-height: 1.25; margin-top: 2px; }
body.ui-new-nav .hg-ma__metric-value small { font-size: var(--hg-ui-font-xs, 11px); font-weight: 400; color: var(--color-text-secondary, #5b636e); margin-left: 6px; }
body.ui-new-nav .hg-ma__metric-value--none { color: var(--color-text-secondary, #5b636e); }
body.ui-new-nav .hg-ma__metric-note { margin: 2px 0 0; font-size: var(--hg-ui-font-2xs, 10px); color: var(--color-text-secondary, #5b636e); line-height: 1.4; }

/* ---- Detalhes (fora do cálculo, lista da faixa) ---- */
body.ui-new-nav .hg-ma__details { margin-top: 8px; font-size: var(--hg-ui-font-xs, 11px); color: var(--color-text-secondary, #5b636e); }
body.ui-new-nav .hg-ma__details summary { cursor: pointer; }
body.ui-new-nav .hg-ma__details ul { margin: 6px 0 0; padding-left: 16px; }

body.ui-new-nav .hg-ma__drill { margin-top: 10px; border-top: 1px solid var(--color-surface-2, #f0f2f5); padding-top: 8px; }
body.ui-new-nav .hg-ma__drill-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--hg-ui-font-sm, 12px); margin-bottom: 6px; }
body.ui-new-nav .hg-ma__drill ul { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; }
body.ui-new-nav .hg-ma__drill li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; font-size: var(--hg-ui-font-xs, 11px); }
body.ui-new-nav .hg-ma__drill li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ui-new-nav .hg-ma__drill li em { font-style: normal; color: var(--color-text-secondary, #5b636e); }

body.ui-new-nav .hg-ma__link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--color-primary, #05617a);
    font-weight: 600;
    cursor: pointer;
}
body.ui-new-nav .hg-ma__link:hover { text-decoration: underline; }

/* ---- Ações recomendadas ---- */
body.ui-new-nav .hg-ma__recs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
@media (max-width: 900px) { body.ui-new-nav .hg-ma__recs { grid-template-columns: minmax(0, 1fr); } }
body.ui-new-nav .hg-ma__rec { border-bottom: 1px solid var(--color-surface-2, #f0f2f5); }
body.ui-new-nav .hg-ma__rec-main {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 7px 2px;
    text-align: left;
    cursor: pointer;
    font-size: var(--hg-ui-font-sm, 12px);
    color: var(--color-text-primary, #12313f);
}
body.ui-new-nav .hg-ma__rec-main:hover .hg-ma__rec-text { color: var(--color-primary, #05617a); }
body.ui-new-nav .hg-ma__rec-main .hg-fd__pill { flex: 0 0 auto; min-width: 64px; text-align: center; }
body.ui-new-nav .hg-ma__rec-text { flex: 1 1 auto; min-width: 0; }
body.ui-new-nav .hg-ma__rec-go { font-style: normal; color: var(--color-text-secondary, #5b636e); font-size: 16px; }
body.ui-new-nav .hg-ma__rec-list { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0 2px 8px 76px; font-size: var(--hg-ui-font-xs, 11px); }

/* ---- Notas ---- */
body.ui-new-nav .hg-ma__notes { font-size: var(--hg-ui-font-xs, 11px); color: var(--color-text-secondary, #5b636e); }
body.ui-new-nav .hg-ma__notes summary { cursor: pointer; font-weight: 600; color: var(--color-text-primary, #12313f); }
body.ui-new-nav .hg-ma__notes ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.55; }
body.ui-new-nav .hg-ma__notes li { margin-bottom: 4px; }
