* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f2f4f7;
  color: #1c2530;
}
.topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b3d59;
  color: #fff;
  padding: 16px 24px;
}
.topo h1 { margin: 0; font-size: 1.3rem; }
.subtitulo { font-size: 0.85rem; opacity: 0.85; }
.topo-ambiente { font-size: 0.85rem; display: flex; gap: 8px; align-items: center; }
.topo-ambiente select { padding: 4px; border-radius: 4px; border: none; }

main {
  max-width: 820px;
  margin: 24px auto;
  padding: 0 16px 48px;
}

.cartao {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.cartao h2 { margin-top: 0; font-size: 1.05rem; }
.ajuda { color: #5a6b7d; font-size: 0.85rem; margin-top: -8px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 600;
  color: #32404f;
  gap: 4px;
}
.form-grid input, .form-grid select {
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid #c3ccd6;
  border-radius: 5px;
  font-size: 0.95rem;
}
.form-grid .dica { font-size: 0.72rem; font-weight: 400; color: #798a9c; }
.form-grid .titulo-bloco {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #e6eaef;
  color: #0b3d59;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-grid .titulo-bloco:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.linha-checkbox { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: normal; font-weight: 600; }
.linha-checkbox input { width: auto; }
.form-grid button {
  grid-column: 1 / -1;
  padding: 10px 16px;
  background: #0b3d59;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 0.95rem;
  cursor: pointer;
  justify-self: start;
}
.form-grid button:hover { background: #0e4f72; }

.mensagem { margin-top: 12px; font-size: 0.88rem; }
.mensagem.sucesso { color: #1a7f45; }
.mensagem.erro { color: #b4232b; }

.status-box {
  background: #eef6f0;
  border: 1px solid #bfe3cc;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.status-box-alerta {
  background: #fff6e6;
  border-color: #f0cf8a;
  color: #7a5700;
}
.dica-destaque {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #7a5700;
}

.identificacao-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 4px;
}
.identificacao-bloco {
  background: #f6f8fa;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.identificacao-rotulo {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5a6b7d;
  margin-bottom: 4px;
}
.identificacao-valor {
  font-size: 0.98rem;
  font-weight: 600;
  color: #1c2530;
}
.identificacao-doc {
  font-size: 0.82rem;
  color: #5a6b7d;
}
.identificacao-select {
  font-weight: 600;
  font-size: 0.98rem;
  color: #1c2530;
  padding: 4px 6px;
  margin-bottom: 2px;
  border: 1px solid #c3ccd6;
  border-radius: 5px;
  background: #fff;
}

button.botao-secundario {
  grid-column: auto;
  background: #fff;
  color: #0b3d59;
  border: 1px solid #0b3d59;
  padding: 10px 16px;
  border-radius: 5px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 10px;
}
button.botao-secundario:hover { background: #eef3f6; }

.abas { display: flex; gap: 4px; margin-bottom: -1px; }
.aba {
  padding: 10px 18px;
  border: 1px solid #dde3ea;
  border-bottom: none;
  background: #e6eaef;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
}
.aba.ativa { background: #fff; font-weight: 600; }
.painel-aba { border-radius: 0 8px 8px 8px; }

.lista { margin-top: 16px; }
.lista table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lista th, .lista td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eceff3; }
.lista .vazio { color: #8795a5; font-size: 0.85rem; }
.tag-ok { color: #1a7f45; font-weight: 600; }
.tag-erro { color: #b4232b; font-weight: 600; cursor: help; }
.tag-alerta { color: #946c00; font-weight: 600; cursor: help; }
.tag-excluido { color: #8a4b00; font-weight: 600; cursor: help; }
#historicoEnvios td:first-child { white-space: nowrap; }
.tag-neutra { color: #6b6f76; font-weight: 600; cursor: help; }
.botao-excluir-esocial {
  background: #fff; color: #b4232b; border: 1px solid #e3b5b8; border-radius: 4px;
  padding: 3px 8px; font-size: 12px; cursor: pointer; white-space: nowrap; width: auto; margin: 0;
}
.botao-excluir-esocial:hover { background: #fdf0f0; }
.botao-excluir-esocial:disabled { opacity: .6; cursor: wait; }

.botao-remover-registro {
  background: #fff;
  color: #b4232b;
  border: 1px solid #e3b2b2;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 0.78rem;
  cursor: pointer;
}
.botao-remover-registro:hover { background: #fdf0f0; }

/* Mensagem de sucesso da busca de CEP */
.dica-ok { color: #1a7f45; }

/* Biblioteca de Prestadores (por certificado) */
.biblioteca-bloco {
  background: #f6f8fa;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.biblioteca-bloco label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.biblioteca-bloco select { padding: 8px; border: 1px solid #c3ccd6; border-radius: 5px; font-size: 0.92rem; background: #fff; }
.subtitulo-lista { font-size: 0.92rem; margin: 22px 0 0; color: #1c2530; }
.botao-tabela {
  background: #fff; color: #0b3d59; border: 1px solid #9fb6c6; border-radius: 4px;
  padding: 3px 9px; font-size: 0.78rem; cursor: pointer; margin-right: 4px;
}
.botao-tabela:hover { background: #eef3f6; }
.lista td:last-child { white-space: nowrap; }

/* Campos com valor padrão fixo: ficam ocultos (mas são enviados) até o
   usuário clicar em "Mostrar campos padrão". */
form:not(.mostrar-padrao) .campo-padrao { display: none; }
button.botao-link {
  grid-column: 1 / -1;
  justify-self: start;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: #0b5d8a;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}
button.botao-link:hover { color: #083f5e; background: none; }

/* Encerramento da Folha (S-1299 / S-1298) */
.folha-situacao {
  display: inline-flex; flex-direction: column; gap: 6px;
  background: #f1f4f7; border: 1px solid #d5dde5; border-radius: 6px;
  padding: 12px 18px; margin-bottom: 18px;
}
.folha-rotulo { font-weight: 700; color: #0b3d59; margin-right: 8px; }
.folha-valor { font-weight: 600; }
.folha-valor.aberta { color: #1a7f45; }
.folha-valor.fechada { color: #b4232b; }
#folhaPeriodo { width: 110px; padding: 5px 8px; border: 1px solid #c3ccd6; border-radius: 5px; }
.form-folha { display: flex; flex-direction: column; gap: 2px; }
.folha-pergunta {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #eef1f4; font-size: 0.86rem;
}
.folha-pergunta em { color: #b4232b; font-style: normal; }
.folha-opcoes { display: inline-flex; gap: 16px; white-space: nowrap; }
.folha-opcoes label { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.folha-botoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.folha-botoes button[type="submit"] {
  background: #0b3d59; color: #fff; border: none; padding: 10px 16px; border-radius: 5px; font-size: 0.9rem; cursor: pointer;
}
.folha-botoes button.botao-secundario { margin-top: 0; }
@media (max-width: 640px) {
  .folha-pergunta { grid-template-columns: 1fr; gap: 4px; }
}

/* Relatório de Obras (CNO) */
.relatorio-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.relatorio-filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; }
.relatorio-filtros select { padding: 7px 8px; border: 1px solid #c3ccd6; border-radius: 5px; }
.relatorio-filtros button.botao-secundario { margin-top: 0; }
.relatorio-mes { margin: 18px 0 6px; font-size: 0.95rem; color: #0b3d59; }
.relatorio-mes .contagem { font-weight: 400; color: #5a6b7d; font-size: 0.85rem; }
.relatorio-resumo { font-size: 0.85rem; color: #5a6b7d; }


.form-folha .dica { font-size: 0.78rem; font-weight: 400; color: #798a9c; margin-top: 8px; }
#relatorioObras table { table-layout: fixed; }


/* ===== Layout em duas colunas: certificado/identificação à esquerda,
   abas de cadastro à direita, cada coluna com sua própria rolagem ===== */
html, body { height: 100%; }
.topo { gap: 16px; padding: 12px 24px; }
.topo-acoes { display: flex; gap: 8px; margin-left: auto; }
.topo-botao {
  background: #fff; color: #0b3d59; border: none; border-radius: 5px;
  padding: 7px 12px; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.topo-botao:hover { background: #e3edf4; }

main.layout {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(360px, 2fr) 3fr;
}
.coluna-esquerda { padding: 16px 16px 24px; border-right: 2px solid #c9d2dc; }
.coluna-direita { padding: 16px 20px 24px; min-width: 0; }
.coluna-esquerda .cartao, .coluna-direita .cartao { margin-bottom: 14px; }
.aviso-inicial { border-style: dashed; }

/* Abas mais compactas e sempre numa linha, presas no topo da coluna */
.coluna-direita .abas {
  position: sticky; top: 0; z-index: 2;
  background: #f2f4f7; padding-top: 2px;
  /* cobre a faixa de cima da coluna: o conteúdo rolado não aparece acima das abas */
  box-shadow: 0 -16px 0 0 #f2f4f7;
  overflow-x: auto; scrollbar-width: thin;
}
.coluna-direita .aba { padding: 8px 12px; font-size: 0.84rem; white-space: nowrap; flex: 0 0 auto; }
.coluna-direita .cartao { padding: 16px 20px; }
.coluna-direita .cartao h2 { margin-bottom: 10px; }

/* Formulários mais densos à direita: 3 colunas quando houver espaço */
.coluna-direita .form-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.coluna-direita .form-grid input, .coluna-direita .form-grid select { padding: 7px 9px; font-size: 0.9rem; }
.coluna-direita .ajuda { margin-bottom: 10px; }

/* Em telas largas, só as colunas rolam — a página não */
@media (min-width: 1001px) {
  body { display: flex; flex-direction: column; overflow: hidden; }
  .topo { flex: 0 0 auto; }
  main.layout { flex: 1 1 auto; min-height: 0; }
  .coluna-esquerda, .coluna-direita { overflow-y: auto; min-height: 0; }
}
/* Telas estreitas: uma coluna só, rolagem normal */
@media (max-width: 1000px) {
  main.layout { display: block; }
  .coluna-esquerda { border-right: none; padding-bottom: 0; }
  .topo { flex-wrap: wrap; }
  .topo-acoes { margin-left: 0; }
}
@media (max-width: 560px) {
  .identificacao-grid { grid-template-columns: 1fr; }
}

/* ===== Janelas (Relatório de Obras e Histórico de Envios) ===== */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12, 28, 42, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px; overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-caixa {
  background: #fff; border-radius: 10px; width: min(1100px, 100%);
  padding: 16px 24px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-topo h2 { margin: 0; font-size: 1.1rem; }
.modal-fechar { background: none; border: none; font-size: 1.7rem; line-height: 1; cursor: pointer; color: #5a6b7d; padding: 0 4px; }
.modal-fechar:hover { color: #1c2530; }
.modal-conteudo { margin-top: 10px; }
body.modal-aberto { overflow: hidden; }

/* Impressão do relatório: só a janela do relatório */
@media print {
  body.imprimir-relatorio { height: auto; overflow: visible; display: block; }
  body.imprimir-relatorio > *:not(#modalRelatorio) { display: none !important; }
  body.imprimir-relatorio #modalRelatorio { position: static; background: none; padding: 0; display: block; overflow: visible; }
  body.imprimir-relatorio .modal-caixa { box-shadow: none; width: auto; padding: 0; }
  body.imprimir-relatorio .modal-fechar,
  body.imprimir-relatorio .relatorio-filtros,
  body.imprimir-relatorio #secaoRelatorio .ajuda { display: none !important; }
}

/* Mais campos por linha e blocos mais compactos na coluna da direita
   (evita rolar para preencher) */
.coluna-direita .form-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.coluna-direita .form-grid .titulo-bloco { margin-top: 2px; padding-top: 8px; }
.coluna-direita .form-grid .dica { line-height: 1.25; }
.coluna-direita .biblioteca-bloco { padding: 8px 12px; margin-bottom: 10px; }
.coluna-direita .biblioteca-bloco label { flex-direction: row; align-items: center; gap: 10px; white-space: nowrap; }
.coluna-direita .biblioteca-bloco select { flex: 1; min-width: 0; }

/* ---------- Endereço da obra ---------- */
.linha-municipio-uf { display: grid; grid-template-columns: 1fr 52px; gap: 6px; }
.linha-municipio-uf input { min-width: 0; }
.modal-caixa.modal-pequena { max-width: 720px; }
button.botao-endereco-obra, .form-grid button.botao-endereco-obra {
  background: #fff; color: #0b3d59; border: 1px solid #b9c7d4; border-radius: 4px;
  padding: 2px 8px; font-size: 0.75rem; cursor: pointer; margin-left: 6px; grid-column: auto;
}
button.botao-endereco-obra:hover { background: #eef3f6; }

/* ---------- Lançamento por Período ---------- */
.form-grid .lote-prestadores, .form-grid .lote-regras, .form-grid .lote-botoes { grid-column: 1 / -1; }
.lote-prestadores { border: 1px solid #dde3ea; border-radius: 6px; padding: 10px 12px; background: #fafbfc; }
.lote-prestadores-topo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-size: 0.88rem; }
.lote-valor-todos { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.lote-valor-todos input { width: 150px; }
.form-grid .lote-valor-todos button.botao-secundario, .lote-botoes button.botao-secundario { margin-top: 0; padding: 7px 12px; }
.lote-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 14px; max-height: 300px; overflow-y: auto; }
.form-grid label.lote-linha {
  display: grid; grid-template-columns: 18px 1fr 120px; align-items: center; gap: 8px;
  font-weight: 400; padding: 5px 6px; border-radius: 4px; background: #fff; border: 1px solid #eceff3; cursor: pointer;
}
.lote-linha input[type=checkbox] { margin: 0; }
.lote-nome { display: flex; flex-direction: column; font-weight: 600; line-height: 1.2; }
.lote-nome .dica { font-weight: 400; }
.form-grid .lote-linha .lote-valor { padding: 5px 7px; text-align: right; }
.lote-botoes { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lote-botoes button { margin-top: 0; }
.lote-caixa { margin-top: 14px; border: 1px solid #dde3ea; border-radius: 8px; padding: 12px 14px; background: #fbfcfd; font-size: 0.88rem; }
.lote-caixa p { margin: 6px 0; }
.lote-avisos { margin: 6px 0; padding-left: 18px; color: #946c00; font-size: 0.82rem; }
.lote-cabecalho { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lote-barra { height: 10px; background: #e6eaef; border-radius: 5px; overflow: hidden; margin: 8px 0 4px; }
.lote-barra div { height: 100%; background: #1a7f45; transition: width .4s; }
.lote-contagens { color: #5a6b7d; }
.lote-caixa .lote-botoes { margin: 8px 0; }
.lote-caixa .lote-botoes button:not(.botao-secundario) {
  padding: 8px 14px; background: #0b3d59; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 0.9rem;
}
.lote-mes { margin-top: 6px; border-top: 1px solid #eceff3; padding-top: 4px; }
.lote-mes summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.lote-mes .lista { margin-top: 4px; }
.lote-msg { color: #5a6b7d; font-size: 0.78rem; max-width: 420px; }
.form-grid label.linha-checkbox.lote-regras { flex-direction: row; align-items: center; font-weight: 400; gap: 8px; }
.form-grid p.lote-regras { margin: 0; }
.coluna-direita .abas { flex-wrap: wrap; row-gap: 2px; }
.coluna-direita .aba { padding: 9px 12px; font-size: 0.85rem; }
#relatorioObras td.rel-endereco { min-width: 190px; }
#relatorioObras td.rel-recibo { font-size: 0.74rem; word-break: break-all; overflow-wrap: anywhere; width: 120px; max-width: 120px; }

/* ===== Login e página offline ===== */
body.pagina-login { display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 16px; overflow: auto; }
.login-caixa {
  background: #fff; border: 1px solid #dde3ea; border-radius: 12px; padding: 28px 26px;
  width: min(420px, 100%); margin: 0; text-align: center; box-shadow: 0 8px 30px rgba(12, 28, 42, 0.08);
}
.login-caixa h1 { margin: 10px 0 4px; font-size: 1.35rem; color: #0b3d59; }
.login-logo { border-radius: 14px; }
.login-form { grid-template-columns: 1fr; text-align: left; margin-top: 14px; }
.login-form button { justify-self: stretch; padding: 12px; font-size: 1rem; }
.login-form .linha-checkbox { flex-direction: row; font-weight: 400; }
.botao-link-grande { display: inline-block; background: #0b3d59; color: #fff; padding: 10px 18px; border-radius: 6px; text-decoration: none; }
.login-app { margin: 18px 0 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.9rem; }
.login-app a { color: #0b3d59; }
a.topo-botao { text-decoration: none; display: inline-flex; align-items: center; }
.topo-botao[hidden], .so-fora-do-app[hidden] { display: none !important; }

/* ===== Página "Instalar o app" ===== */
.instalar-caixa { width: min(680px, 100%); text-align: left; }
.instalar-caixa h1, .instalar-caixa .instalar-topo { text-align: center; }
.instalar-caixa h2 { font-size: 1.08rem; color: #0b3d59; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.instalar-caixa ol { padding-left: 22px; margin: 6px 0; }
.instalar-caixa li { margin: 6px 0; line-height: 1.45; }
.instalar-plataforma { border: 1px solid #dde3ea; border-radius: 10px; padding: 4px 16px 12px; margin-top: 14px; }
.instalar-plataforma.seu-aparelho { border-color: #0b3d59; box-shadow: 0 0 0 2px rgba(11, 61, 89, 0.12); }
.instalar-plataforma .selo { font-size: 0.72rem; font-weight: 700; background: #0b3d59; color: #fff; border-radius: 99px; padding: 2px 8px; }
.instalar-endereco { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.instalar-endereco code { background: #eef3f7; border-radius: 6px; padding: 8px 10px; font-size: 1rem; word-break: break-all; }
.instalar-conferir { font-size: 0.78rem; color: #555; word-break: break-all; }
.instalar-aviso { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }

/* ===== Celular ===== */
@media (max-width: 1000px) {
  .coluna-direita .abas { flex-wrap: nowrap; }
}
@media (max-width: 640px) {
  .topo { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px; }
  .topo h1 { font-size: 1.1rem; }
  .subtitulo { display: none; }
  .topo-acoes { order: 3; width: 100%; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .topo-botao { padding: 8px 10px; font-size: 0.8rem; }
  .topo-ambiente { margin-left: auto; }
  .topo-ambiente label { display: none; }
  .topo-ambiente select { max-width: 190px; font-size: 0.8rem; padding: 6px; }

  .coluna-esquerda, .coluna-direita { padding: 10px 10px 16px; }
  .cartao, .coluna-direita .cartao { padding: 14px 12px; border-radius: 8px; }
  .painel-aba { border-radius: 0 0 8px 8px; }
  .coluna-direita .abas { margin: 0 -10px; padding: 4px 10px 0; }
  .coluna-direita .aba { padding: 10px 12px; font-size: 0.85rem; }

  .form-grid, .coluna-direita .form-grid { grid-template-columns: 1fr; gap: 10px; }
  /* 16px evita o zoom automático do iPhone ao tocar no campo */
  .form-grid input, .form-grid select, .coluna-direita .form-grid input, .coluna-direita .form-grid select,
  .identificacao-select, .topo-ambiente select { font-size: 16px; }
  .form-grid button { justify-self: stretch; padding: 12px; }
  .form-grid button.botao-link { justify-self: start; padding: 4px 0; }

  .lista { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lista table { min-width: 520px; }
  #historicoEnvios table { min-width: 760px; }

  .modal { padding: 0; }
  .modal-caixa, .modal-caixa.modal-pequena { width: 100%; max-width: none; min-height: 100%; border-radius: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 24px; }
  #relatorioObras { overflow-x: auto; }
  #relatorioObras table { table-layout: auto; min-width: 900px; }

  .lote-lista { grid-template-columns: 1fr; max-height: none; }
  .lote-prestadores-topo { gap: 8px; }
  .lote-valor-todos { margin-left: 0; width: 100%; }
  .lote-valor-todos input { flex: 1; width: auto; }
  .form-grid label.lote-linha { grid-template-columns: 22px 1fr 110px; padding: 8px 6px; }
  .lote-botoes button { flex: 1 1 auto; }
  .lote-msg { max-width: 220px; }
  .folha-botoes, .relatorio-filtros { flex-wrap: wrap; }
}
.resumo-recolhido { display: none; }
@media (max-width: 640px) {
  .cartao.recolhivel > h2 { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
  .cartao.recolhivel > h2::after { content: '▾'; margin-left: auto; color: #5a6b7d; }
  .cartao.recolhivel.recolhido > h2::after { content: '▸'; }
  .cartao.recolhivel.recolhido > :not(h2) { display: none !important; }
  .cartao.recolhivel.recolhido { padding-top: 10px; padding-bottom: 10px; }
  .cartao.recolhivel.recolhido > h2 { margin: 0; font-size: 0.95rem; }
  .cartao.recolhivel.recolhido .resumo-recolhido { display: block; width: 100%; order: 3; font-size: 0.82rem; font-weight: 400; color: #5a6b7d; }
  .lote-valor-todos button { white-space: nowrap; }
  #historicoEnvios th:nth-child(3), #historicoEnvios td:nth-child(3) { display: none; }
  #historicoEnvios table { min-width: 640px; }
}
.login-caixa .ajuda { margin-top: 4px; }
.bloco-existente { margin-top: 16px; border: 1px solid #dde3ea; border-radius: 6px; padding: 10px 12px; background: #fafbfc; }
.bloco-existente summary { cursor: pointer; font-weight: 600; color: #0b3d59; font-size: 0.9rem; }
.bloco-existente[open] summary { margin-bottom: 8px; }
.bloco-existente .ajuda { margin-top: 0; }
.form-grid .aviso-sem-prestador { line-height: 1.3; }
.bloco-sinc { margin-top: 18px; border-top: 1px solid #e6eaef; padding-top: 6px; }
.sinc-opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sinc-opcao { border: 1px solid #dde3ea; border-radius: 6px; padding: 10px 12px; background: #fafbfc; font-size: 0.88rem; }
.sinc-opcao > strong { color: #0b3d59; }
.sinc-passos { margin: 6px 0 10px; padding-left: 18px; font-size: 0.82rem; color: #32404f; }
.sinc-opcao .form-grid { grid-template-columns: 1fr 1fr; }
.sinc-opcao .form-grid .sinc-cpfs, .sinc-opcao #formSincArquivo label { grid-column: 1 / -1; }
.sinc-opcao textarea { font: inherit; font-weight: 400; padding: 7px 9px; border: 1px solid #c3ccd6; border-radius: 5px; resize: vertical; }
@media (max-width: 1100px) { .sinc-opcoes { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .sinc-opcao .form-grid { grid-template-columns: 1fr; } .sinc-opcao textarea { font-size: 16px; } }
@media (max-width: 640px) {
  .form-grid, .coluna-direita .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > *, .form-grid label > * { min-width: 0; max-width: 100%; }
  .form-grid select { width: 100%; }
  .biblioteca-bloco select { max-width: 100%; }
}
@media (max-width: 640px) { .lote-valor-todos input { min-width: 0; } .lote-valor-todos button { flex: 0 0 auto; } }

/* Lançar Período com várias obras */
.form-grid .lote-obras { grid-column: 1 / -1; font-size: 0.88rem; }
.lote-obras-lista { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; }
.form-grid label.lote-obra {
  flex-direction: row; align-items: center; gap: 6px; font-weight: 600; padding: 6px 10px;
  border: 1px solid #dde3ea; border-radius: 5px; background: #fff; cursor: pointer;
}
.lote-obra input { margin: 0; }
.lote-obra .dica { font-weight: 400; }
.lote-matriz { overflow-x: auto; }
.lote-matriz table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: #fff; }
.lote-matriz th, .lote-matriz td { padding: 5px 6px; border-bottom: 1px solid #eceff3; text-align: left; vertical-align: middle; }
.lote-matriz th.num, .lote-matriz td.num { text-align: right; white-space: nowrap; }
.form-grid .lote-matriz input.lote-valor { width: 120px; padding: 5px 7px; text-align: right; }
.form-grid .lote-matriz label.lote-quem { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.lote-quem input { margin: 0; }
.lote-total { font-weight: 600; color: #0b3d59; }
@media (max-width: 640px) { .lote-matriz table { min-width: 420px; } .form-grid .lote-matriz input.lote-valor { width: 100px; } }
.lote-mes td:first-child { white-space: nowrap; }
.lote-msg { overflow-wrap: anywhere; }

/* Lançar Período: modo Excluir */
.lote-modo { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
#formLote .so-excluir { display: none; }
#formLote.modo-excluir .so-excluir { display: block; }
#formLote.modo-excluir .so-lancar { display: none; }
#formLote.modo-excluir .lote-matriz th.num,
#formLote.modo-excluir .lote-matriz td:not(:first-child) { display: none; }
#formLote.modo-excluir #btnLoteIniciar { background: #b42318; border-color: #b42318; }
.lote-modo { border: 1px solid #d0d7de; border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.lote-modo label { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; text-align: left; font-weight: normal; margin: 0; }
.lote-modo input[type=radio] { width: auto; flex: 0 0 auto; margin: 3px 0 0; }
.mensagem.aviso { color: #9a6700; }
.aba[hidden] { display: none; }

/* Comprovante do CNO */
.cno-bloco { margin-top: 12px; gap: 6px; }
.cno-escolher { display: inline-block; width: fit-content; cursor: pointer; padding: 8px 14px; }
.cno-resumo { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.cno-resumo th { text-align: left; font-weight: 600; color: #57606a; padding: 3px 8px 3px 0; white-space: nowrap; vertical-align: top; }
.cno-resumo td { padding: 3px 0; overflow-wrap: anywhere; }
.preenchido-cno { background: #fff8db !important; }
.identificacao-grid > * { min-width: 0; }
.identificacao-select { max-width: 100%; min-width: 0; }
.cno-bloco .dica { font-size: 0.82rem; color: #5a6b7d; }
label.cno-escolher {
  border: 1px solid #0f3d5c; color: #0f3d5c; background: #fff; border-radius: 6px;
  font-weight: 600; font-size: 0.9rem; margin-top: 6px;
}
label.cno-escolher:hover { background: #eef3f6; }
.cno-bloco p { font-size: 0.85rem; margin: 6px 0 0; }

/* Calculadora */
.calc-cno { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.calc-cno .cno-escolher { margin-top: 0; }
.calc-destaques { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 8px; }
.calc-destaques > div { border: 1px solid #dde3ea; border-radius: 8px; padding: 12px 14px; background: #f6f8fa; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.calc-destaques span { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: #5a6b7d; }
.calc-destaques strong { font-size: 1.25rem; color: #0b3d59; overflow-wrap: anywhere; }
.calc-destaques em { font-style: normal; font-size: 0.8rem; color: #5a6b7d; }
.calc-destaques .calc-principal { background: #eefcf3; border-color: #9fd8b4; }
.calc-destaques .calc-principal strong { color: #1a7f45; font-size: 1.5rem; }
.calc-detalhes { margin: 6px 0 4px; }
.calc-detalhes summary { cursor: pointer; color: #0b3d59; font-weight: 600; padding: 4px 0; }
.calc-detalhes .lista { margin-top: 8px; }
#formCalculadora input[readonly] { background: #f0f4f8; color: #33475b; }
@media (max-width: 720px) { .calc-destaques { grid-template-columns: 1fr; } }
#formCalculadora [hidden] { display: none !important; }
#btnCalcLevar { background: #0b3d59; color: #fff; border: none; border-radius: 5px; padding: 10px 18px; font-size: 0.95rem; cursor: pointer; }
#btnCalcLevar:disabled { opacity: 0.5; cursor: default; }
#painelCalculadora .lote-botoes { margin-top: 10px; }
.calc-tabelas { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.calc-tabelas .botao-secundario { margin-top: 0; padding: 6px 12px; }

#formLote .lote-da-calc { grid-column: 1 / -1; margin: 0; font-size: 0.9rem; }

/* ===== Produtividade ===== */
.prod-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; border-bottom: 1px solid #dde3ea; padding-bottom: 10px; }
.prod-nav-btn { background: #f1f4f7; color: #33475b; border: 1px solid #dde3ea; border-radius: 999px; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.prod-nav-btn.ativa { background: #0b3d59; color: #fff; border-color: #0b3d59; }
.prod-alternar { display: inline-flex; border: 1px solid #0b3d59; border-radius: 6px; overflow: hidden; align-self: flex-end; }
.prod-alternar button { background: #fff; color: #0b3d59; border: 0; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; margin: 0; }
.prod-alternar button.ativa { background: #0b3d59; color: #fff; }
.prod-cartoes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prod-cartoes .prod-cartao-cno { background: #fbf6ec; border-color: #e3cfa3; }
.prod-cartoes .prod-cartao-cno strong { color: #8a6420; font-size: 1.9rem; }
.prod-grafico { overflow-x: auto; border: 1px solid #eceff3; border-radius: 8px; padding: 8px; background: #fff; }
.prod-grafico svg { display: block; max-width: none; }
.prod-media { white-space: nowrap; }
.prod-traco { display: inline-block; width: 18px; border-top: 2px dashed #c0392b; vertical-align: middle; margin-right: 6px; }
#painelProdutividade .form-grid .prod-largo { grid-column: 1 / -1; }
.prod-busca { margin-top: 14px; align-items: center; }
.prod-busca input[type=search] { min-width: 280px; padding: 7px 8px; border: 1px solid #c3ccd6; border-radius: 5px; }
.prod-passos { margin: 6px 0 10px; padding-left: 20px; font-size: 0.88rem; line-height: 1.5; }
.prod-rel-titulo { font-size: 1.05rem; color: #0b3d59; margin: 4px 0; }
.prod-resumo-tipos { max-width: 520px; margin: 8px 0 4px; }
.prod-rel-proc { margin-top: 8px; }
#prodRelatorio table .num, .prod-resumo-tipos .num { text-align: right; }
#prodImpressao { display: none; }
#prodAviso[hidden] { display: none !important; }
#prodRelatorio td:last-child, #prodImpressao td:last-child { white-space: normal; }
#prodRelatorio td, #prodImpressao td { vertical-align: top; }
@media (max-width: 720px) { .prod-cartoes { grid-template-columns: 1fr; } .prod-busca input[type=search] { min-width: 0; width: 100%; } }
@media print {
  body.imprimir-produtividade { height: auto; overflow: visible; display: block; }
  body.imprimir-produtividade > *:not(#prodImpressao) { display: none !important; }
  body.imprimir-produtividade #prodImpressao { display: block; }
  body.imprimir-produtividade #prodImpressao table { font-size: 9pt; }
  body.imprimir-produtividade #prodImpressao tr { break-inside: avoid; }
}

.historico-pendentes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.historico-pendentes button.botao-secundario { margin-top: 0; padding: 6px 12px; }

/* Histórico: descartar envio sem resposta (mesmo visual do Remover, outra ação) */
.botao-descartar-envio {
  background: #fff;
  color: #b4232b;
  border: 1px solid #e3b2b2;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 0.78rem;
  cursor: pointer;
}
.botao-descartar-envio:hover { background: #fdf0f0; }

/* Folha aberta/fechada pelo portal do eSocial (Lançar Período) */
.form-grid .folha-portal { grid-column: 1 / -1; }
.folha-portal { border: 1px dashed #c9d2de; border-radius: 8px; padding: 8px 12px; background: #fafbfd; }
.folha-portal summary { cursor: pointer; font-weight: 600; color: #1f4e8c; }
.folha-portal-campos { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 6px; }
.folha-portal-campos label { display: flex; flex-direction: column; font-size: 13px; gap: 3px; }
.folha-portal-campos input { width: 110px; }
.folha-portal-campos button.botao-secundario { margin-top: 0; padding: 7px 12px; }
.historico-ultima-consulta { font-size: 12px; color: #5b6573; margin-top: 4px; min-width: 220px; max-width: 320px; }
.historico-ultima-consulta summary { cursor: pointer; color: #1f4e8c; }
.historico-ultima-consulta code { display: block; white-space: pre-wrap; word-break: break-all; font-size: 11px; background: #f4f6f9; padding: 6px; border-radius: 4px; max-height: 160px; overflow: auto; }

/* Conferência com o eSocial antes de transmitir (Lançar Período) */
.conferencia-esocial { border-left: 4px solid #1f4e8c; }
.lista-mudancas { margin: 6px 0 8px 18px; padding: 0; font-size: 14px; }
.lista-mudancas li { margin: 3px 0; }
.conferencia-arquivo { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.conferencia-arquivo button { margin-top: 0; }
.previa-correcoes { margin-top: 10px; }
.previa-correcoes summary { cursor: pointer; font-weight: 600; color: #1f4e8c; }
.previa-correcoes table { margin-top: 6px; }

/* ===== Versão nova: tela inicial, modos e correção em lote ===== */
/* modos: inicio | obra | correcao | relatorios */
body[data-modo="inicio"] main.layout { display: none !important; }
body:not([data-modo="inicio"]) #telaInicio { display: none !important; }
body:not([data-modo]) #telaInicio { display: none !important; }
body[data-modo="obra"] .coluna-esquerda, body[data-modo="correcao"] .coluna-esquerda, body[data-modo="relatorios"] .coluna-esquerda { display: none; }
body[data-modo="obra"] main.layout, body[data-modo="correcao"] main.layout, body[data-modo="relatorios"] main.layout { grid-template-columns: 1fr; }
body[data-modo="obra"] .aba:not([data-modos~="obra"]),
body[data-modo="correcao"] .aba:not([data-modos~="correcao"]),
body[data-modo="relatorios"] .aba:not([data-modos~="relatorios"]) { display: none !important; }
/* nas correções, Remuneração, Pagamento e Fechar Folha aparecem sempre (correções individuais) */
body[data-modo="correcao"] .aba[data-modos~="correcao"][hidden] { display: inline-block !important; }
/* no cadastro de obra nova, o Lançar Período só lança */
body[data-modo="obra"] #formLote .lote-modo, body[data-modo="obra"] #formLote .lote-corrigir { display: none !important; }
body[data-modo="relatorios"] #secaoEmpregador { display: none !important; }

.tela-inicio { max-width: 980px; margin: 24px auto; padding: 0 16px 48px; }
@media (min-width: 1001px) { .tela-inicio { flex: 1 1 auto; overflow-y: auto; width: 100%; max-width: none; } .tela-inicio > * { max-width: 980px; margin-left: auto; margin-right: auto; } }
.inicio-cartao h2 { margin-top: 0; }
.inicio-linha { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; }
.inicio-campo { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.9rem; flex: 1 1 320px; min-width: 0; }
.inicio-campo select, .inicio-campo input { padding: 9px 10px; font-size: 0.95rem; border: 1px solid #c6d0da; border-radius: 6px; width: 100%; font-weight: normal; }
.inicio-linha > button { margin-top: 0; }
.botao-excluir-ini { color: #b3261e; border-color: #e3b3ae; }
.inicio-novo { border: 1px dashed #c9d2de; border-radius: 8px; padding: 10px 14px; background: #fafbfd; margin-bottom: 8px; }
.botao-principal-arquivo { display: inline-block; background: #0b3d59; color: #fff; padding: 10px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.botao-principal-arquivo:hover { background: #0e4d70; }
.inicio-menu { margin-top: 16px; }
.inicio-opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .inicio-opcoes { grid-template-columns: 1fr; } }
.inicio-opcao { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin: 0; }
.inicio-opcao h3 { margin: 0; color: #0b3d59; }
.inicio-opcao-larga { margin-top: 16px; }
.inicio-opcao .botao-link { padding: 0; }

.topo-identidade { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; background: rgba(255,255,255,0.1); padding: 6px 12px; border-radius: 6px; min-width: 0; }
.topo-identidade[hidden] { display: none !important; }
.topo-rotulo { opacity: 0.8; }
.topo-link { background: none; border: none; color: #cfe6f5; text-decoration: underline; padding: 0; font-size: 0.78rem; cursor: pointer; margin: 0; }
.topo-link:hover { color: #fff; background: none; }
.barra-modo { display: none; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
body[data-modo="obra"] .barra-modo, body[data-modo="correcao"] .barra-modo, body[data-modo="relatorios"] .barra-modo { display: flex; }
.barra-modo button { margin-top: 0; padding: 6px 12px; }
.barra-modo strong { color: #0b3d59; font-size: 1.05rem; }
.barra-modo-acoes { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.corr-passos { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 10px 0 14px; counter-reset: none; }
.corr-passos li { padding: 5px 10px; border-radius: 14px; background: #e8edf3; color: #51606f; font-size: 0.82rem; }
.corr-passos li.atual { background: #0b3d59; color: #fff; }
.corr-passos li.feito { background: #d8efe0; color: #22663b; }
.corr-periodo { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.corr-periodo label { display: flex; flex-direction: column; font-size: 0.88rem; gap: 3px; }
.corr-periodo input { width: 120px; padding: 7px 9px; }
.corr-periodo button { margin-top: 0; }
.corr-tabela td, .corr-tabela th { vertical-align: top; }
.corr-tabela input.corr-valor { width: 100px; padding: 5px 6px; text-align: right; }
.corr-tabela input.corr-mudou { background: #fff7d6; border-color: #e0b100; }
/* botão principal nas telas novas (o estilo base só existia dentro de .form-grid) */
.tela-inicio button:not(.botao-secundario):not(.botao-link),
#painelCorrecao button:not(.botao-secundario):not(.botao-link),
#loteConferencia button:not(.botao-secundario):not(.botao-link) {
  padding: 9px 16px; background: #0b3d59; color: #fff; border: none; border-radius: 5px; font-size: 0.92rem; cursor: pointer; font-weight: 600;
}
.tela-inicio button:not(.botao-secundario):not(.botao-link):hover,
#painelCorrecao button:not(.botao-secundario):not(.botao-link):hover,
#loteConferencia button:not(.botao-secundario):not(.botao-link):hover { background: #0e4f72; }
.tela-inicio button:disabled, #painelCorrecao button:disabled { opacity: 0.5; cursor: default; }
.inicio-linha > button { padding: 10px 16px; }
/* identidade (procurador/empregador) numa faixa própria, como no portal */
.topo { flex-wrap: wrap; }
.topo-identidade { order: 10; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 6px 22px; align-items: center; }
.topo-links { margin-left: auto; }
.barra-modo { margin-bottom: 20px; }
.corr-recalc-topo { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }
.corr-recalc-topo label { font-size: 0.88rem; }
.corr-recalc .rc-area { width: 90px; } .corr-recalc .rc-meses { width: 60px; }
.corr-recalc select { max-width: 170px; }
.corr-recalc td.num { white-space: nowrap; font-weight: 600; }
label.rc-ler { display: inline-block; border: 1px solid #0b3d59; color: #0b3d59; background: #fff; border-radius: 5px; padding: 7px 12px; cursor: pointer; font-weight: 600; }
label.rc-ler:hover { background: #eef3f6; }

/* Ambiente: faixa de aviso na Produção Restrita (testes) */
body.amb-restrita .topo { border-bottom: 6px solid #e0a100; }
body.amb-restrita .topo::after {
  content: "PRODUÇÃO RESTRITA (testes) — nada do que for enviado vale de verdade";
  flex: 1 1 100%; order: 20; text-align: center; font-weight: 700; font-size: 0.85rem;
  background: #ffd44d; color: #3d2c00; padding: 4px 8px; border-radius: 4px;
}
body.amb-restrita #seletorAmbiente { background: #ffd44d; font-weight: 700; }
body.amb-producao #seletorAmbiente { font-weight: 700; }

/* "Já existe no eSocial (feita pelo portal)" — Rubrica e Lotação */
details.ja-esocial { margin: 10px 0 4px; padding: 8px 12px; border: 1px dashed #b8c4cf; border-radius: 6px; background: #f8fafc; }
details.ja-esocial > summary { cursor: pointer; color: #0b3d59; font-weight: 600; }
details.ja-esocial[open] { border-style: solid; }
details.ja-esocial .ajuda { margin: 8px 0; }
details.ja-esocial button.botao-secundario { margin-top: 0; }

/* Aba Divergências (arquivo do eSocial × sistema) */
.div-legenda { margin: 4px 0 10px 18px; padding: 0; }
.div-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.div-upload button { margin-top: 0; }
.div-info { background: #f6f8fb; border: 1px solid #dde4ec; border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.div-info p { margin: 4px 0; }
.div-filtros { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
button.div-filtro { margin: 0; padding: 5px 12px; border-radius: 14px; background: #e8edf3; color: #33475b; border: 1px solid transparent; font-size: 0.85rem; }
button.div-filtro.ativo { background: #0b3d59; color: #fff; }
button.div-filtro:disabled { opacity: 0.5; cursor: default; }
.div-bloco { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; padding: 8px 10px; background: #fffbea; border: 1px solid #f0e2a8; border-radius: 6px; position: sticky; top: 0; z-index: 2; }
.div-bloco button { margin-top: 0; }
.div-marcar { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.div-tabela td { vertical-align: top; }
.div-acoes { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.div-acoes button { margin-top: 0; padding: 6px 10px; font-size: 0.85rem; }
.div-acoes button:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 700px) {
  .div-tabela thead { display: none; }
  .div-tabela tr { display: block; border-bottom: 1px solid #dde4ec; padding: 6px 0; }
  .div-tabela td { display: block; border: 0; padding: 3px 6px; }
  .div-acoes { flex-direction: row; flex-wrap: wrap; }
}
.div-upload button:not(.botao-secundario), .div-bloco button:not(.botao-secundario), .div-acoes button:not(.botao-secundario) {
  padding: 10px 16px; background: #0b3d59; color: #fff; border: none; border-radius: 5px; font-size: 0.9rem; cursor: pointer;
}
.div-upload button:not(.botao-secundario):hover:not(:disabled), .div-bloco button:not(.botao-secundario):hover:not(:disabled), .div-acoes button:not(.botao-secundario):hover:not(:disabled) { background: #0e4f72; }
.div-bloco button:disabled { opacity: 0.45; cursor: not-allowed; }
.div-bloco[hidden], .div-upload [hidden] { display: none; }

/* Tela inicial: teste de resposta do eSocial */
.inicio-teste { margin-top: 16px; }
.inicio-teste h3 { margin: 0 0 4px; color: #0b3d59; }
.inicio-teste-cabecalho { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.inicio-teste-cabecalho > div { flex: 1 1 420px; min-width: 0; }
.inicio-teste-cabecalho .dica { margin: 0; }
.inicio-teste-cabecalho > button { margin-top: 0; white-space: nowrap; }
.teste-resultado { margin-top: 12px; }
.teste-semaforo { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; border: 1px solid #dde4ec; background: #f6f8fb; }
.teste-semaforo p { margin: 4px 0; }
.teste-luz { flex: 0 0 18px; height: 18px; border-radius: 50%; margin-top: 2px; background: #9aa7b4; box-shadow: 0 0 0 3px rgba(154, 167, 180, 0.25); }
.teste-detalhes { margin: 6px 0 0 18px; padding: 0; font-size: 0.9rem; }
.teste-detalhes li { margin: 2px 0; }
.teste-botoes button { margin-top: 8px; }
.teste-semaforo.nivel-normal, .teste-semaforo.nivel-so_conexao { background: #eef8f1; border-color: #b9e0c6; }
.teste-semaforo.nivel-normal .teste-luz, .teste-semaforo.nivel-so_conexao .teste-luz { background: #1a7f45; box-shadow: 0 0 0 3px rgba(26, 127, 69, 0.2); }
.teste-semaforo.nivel-lento { background: #fff8e6; border-color: #f0d796; }
.teste-semaforo.nivel-lento .teste-luz { background: #d39b00; box-shadow: 0 0 0 3px rgba(211, 155, 0, 0.25); }
.teste-semaforo.nivel-parado, .teste-semaforo.nivel-sem_conexao, .teste-semaforo.nivel-erro { background: #fdeeee; border-color: #f0b9b9; }
.teste-semaforo.nivel-parado .teste-luz, .teste-semaforo.nivel-sem_conexao .teste-luz, .teste-semaforo.nivel-erro .teste-luz { background: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2); }
.teste-semaforo.nivel-testando .teste-luz { animation: teste-pulsar 1s ease-in-out infinite; background: #2f6f9f; }
@keyframes teste-pulsar { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .teste-semaforo.nivel-testando .teste-luz { animation: none; } }
.div-avisos { margin: 4px 0; } .div-avisos summary { cursor: pointer; } .div-avisos ul { margin: 4px 0 0 18px; padding: 0; max-height: 180px; overflow-y: auto; }

/* Relatório de CNOs Emitidos (Produtividade) — no visual do "Relatório de Obras Cadastradas" */
.rcno { --rcno-azul: #1e3a8a; --rcno-texto: #0f172a; --rcno-suave: #64748b; --rcno-linha: #e2e8f0; --rcno-fundo: #f8fafc;
  background: #fff; color: var(--rcno-texto); padding: 28px 32px 20px; max-width: 1000px; margin: 0 auto; font-family: "Roboto", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rcno .rcno-titulo { margin: 0; color: var(--rcno-azul); font-size: 1.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }
.rcno .rcno-sub { margin: 6px 0 0; color: var(--rcno-suave); font-size: 0.92rem; padding-bottom: 14px; border-bottom: 3px solid var(--rcno-azul); }
.rcno .rcno-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.rcno .rcno-card { background: var(--rcno-fundo); border: 1px solid var(--rcno-linha); border-left: 4px solid var(--rcno-azul); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.rcno .rcno-card span { color: var(--rcno-suave); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.rcno .rcno-card strong { font-size: 1.25rem; color: var(--rcno-texto); }
.rcno .rcno-card small { color: var(--rcno-suave); font-size: 0.72rem; }
.rcno table.rcno-tabela { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin: 0; }
.rcno table.rcno-tabela thead th { background: var(--rcno-azul); color: #fff; text-transform: uppercase; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; padding: 9px 10px; text-align: left; border: 0; white-space: nowrap; }
.rcno table.rcno-tabela td { padding: 10px; border: 0; border-bottom: 1px solid var(--rcno-linha); color: #334155; vertical-align: middle; white-space: normal; }
.rcno table.rcno-tabela tbody tr:nth-child(even) td { background: var(--rcno-fundo); }
.rcno table.rcno-tabela tr.rcno-mes td { background: #eef2fb !important; color: var(--rcno-azul); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; padding: 6px 10px; }
.rcno .rcno-cno { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.86rem; white-space: nowrap; color: var(--rcno-texto); }
.rcno .rcno-num { text-align: right; white-space: nowrap; }
.rcno .rcno-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 0.76rem; font-weight: 700; border: 1px solid; white-space: nowrap; }
.rcno .rcno-uni { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.rcno .rcno-multi { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.rcno .rcno-outra { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.rcno .rcno-vazio { color: #94a3b8; font-style: italic; }
.rcno .rcno-rodape { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--rcno-linha); color: var(--rcno-suave); font-size: 0.78rem; }
#prodRelatorio .rcno { border: 1px solid var(--rcno-linha); border-radius: 6px; }
@media (max-width: 700px) {
  .rcno { padding: 16px 12px; }
  .rcno .rcno-cards { grid-template-columns: 1fr; }
  #prodRelatorio .rcno { overflow-x: auto; }
}
.prod-pdfs { margin: 10px 0; padding: 8px 12px; border: 1px dashed #b8c4cf; border-radius: 6px; background: #f8fafc; }
.prod-pdfs > summary { cursor: pointer; font-weight: 600; color: #0b3d59; }
.prod-pdfs .relatorio-filtros button { margin-top: 0; }
@media print {
  body.imprimir-produtividade #prodImpressao .rcno { padding: 0; max-width: none; border: 0; }
  body.imprimir-produtividade #prodImpressao .rcno table.rcno-tabela { font-size: 8.5pt; }
  body.imprimir-produtividade #prodImpressao .rcno thead { display: table-header-group; }
  body.imprimir-produtividade #prodImpressao { page: relatorio-cnos; }
}
@page relatorio-cnos { size: A4; margin: 14mm 12mm 16mm;
  @bottom-left { content: "eSocial Simples • Cadastro Nacional de Obras"; font: 8pt sans-serif; color: #64748b; }
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt sans-serif; color: #64748b; }
}
@media print { body.imprimir-produtividade #prodImpressao .rcno .rcno-rodape span:first-child { display: none; } }
.rcno table.rcno-tabela { table-layout: fixed; }
.rcno table.rcno-tabela th:nth-child(1) { width: 12%; }
.rcno table.rcno-tabela th:nth-child(2) { width: 16%; }
.rcno table.rcno-tabela th:nth-child(3) { width: 21%; }
.rcno table.rcno-tabela th:nth-child(4) { width: 22%; }
.rcno table.rcno-tabela th:nth-child(5) { width: 11%; }
.rcno table.rcno-tabela th:nth-child(6) { width: 18%; }
.rcno table.rcno-tabela td.rcno-num, .rcno table.rcno-tabela td.rcno-cno, .rcno table.rcno-tabela td:first-child { white-space: nowrap; }
.rcno table.rcno-tabela td.rcno-cno { font-size: 0.8rem; }
.rcno .rcno-badge { white-space: normal; }
@media print {
  html, body.imprimir-produtividade, body.imprimir-produtividade #prodImpressao, body.imprimir-produtividade #prodImpressao .lista { background: #fff !important; margin: 0; padding: 0; }
  body.imprimir-produtividade #prodImpressao .rcno table.rcno-tabela td.rcno-cno { font-size: 7.8pt; }
}
@media (max-width: 700px) { .rcno table.rcno-tabela { table-layout: auto; min-width: 680px; } }
.rcno table.rcno-tabela thead th { white-space: normal; vertical-align: middle; line-height: 1.2; }
.rcno table.rcno-tabela th:nth-child(3) { width: 19%; }
.rcno table.rcno-tabela th:nth-child(4) { width: 21%; }
.rcno table.rcno-tabela th:nth-child(6) { width: 21%; }
.rcno .rcno-badge { white-space: nowrap; }
@media print { body.imprimir-produtividade #prodImpressao .rcno .rcno-badge { font-size: 7.2pt; padding: 1px 6px; } }

/* Lançar Período: várias obras e folhas aguardando fechamento */
.lote-dica-varias { background: #f1f6fb; border-left: 3px solid #0b3d59; padding: 8px 10px; border-radius: 4px; }
.lote-pendentes-caixa { background: #fff8e6; border-color: #f0d796; }
.lote-pendentes-meses { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0; }
.lote-pendentes-meses .linha-checkbox { margin: 0; }
.lote-lista-obras .lote-caixa { border-color: #b9cde0; background: #f6f9fc; }
.lote-lista-obras td { vertical-align: top; }
#loteFolhasPendentes button, #loteListaObras button:not(.botao-link) { margin-top: 0; }

/* Relatório Gerencial (Produtividade) — mesmo visual do de CNOs, em paisagem */
.rcno.rger { max-width: 1400px; }
.rger .rger-cards { grid-template-columns: repeat(4, 1fr); }
.rcno table.rger-tipos { width: auto; min-width: 360px; margin: 0 0 18px; }
.rcno table.rger-tabela { table-layout: fixed; }
.rcno table.rger-tabela th:nth-child(1) { width: 8%; }
.rcno table.rger-tabela th:nth-child(2) { width: 9%; }
.rcno table.rger-tabela th:nth-child(3) { width: 11%; }
.rcno table.rger-tabela th:nth-child(4) { width: 14%; }
.rcno table.rger-tabela th:nth-child(5) { width: 16%; }
.rcno table.rger-tabela th:nth-child(6) { width: 15%; }
.rcno table.rger-tabela th:nth-child(7) { width: 27%; }
.rcno table.rger-tabela td { vertical-align: top; }
.rcno table.rger-tabela td.rger-hora { white-space: normal; font-size: 0.82rem; }
.rger .rger-prest { padding: 1px 0; min-height: 1.35em; }
.rger .rger-prest + .rger-prest { border-top: 1px dashed #e2e8f0; }
.rger td.rger-rem { font-size: 0.82rem; }
@media (max-width: 700px) { .rger .rger-cards { grid-template-columns: 1fr 1fr; } .rcno table.rger-tabela { table-layout: auto; min-width: 900px; } }
@media print {
  body.imprimir-produtividade #prodImpressao.rel-gerencial { page: relatorio-gerencial; }
  body.imprimir-produtividade #prodImpressao .rger table.rger-tabela { font-size: 7.8pt; }
  body.imprimir-produtividade #prodImpressao .rger .rcno-card strong { font-size: 13pt; }
  body.imprimir-produtividade #prodImpressao .rger .rcno-rodape span:first-child { display: none; }
}
@page relatorio-gerencial { size: A4 landscape; margin: 12mm 12mm 14mm;
  @bottom-left { content: "eSocial Simples • Produtividade"; font: 8pt sans-serif; color: #64748b; }
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt sans-serif; color: #64748b; }
}
.rcno table.rger-tabela tbody tr:nth-child(even) td { background: transparent; }
.rcno table.rger-tabela tbody tr.rger-par td { background: #f8fafc; }
.rcno table.rger-tabela tbody tr.rger-impar td { background: #fff; }
.rcno table.rger-tabela tbody tr.rcno-mes td { background: #eef2fb !important; }
.rcno table.rcno-tabela.rger-tipos { width: auto; min-width: 380px; table-layout: auto; }
.rcno table.rcno-tabela.rger-tipos th { width: auto !important; }
.rcno table.rger-tabela td.rger-hora, .rcno table.rger-tabela td.rger-rem { font-size: 0.95em; }
