/* ============================================================
   acs-telas.css — o que é específico das telas de ACS e território
   (localização do app, marcadores, cidadãos por microárea, mapa GPS,
   acompanhamento individual). Tudo o mais vem de ui.css.
   ============================================================ */

/* ------------------------------------------------------------
   Mapa
   ------------------------------------------------------------ */
#map {
    height: 520px;
    width: 100%;
    border-radius: var(--t-radius-md);
    overflow: hidden;
    border: 1px solid var(--t-border);
}

@media (max-width: 700px) {
    #map { height: 360px; }
}

/* ------------------------------------------------------------
   Botão de ação dentro de tabela
   ------------------------------------------------------------ */
.ui-table .btn-link {
    font: inherit;
    font-size: var(--t-fs-sm);
    color: var(--t-primary);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ui-table .btn-link:hover { color: var(--t-primary-dark); }

/* ------------------------------------------------------------
   Condições do cidadão (microárea)
   ------------------------------------------------------------ */
.badge-cond {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 1px 3px 1px 0;
    padding: 2px 8px;
    font-size: var(--t-fs-xs);
    font-weight: 600;
    border-radius: var(--t-radius-pill);
    white-space: nowrap;
    color: var(--t-neutral);
    background: var(--t-neutral-soft);
}

.badge-cond.badge-hiper { color: var(--t-crit);     background: var(--t-crit-soft); }
.badge-cond.badge-diab  { color: var(--t-series-3); background: #ede9fe; }
.badge-cond.badge-gest  { color: #9d174d;           background: #fce7f3; }
.badge-cond.badge-cri   { color: var(--t-info);     background: var(--t-info-soft); }
.badge-cond.badge-idoso { color: var(--t-warn);     background: var(--t-warn-soft); }

/* ------------------------------------------------------------
   Marcadores de consumo alimentar
   ------------------------------------------------------------ */
.badge-tipo {
    display: inline-flex;
    padding: 2px 9px;
    font-size: var(--t-fs-xs);
    font-weight: 600;
    border-radius: var(--t-radius-pill);
    white-space: nowrap;
}

.badge-tipo.badge-tipo1 { color: var(--t-ok);       background: var(--t-ok-soft); }
.badge-tipo.badge-tipo2 { color: var(--t-series-3); background: #ede9fe; }
.badge-tipo.badge-tipo3 { color: var(--t-warn);     background: var(--t-warn-soft); }

.dados-expand { display: none; }
.dados-expand.is-open { display: table-row; }
.dados-expand > td { background: var(--t-surface-soft); }

.dados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--t-space-2) var(--t-space-4);
    padding: var(--t-space-2) 0;
}

.dados-item {
    display: flex;
    gap: var(--t-space-2);
    font-size: var(--t-fs-sm);
    line-height: var(--t-lh-normal);
    color: var(--t-text-2);
}

.dados-item .q {
    flex: none;
    max-width: 62%;
    font-weight: 600;
    color: var(--t-text);
}

/* ------------------------------------------------------------
   Acompanhamento individual
   ------------------------------------------------------------ */
.ai-pesos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--t-space-2);
}

.ai-peso {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--t-space-3);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-md);
    background: var(--t-surface-soft);
}

.ai-peso strong { font-size: var(--t-fs-sm); color: var(--t-text); }
.ai-peso span { font-size: var(--t-fs-xs); color: var(--t-muted); font-variant-numeric: tabular-nums; }

/* Célula com percentual e fração */
.ui-table .stack {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.ui-table .stack strong { font-variant-numeric: tabular-nums; }
.ui-table .stack span { font-size: var(--t-fs-xs); color: var(--t-muted); }

.ui-table .metric-link {
    font: inherit;
    text-align: left;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.ui-table .metric-link:hover .stack strong { text-decoration: underline; text-underline-offset: 2px; }

.pct-alto  { color: var(--t-ok); }
.pct-medio { color: var(--t-warn); }
.pct-baixo { color: var(--t-crit); }

.status {
    display: inline-flex;
    padding: 2px 9px;
    font-size: var(--t-fs-xs);
    font-weight: 600;
    border-radius: var(--t-radius-pill);
    white-space: nowrap;
    color: var(--t-neutral);
    background: var(--t-neutral-soft);
}

.status.status-otimo,
.status.status-bom     { color: var(--t-ok);   background: var(--t-ok-soft); }
.status.status-atencao { color: var(--t-warn); background: var(--t-warn-soft); }
.status.status-critico { color: var(--t-crit); background: var(--t-crit-soft); }

/* Lista nominal em painel lateral */
.ai-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--t-z-modal);
    display: none;
    background: rgba(15, 23, 42, 0.45);
}

.ai-overlay.is-open { display: flex; justify-content: flex-end; }

.ai-painel {
    width: min(560px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--t-surface);
    box-shadow: var(--t-shadow-pop);
}

.ai-painel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-5);
    border-bottom: 1px solid var(--t-border);
}

.ai-painel__head h2 {
    margin: 0;
    font-size: var(--t-fs-lg);
    font-weight: 600;
    color: var(--t-text);
}

.ai-painel__head p {
    margin: var(--t-space-1) 0 0;
    font-size: var(--t-fs-sm);
    color: var(--t-muted);
}

.ai-painel__fechar {
    flex: none;
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
    color: var(--t-muted);
    background: var(--t-surface-soft);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    cursor: pointer;
}

.ai-painel__corpo {
    flex: 1;
    overflow-y: auto;
    padding: var(--t-space-4) var(--t-space-5);
}

.ai-painel__resumo {
    display: flex;
    gap: var(--t-space-4);
    padding: 0 var(--t-space-5) var(--t-space-4);
    font-size: var(--t-fs-sm);
    color: var(--t-text-2);
}

.ai-painel__resumo strong { font-variant-numeric: tabular-nums; }
