:root {
  --fundo: #f4f6f8; --cartao: #fff; --texto: #1d2733; --suave: #5d6b7a; --borda: #d8dee5;
  --primaria: #0f5c8c; --primaria-esc: #0a4569; --perigo: #b3261e; --ok: #1e7b3c; --atencao: #a15c00;
  --raio: 8px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto);
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--fundo); }
body { font-size: 15px; line-height: 1.4; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; margin-top: 1rem; }
a { color: var(--primaria); }
.marca { color: var(--primaria); font-weight: 800; }
.sub { display: block; color: var(--suave); font-size: .8rem; }
.vermelho { color: var(--perigo); }
.quebra { word-break: break-all; }
.riscado { text-decoration: line-through; color: var(--suave); }

/* Rolagem sempre visível quando o conteúdo não cabe */
.rolagem, .janela .corpo, .cartao ul { overflow: auto; scrollbar-width: auto; scrollbar-color: #9aa7b4 #e6eaee; }
.rolagem::-webkit-scrollbar, .janela .corpo::-webkit-scrollbar, .cartao ul::-webkit-scrollbar { width: 12px; height: 12px; }
.rolagem::-webkit-scrollbar-thumb, .janela .corpo::-webkit-scrollbar-thumb, .cartao ul::-webkit-scrollbar-thumb { background: #9aa7b4; border-radius: 6px; border: 2px solid #e6eaee; }
.rolagem::-webkit-scrollbar-track, .janela .corpo::-webkit-scrollbar-track, .cartao ul::-webkit-scrollbar-track { background: #e6eaee; }

.btn { font: inherit; padding: .5rem .9rem; border-radius: var(--raio); border: 1px solid var(--borda); background: #fff; color: var(--texto); cursor: pointer; white-space: nowrap; min-height: 40px; }
.btn:hover:not(:disabled) { border-color: var(--primaria); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn.primario:hover:not(:disabled) { background: var(--primaria-esc); }
.btn.perigo { color: var(--perigo); border-color: #e8b4b0; }
.btn.link { border: 0; background: none; color: var(--primaria); padding: .4rem .5rem; min-height: 36px; }

input, select { font: inherit; width: 100%; min-width: 0; padding: .5rem .6rem; border: 1px solid var(--borda); border-radius: var(--raio); background: #fff; min-height: 40px; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--primaria); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--suave); min-width: 0; }
.erro { color: var(--perigo); margin: .6rem 0 0; }
.ajuda { color: var(--suave); font-size: .9rem; margin: 0 0 .8rem; }
.vazio { color: var(--suave); padding: 1.5rem 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px; padding: 1.1rem; min-width: 0; }
.login-cartao { width: 100%; max-width: 380px; }
.campos { display: flex; flex-direction: column; gap: .75rem; }

/* App */
.topo { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--borda); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .5rem 16px; }
.titulo { font-weight: 700; }
.abas { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1 1 auto; }
.abas button { font: inherit; border: 0; background: none; padding: .55rem .75rem; border-radius: var(--raio); cursor: pointer; color: var(--suave); min-height: 40px; }
.abas button.ativa { background: #e3eef6; color: var(--primaria); font-weight: 600; }
.selo { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 1em; background: var(--perigo); color: #fff; font-size: .75rem; text-align: center; }
.quem { display: flex; align-items: center; gap: .25rem; color: var(--suave); font-size: .9rem; }
.pagina { padding: 16px; max-width: 1400px; margin: 0 auto; }
.barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.barra select { width: auto; }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.resumo { margin: 0 0 .6rem; }

.rolagem { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); max-height: calc(100vh - 260px); min-height: 160px; }
table { border-collapse: collapse; width: 100%; min-width: 820px; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #edf0f3; vertical-align: top; }
th { position: sticky; top: 0; background: #f8fafb; font-size: .8rem; color: var(--suave); z-index: 1; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.acoes { white-space: nowrap; text-align: right; }
td.acoes .btn { margin-left: .25rem; }
tr.golpe td { background: #fdeeed; }
.alerta { display: inline-block; font-size: .75rem; padding: .1rem .4rem; border-radius: 4px; margin: 0 .2rem .2rem 0; background: #eef1f4; color: var(--suave); }
p.alerta { display: block; font-size: .9rem; padding: .4rem .6rem; }
.a-GOLPE_SUSPEITO, .a-DUPLICIDADE { background: #fdeeed; color: var(--perigo); font-weight: 600; }
.a-VENCIDO, .a-DFX_DO_CLAUDEMIR { background: #fff4e0; color: var(--atencao); }
.sit { font-size: .85rem; padding: .1rem .45rem; border-radius: 4px; background: #eef1f4; display: inline-block; }
.s-vencido, .f-erro { background: #fdeeed; color: var(--perigo); font-weight: 600; }
.s-vence_hoje, .s-esta_semana, .f-pendente { background: #fff4e0; color: var(--atencao); }
.s-pago, .f-feito { background: #e6f4ea; color: var(--ok); }

.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; }
.cartao ul { margin: 0; padding-left: 1.1rem; max-height: 320px; }
.cartao li { margin: .15rem 0; }

/* Janelas */
.fundo { position: fixed; inset: 0; background: rgba(20, 30, 40, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.janela { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; min-width: 0; }
.janela header, .janela footer { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; flex-wrap: wrap; }
.janela header { border-bottom: 1px solid var(--borda); justify-content: space-between; }
.janela header h3 { margin: 0; overflow-wrap: anywhere; }
.janela footer { border-top: 1px solid var(--borda); }
.janela .corpo { padding: 1rem; display: flex; flex-direction: column; gap: .75rem; flex: 1 1 auto; min-height: 0; }
.janela .erro { padding: 0 1rem .75rem; margin: 0; }
.espaco { flex: 1 1 auto; }
.duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; }
.ficha dt { color: var(--suave); } .ficha dd { margin: 0; min-width: 0; }
.aviso-flutuante { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); background: #1d2733; color: #fff; padding: .6rem 1rem; border-radius: var(--raio); z-index: 60; max-width: calc(100vw - 32px); }

@media (max-width: 560px) {
  .ficha { grid-template-columns: 1fr; } .ficha dd { margin-bottom: .4rem; }
  .rolagem { max-height: none; }
  .janela footer .btn { flex: 1 1 auto; }
}
/* Botões da linha sempre à vista, mesmo com a tabela rolando para o lado */
td.acoes, th:last-child { position: sticky; right: 0; background: #fff; box-shadow: -6px 0 6px -6px rgba(0,0,0,.25); }
th:last-child { background: #f8fafb; z-index: 2; }
tr.golpe td.acoes { background: #fdeeed; }

/* Extratos e resultado */
.envio { margin-bottom: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.linha-botoes { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ok { color: var(--ok); margin: 0; }
.check { flex-direction: row; align-items: center; gap: .35rem; font-size: .9rem; }
.check input { width: auto; min-height: 0; }
.cand { display: block; font-size: .85rem; }
.rolagem.baixa { max-height: 320px; }
table.dre { min-width: 640px; }
table.dre tr.sub td { font-weight: 700; background: #f3f7fa; }
h3 { margin-top: 1rem; }
/* Tabelas sem coluna de botões: última coluna rola junto */
table.livre th:last-child { position: sticky; top: 0; right: auto; box-shadow: none; }
