/* Portal RPPS: visual sobrio de portal publico. A cor do instituto entra pela variavel --cor (definida no <html>). */
:root {
  --cor: #0b4f8a;
  --cor-texto: #ffffff;
  --fundo: #ffffff;
  --fundo-suave: #f2f5f8;
  --texto: #111111;
  --texto-suave: #3d4752;
  --borda: #b8c2cc;
  --link: #0a3d91;
  --erro: #8a1010;
  --erro-fundo: #fdecec;
  --ok: #0b5a2a;
  --ok-fundo: #e7f6ec;
  --info-fundo: #e8f0fa;
  --raio: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 112.5%; } /* 18px: fonte grande por padrao */

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

h1 { font-size: 1.7rem; line-height: 1.25; margin: 1.2rem 0 0.8rem; }
h2 { font-size: 1.35rem; margin: 1.6rem 0 0.6rem; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
small { display: block; font-size: 0.8rem; font-weight: 400; }

/* Foco sempre visivel */
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; box-shadow: 0 0 0 5px #111111; }

.pular {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 10;
  background: #111; color: #fff; padding: 0.6rem 1rem; border-radius: var(--raio);
}
.pular:focus { top: 0.5rem; }

.contorno { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

/* Cabecalho */
.topo { background: var(--cor); color: var(--cor-texto); }
.topo a { color: var(--cor-texto); }
.topo-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.8rem; padding-bottom: 0.8rem; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: inherit; }
.marca .sigla { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.04em; border: 2px solid currentColor; border-radius: var(--raio); padding: 0.1rem 0.6rem; }
.marca .logo { height: 2.8rem; width: auto; max-width: 8rem; object-fit: contain; background: #ffffff; border-radius: var(--raio); padding: 0.15rem; }
.marca .nome { font-weight: 600; line-height: 1.25; font-size: 0.95rem; max-width: 26rem; }

.menu { background: rgba(0, 0, 0, 0.18); }
.menu ul { list-style: none; margin: 0 auto; padding: 0 1rem; display: flex; flex-wrap: wrap; gap: 0.2rem; }
.menu a { display: block; padding: 0.7rem 0.9rem; color: var(--cor-texto); text-decoration: none; font-weight: 600; }
.menu a:hover, .menu a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; }

main.contorno { padding-top: 0.5rem; padding-bottom: 3rem; }

/* Botoes */
.btn {
  display: inline-block; min-height: 3rem; padding: 0.7rem 1.4rem;
  background: var(--cor); color: var(--cor-texto); border: 2px solid var(--cor);
  border-radius: var(--raio); font: inherit; font-weight: 700; text-decoration: none; text-align: center; cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn-claro { background: #ffffff; color: #111111; border-color: #ffffff; }
.topo .btn-claro { color: #111111; }
.btn-pequeno { min-height: 2.5rem; padding: 0.4rem 1rem; }

/* Formularios */
.form { display: grid; gap: 0.4rem; max-width: 28rem; }
.form label { font-weight: 600; margin-top: 0.6rem; }
.form input:not([type="checkbox"]) {
  width: 100%; min-height: 3rem; padding: 0.5rem 0.8rem;
  border: 2px solid #55606b; border-radius: var(--raio); font: inherit; background: #fff; color: var(--texto);
}
.form .btn { margin-top: 1rem; }
.form label.marcar { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 400; }
.form label.marcar input { width: 1.5rem; height: 1.5rem; flex: none; margin-top: 0.2rem; }

/* Alertas */
.alerta { padding: 0.9rem 1rem; border-radius: var(--raio); border: 2px solid; margin: 1rem 0; }
.alerta-erro { background: var(--erro-fundo); border-color: var(--erro); color: var(--erro); font-weight: 600; }
.alerta-ok { background: var(--ok-fundo); border-color: var(--ok); color: var(--ok); }
.alerta-info { background: var(--info-fundo); border-color: var(--cor); color: var(--texto); }

/* Cartoes e dados */
.cartoes { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.cartao { border: 2px solid var(--borda); border-radius: var(--raio); background: var(--fundo-suave); }
.cartao a { display: block; padding: 1rem; text-decoration: none; color: var(--texto); }
.cartao a:hover .rotulo { text-decoration: underline; }
.cartao .numero { display: block; font-size: 2.4rem; font-weight: 800; color: var(--cor); line-height: 1.1; }
.cartao .rotulo { display: block; font-weight: 600; }

.dados { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; }
.dados dt { font-weight: 700; color: var(--texto-suave); }
.dados dd { margin: 0; }

/* Tela de entrada */
.cartao-acesso { max-width: 32rem; margin: 1.5rem auto 3rem; padding: 0 1rem; }
body.simples main { padding-top: 3rem; }

/* Rodape */
.rodape { background: var(--fundo-suave); border-top: 4px solid var(--cor); margin-top: 2rem; padding: 1.5rem 0; font-size: 0.9rem; }
.rodape-in { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.contatos { list-style: none; margin: 0; padding: 0; }

/* Area do servidor: celular primeiro, menu fixo embaixo */
body.servidor { padding-bottom: 5rem; }
.saudacao { margin: 0; padding-bottom: 0.7rem; font-weight: 600; }
.sair { margin: 0; }
.carteirinha footer p { overflow-wrap: anywhere; min-width: 0; }
/* Celular: cabeçalho compacto (só sigla + Sair numa linha; nome do instituto some) */
@media (max-width: 40rem) {
  body.servidor .topo-in { flex-wrap: nowrap; padding-top: 0.5rem; padding-bottom: 0.4rem; }
  body.servidor .marca .nome { display: none; }
  body.servidor .marca .sigla { font-size: 1.15rem; }
  body.servidor .saudacao { padding-bottom: 0.5rem; font-size: 0.95rem; }
}
.barra { position: fixed; left: 0; right: 0; bottom: 0; background: #ffffff; border-top: 3px solid var(--cor); z-index: 5; }
.barra ul { list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto; }
.barra li { flex: 1 0 5.4rem; }
.barra a { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 3.6rem; padding: 0.3rem 0.2rem; font-size: 0.72rem; font-weight: 700; color: var(--texto); text-decoration: none; line-height: 1.2; }
.barra a[aria-current="page"] { background: var(--cor); color: var(--cor-texto); }

/* Painel do gestor: menu lateral (faixa no celular) */
.gestor-grade { display: block; min-height: 100vh; }
.lateral { background: var(--cor); color: var(--cor-texto); padding: 0.8rem 1rem; }
.lateral a { color: var(--cor-texto); }
.lateral nav ul { list-style: none; margin: 0.6rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem; }
.lateral nav a { display: block; padding: 0.5rem 0.7rem; border-radius: var(--raio); text-decoration: none; font-weight: 600; }
.lateral nav a:hover { background: rgba(255, 255, 255, 0.18); }
.lateral nav a[aria-current="page"] { background: #ffffff; color: #111111; }
.usuario { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; font-weight: 600; }
.painel { padding: 0.5rem 1.2rem 3rem; max-width: 64rem; }

@media (min-width: 56rem) {
  .gestor-grade { display: grid; grid-template-columns: 17rem 1fr; }
  .lateral { padding: 1.2rem 1rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
  .lateral nav { flex: 1; }
  .lateral nav ul { flex-direction: column; }
  .usuario { flex-direction: column; align-items: flex-start; }
  .lateral .marca { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .lateral .marca .nome { font-size: 0.85rem; }
  .painel { padding: 1rem 2rem 3rem; }
  body.servidor { padding-bottom: 0; }
  .barra { position: static; border-top: 0; border-bottom: 3px solid var(--cor); }
  .barra ul { max-width: 40rem; margin: 0 auto; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .topo, .menu, .barra, .lateral, .rodape, .pular { display: none; } }

/* ---- Site publico: atalhos, noticias, transparencia, texto ---- */
.topo-acoes { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.meta { color: var(--texto-suave); font-size: 0.85rem; margin: 0.2rem 0; }
.atalhos { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.atalho { border: 2px solid var(--borda); border-left: 8px solid var(--cor); border-radius: var(--raio); background: var(--fundo-suave); }
.atalho a { display: block; height: 100%; padding: 1rem; text-decoration: none; color: var(--texto); }
.atalho a:hover .titulo { text-decoration: underline; }
.atalho .titulo { display: block; font-weight: 800; font-size: 1.15rem; color: var(--cor); }
.atalho .desc { display: block; font-size: 0.9rem; color: var(--texto-suave); }
.atalho .contagem { display: block; margin-top: 0.4rem; font-weight: 700; font-size: 0.9rem; }
.destaque { border: 2px solid var(--cor); border-radius: var(--raio); padding: 0.6rem 1.2rem 1rem; margin: 1.5rem 0; background: var(--info-fundo); }
.destaque h2 { margin-top: 0.2rem; }
.lista-noticias { list-style: none; padding: 0; margin: 0; }
.lista-noticias li { border-bottom: 1px solid var(--borda); padding: 0.8rem 0; }
.lista-noticias h3 { margin: 0; font-size: 1.15rem; }
.lista-noticias p { margin: 0.2rem 0; }
.paginacao { display: flex; gap: 1.2rem; align-items: center; justify-content: center; margin: 1.5rem 0; font-weight: 600; }
.texto { max-width: 46rem; }
.texto .resumo { font-size: 1.1rem; color: var(--texto-suave); }
.texto h2, .texto h3, .texto h4 { margin-top: 1.4rem; }
.docs { list-style: none; padding: 0; }
.docs li { padding: 0.6rem 0; border-bottom: 1px solid var(--borda); }
.docs p { margin: 0.2rem 0 0; }

/* ---- Painel: tabelas, filtros, formularios largos ---- */
.form-larga { max-width: 46rem; }
.form textarea, .form select {
  width: 100%; padding: 0.5rem 0.8rem; border: 2px solid #55606b; border-radius: var(--raio);
  font: inherit; background: #fff; color: var(--texto);
}
.form select { min-height: 3rem; }
.filtros { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; margin: 1rem 0; }
.filtros a[aria-current] { font-weight: 800; text-decoration-thickness: 3px; }
.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tabela th, .tabela td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela th { background: var(--fundo-suave); }

/* ---- Alto contraste (botao no site publico) ---- */
html.contraste { --fundo: #000000; --fundo-suave: #000000; --texto: #ffffff; --texto-suave: #ffffff; --borda: #ffffff; --link: #ffff00; --info-fundo: #000000; --cor: #000000; --cor-texto: #ffff00; }
html.contraste body { background: #000; color: #fff; }
html.contraste .topo, html.contraste .menu { background: #000; border-bottom: 2px solid #ffff00; }
html.contraste .btn { background: #000; color: #ffff00; border-color: #ffff00; }
html.contraste .btn-claro, html.contraste .topo .btn-claro { background: #000; color: #ffff00; border-color: #ffff00; }
html.contraste .atalho .titulo, html.contraste .cartao .numero { color: #ffff00; }
html.contraste .atalho, html.contraste .destaque, html.contraste .rodape { border-color: #ffff00; }

/* ---- Protocolos e recadastramento ---- */
[hidden] { display: none !important; }
.selo { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; border: 2px solid var(--borda); font-size: 0.85rem; font-weight: 700; background: #fff; color: #111; }
.selo-aberto { border-color: #0a3d91; background: #e8f0fa; color: #0a3d91; }
.selo-em_analise { border-color: #8a5a00; background: #fff4d6; color: #5c3d00; }
.selo-pendente_segurado { border-color: #8a1010; background: #fdecec; color: #8a1010; }
.selo-concluido { border-color: var(--ok); background: var(--ok-fundo); color: var(--ok); }
.selo-indeferido { border-color: #444; background: #eee; color: #222; }
.selo-interno { border-color: #6b3fa0; background: #f1eaf9; color: #4b2a7a; margin-left: 0.4rem; }
.aguarda { color: var(--erro); font-weight: 700; }
.texto-livre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.3rem 0; }
.linha-tempo { list-style: none; padding: 0; margin: 0.6rem 0; }
.evento { border-left: 5px solid var(--borda); padding: 0.4rem 0.8rem; margin: 0 0 0.8rem; background: var(--fundo-suave); }
.evento-segurado { border-left-color: var(--cor); }
.evento-gestor { border-left-color: var(--ok); }
.evento-interno { border-left-color: #6b3fa0; background: #f1eaf9; }
.lado-a-lado { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1rem 0; }
@media (min-width: 48rem) { .lado-a-lado { grid-template-columns: 1fr 1fr; } }
.lado-a-lado figure { margin: 0; }
.lado-a-lado figcaption { font-weight: 700; margin-bottom: 0.4rem; }
.foto { max-width: 100%; height: auto; border: 2px solid var(--borda); border-radius: var(--raio); }
.miniatura { max-width: 12rem; height: auto; border: 2px solid var(--borda); border-radius: var(--raio); }
html.contraste .selo, html.contraste .evento, html.contraste .evento-interno { background: #000; color: #fff; border-color: #ffff00; }

/* ---- Area do servidor: contracheques, documentos, carteirinha, simulador ---- */
.cartao-fixo { padding: 1rem; }
.tabela .num, .tabela th.num { text-align: right; white-space: nowrap; }
.tabela tfoot th { background: var(--fundo-suave); }
.lista-cc { list-style: none; padding: 0; margin: 0; }
.lista-cc li { border-bottom: 1px solid var(--borda); }
.lista-cc a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 0.2rem; text-decoration: none; color: var(--texto); min-height: 3.2rem; }
.lista-cc a:hover .cc-mes { text-decoration: underline; }
.cc-mes { font-weight: 700; }
.cc-valor { text-align: right; font-weight: 700; color: var(--cor); }

.folha { border: 2px solid var(--borda); border-radius: var(--raio); padding: 0.5rem 1rem 1rem; margin: 1rem 0; background: #fff; }
.folha-cab { display: grid; gap: 0.1rem; border-bottom: 2px solid var(--cor); padding-bottom: 0.5rem; margin-bottom: 0.8rem; }
.folha-cab h1 { margin: 0.4rem 0 0; font-size: 1.3rem; }
.folha-inst { font-size: 1.1rem; color: var(--cor); }

.carteirinha { max-width: 24rem; margin: 1rem auto; border: 3px solid var(--cor); border-radius: 14px; overflow: hidden; background: #fff; color: #111; }
.carteirinha header { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 1rem; background: var(--cor); color: var(--cor-texto); font-size: 0.85rem; line-height: 1.25; }
.carteirinha header strong { font-size: 1.3rem; letter-spacing: 0.05em; }
.cart-corpo { display: flex; gap: 1rem; padding: 1rem; align-items: flex-start; }
.foto { flex: none; width: 5.2rem; height: 6.5rem; border: 2px dashed var(--borda); border-radius: var(--raio); background: var(--fundo-suave); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.foto svg { width: 80%; fill: #9aa5b1; }
.cart-dados { margin: 0; display: grid; gap: 0.05rem; font-size: 0.9rem; line-height: 1.3; }
.cart-dados dt { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--texto-suave); margin-top: 0.4rem; }
.cart-dados dt:first-child { margin-top: 0; }
.cart-dados dd { margin: 0; font-weight: 700; }
.carteirinha footer { display: flex; gap: 1rem; align-items: center; padding: 0.8rem 1rem 1rem; border-top: 1px solid var(--borda); font-size: 0.75rem; }
.carteirinha footer p { margin: 0; }
.qr { flex: none; width: 7.5rem; height: 7.5rem; }
.qr svg { width: 100%; height: 100%; display: block; }

.regra { border: 2px solid var(--borda); border-left: 8px solid var(--cor); border-radius: var(--raio); padding: 0.2rem 1rem 0.8rem; margin: 1rem 0; background: var(--fundo-suave); }
.regra-sim { border-left-color: var(--ok); background: var(--ok-fundo); }
.regra-nao { opacity: 0.8; border-left-color: var(--borda); }
.regra h2 { margin: 0.6rem 0 0.2rem; font-size: 1.2rem; }
.regra-situacao { font-weight: 700; margin: 0.3rem 0 0.6rem; }
.reqs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.req-topo { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; font-size: 0.95rem; }
.prog { height: 0.8rem; background: #fff; border: 2px solid #55606b; border-radius: 999px; overflow: hidden; margin: 0.25rem 0; }
.prog span { display: block; height: 100%; background: var(--cor); }
.prog span.prog-ok { background: var(--ok); }

.nao-imprimir { }
@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  .nao-imprimir { display: none !important; }
  .folha { border: 0; padding: 0; margin: 0; }
  .folha-cab { border-bottom-color: #000; }
  .folha-inst { color: #000; }
  .carteirinha { break-inside: avoid; }
  .tabela th, .tabela td { border-bottom-color: #888; }
}

/* Contador de pendencias no menu do gestor */
.contador { display: inline-block; min-width: 1.4rem; margin-left: 0.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--erro); color: #ffffff; font-size: 0.8rem; font-weight: 800; text-align: center; line-height: 1.4rem; }

/* 2FA e area administrativa */
.qr-2fa { width: 14rem; max-width: 100%; background: #ffffff; padding: 0.5rem; border: 1px solid var(--borda); border-radius: var(--raio); }
.qr-2fa svg { display: block; width: 100%; height: auto; }
.segredo { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; word-break: break-all; background: var(--fundo-suave); padding: 0.4rem 0.6rem; border-radius: var(--raio); }
.grade-filtros { display: grid; gap: 0.4rem 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); align-items: end; max-width: 60rem; }
.grade-filtros .btn { margin-top: 0; }
.cor-previa { display: inline-block; width: 1.2rem; height: 1.2rem; border: 1px solid var(--borda); vertical-align: middle; margin-right: 0.4rem; }

/* ---- Carta de acesso (código de ativação) ---- */
.carta { border: 2px solid var(--borda); border-radius: var(--raio); padding: 1.2rem 1.5rem; margin: 1rem 0; max-width: 40rem; background: #fff; color: #000; }
.carta dt { font-weight: 700; margin-top: 0.6rem; }
.carta dd { margin: 0; }
.carta-titulo { font-weight: 700; margin: 0 0 0.5rem; }
.codigo-ativacao { font-family: ui-monospace, Consolas, monospace; font-size: 1.8rem; letter-spacing: 0.15em; font-weight: 700; }
@media print {
  .carta { break-after: page; break-inside: avoid; border: 1px solid #000; margin: 0; }
  .carta:last-of-type { break-after: auto; }
}
