:root{
  --navy-900:#0a1a2f;
  --navy-800:#0d2440;
  --teal-400:#1abc9c;
  --teal-300:#2dd4bf;
  --ink:#33394a;
  --muted:#8b93a3;
  --border:#e5e8f0;
  --bg:#f4f6fa;
  --card:#ffffff;
  /* Tudo na tabela é dimensionado em "em" a partir de --fs, que acompanha a largura
     da janela: fonte, espaçamentos, botões e badges diminuem juntos, sem scrollbar. */
  --fs: clamp(6px, 1.02vw, 13px);
  /* Mesma ideia pro topo (título + botão) e pra barra de filtros: 14px na
     largura cheia, diminuindo junto com a janela. */
  --fs-ui: clamp(6px, 1.19vw, 14px);
}

*{ box-sizing:border-box; }

body {
  font-family:'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px clamp(6px, 1.5vw, 24px) 64px;
  color: var(--ink);
  background: var(--bg);
}

.topo {
  font-size: var(--fs-ui);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85em;
  margin-bottom: 1.7em;
}

.topo button {
  font-size: 1em;
  padding: .72em 1.3em;
  border-radius: .72em;
}

.topo button svg {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.22em;
  margin-right: .43em;
}

h1 {
  font-size: 1.57em;
  font-weight: 700;
  margin: 0;
  color: var(--navy-900);
  letter-spacing: -0.2px;
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #e3f7f2;
  color: #0f7a63;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(26,188,156,0.16);
  transition: background .15s, transform .15s, box-shadow .15s;
}

button:hover {
  background: #d3f1e9;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(26,188,156,0.22);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(26,188,156,0.16);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.filtros {
  font-size: var(--fs-ui);
  display: flex;
  gap: .72em;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.43em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1em;
  padding: 1em 1.15em;
  box-shadow: 0 2px 10px rgba(10,26,47,0.04);
}

.filtros input,
.filtros select {
  padding: .72em .86em;
  border: 1.5px solid var(--border);
  border-radius: .72em;
  font-size: 1em;
  font-family: inherit;
  color: var(--navy-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.filtros input:focus,
.filtros select:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(26,188,156,0.14);
}

.filtros span {
  color: var(--muted);
  font-size: .93em;
}

#busca {
  flex: 1;
  min-width: 12em;
}

.acoes-selecao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9em;
  flex-wrap: wrap;
  background: #f0fdfa;
  border: 1px solid #b8ece1;
  border-radius: .95em;
  padding: .75em 1.2em;
  margin-bottom: 1.1em;
  font-size: var(--fs);
  color: #0f7a63;
  font-weight: 600;
}

.acoes-selecao button {
  font-size: 1em;
  padding: .75em 1.3em;
  border-radius: .75em;
}

.acoes-selecao[hidden] {
  display: none;
}

.acoes-selecao-botoes {
  display: flex;
  gap: 10px;
}

.btn-secundario {
  background: #fff;
  color: var(--muted);
  border: 1.5px solid var(--border);
  box-shadow: none;
}

.btn-secundario:hover {
  background: #f4f5f7;
  color: var(--navy-900);
  transform: none;
  box-shadow: none;
}

.col-checkbox {
  width: 2.8em;
  text-align: center;
}

.chk-comprovante,
#chkSelecionarTodos {
  font-size: inherit;
  width: 1.25em;
  height: 1.25em;
  margin: 0;
  accent-color: var(--teal-400);
  cursor: pointer;
  vertical-align: middle;
}

/* NUNCA usar overflow:hidden aqui (nem em nenhum ancestral da <th>) — isso faz
   o cabeçalho parar de "grudar" no topo real da página, porque o sticky passa
   a colar no topo desse container em vez do topo da janela. Por isso o
   arredondado é feito nos cantos das células, não com clip no wrapper. */
.tabela-wrap {
  font-size: var(--fs);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(10,26,47,0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1em;
  background: var(--card);
}

/* Só o FAVORECIDO (.nome-txt) pode quebrar linha, e mesmo assim só quando o
   nome não cabe. Datas, valores, CPF/CNPJ, AP etc. nunca quebram no meio —
   com overflow-wrap:anywhere em tudo, o navegador espremia essas colunas a 1
   caractere ("14/09/202|6", "R$ 57.520,2|0") pra dar espaço ao nome. Os
   cabeçalhos só quebram nos espaços ("Tipo|Documento"), nunca no meio da
   palavra ("COMPROVANT|E"). */
th, td {
  padding: 1em .8em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--navy-900);
  color: #fff;
  text-transform: uppercase;
  font-size: .85em;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 1.2em .8em;
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 1;
}

th:first-child { border-top-left-radius: 14px; }
th:last-child { border-top-right-radius: 14px; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 14px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 14px; }

tbody tr:hover {
  background: #f7fbfa;
}

tbody tr:last-child td {
  border-bottom: none;
}

#mensagem {
  color: var(--muted);
  font-size: var(--fs);
  margin-top: 1.1em;
  text-align: center;
}

.linha-manual td {
  color: #2b6fd1;
}

.btn-expandir {
  border: none;
  background: none;
  padding: 0;
  font-size: .85em;
  flex: none;
  margin-top: .15em;
  cursor: pointer;
  color: var(--muted);
  box-shadow: none;
}

/* FAVORECIDO acompanha o tamanho do nome; só quebra de linha acima de ~21em */
.nome-flex {
  display: flex;
  align-items: flex-start;
  gap: .45em;
}

.nome-txt {
  display: block;
  max-width: 21em;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-expandir:hover {
  background: none;
  color: var(--navy-900);
  transform: none;
  box-shadow: none;
}

.linha-detalhe.oculta {
  display: none;
}

.linha-detalhe td {
  background: #fafbfd;
  padding: .6em .8em 1em 2.6em;
}

.tabela-detalhe {
  width: auto;
  min-width: 24em;
  max-width: 100%;
  border-collapse: collapse;
  font-size: .93em;
  box-shadow: none;
  border-radius: 0;
}

.tabela-detalhe th,
.tabela-detalhe td {
  padding: .5em .9em;
  text-align: left;
  border-bottom: 1px solid #ececf2;
}

.tabela-detalhe th {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .85em;
}

.badge-banco {
  display: inline-block;
  padding: .35em 1em;
  border-radius: 999px;
  font-weight: 600;
  font-size: .93em;
}

.banco-santander {
  background: #ffe1e1;
  color: #b02a2a;
}

.banco-sicoob {
  background: #dcf5df;
  color: #1c7a3a;
}

.banco-sox {
  background: #dbeafe;
  color: #1d4ed8;
}

.tooltip-historico {
  position: absolute;
  z-index: 20;
  max-width: 22em;
  padding: .7em 1em;
  border-radius: .72em;
  background: var(--navy-900);
  color: #fff;
  font-size: var(--fs-ui);
  line-height: 1.4;
  box-shadow: 0 10px 22px rgba(10,26,47,0.28);
  white-space: pre-wrap;
  pointer-events: none;
}

.col-comprovante,
.col-centro {
  text-align: center;
}

.btn-baixar-comprovante {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8em;
  height: 2.8em;
  padding: 0;
  font-size: 1em;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--navy-900);
  cursor: pointer;
  box-shadow: none;
}

.btn-baixar-comprovante svg {
  width: 1.4em;
  height: 1.4em;
}

.btn-baixar-comprovante:hover {
  background: #f0fdfa;
  border-color: var(--teal-400);
  color: var(--teal-400);
  transform: none;
  box-shadow: none;
}

/* telas estreitas: menos espaçamento lateral para sobrar mais espaço ao conteúdo */
@media (max-width: 600px) {
  th, td { padding-left: .3em; padding-right: .3em; }
  th { letter-spacing: 0; }
  .linha-detalhe td { padding-left: 1em; }
  .tabela-detalhe th, .tabela-detalhe td { padding-left: .4em; padding-right: .4em; }
  .nome-flex { gap: .25em; }
}

/* ---- Modal de conciliação ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 47, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(10,26,47,0.28);
}

.modal-fechar {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f4f5f7;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  box-shadow: none;
}

.modal-fechar:hover {
  background: #e9ebef;
  color: var(--navy-900);
  transform: none;
  box-shadow: none;
}

#conciliarForm div {
  margin-bottom: 16px;
}

#conciliarForm label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

#conciliarForm input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--ink);
  padding: 8px 0;
}

#conciliarForm button[type="submit"] {
  width: 100%;
  padding: 12px 16px;
  margin-top: 4px;
}

#resultado {
  white-space: pre-wrap;
  font-size: 13px;
  background: #f4f6fa;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 16px 0;
  color: var(--ink);
}

#resultado:empty {
  display: none;
  margin: 0;
}

#statusEnvio {
  font-size: 13px;
  margin-top: 10px;
  color: var(--muted);
  text-align: center;
}

#areaManual {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 16px;
}

#areaManual p {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

#areaManual div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s, background .15s;
}

#areaManual div:hover {
  border-color: var(--teal-400);
}

#enviarBtn {
  width: 100%;
}

/* ---- Edição de conciliação manual (SOX) ---- */

.btn-editar-manual {
  border: none;
  background: none;
  padding: 0;
  font-size: .95em;
  flex: none;
  cursor: pointer;
  color: var(--muted);
  box-shadow: none;
}

.btn-editar-manual:hover {
  background: none;
  color: var(--navy-900);
  transform: none;
  box-shadow: none;
}

.editar-manual-titulo {
  margin: 0 32px 16px 0;
  font-weight: 600;
  color: var(--navy-900);
}

#editarManualForm div {
  margin-bottom: 16px;
}

#editarManualForm label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

#editarManualForm input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: .72em .86em;
  border: 1.5px solid var(--border);
  border-radius: .72em;
  font-size: 1em;
  font-family: inherit;
  color: var(--navy-900);
  background: #fff;
}

#editarManualForm input[type="text"]:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(26,188,156,0.14);
}

#editarManualForm button[type="submit"] {
  width: 100%;
  padding: 12px 16px;
  margin-top: 4px;
}

#statusEditarManual {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}
