/* ===========================================================
   Estrutura geral
   =========================================================== */
.c-container.c-container--2xl{ max-width: var(--c-container-2xl); width:100%; box-sizing:border-box; }

h1{
  text-align:center; color:var(--c-primary-600); margin-bottom:var(--c-space-6);
  font-size:1.9rem; letter-spacing:.2px;
}

/* ===========================================================
   Saldos
   =========================================================== */
.saldos{ display:flex; justify-content:space-between; gap:var(--c-space-4); margin-bottom:var(--c-space-8); flex-wrap:wrap; }
.saldo-box{
  flex:1 1 220px; background:#e8f0ff; border-radius:10px; padding:18px 20px; text-align:center;
  font-weight:600; font-size:1.15rem; color:#2563eb; box-shadow:0 2px 8px rgba(37,99,235,.18); border:1px solid rgba(37,99,235,.15);
}
.saldo-total{ background:#2563eb; color:#fff; box-shadow:0 6px 18px rgba(37,99,235,.35); }
.saldo-label{ font-weight:700; font-size:1.05rem; color:#475569; margin-bottom:6px; }

/* ===========================================================
   Cards
   =========================================================== */
.card{ background:#fff; border-radius:10px; box-shadow:0 0 15px rgba(0,0,0,.06); border:1px solid var(--c-border,#e5e7eb); }
.card-header{ padding:14px 18px; border-bottom:1px solid var(--c-border,#e5e7eb); }
.card-title{ margin:0; color:#1d4ed8; font-size:1.1rem; font-weight:700; }
.card-body{ padding:16px 18px 20px; }

/* ===========================================================
   Formulários / Botões
   =========================================================== */
form#formMovimentacao{ display:flex; flex-direction:column; gap:var(--c-space-6); }
.linha{ display:flex; gap:var(--c-space-4); flex-wrap:wrap; }
.campo{ flex:1 1 30%; display:flex; flex-direction:column; min-width:220px; }
label{ font-weight:600; color:#1e293b; margin-bottom:6px; font-size:.95rem; }
input,select,textarea{ font-size:14px; font-family:inherit; }
textarea{ min-height:90px; }

.btn{ display:inline-flex; align-items:center; justify-content:center; gap:.4rem; padding:8px 12px; font-size:.9rem; line-height:1; border-radius:10px; width:auto; white-space:nowrap; }
.btn-sm{ padding:6px 10px; font-size:.85rem; }
.btn-secondary{ background:#f3f4f6; color:#111827; border:1px solid #e5e7eb; }
.btn-secondary:hover{ background:#e9ebef; }
.btn-light{ background:#fff; color:#111827; border:1px solid #e5e7eb; }
.btn-light:hover{ background:#f9fafb; }
.btn-icon{ background:transparent; border:none; font-size:1rem; line-height:1; cursor:pointer; }

/* ===========================================================
   Tabela base
   =========================================================== */
.tabela-wrapper{ width:100%; overflow:auto; }
.tabela{
  width:100%; border-collapse:separate; border-spacing:0; background:#fff;
  border:1px solid var(--c-border,#e5e7eb); border-radius:10px; overflow:hidden;
}
.tabela thead th{
  background:#f8fafc; color:#334155; font-weight:700; text-align:left;
  padding:10px 12px; border-bottom:1px solid var(--c-border,#e5e7eb); white-space:nowrap;
}
.tabela tbody td{ padding:10px 12px; border-bottom:1px solid #eef2f7; vertical-align:top; }
.tabela tbody tr:hover{ background:#fafbff; }

/* Paginação */
.paginacao{ display:flex; align-items:center; gap:.5rem; }

/* ===========================================================
   Modal
   =========================================================== */
.modal[hidden]{ display:none !important; }
.modal{ position:fixed; inset:0; background:rgba(15,23,42,.4); display:grid; place-items:center; padding:1rem; z-index:1000; }
.modal-content{ width:min(980px,98vw); background:#fff; border-radius:12px; box-shadow:0 20px 50px rgba(0,0,0,.25); overflow:hidden; border:1px solid var(--c-border,#e5e7eb); }
.modal-header{ padding:14px 18px; border-bottom:1px solid var(--c-border,#e5e7eb); display:flex; align-items:center; justify-content:space-between; }
.modal-body{ padding:16px 18px; max-height:70vh; overflow:auto; }
.modal-footer{ padding:12px 18px 18px; display:flex; justify-content:flex-end; gap:.5rem; }

.lista-anexos{ list-style:none; padding:0; margin:.25rem 0 0; }
.lista-anexos li{ display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:8px 10px; border:1px solid #eef2f7; border-radius:8px; margin-bottom:6px; background:#fcfdff; }

/* ===========================================================
   Responsividade
   =========================================================== */
@media (max-width:1024px){
  .tabela thead th:nth-child(13),
  .tabela tbody td:nth-child(13){ display:none; } /* subcategoria */
}
@media (max-width:900px){
  .tabela thead th:nth-child(11),
  .tabela tbody td:nth-child(11){ display:none; } /* fornecedor */
  .tabela thead th:nth-child(12),
  .tabela tbody td:nth-child(12){ display:none; } /* categoria */
}
@media (max-width:768px){
  .linha{ flex-direction:column; }
  .campo{ flex:1 1 100%; }
}

/* ===========================================================
   Abas
   =========================================================== */
.tabs{ background:#fff; border:1px solid var(--c-border,#e5e7eb); border-radius:12px; }
.tablist{ display:flex; gap:6px; padding:10px; border-bottom:1px solid var(--c-border,#e5e7eb); background:#f8fafc; border-top-left-radius:12px; border-top-right-radius:12px; }
.tab{ appearance:none; border:1px solid var(--c-border,#e5e7eb); background:#fff; padding:8px 12px; border-radius:8px; cursor:pointer; font-weight:600; }
.tab.ativa{ background:#111827; color:#fff; border-color:#111827; }
.tabpanel{ padding:12px; }
.tabpanel[hidden]{ display:none !important; }

/* ===========================================================
   Movimentações: card fixo com scroll + sticky header
   =========================================================== */
:root{
  --movs-height: 600px;
  --tabela-min-w: 1500px; /* +Anexo → dá um respiro a mais */
}
.movs-card{ display:flex; flex-direction:column; margin-bottom:1rem; }
.movs-card .card-header{ flex:0 0 auto; }
.movs-card .card-body{ flex:1 1 auto; display:flex; flex-direction:column; min-height:var(--movs-height); max-height:clamp(var(--movs-height),70vh,80vh); }
.movs-card .tabela-wrapper{ flex:1 1 auto; overflow:auto; border:1px solid var(--c-border,#e5e7eb); border-radius:10px; background:#fff; }
.movs-card .tabela{ min-width:var(--tabela-min-w); }
.movs-card .tabela thead th{ position:sticky; top:0; z-index:2; background:#f8fafc; }

@media (max-width:1024px){ :root{ --movs-height:65vh; } }
@media (max-width:768px){ :root{ --movs-height:60vh; --tabela-min-w:1100px; } }

/* ===========================================================
   Pré-lista de anexos (rename inputs)
   =========================================================== */
.pre-lista-anexos{ margin-top:8px; display:grid; gap:6px; }
.pre-lista-anexos .item{ display:grid; grid-template-columns:1fr minmax(180px,2fr); gap:8px; align-items:center; }
.pre-lista-anexos .item label{ margin:0; font-size:.85rem; color:#475569; font-weight:600; }
.pre-lista-anexos .item input{ padding:6px 8px; border:1px solid #e5e7eb; border-radius:8px; font-size:.9rem; }

/* ===========================================================
   Tabela de Movimentações — compacto + zebra + larguras
   =========================================================== */
:root{
  /* fontes/altura */
  --mov-font-size-base: 12px;
  --mov-font-size-header: 11px;
  --mov-row-h: 28px;

  /* zebra */
  --zebra-odd: #ffffff;
  --zebra-even: #f7fafc;

  /* larguras */
  --col-1-id: 50px;
  --col-2-data: 150px;
  --col-3-tipo: 60px;
  --col-4-conta: 60px;
  --col-5-valor: 60px;
  --col-6-multa: 60px;
  --col-7-juros: 60px;
  --col-8-encargos: 60px;
  --col-9-tipo-doc: 80px;
  --col-10-num-doc: 60px;
  --col-11-fornecedor: 250px;
  --col-12-categoria: 150px;
  --col-13-subcategoria: 150px;
  --col-14-observacao: auto;
  --col-15-anexo: 96px;   /* NOVO */
  --col-16-acoes: 130px;  /* NOVO */
}

/* base + cabeçalho */
#tabelaMovimentacoes{
  table-layout:fixed;
  width:100%;
  font-size:var(--mov-font-size-base) !important;
  border-collapse:separate;
  border-spacing:0;
}
#tabelaMovimentacoes thead th{
  font-size:var(--mov-font-size-header) !important;
}

/* compactação das linhas */
#tabelaMovimentacoes thead th,
#tabelaMovimentacoes tbody td{
  padding:4px 8px !important;
  height:var(--mov-row-h) !important;
  line-height:1.15 !important;
  vertical-align:middle;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* larguras por coluna */
#tabelaMovimentacoes th:nth-child(1),  #tabelaMovimentacoes td:nth-child(1)  { width:var(--col-1-id); }
#tabelaMovimentacoes th:nth-child(2),  #tabelaMovimentacoes td:nth-child(2)  { width:var(--col-2-data); }
#tabelaMovimentacoes th:nth-child(3),  #tabelaMovimentacoes td:nth-child(3)  { width:var(--col-3-tipo); }
#tabelaMovimentacoes th:nth-child(4),  #tabelaMovimentacoes td:nth-child(4)  { width:var(--col-4-conta); }
#tabelaMovimentacoes th:nth-child(5),  #tabelaMovimentacoes td:nth-child(5)  { width:var(--col-5-valor); }
#tabelaMovimentacoes th:nth-child(6),  #tabelaMovimentacoes td:nth-child(6)  { width:var(--col-6-multa); }
#tabelaMovimentacoes th:nth-child(7),  #tabelaMovimentacoes td:nth-child(7)  { width:var(--col-7-juros); }
#tabelaMovimentacoes th:nth-child(8),  #tabelaMovimentacoes td:nth-child(8)  { width:var(--col-8-encargos); }
#tabelaMovimentacoes th:nth-child(9),  #tabelaMovimentacoes td:nth-child(9)  { width:var(--col-9-tipo-doc); }
#tabelaMovimentacoes th:nth-child(10), #tabelaMovimentacoes td:nth-child(10) { width:var(--col-10-num-doc); }
#tabelaMovimentacoes th:nth-child(11), #tabelaMovimentacoes td:nth-child(11) { width:var(--col-11-fornecedor); }
#tabelaMovimentacoes th:nth-child(12), #tabelaMovimentacoes td:nth-child(12) { width:var(--col-12-categoria); }
#tabelaMovimentacoes th:nth-child(13), #tabelaMovimentacoes td:nth-child(13) { width:var(--col-13-subcategoria); }
#tabelaMovimentacoes th:nth-child(14), #tabelaMovimentacoes td:nth-child(14) { width:var(--col-14-observacao); }
#tabelaMovimentacoes th:nth-child(15), #tabelaMovimentacoes td:nth-child(15) { width:var(--col-15-anexo); }  /* Anexo */
#tabelaMovimentacoes th:nth-child(16), #tabelaMovimentacoes td:nth-child(16) { width:var(--col-16-acoes); }  /* Ações */

/* alinhar números */
#tabelaMovimentacoes td:nth-child(5),
#tabelaMovimentacoes td:nth-child(6),
#tabelaMovimentacoes td:nth-child(7),
#tabelaMovimentacoes td:nth-child(8){
  text-align:right !important;
}

/* zebra + hover robustos */
#tabelaMovimentacoes tbody tr:nth-child(odd)  td{ background:var(--zebra-odd) !important; }
#tabelaMovimentacoes tbody tr:nth-child(even) td{ background:var(--zebra-even) !important; }
#tabelaMovimentacoes tbody tr:hover td{ background:#eef2ff !important; }

/* ===== Coluna ANEXO ===== */
#tabelaMovimentacoes th.col-anexo,
#tabelaMovimentacoes td.col-anexo{
  text-align: center;
  white-space: nowrap;
}

/* Badge Anexo */
.tag-anexo{
  display:inline-flex; align-items:center; gap:6px;
  padding:2px 8px; font-size:.85rem; line-height:1.15;
  border-radius:999px; font-weight:600;
}
.tag-anexo.ok{  background:#e8f5e9; color:#16a34a; }
.tag-anexo.off{ background:#fff1f2; color:#dc2626; }
.tag-anexo .count{ font-variant-numeric:tabular-nums; opacity:.9; }

/* ===== Coluna AÇÕES ===== */
:root{
  --mov-btn-font: var(--mov-font-size-base);
  --mov-btn-h: var(--mov-row-h);
  --mov-btn-px: 10px;
}

#tabelaMovimentacoes td:nth-child(16){
  display:flex; align-items:center; gap:6px; white-space:nowrap;
}

#tabelaMovimentacoes td:nth-child(16) .btn{
  height:var(--mov-btn-h) !important;
  padding:0 var(--mov-btn-px) !important;
  font-size:var(--mov-btn-font) !important;
  line-height:1 !important;
  border-radius:8px;
}

#tabelaMovimentacoes td:nth-child(16) .btn-icon{
  height:var(--mov-btn-h) !important;
  width: var(--mov-btn-h) !important;
  padding:0 !important;
  font-size:calc(var(--mov-btn-font) + 2px) !important;
}
