:root {
  --fund: #f4f6f8;
  --card: #ffffff;
  --texto: #1f2933;
  --muted: #65727e;
  --linha: #dfe5eb;
  --azul: #1d5d8c;
  --azul-esc: #164a70;
  --verde: #2e8b57;
  --laranja: #c56a17;
  --vermelho: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--fund);
  color: var(--texto);
  font-size: 14px;
}
.topo {
  background: linear-gradient(100deg, #123c5a, #1d5d8c);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.marca { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 10px;
  background: #fff; color: var(--azul);
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: .5px;
}
.topo h1 { margin: 0; font-size: 19px; }
.topo p { margin: 2px 0 0; opacity: .85; font-size: 12px; }
.aviso-local {
  font-size: 12px;
  background: rgba(255,255,255,.14);
  padding: 7px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.abas {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--linha);
  overflow-x: auto;
}
.aba {
  border: 0; background: transparent; cursor: pointer;
  padding: 13px 16px; color: var(--muted);
  font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.aba:hover { color: var(--azul); }
.aba.ativa { color: var(--azul); border-bottom-color: var(--azul); }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.tela { display: none; }
.tela.ativa { display: block; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .rotulo { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.card .valor { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card.destaque .valor { color: var(--azul); }
.card.atencao .valor { color: var(--laranja); }
.card.ok .valor { color: var(--verde); }
.painel-grafico {
  background: #fff; border: 1px solid var(--linha); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
}
.barra { height: 18px; border-radius: 10px; background: #e6ebf0; overflow: hidden; display: flex; }
.barra span { display: block; height: 100%; }
.barra .cadastrados { background: var(--verde); }
.barra .pendentes { background: var(--laranja); }
#legenda-barra { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.bloco {
  background: #fff; border: 1px solid var(--linha);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.bloco-cabecalho {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.bloco-cabecalho h2 { margin: 0; font-size: 17px; }
.acoes-topo { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.busca, input, select, textarea {
  font: inherit; color: var(--texto);
  border: 1px solid #cbd4dd; border-radius: 6px;
  padding: 8px 10px; background: #fff;
}
.busca { min-width: 210px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a9cbdf; border-color: var(--azul); }
.tabela-wrap { overflow: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { background: #eef2f6; font-size: 11px; text-transform: uppercase; color: var(--muted); position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #f7fafc; }
.linha-secretaria { background: #e8f1f7; font-weight: 700; }
.linha-secretaria td { border-top: 2px solid #b7d1e2; color: #164a70; }
.linha-local td:first-child { padding-left: 22px; color: #40525f; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pendente { color: var(--laranja); font-weight: 700; }
.zero { color: #9aa6b2; }
.pat { font-family: Consolas, monospace; }
.sem { color: var(--vermelho); background: #fdeceb; padding: 2px 6px; border-radius: 4px; }
.tag {
  display: inline-block; padding: 2px 7px; border-radius: 12px;
  background: #e8f1f7; color: var(--azul); font-size: 11px; font-weight: 600;
}
.tag.avancado { background: #f3e8fb; color: #7b2cbf; }
.tag.note { background: #fff1dc; color: #9a5b00; }
.btn {
  border: 1px solid #c3ced8; background: #fff; color: var(--texto);
  padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 600;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: #f2f6f9; }
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primario:hover { background: var(--azul-esc); }
.btn.perigo { color: var(--vermelho); border-color: #e7b4ae; }
.btn.pequeno { padding: 4px 8px; font-size: 12px; }
.btn-icone { border: 0; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-fundo { position: absolute; inset: 0; background: rgba(15,30,45,.55); }
.modal-caixa {
  position: relative; background: #fff; border-radius: 12px;
  width: min(620px, 94vw); max-height: 90vh; overflow: auto;
  padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-titulo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-titulo h2 { margin: 0; font-size: 18px; }
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.campo label { font-weight: 600; font-size: 12px; color: var(--muted); }
.campo input, .campo select, .campo textarea { width: 100%; }
.linha-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.checkbox input { width: auto; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; border-top: 1px solid var(--linha); padding-top: 14px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  background: #173f5f; color: #fff; padding: 11px 16px;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast[hidden] { display: none; }
.texto { color: var(--muted); line-height: 1.6; }
.texto.pequeno { font-size: 12px; }
.botoes-backup { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.subabas { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--linha); margin-bottom: 14px; }
.subaba {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 8px 12px; border-radius: 6px 6px 0 0; color: var(--muted); font-weight: 600;
}
.subaba:hover { color: var(--azul); background: #f2f6f9; }
.subaba.ativa { color: var(--azul); border-color: var(--linha); border-bottom-color: #fff; background: #fff; }
.rel-filtros { margin-bottom: 12px; }
.dup { color: var(--vermelho); font-weight: 700; }
@media print {
  body { background: #fff; }
  .topo, .abas, .subabas, .rel-filtros, .botoes-backup, .modal, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .tela { display: none !important; }
  .tela.ativa { display: block !important; }
  .bloco { border: 0; padding: 0; }
  .tabela-wrap { max-height: none; overflow: visible; }
  table { font-size: 11px; }
  th { position: static; }
}
@media (max-width: 800px) {
  .aviso-local { display: none; }
  .linha-campos { grid-template-columns: 1fr; }
  th, td { padding: 7px; }
}
