/* =====================================================
   DASHBOARD CARTERA PREMIUM CSS
   AISLADO TOTAL
   PREFIX: dcrt-
===================================================== */

/* =========================
   LAYOUT
========================= */
.dcrt-layout{
  padding:20px;
  width:100%;
  box-sizing:border-box;
}

.dcrt-main{
  display:grid;
  grid-template-columns:1.35fr 1fr;
  gap:20px;
  align-items:start;
}

.dcrt-left,
.dcrt-right{
  display:flex;
  flex-direction:column;
  gap:20px;
  min-width:0;
}

/* =========================
   HEADER
========================= */
.dcrt-header{
  margin-bottom:20px;
}

.dcrt-header h2{
  margin:0;
  font-size:34px;
  font-weight:700;
  color:#111827;
}

/* =========================
   BUTTONS
========================= */
.dcrt-btn{
  border:none;
  border-radius:10px;
  height:44px;
  padding:0 18px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  transition:.2s ease;
  white-space:nowrap;
}

.dcrt-btn:hover{
  transform:translateY(-1px);
}

.dcrt-btn-primary{
  background:#2f56a6;
  color:#fff;
}

.dcrt-btn-light{
  background:#eef2f7;
  color:#111827;
}

.dcrt-btn-danger{
  background:#ea4335;
  color:#fff;
}

/* =========================
   FILTROS
========================= */
.dcrt-filters-box{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-bottom:18px;
}

.dcrt-toolbar{
  display:grid;
  grid-template-columns:
    auto auto auto
    110px
    auto auto auto auto
    auto auto auto;
  gap:10px;
  align-items:center;
}

.dcrt-select{
  width:110px;
  height:44px;
  padding:0 12px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
}

.dcrt-toolbar-bottom{
  display:grid;
  grid-template-columns:220px 220px 160px;
  gap:14px;
  align-items:end;
}

.dcrt-group{
  display:flex;
  flex-direction:column;
}

.dcrt-group label{
  font-size:12px;
  font-weight:600;
  color:#6b7280;
  margin-bottom:6px;
}

.dcrt-group input{
  width:100%;
  height:44px;
  padding:0 12px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
  box-sizing:border-box;
}

.dcrt-btn-group .dcrt-btn{
  width:100%;
}

/* =========================
   KPI CARDS
========================= */
.dcrt-cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:22px;
}

.dcrt-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  position:relative;
}

.dcrt-card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:5px;
  border-radius:14px 0 0 14px;
}

.dcrt-card h3{
  margin:0 0 10px;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  color:#6b7280;
  letter-spacing:.4px;
}

.dcrt-card p{
  margin:0;
  font-size:22px;
  font-weight:800;
  color:#111827;
}

.dcrt-small{
  font-size:17px !important;
  line-height:1.45;
}

/* COLORES */
.dcrt-periodo::before{ background:#34495e; }
.dcrt-total::before{ background:#2563eb; }
.dcrt-vencida::before{ background:#dc2626; }
.dcrt-corriente::before{ background:#16a34a; }
.dcrt-clientes::before{ background:#8e44ad; }
.dcrt-facturas::before{ background:#f39c12; }
.dcrt-mora::before{ background:#00a6a6; }
.dcrt-retenciones::before{ background:#c0392b; }

/* =========================
   BOXES
========================= */
.dcrt-table-card,
.dcrt-chart-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:16px;
}

.dcrt-table-card h3,
.dcrt-chart-card h3{
  margin:0 0 14px;
  font-size:18px;
  font-weight:700;
  color:#111827;
}

/* =========================
   TABLES
========================= */
.dcrt-table-scroll{
  max-height:500px;
  overflow:auto;
  border-radius:10px;
}

.dcrt-table{
  width:100%;
  min-width:760px;
  border-collapse:collapse;
}

.dcrt-table th{
  position:sticky;
  top:0;
  background:#f5f7fb;
  z-index:5;
  text-align:left;
  padding:12px 14px;
  font-size:13px;
  font-weight:700;
}

.dcrt-table td{
  padding:12px 14px;
  font-size:14px;
  border-bottom:1px solid #f1f1f1;
  white-space:nowrap;
}

.dcrt-table tbody tr:hover{
  background:#fafafa;
}

/* =========================
   CHARTS
========================= */
.dcrt-chart-wrap{
  position:relative;
  width:100%;
  height:320px;
}

.dcrt-chart-wrap canvas{
  width:100% !important;
  height:100% !important;
}

/* =========================
   HELPERS
========================= */
.dcrt-red{
  color:#dc2626;
  font-weight:700;
}

.dcrt-center{
  text-align:center;
}

/* =========================
   RESPONSIVE
========================= */
@media(max-width:1400px){

  .dcrt-cards{
    grid-template-columns:repeat(2,1fr);
  }

  .dcrt-main{
    grid-template-columns:1fr;
  }

  .dcrt-toolbar{
    grid-template-columns:repeat(3,1fr);
  }

  .dcrt-toolbar-bottom{
    grid-template-columns:1fr;
  }

}

@media(max-width:768px){

  .dcrt-cards{
    grid-template-columns:1fr;
  }

  .dcrt-toolbar{
    grid-template-columns:1fr;
  }

}

/* ==========================================
TABLAS CON EMPRESA A CARGO
========================================== */

.dcrt-table{
  min-width:1150px;
}

.dcrt-table th,
.dcrt-table td{
  font-size:13px;
  padding:10px 12px;
}

.dcrt-table td:nth-child(1),
.dcrt-table td:nth-child(2),
.dcrt-table th:nth-child(1),
.dcrt-table th:nth-child(2){
  max-width:220px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* =====================================================
TABLAS FULL WIDTH OPTIMIZADAS
===================================================== */

/* tarjetas más amplias */
.dcrt-left{
  width:100%;
}

.dcrt-table-card{
  width:100%;
  padding:14px;
}

/* scroll solo si realmente se necesita */
.dcrt-table-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y:auto;
}

/* tablas ocupar todo */
.dcrt-table{
  width:100%;
  min-width:100%;
  table-layout:auto;
  border-collapse:collapse;
}

/* encabezados compactos */
.dcrt-table th{
  font-size:12px;
  padding:9px 10px;
  white-space:nowrap;
}

/* filas compactas */
.dcrt-table td{
  font-size:12px;
  padding:9px 10px;
  white-space:nowrap;
}

/* primeras columnas más flexibles */
.dcrt-table th:nth-child(1),
.dcrt-table td:nth-child(1){
  width:140px;
}

.dcrt-table th:nth-child(2),
.dcrt-table td:nth-child(2){
  width:170px;
}

.dcrt-table th:nth-child(3),
.dcrt-table td:nth-child(3){
  width:170px;
}

/* textos largos elegantes */
.dcrt-table td{
  overflow:hidden;
  text-overflow:ellipsis;
}

/* títulos */
.dcrt-table-card h3{
  font-size:16px;
  margin-bottom:10px;
}

/* detalle cartera aún más compacto */
#dcrTablaDetalle td{
  font-size:11.5px;
}

/* facturas vencidas */
#dcrTablaFacturasVencidas td{
  font-size:11.5px;
}

/* filas vacías */
.dcr-empty-row td{
  text-align:left;
  color:#666;
  font-size:12px;
}

/* =====================================================
DASHBOARD CARTERA PREMIUM CSS COMPLETO
AISLADO TOTAL
PREFIX: dcrt-
===================================================== */

/* =========================
LAYOUT GENERAL
========================= */
.dcrt-layout{
  padding:20px;
  width:100%;
  box-sizing:border-box;
}

.dcrt-header{
  margin-bottom:20px;
}

.dcrt-header h2{
  margin:0;
  font-size:34px;
  font-weight:700;
  color:#111827;
}

/* =========================
BOTONES
========================= */
.dcrt-btn{
  border:none;
  border-radius:10px;
  height:44px;
  padding:0 18px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  transition:.2s ease;
  white-space:nowrap;
}

.dcrt-btn:hover{
  transform:translateY(-1px);
}

.dcrt-btn-primary{
  background:#2f56a6;
  color:#fff;
}

.dcrt-btn-light{
  background:#eef2f7;
  color:#111827;
}

.dcrt-btn-danger{
  background:#ea4335;
  color:#fff;
}

/* =========================
FILTROS
========================= */
.dcrt-filters-box{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-bottom:18px;
}

.dcrt-toolbar{
  display:grid;
  grid-template-columns:
    auto auto auto
    110px
    auto auto auto auto
    auto auto auto;
  gap:10px;
  align-items:center;
}

.dcrt-select{
  width:110px;
  height:44px;
  padding:0 12px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
}

.dcrt-toolbar-bottom{
  display:grid;
  grid-template-columns:220px 220px 160px;
  gap:14px;
  align-items:end;
}

.dcrt-group{
  display:flex;
  flex-direction:column;
}

.dcrt-group label{
  font-size:12px;
  font-weight:600;
  color:#6b7280;
  margin-bottom:6px;
}

.dcrt-group input{
  width:100%;
  height:44px;
  padding:0 12px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
  box-sizing:border-box;
}

.dcrt-btn-group .dcrt-btn{
  width:100%;
}

/* =========================
CARDS KPI
========================= */
.dcrt-cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:22px;
}

.dcrt-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  position:relative;
}

.dcrt-card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:5px;
  border-radius:14px 0 0 14px;
}

.dcrt-card h3{
  margin:0 0 10px;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  color:#6b7280;
  letter-spacing:.4px;
}

.dcrt-card p{
  margin:0;
  font-size:22px;
  font-weight:800;
  color:#111827;
}

.dcrt-small{
  font-size:17px !important;
  line-height:1.45;
}

/* COLORES KPI */
.dcrt-periodo::before{ background:#34495e; }
.dcrt-total::before{ background:#2563eb; }
.dcrt-vencida::before{ background:#dc2626; }
.dcrt-corriente::before{ background:#16a34a; }
.dcrt-clientes::before{ background:#8e44ad; }
.dcrt-facturas::before{ background:#f39c12; }
.dcrt-mora::before{ background:#00a6a6; }
.dcrt-retenciones::before{ background:#c0392b; }

/* =========================
TABLAS FULL WIDTH
========================= */
.dcrt-full-tables{
  display:flex;
  flex-direction:column;
  gap:20px;
  margin-bottom:20px;
  width:100%;
}

.dcrt-table-card{
  width:100%;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:14px;
}

.dcrt-table-card h3{
  margin:0 0 12px;
  font-size:16px;
  font-weight:700;
  color:#111827;
}

.dcrt-table-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y:auto;
  border-radius:10px;
}

.dcrt-table{
  width:100%;
  min-width:100%;
  table-layout:auto;
  border-collapse:collapse;
}

.dcrt-table th{
  position:sticky;
  top:0;
  z-index:5;
  background:#f5f7fb;
  text-align:left;
  font-size:12px;
  padding:9px 10px;
  white-space:nowrap;
}

.dcrt-table td{
  font-size:12px;
  padding:9px 10px;
  border-bottom:1px solid #f1f1f1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.dcrt-table tbody tr:hover{
  background:#fafafa;
}

/* columnas principales */
.dcrt-table th:nth-child(1),
.dcrt-table td:nth-child(1){
  width:150px;
}

.dcrt-table th:nth-child(2),
.dcrt-table td:nth-child(2){
  width:180px;
}

.dcrt-table th:nth-child(3),
.dcrt-table td:nth-child(3){
  width:180px;
}

/* =========================
GRAFICAS ABAJO
========================= */
.dcrt-bottom-charts{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
  width:100%;
}

.dcrt-chart-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:16px;
}

.dcrt-chart-card h3{
  margin:0 0 14px;
  font-size:18px;
  font-weight:700;
  color:#111827;
}

.dcrt-chart-wrap{
  position:relative;
  width:100%;
  height:340px;
}

.dcrt-chart-wrap canvas{
  width:100% !important;
  height:100% !important;
}

/* =========================
HELPERS
========================= */
.dcrt-red{
  color:#dc2626;
  font-weight:700;
}

.dcrt-center{
  text-align:center;
}

.dcr-empty-row td{
  color:#666;
  font-size:12px;
}

/* =========================
RESPONSIVE
========================= */
@media(max-width:1400px){

  .dcrt-cards{
    grid-template-columns:repeat(2,1fr);
  }

  .dcrt-bottom-charts{
    grid-template-columns:1fr;
  }

  .dcrt-toolbar{
    grid-template-columns:repeat(3,1fr);
  }

  .dcrt-toolbar-bottom{
    grid-template-columns:1fr;
  }

}

@media(max-width:768px){

  .dcrt-cards{
    grid-template-columns:1fr;
  }

  .dcrt-toolbar{
    grid-template-columns:1fr;
  }

  .dcrt-bottom-charts{
    grid-template-columns:1fr;
  }

}

/* =====================================
   AJUSTE COMPACTO DASHBOARD CARTERA
   AGREGAR AL FINAL
===================================== */

/* layout */
.dcrt-layout{
  padding:14px !important;
}

.dcrt-main,
.dcrt-left,
.dcrt-right{
  gap:14px !important;
}

/* header */
.dcrt-header{
  margin-bottom:14px !important;
}

.dcrt-header h2{
  font-size:28px !important;
}

/* botones */
.dcrt-btn{
  height:34px !important;
  padding:0 14px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* =========================
   FILTROS COMPACTOS
========================= */
.dcrt-filters-box{
  padding:14px !important;
  gap:10px !important;
  margin-bottom:14px !important;
}

/* fila superior botones */
.dcrt-toolbar{
  display:flex !important;
  flex-wrap:nowrap !important;
  gap:8px !important;
  align-items:center !important;
  overflow-x:auto !important;
}

.dcrt-toolbar > *{
  flex:none !important;
}

.dcrt-toolbar .dcrt-select{
  min-width:90px !important;
  height:34px !important;
  font-size:12px !important;
}

.dcrt-toolbar::-webkit-scrollbar{
  height:6px;
}

.dcrt-toolbar::-webkit-scrollbar-thumb{
  background:#c7cfdd;
  border-radius:20px;
}

/* fila inferior */
.dcrt-toolbar-bottom{
  grid-template-columns:1fr 1fr 1fr !important;
  gap:8px !important;
}

.dcrt-group label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

.dcrt-group input{
  height:34px !important;
  padding:0 10px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* =========================
   KPI CARDS MÁS PEQUEÑAS
========================= */
.dcrt-cards{
  grid-template-columns:repeat(4,1fr) !important;
  gap:10px !important;
  margin-bottom:14px !important;
}

.dcrt-card{
  padding:12px 14px !important;
  border-radius:12px !important;
}

.dcrt-card::before{
  width:4px !important;
}

.dcrt-card h3{
  font-size:10px !important;
  margin-bottom:4px !important;
}

.dcrt-card p{
  font-size:18px !important;
  line-height:1.25 !important;
}

.dcrt-small{
  font-size:14px !important;
  line-height:1.3 !important;
}

/* =========================
   TABLAS / TARJETAS
========================= */
.dcrt-table-card,
.dcrt-chart-card{
  padding:12px !important;
  border-radius:12px !important;
}

.dcrt-table-card h3,
.dcrt-chart-card h3{
  font-size:16px !important;
  margin-bottom:10px !important;
}

.dcrt-table-scroll{
  max-height:320px !important;
}

.dcrt-table th{
  font-size:12px !important;
  padding:9px 10px !important;
}

.dcrt-table td{
  font-size:12px !important;
  padding:9px 10px !important;
}

/* charts */
.dcrt-chart-wrap{
  height:280px !important;
}

.dcrt-bottom-charts{
  gap:14px !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:1400px){

  .dcrt-toolbar{
    flex-wrap:wrap !important;
  }

  .dcrt-cards{
    grid-template-columns:repeat(2,1fr) !important;
  }

  .dcrt-main{
    grid-template-columns:1fr !important;
  }
}

@media (max-width:992px){

  .dcrt-toolbar-bottom{
    grid-template-columns:1fr !important;
  }

  .dcrt-bottom-charts{
    grid-template-columns:1fr !important;
  }
}

@media (max-width:768px){

  .dcrt-layout{
    padding:10px !important;
  }

  .dcrt-toolbar{
    display:grid !important;
    grid-template-columns:1fr !important;
  }

  .dcrt-cards{
    grid-template-columns:1fr !important;
  }

  .dcrt-header h2{
    font-size:24px !important;
  }

  .dcrt-chart-wrap{
    height:240px !important;
  }

  .dcrt-btn{
    width:100% !important;
  }
}

/* =====================================
   FILTROS ESTILO GERENCIAL / CONTABLE
===================================== */

.dcrt-toolbar{
  display:flex !important;
  align-items:flex-end !important;
  flex-wrap:nowrap !important;
  gap:8px !important;
}

.dcrt-toolbar .dcrt-group{
  margin:0 !important;
  width:auto !important;
}

.dcrt-toolbar .dcrt-btn{
  width:120px !important;
  min-width:120px !important;
}

.dcrt-toolbar .dcrt-select{
  width:120px !important;
}

.dcrt-toolbar input[type="date"]{
  width:150px !important;
}

.dcrt-toolbar label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

/* responsive */

@media (max-width:1400px){

  .dcrt-toolbar{
    flex-wrap:wrap !important;
  }

}

@media (max-width:992px){

  .dcrt-toolbar{
    display:grid !important;
    grid-template-columns:
      repeat(2, minmax(220px, 1fr));
  }

  .dcrt-toolbar .dcrt-group{
    width:100% !important;
  }

  .dcrt-toolbar .dcrt-btn,
  .dcrt-toolbar .dcrt-select,
  .dcrt-toolbar input{
    width:100% !important;
  }

}

@media (max-width:768px){

  .dcrt-toolbar{
    grid-template-columns:1fr !important;
  }

}

/* =====================================
   FILTROS IGUAL DASHBOARD GERENCIAL
===================================== */

.dcrt-toolbar{
  display:flex !important;
  align-items:flex-end !important;
  flex-wrap:nowrap !important;
  gap:8px !important;
}

.dcrt-toolbar .dcrt-group{
  width:auto !important;
  margin:0 !important;
}

.dcrt-toolbar .dcrt-btn{
  min-width:120px !important;
  width:120px !important;
}

.dcrt-toolbar .dcrt-select{
  width:120px !important;
}

.dcrt-toolbar input[type="date"]{
  width:150px !important;
}

/*=====================================
HEADER
=====================================*/

.dcrt-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    width:100%;

    margin-bottom:18px;

}

.dcrt-header h2{

    margin:0;

}

.dcrt-header-actions{

    display:flex;

    flex-direction:row;

    align-items:center;

    justify-content:flex-end;

    gap:8px;

    flex-shrink:0;

}

/* =====================================
   BOTÓN PDF
===================================== */

.dbx-btn-pdf{

    width:38px;

    height:38px;

    border:none;

    border-radius:6px;

    background:#e53935;

    color:#fff;

    display:flex;

    align-items:center;

    justify-content:center;

    gap:2px;

    cursor:pointer;

    transition:.2s;

    box-shadow:0 2px 6px rgba(0,0,0,.15);

}

.dbx-btn-pdf:hover{

    background:#c62828;

    transform:translateY(-1px);

}

/* =====================================
   BOTÓN EXCEL
===================================== */

.dbx-btn-excel{

    width:38px;

    height:38px;

    border:none;

    border-radius:6px;

    background:#217346;

    color:#fff;

    display:flex;

    align-items:center;

    justify-content:center;

    gap:2px;

    cursor:pointer;

    transition:.2s;

    box-shadow:0 2px 6px rgba(0,0,0,.15);

}

.dbx-btn-excel:hover{

    background:#1b5e37;

    transform:translateY(-1px);

}

.dbx-btn-pdf i,
.dbx-btn-excel i{

    font-size:14px;

}