/* =========================================================
   CONTAS A PAGAR — PREMIUM ERP
========================================================= */

#tab-contas-pagar {
  padding: 0;
}

/* =========================================================
   HERO
========================================================= */

.cp-hero {
  margin-bottom: 24px;
}

.cp-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.cp-tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.cp-hero h2 {
  font-size: 34px;
  font-weight: 950;
  color: #0f172a;
  margin-bottom: 8px;
}

.cp-hero p {
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

.cp-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* =========================================================
   BOTÕES
========================================================= */

.cp-btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: none;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  transition: 0.2s ease;
  white-space: nowrap;
}

.cp-btn-primary {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.18);
}

.cp-btn-primary:hover {
  transform: translateY(-1px);
}

.cp-btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.cp-btn-outline {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  color: #334155;
}

.cp-btn-outline:hover,
.cp-btn-secondary:hover {
  background: #f8fafc;
}

/* =========================================================
   KPIs
========================================================= */

.cp-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.cp-kpi {
  background: #ffffff;
  border-radius: 20px;
  padding: 22px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.cp-kpi span {
  display: block;
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}

.cp-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 950;
  color: #0f172a;
}

.cp-kpi small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
}

/* =========================================================
   CARDS
========================================================= */

.cp-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 26px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
  margin-bottom: 24px;
}

.cp-card-head {
  margin-bottom: 22px;
}

.cp-card-head-space {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.cp-card-head h3 {
  font-size: 18px;
  font-weight: 950;
  color: #0f172a;
  margin-bottom: 4px;
}

.cp-card-head p {
  font-size: 13px;
  color: #64748b;
}

/* =========================================================
   FORMULÁRIOS
========================================================= */

.cp-form-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 14px;
  align-items: end;
}

.cp-field {
  display: flex;
  flex-direction: column;
}

.cp-field-wide {
  grid-column: span 2;
}

.cp-field label {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  margin-bottom: 6px;
}

.cp-field input,
.cp-field select {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid #dbe2ea;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  background: #ffffff;
}

.cp-field input:focus,
.cp-field select:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

/* =========================================================
   TOGGLES
========================================================= */

.cp-toggle {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
}

.cp-toggle.active,
.cp-toggle.ativo {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.toggle-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #cbd5e1;
}

.cp-toggle.active .toggle-dot,
.cp-toggle.ativo .toggle-dot {
  background: #ffffff;
}

/* =========================================================
   AÇÕES
========================================================= */

.cp-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.cp-table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================================================
   FILTROS
========================================================= */

.cp-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}

.cp-filter-action {
  display: flex;
}

.cp-filter-action .cp-btn {
  width: 100%;
}

/* =========================================================
   TABELA
========================================================= */

.cp-table-wrap {
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  overflow: auto;
  max-height: 650px;
}

.cp-table {
  width: 100%;
  min-width: 1350px;
  border-collapse: collapse;
}

.cp-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 5;

  padding: 14px 12px;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #e5e7eb;
}

.cp-table td {
  padding: 13px 12px;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid #eef2f7;
}

.cp-table tbody tr:hover {
  background: #f8fafc;
}

/* =========================================================
   STATUS POR COR
========================================================= */

.cp-table tbody tr.linha-ok {
  background: #f0fdf4;
}

.cp-table tbody tr.linha-ok:hover {
  background: #dcfce7;
}

.cp-table tbody tr.linha-alerta {
  background: #fffbeb;
}

.cp-table tbody tr.linha-alerta:hover {
  background: #fef3c7;
}

.cp-table tbody tr.linha-vencida {
  background: #fff1f2;
}

.cp-table tbody tr.linha-vencida:hover {
  background: #ffe4e6;
}

.cp-table tbody tr.linha-selecionada {
  background: #fee2e2 !important;
}

.cp-table tbody tr.linha-selecionada td {
  color: #7f1d1d;
}

/* =========================================================
   CHECKBOX CENTRALIZADO DEFINITIVO
========================================================= */

.cp-table th:first-child,
.cp-table td.cp-check-cell {
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  padding: 0 !important;
  text-align: center !important;
  vertical-align: middle !important;
  position: relative;
}

.cp-table td.cp-check-cell {
  display: table-cell !important;
}

.cp-table td.cp-check-cell input[type="checkbox"] {
  appearance: auto !important;

  position: absolute !important;
  top: 50% !important;
  left: 50% !important;

  transform: translate(-50%, -50%) !important;

  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;

  cursor: pointer;
  z-index: 10;
}

.cp-table td.cp-check-cell::after {
  display: none !important;
}

/* barrinha lateral sem deslocar checkbox */
.cp-table tbody tr td.cp-check-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;

  width: 4px;
  height: 100%;
}

.cp-table tbody tr.linha-ok td.cp-check-cell::before {
  background: #16a34a;
}

.cp-table tbody tr.linha-alerta td.cp-check-cell::before {
  background: #f59e0b;
}

.cp-table tbody tr.linha-vencida td.cp-check-cell::before {
  background: #dc2626;
}

.cp-table tbody tr.linha-selecionada td.cp-check-cell::before {
  background: #7f1d1d;
}

/* =========================================================
   STATUS / BOTÕES DA TABELA
========================================================= */

.doc-status {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 900;
  margin: 2px;
}

.doc-status.ok {
  background: #dcfce7;
  color: #166534;
}

.doc-status.pendente {
  background: #fee2e2;
  color: #991b1b;
}

.btn-editar,
.btn-duplicar,
.btn-pagar,
.btn-excluir {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 900;
  margin: 2px;
}

.btn-editar {
  background: #dbeafe;
  color: #1d4ed8;
}

.btn-duplicar {
  background: #ede9fe;
  color: #5b21b6;
}

.btn-pagar {
  background: #dcfce7;
  color: #166534;
}

.btn-excluir {
  background: #fee2e2;
  color: #991b1b;
}

/* =========================================================
   RESPONSIVO
========================================================= */

@media (max-width: 1600px) {
  .cp-form-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .cp-filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cp-field-wide {
    grid-column: span 2;
  }
}

@media (max-width: 1100px) {
  .cp-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .cp-hero-top,
  .cp-card-head-space {
    flex-direction: column;
    align-items: flex-start;
  }

  .cp-form-grid,
  .cp-filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cp-field-wide {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .cp-kpis,
  .cp-form-grid,
  .cp-filter-grid {
    grid-template-columns: 1fr;
  }

  .cp-field-wide {
    grid-column: span 1;
  }

  .cp-hero h2 {
    font-size: 28px;
  }

  .cp-card {
    padding: 18px;
    border-radius: 20px;
  }

  .cp-table {
    min-width: 1050px;
  }
}
