/* pei-painel.css
 * "Painel do PEI" (fatia 7c, 09-11-2026) dentro do popup das listas de pacientes:
 * antiga (/pacientes/index.html, Bootstrap) e V3 (/pacientes/v3.html, tokens --pr-*).
 * Montado por /js/paciente/pei/painel.js. A fonte e herdada da tela (Nunito na V3).
 * Tabela com rolagem horizontal so dentro do proprio quadro (a pagina nao rola) e
 * altura minima de 10 linhas para nao encolher durante a paginacao.
 */
.pei-painel [hidden] { display: none !important; }
.pei-painel { color: #1f2937; font-family: inherit; }

.pei-painel__status { margin: 0 0 .75rem; padding: .6rem .8rem; border-radius: 10px; border: 1px solid #dbeafe; background: #f8fbff; font-size: .9rem; line-height: 1.4; }
.pei-painel__status.is-erro { border-color: #fecdd3; background: #fff1f2; color: #9f1239; font-weight: 700; }

.pei-painel__resumo { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.pei-painel__kpi { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .75rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; min-width: 0; }
.pei-painel__kpi.is-alerta { border-color: #fed7aa; background: #fff7ed; }
.pei-painel__kpi-valor { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.pei-painel__kpi.is-alerta .pei-painel__kpi-valor { color: #a8370b; }
.pei-painel__kpi-rotulo { font-size: .78rem; line-height: 1.3; color: #475569; overflow-wrap: anywhere; }
.pei-painel__atualizado { margin: 0 0 .75rem; font-size: .8rem; color: #64748b; }

.pei-painel__filtros { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .75rem; }
.pei-painel__sem-pei { font-size: .9rem; font-weight: 700; }
.pei-painel__check { display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; margin: 0; padding: 0 .75rem; border: 1px solid #cbd5e1; border-radius: 999px; font-size: .85rem; font-weight: 700; line-height: 1.2; cursor: pointer; }
.pei-painel__check input { width: 18px; height: 18px; margin: 0; }

.pei-painel__segmentos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }

/* Botoes (tabela, paginacao e segmentos): 38px, icone 18px, gap .4rem */
.pei-painel button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; padding: 0 .85rem; font-size: .82rem; font-weight: 700; line-height: 1.2; border-radius: 999px; white-space: nowrap; }
.pei-painel button img { width: 18px; height: 18px; object-fit: contain; flex: none; }
.pei-painel button[disabled] { opacity: .45; cursor: default; }
.pei-painel .pei-painel__seg.is-ativo { background: #1e3a8a; border-color: #1e3a8a; color: #ffffff; }
.pei-painel .pei-painel__seg.is-ativo img { filter: brightness(0) invert(1); }

.pei-painel__nota { margin: 0 0 .5rem; font-size: .85rem; color: #475569; line-height: 1.4; }
.pei-painel__aviso { margin: 0 0 .5rem; padding: .5rem .75rem; border-radius: 10px; border: 1px solid #fde68a; background: #fffbeb; font-size: .85rem; font-weight: 700; }

.pei-painel__tabela { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; min-height: calc(10 * 56px + 40px); max-width: 100%; }
.pei-painel__tabela.is-carregando { opacity: .6; transition: opacity .15s; }
.pei-painel__grade { width: 100%; min-width: 780px; border-collapse: collapse; font-size: .875rem; margin: 0; }
.pei-painel__grade th { padding: .6rem .75rem; background: #f8fafc; text-align: left; font-size: .75rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #64748b; white-space: nowrap; }
.pei-painel__grade td { padding: .6rem .75rem; border-top: 1px solid #edf2f7; vertical-align: middle; }
.pei-painel__grade small { display: block; font-size: .75rem; color: #64748b; overflow-wrap: anywhere; }
.pei-painel__grade .pei-painel__num { text-align: center; }
.pei-painel__grade small.pei-painel__pend { color: #a8370b; font-weight: 700; margin-top: .2rem; }
.pei-painel__badge { display: inline-block; padding: 0 .45rem; border-radius: 999px; border: 1px solid #f1b9a0; background: #fff1ea; font-size: .7rem; font-weight: 800; }
.pei-painel__rev--vencida { color: #9f1239; font-weight: 700; }
.pei-painel__rev--proxima { color: #a16207; font-weight: 700; }
.pei-painel__msg { padding: 1.5rem; text-align: center; color: #64748b; }
.pei-painel__msg.is-erro { color: #9f1239; font-weight: 700; }

.pei-painel__pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .75rem; min-height: 40px; }
.pei-painel__pager-info { font-size: .8rem; color: #64748b; }
.pei-painel__pager-botoes { display: flex; align-items: center; gap: .5rem; }
.pei-painel__pager-pagina { font-size: .8rem; font-weight: 700; white-space: nowrap; }

/* V3 (/pacientes/v3.html): tokens da tela */
.pl-page .pei-painel { color: var(--pr-ink); }
.pl-page .pei-painel__tabela { border-color: var(--pr-border); }
.pl-page .pei-painel__grade th { background: var(--pr-surface-2); color: var(--pr-muted); }
.pl-page .pei-painel .pei-painel__seg.is-ativo { background: var(--pr-navy); border-color: var(--pr-navy); }

@media (max-width: 640px) {
  .pei-painel__resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pei-painel__check { width: 100%; }
  .pei-painel__segmentos button { flex: 1 1 0; white-space: normal; }
  .pei-painel__pager-botoes { width: 100%; }
  .pei-painel__pager-botoes button { flex: 1 1 0; }
}
