/**
 * nupema-home.css — Nova tela inicial NUPEMA (home v2, abas)
 * Monitor GeoAmbiental (MPPE) | v1.0 | 11/10/2026
 * Aba 1: Visão geral (KPIs + Top 10) · Aba 2: Mapa · Aba 3: Registros
 * Scroll interno nas abas: cabeçalho da página sempre visível.
 */

/* ---------- barra de abas ---------- */
.nh-tabs {
    display: flex; gap: 4px; padding: 8px 25px 0;
    background: #fff; border-bottom: 2px solid var(--nupema-borda, #c8e6c9);
    flex-shrink: 0;
}
.nh-tab {
    border: 1px solid transparent; border-bottom: none;
    background: transparent; color: #4a6b58;
    padding: 8px 18px; border-radius: 10px 10px 0 0;
    font-weight: 600; font-size: 0.92rem; cursor: pointer; transition: .15s;
}
.nh-tab:hover { background: #f0f7f1; }
.nh-tab.active {
    background: var(--nupema-verde, #1a5f3e); color: #fff;
    border-color: var(--nupema-borda, #c8e6c9);
}
.nh-panes { flex: 1; min-height: 0; position: relative; }
.nh-pane {
    position: absolute; inset: 0; overflow-y: auto;
    padding: 14px 25px 25px; display: none;
}
.nh-pane.active { display: block; }

/* ---------- KPIs ---------- */
.nh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.nh-kpi {
    border: 1px solid var(--nupema-borda, #c8e6c9); border-radius: 10px;
    padding: 10px 14px; background: #fff;
}
.nh-kpi .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #123a26; }
.nh-kpi .l { font-size: 0.75rem; color: var(--nupema-texto-suave, #6c757d); margin-top: 2px; }
.nh-orgaos { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.nh-orgaos span {
    font-size: 0.78rem; padding: 3px 10px; border-radius: 12px;
    border: 1px solid var(--nupema-borda, #c8e6c9); background: #f4f9f5;
}

/* ---------- seções ---------- */
.nh-sec {
    border: 1px solid var(--nupema-borda, #c8e6c9); border-radius: 10px;
    padding: 12px 14px; background: #fff; margin-bottom: 14px;
}
.nh-sec h4 {
    margin: 0 0 10px; font-size: 0.95rem; color: #123a26;
    display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.nh-chart { width: 100%; }
.nh-chart rect { fill: #2e7d52; }
.nh-chart rect:hover { fill: #1a5f3e; }
.nh-chart text { font-size: 9px; fill: #6c757d; }

/* ---------- Top 10 ---------- */
.nh-subtabs { display: flex; gap: 6px; margin-bottom: 8px; }
.nh-subtab {
    border: 1px solid var(--nupema-borda, #c8e6c9); background: #f4f9f5;
    padding: 4px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
    color: #2c5741; cursor: pointer;
}
.nh-subtab.active { background: #123a26; color: #fff; border-color: #123a26; }
.nh-tablewrap { overflow-x: auto; }
.nh-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.nh-table th {
    text-align: left; font-size: 0.72rem; color: #6c757d; font-weight: 600;
    padding: 5px 8px; border-bottom: 2px solid #e9ecef; white-space: nowrap;
}
.nh-table td { padding: 6px 8px; border-bottom: 1px dashed #e3eae5; vertical-align: top; }
.nh-table tbody tr { cursor: pointer; }
.nh-table tbody tr:hover td { background: #f2f8f4; }
.nh-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nh-multa { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; color: #b3261e; font-weight: 600; }
.nh-badge { font-size: 0.68rem; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.nh-badge.ib { background: #e7f0ff; color: #0d4ea6; }
.nh-badge.cp { background: #fff3cd; color: #856404; }
.nh-geo-ok { color: #1a7f37; }
.nh-muted { color: #9aa5ad; }

/* ---------- mapa ---------- */
.nh-map-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.nh-map-toolbar .nh-chip {
    border: 1px solid var(--nupema-borda, #c8e6c9); background: #fff;
    padding: 4px 12px; border-radius: 14px; font-size: 0.8rem; cursor: pointer;
}
.nh-map-toolbar .nh-chip.on { background: #123a26; color: #fff; border-color: #123a26; }
#nhMap {
    width: 100%; height: calc(100% - 46px); min-height: 420px;
    border: 1px solid var(--nupema-borda, #c8e6c9); border-radius: 10px;
}

/* ---------- modal do registro (ficha) ---------- */
.nh-modal { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.4); }
.nh-modal.open { display: flex; justify-content: flex-end; }
.nh-sheet {
    width: min(480px, 94vw); height: 100%; background: #fff;
    overflow-y: auto; padding: 20px; border-left: 3px solid var(--nupema-verde, #1a5f3e);
    box-shadow: -4px 0 24px rgba(0,0,0,.2);
    display: flex; flex-direction: column;
}
.nh-sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.nh-sheet-head h3 { margin: 0; font-size: 1.15rem; color: #123a26; }
.nh-sheet-sub { font-size: 0.8rem; color: #6c757d; margin: 4px 0 14px; }
.nh-sheet-body { flex: 1; }
.nh-dsec { border-top: 1px solid #e9ecef; padding: 10px 0; font-size: 0.85rem; }
.nh-dsec h5 {
    margin: 0 0 6px; font-size: 0.72rem; color: #6c757d; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
}
.nh-dl { display: grid; grid-template-columns: 135px 1fr; gap: 3px 10px; font-size: 0.82rem; margin: 0; }
.nh-dl dt { color: #6c757d; }
.nh-dl dd { margin: 0; }
.nh-sheet-foot { border-top: 1px solid #e9ecef; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.nh-btn {
    padding: 9px 14px; border-radius: 8px; border: 1px solid var(--nupema-borda, #c8e6c9);
    background: #fff; font-weight: 600; font-size: 0.85rem; cursor: pointer; text-align: center;
}
.nh-btn.primario { background: var(--nupema-verde, #1a5f3e); color: #fff; border-color: transparent; }
.nh-btn:disabled { opacity: .55; cursor: not-allowed; }
.nh-docs-list { font-size: 0.8rem; }
.nh-docs-list a { color: #0d4ea6; }
.nh-valoracao {
    background: #fff8e6; border: 1px dashed #d9a404; border-radius: 8px;
    padding: 8px 12px; font-size: 0.78rem; color: #7a5b00; margin-top: 8px;
}
.nh-loading, .nh-erro { padding: 14px; font-size: 0.85rem; color: #6c757d; }
.nh-erro { color: #b3261e; }
/* ============ v1.1 — layout: menu esquerda + pesquisa global ============ */
#nupemaHome { height: calc(100vh - 120px); min-height: 480px; }

.nh-searchbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; margin-bottom: 8px;
    background: #fff; border: 1px solid #c8e6c9; border-radius: 10px;
}
.nh-searchbar i { color: #1a5f3e; }
.nh-searchbar input {
    flex: 1; border: none; outline: none; font-size: 0.9rem; background: transparent;
}
.nh-searchbar .nh-btn { padding: 6px 16px; font-size: 0.82rem; white-space: nowrap; }

.nh-body { display: flex; gap: 10px; flex: 1; min-height: 0; }
.nh-sidemenu {
    width: 210px; flex-shrink: 0; overflow-y: auto;
    background: #fff; border: 1px solid #c8e6c9; border-radius: 10px; padding: 10px;
}
.nh-sidemenu .menu-regioes {
    position: static; width: auto; border: none; background: transparent; padding: 0;
}
.nh-sidemenu .menu-regioes-title { font-weight: 700; color: #123a26; margin-bottom: 8px; font-size: 0.85rem; }
.nh-side-sec { margin-top: 14px; border-top: 1px dashed #c8e6c9; padding-top: 10px; }

.nh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nh-tabs { padding: 0 2px; }
.nh-panes { flex: 1; }
.nh-pane { padding: 12px 4px 4px; }

/* grid legado dentro da aba Registros */
#nhPaneRegistros .nupema-layout { display: block; }
#nhPaneRegistros .grid-container { max-height: none; }

@media (max-width: 860px) {
    .nh-body { flex-direction: column; }
    .nh-sidemenu { width: auto; max-height: 160px; }
}
