/*
 * Crediton · Temas claro / oscuro
 * ------------------------------------------------------------
 * Se carga al final (después de styles.css, app-ui.css y de los
 * estilos propios de cada vista) para poder sobrescribir los
 * colores fijos sin tocar cada página.
 *
 * El tema se controla con el atributo data-theme en <html>:
 *   <html data-theme="light">  ·  <html data-theme="dark">
 * La preferencia se guarda en localStorage desde theme.js.
 */

/* ===================== Tokens del tema oscuro ===================== */
html[data-theme="dark"]{
  color-scheme: dark;

  --primary-blue:#3b82f6;
  --primary-light:#60a5fa;
  --secondary:#94a3b8;
  --accent:#10b981;
  --warning:#f59e0b;
  --danger:#ef4444;

  --bg-light:#0b1220;
  --bg-white:#111c2e;
  --border:#243247;
  --text-primary:#e6edf6;
  --text-secondary:#9fb0c7;

  --shadow:0 1px 3px 0 rgba(0,0,0,.55), 0 1px 2px 0 rgba(0,0,0,.4);
  --shadow-lg:0 14px 30px -10px rgba(0,0,0,.65), 0 4px 10px -4px rgba(0,0,0,.5);

  --sidebar-bg:#0d1728;
  --sidebar-border:#22314a;
  --sidebar-text:#cbd5e1;
  --sidebar-muted:#7c8ea3;
  --active-blue:#3b82f6;

  --ct-surface:#111c2e;
  --ct-surface-2:#16233a;
  --ct-surface-3:#1b2a41;
  --ct-line:#243247;
  --ct-line-soft:#1d2a3e;
  --ct-text:#e6edf6;
  --ct-muted:#9fb0c7;
}

/* Tokens que cada módulo redefine en su propio bloque <style> */
html[data-theme="dark"] .ui,
html[data-theme="dark"] .dash,
html[data-theme="dark"] .cli,
html[data-theme="dark"] .cuo,
html[data-theme="dark"] .pre,
html[data-theme="dark"] .his,
html[data-theme="dark"] .por{
  --navy:#2f6fbf;
  --navy2:#3b82d6;
  --teal:#14b8a6;
  --teal-d:#2dd4bf;
  --blue:#6ba7f5;
  --line:#243247;
  --line-soft:#1d2a3e;
  --muted:#9fb0c7;
  --ink:#e6edf6;
  --soft:#16233a;
  --shadow-card:0 10px 24px -18px rgba(0,0,0,.85);
}

/* ===================== Base ===================== */
html[data-theme="dark"] body{
  background:var(--bg-light);
  color:var(--text-primary);
}
html[data-theme="dark"] .wrapper,
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .content{background:transparent;color:var(--text-primary);}
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-body{color:var(--text-secondary) !important;}
html[data-theme="dark"] .text-dark{color:var(--text-primary) !important;}
html[data-theme="dark"] .bg-white{background-color:var(--bg-white) !important;}
html[data-theme="dark"] .bg-light{background-color:var(--bg-light) !important;}
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-left,
html[data-theme="dark"] .border-right{border-color:var(--border) !important;}
html[data-theme="dark"] hr{border-top-color:var(--border);}
html[data-theme="dark"] ::placeholder{color:#71839b !important;}
html[data-theme="dark"] ::selection{background:rgba(59,130,246,.35);color:#fff;}

/* Scrollbars discretas */
html[data-theme="dark"] *{scrollbar-color:#2a3b54 #0d1728;}
html[data-theme="dark"] ::-webkit-scrollbar{width:10px;height:10px;}
html[data-theme="dark"] ::-webkit-scrollbar-track{background:#0d1728;}
html[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#2a3b54;border-radius:999px;}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#354a68;}

/* ===================== Tarjetas y superficies ===================== */
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .admin-dashboard .stat-card,
html[data-theme="dark"] .admin-dashboard .quick-card,
html[data-theme="dark"] .ui-card,
html[data-theme="dark"] .ui-kpi,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .dash-kpi,
html[data-theme="dark"] .cli-card,
html[data-theme="dark"] .cli-kpi,
html[data-theme="dark"] .cuo-card,
html[data-theme="dark"] .cuo-kpi,
html[data-theme="dark"] .pre-card,
html[data-theme="dark"] .pre-kpi,
html[data-theme="dark"] .por-card,
html[data-theme="dark"] .por-kpi,
html[data-theme="dark"] .por-loan,
html[data-theme="dark"] .cfg-rol,
html[data-theme="dark"] .sec-qr-box{
  background:var(--ct-surface);
  border-color:var(--ct-line);
  box-shadow:var(--shadow);
}
html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .stat-card:hover{box-shadow:var(--shadow-lg);}

/* Bloques internos con fondo claro */
html[data-theme="dark"] .met-box,
html[data-theme="dark"] .met-clients,
html[data-theme="dark"] .met-panel-foot,
html[data-theme="dark"] .soc-bloque,
html[data-theme="dark"] .soc-cuotas > div,
html[data-theme="dark"] .por-info-item,
html[data-theme="dark"] .ui-summary,
html[data-theme="dark"] .soc-input span,
html[data-theme="dark"] .cuo-wa-item,
html[data-theme="dark"] .por-loans-tabs,
html[data-theme="dark"] .cred-card .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .por-table tr{
  background:var(--ct-surface-2);
  border-color:var(--ct-line);
}
html[data-theme="dark"] .por-loan-grid .por-info-item{background:var(--ct-surface-2);}
html[data-theme="dark"] .ui-summary-item{background:var(--ct-surface);border-color:var(--ct-line);}
html[data-theme="dark"] .met-panel-foot:hover{background:var(--ct-surface-3);}
html[data-theme="dark"] .met-panel-foot{color:#c3d0e0;}
html[data-theme="dark"] .met-panel-foot:hover{color:#fff;}

/* ===================== Tablas ===================== */
html[data-theme="dark"] .table,
html[data-theme="dark"] .ui-table,
html[data-theme="dark"] .dash-table,
html[data-theme="dark"] .cli-table,
html[data-theme="dark"] .cuo-table,
html[data-theme="dark"] .pre-table,
html[data-theme="dark"] .his-table,
html[data-theme="dark"] .por-table,
html[data-theme="dark"] .cred-table{background:transparent;color:var(--text-primary);}

html[data-theme="dark"] .ui-table thead th,
html[data-theme="dark"] .dash-table thead th,
html[data-theme="dark"] .cli-table thead th,
html[data-theme="dark"] .cuo-table thead th,
html[data-theme="dark"] .pre-table thead th,
html[data-theme="dark"] .his-table thead th,
html[data-theme="dark"] .por-table thead th,
html[data-theme="dark"] .cred-table thead th,
html[data-theme="dark"] .table thead th{
  background:var(--ct-surface-2);
  color:#8fa6c2;
  border-bottom-color:var(--ct-line);
}
html[data-theme="dark"] .ui-table tbody td,
html[data-theme="dark"] .dash-table tbody td,
html[data-theme="dark"] .cli-table tbody td,
html[data-theme="dark"] .cuo-table tbody td,
html[data-theme="dark"] .pre-table tbody td,
html[data-theme="dark"] .his-table tbody td,
html[data-theme="dark"] .por-table tbody td,
html[data-theme="dark"] .cred-table tbody td,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td{
  border-color:var(--ct-line-soft);
  color:var(--text-primary);
}
html[data-theme="dark"] .ui-table tbody tr:hover,
html[data-theme="dark"] .dash-table tbody tr:hover,
html[data-theme="dark"] .cli-table tbody tr:hover,
html[data-theme="dark"] .cuo-table tbody tr:hover,
html[data-theme="dark"] .pre-table tbody tr:hover,
html[data-theme="dark"] .his-table tbody tr:hover,
html[data-theme="dark"] .por-table tbody tr:hover,
html[data-theme="dark"] .cred-table tbody tr:hover,
html[data-theme="dark"] .table-hover tbody tr:hover{background:var(--ct-surface-2);}
html[data-theme="dark"] .table-striped tbody tr:nth-child(even){background:#0f1a2b;}
html[data-theme="dark"] .table th{background:var(--ct-surface-2);}
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .cred-card .table-responsive{background:transparent;border-color:var(--ct-line);}

/* Columnas fijas (Clientes) */
html[data-theme="dark"] .cli-table th:last-child,
html[data-theme="dark"] .cli-table td:last-child{background:var(--ct-surface);}
html[data-theme="dark"] .cli-table thead th:last-child{background:var(--ct-surface-2);}
html[data-theme="dark"] .cli-table tbody tr:hover td:last-child{background:var(--ct-surface-2);}

/* Tarjetas de tabla en móvil */
html[data-theme="dark"] .dash .dash-table tbody tr.dash-row,
html[data-theme="dark"] .cli-table tbody tr.cli-row,
html[data-theme="dark"] .cuo-table tbody tr.cuo-row,
html[data-theme="dark"] .pre-table tbody tr.pre-row,
html[data-theme="dark"] .his-table tbody tr.his-row,
html[data-theme="dark"] .soc-page .ui-table tbody tr,
html[data-theme="dark"] .cfg-page .ui-table tbody tr,
html[data-theme="dark"] .met-page .met-audit-detail .ui-table tbody tr,
html[data-theme="dark"] .cred-page .cred-table tbody tr,
html[data-theme="dark"] .cuop-page .cuop-table tbody tr,
html[data-theme="dark"] .por-table tr{
  background:var(--ct-surface);
  border-color:var(--ct-line);
  box-shadow:0 1px 2px rgba(0,0,0,.35);
}
html[data-theme="dark"] .dash .dash-table tbody tr.dash-row:hover,
html[data-theme="dark"] .cli-table tbody tr.cli-row:hover,
html[data-theme="dark"] .cuo-table tbody tr.cuo-row:hover,
html[data-theme="dark"] .pre-table tbody tr.pre-row:hover,
html[data-theme="dark"] .his-table tbody tr.his-row:hover{background:var(--ct-surface);border-color:#2f4460;}
html[data-theme="dark"] .dash .dash-table tbody tr.dash-row > td:nth-child(6),
html[data-theme="dark"] .cli-table tbody tr.cli-row > td:nth-child(7),
html[data-theme="dark"] .cuo-table tbody tr.cuo-row > td:nth-child(8),
html[data-theme="dark"] .pre-table tbody tr.pre-row > td:nth-child(9),
html[data-theme="dark"] .his-table tbody tr.his-row > td:nth-child(9){border-left-color:var(--ct-line);}
html[data-theme="dark"] .dash .table-responsive,
html[data-theme="dark"] .cli .table-responsive,
html[data-theme="dark"] .cuo .table-responsive,
html[data-theme="dark"] .pre .table-responsive,
html[data-theme="dark"] .his-table,
html[data-theme="dark"] .soc-page .table-responsive,
html[data-theme="dark"] .cfg-page .table-responsive,
html[data-theme="dark"] .met-page .met-audit-detail .table-responsive,
html[data-theme="dark"] .cred-page .cred-card .table-responsive,
html[data-theme="dark"] .cuop-page .table-responsive{background:transparent;}
html[data-theme="dark"] .cuop-table tbody tr.cuop-row-open,
html[data-theme="dark"] .cuop-table tbody tr.cuop-row-open:hover{background:rgba(20,184,166,.08);}
html[data-theme="dark"] .cred-page .cred-table tbody tr:hover{background:var(--ct-surface);}
html[data-theme="dark"] .pre-table tbody tr.pre-row > td:nth-child(1){background:rgba(59,130,246,.16);color:#93c5fd;}

/* Calendario de cuotas en móvil: la celda "Saldo restante" tiene fondo propio */
@media (max-width:768px){
  html[data-theme="dark"] .cuop-table.ui-table tbody tr > td:nth-child(1){
    background:rgba(59,130,246,.16);color:#93c5fd;
  }
  html[data-theme="dark"] .cuop-table.ui-table tbody tr > td:nth-child(2){color:#9fb0c7;}
  html[data-theme="dark"] .cuop-table.ui-table tbody tr > td:nth-child(6){
    background:var(--ct-surface-2);
    border:1px solid var(--ct-line);
    color:var(--text-primary);
  }
  html[data-theme="dark"] .cuop-table.ui-table tbody tr > td:nth-child(6)::before{color:#8fa6c2;}
  html[data-theme="dark"] .cuop-table.ui-table tbody tr > td:nth-child(7){border-top-color:var(--ct-line);}
}

/* Encabezados de tarjeta y pies */
html[data-theme="dark"] .ui-card-head,
html[data-theme="dark"] .ui-segbar,
html[data-theme="dark"] .ui-filters,
html[data-theme="dark"] .dash-card-head,
html[data-theme="dark"] .dash-filters,
html[data-theme="dark"] .cli-filters,
html[data-theme="dark"] .cli-controls,
html[data-theme="dark"] .cuo-segbar,
html[data-theme="dark"] .cuo-filters,
html[data-theme="dark"] .pre-segbar,
html[data-theme="dark"] .pre-filters,
html[data-theme="dark"] .met-panel-head,
html[data-theme="dark"] .met-detail-head,
html[data-theme="dark"] .por-card-head,
html[data-theme="dark"] .por-loans-tabs,
html[data-theme="dark"] .soc-modal-head,
html[data-theme="dark"] .cuo-modal-head{border-color:var(--ct-line);}
html[data-theme="dark"] .ui-foot,
html[data-theme="dark"] .dash-table-foot,
html[data-theme="dark"] .cli-foot,
html[data-theme="dark"] .cuo-foot,
html[data-theme="dark"] .pre-foot,
html[data-theme="dark"] .soc-modal-foot,
html[data-theme="dark"] .cuo-modal-foot{border-color:var(--ct-line);}

/* ===================== Formularios ===================== */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .custom-file-label,
html[data-theme="dark"] .ui-input,
html[data-theme="dark"] .ui-search input,
html[data-theme="dark"] .dash-search input,
html[data-theme="dark"] .cli-search input,
html[data-theme="dark"] .cuo-search input,
html[data-theme="dark"] .pre-search input,
html[data-theme="dark"] .ui-select,
html[data-theme="dark"] .cli-select,
html[data-theme="dark"] .cuo-select,
html[data-theme="dark"] .pre-select,
html[data-theme="dark"] .cli-field input,
html[data-theme="dark"] .cli-field select,
html[data-theme="dark"] .cfg-field input,
html[data-theme="dark"] .cfg-field select,
html[data-theme="dark"] .sec-campo input,
html[data-theme="dark"] .soc-input input,
html[data-theme="dark"] .cred-card .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .cred-card .dataTables_wrapper .dataTables_length select{
  background:#0f1a2b;
  border-color:#2a3b54;
  color:var(--text-primary);
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .custom-select:focus,
html[data-theme="dark"] .ui-input:focus,
html[data-theme="dark"] .ui-search input:focus,
html[data-theme="dark"] .dash-search input:focus,
html[data-theme="dark"] .cli-search input:focus,
html[data-theme="dark"] .cuo-search input:focus,
html[data-theme="dark"] .pre-search input:focus,
html[data-theme="dark"] .cli-field input:focus,
html[data-theme="dark"] .cli-field select:focus,
html[data-theme="dark"] .cfg-field input:focus,
html[data-theme="dark"] .cfg-field select:focus,
html[data-theme="dark"] .sec-campo input:focus,
html[data-theme="dark"] .cred-card .dataTables_wrapper .dataTables_filter input:focus{
  background:#0f1a2b;
  border-color:#3b82f6;
  color:var(--text-primary);
}
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .ui-input-btn,
html[data-theme="dark"] .ui-kbd,
html[data-theme="dark"] .cli-kbd,
html[data-theme="dark"] .cuo-kbd,
html[data-theme="dark"] .pre-kbd{
  background:var(--ct-surface-2);
  border-color:#2a3b54;
  color:#8fa6c2;
}
html[data-theme="dark"] .ui-input::placeholder,
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .ui-search input::placeholder,
html[data-theme="dark"] .dash-search input::placeholder,
html[data-theme="dark"] .cli-search input::placeholder,
html[data-theme="dark"] .cuo-search input::placeholder,
html[data-theme="dark"] .pre-search input::placeholder{color:#71839b;font-weight:500;}
html[data-theme="dark"] select.ui-input,
html[data-theme="dark"] .ui-select,
html[data-theme="dark"] .cli-select,
html[data-theme="dark"] .cuo-select,
html[data-theme="dark"] .pre-select{color:var(--text-primary);}
html[data-theme="dark"] option{background:#111c2e;color:#e6edf6;}
html[data-theme="dark"] .custom-control-label::before{background:#0f1a2b;border-color:#2a3b54;}
html[data-theme="dark"] .custom-control-input:checked ~ .custom-control-label::before{background:#3b82f6;border-color:#3b82f6;}
html[data-theme="dark"] .form-check-input{background-color:#0f1a2b;border-color:#2a3b54;}

/* ===================== Botones ===================== */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .ui-btn,
html[data-theme="dark"] .dash-btn,
html[data-theme="dark"] .cli-btn,
html[data-theme="dark"] .cuo-btn,
html[data-theme="dark"] .pre-btn,
html[data-theme="dark"] .cfg-tab,
html[data-theme="dark"] .por-loan-tab,
html[data-theme="dark"] .ui-icon-btn,
html[data-theme="dark"] .dash-icon-btn,
html[data-theme="dark"] .cli-icon-btn,
html[data-theme="dark"] .cuo-icon-btn,
html[data-theme="dark"] .pre-icon-btn,
html[data-theme="dark"] .ui-icon-action,
html[data-theme="dark"] .ui-more-btn,
html[data-theme="dark"] .cli-more-btn,
html[data-theme="dark"] .pre-more-btn,
html[data-theme="dark"] .ui-refresh,
html[data-theme="dark"] .cli-refresh,
html[data-theme="dark"] .cuo-refresh,
html[data-theme="dark"] .pre-refresh,
html[data-theme="dark"] .met-refresh,
html[data-theme="dark"] .ui-page,
html[data-theme="dark"] .dash-page,
html[data-theme="dark"] .cli-page,
html[data-theme="dark"] .cuo-page,
html[data-theme="dark"] .pre-page,
html[data-theme="dark"] .ui-seg button,
html[data-theme="dark"] .ui-seg-btn,
html[data-theme="dark"] .cuo-seg,
html[data-theme="dark"] .pre-seg,
html[data-theme="dark"] .dash-seg button,
html[data-theme="dark"] .cli-seg button,
html[data-theme="dark"] .cli-detail,
html[data-theme="dark"] .cli-copy,
html[data-theme="dark"] .cuo-modal-close,
html[data-theme="dark"] .app-sheet-close{
  background:var(--ct-surface-2);
  border-color:#2a3b54;
  color:#c3d0e0;
}
html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .ui-btn:hover,
html[data-theme="dark"] .dash-btn:hover,
html[data-theme="dark"] .cli-btn:hover,
html[data-theme="dark"] .cuo-btn:hover,
html[data-theme="dark"] .pre-btn:hover,
html[data-theme="dark"] .cfg-tab:hover,
html[data-theme="dark"] .por-loan-tab:hover,
html[data-theme="dark"] .ui-icon-btn:hover,
html[data-theme="dark"] .ui-icon-action:hover,
html[data-theme="dark"] .ui-more-btn:hover,
html[data-theme="dark"] .cli-more-btn:hover,
html[data-theme="dark"] .pre-more-btn:hover,
html[data-theme="dark"] .ui-refresh:hover,
html[data-theme="dark"] .cli-refresh:hover,
html[data-theme="dark"] .cuo-refresh:hover,
html[data-theme="dark"] .pre-refresh:hover,
html[data-theme="dark"] .met-refresh:hover,
html[data-theme="dark"] .ui-page:hover:not(:disabled),
html[data-theme="dark"] .dash-page:hover,
html[data-theme="dark"] .cli-page:hover:not(:disabled),
html[data-theme="dark"] .cuo-page:hover:not(:disabled),
html[data-theme="dark"] .pre-page:hover:not(:disabled),
html[data-theme="dark"] .ui-seg button:hover,
html[data-theme="dark"] .ui-seg-btn:hover,
html[data-theme="dark"] .cuo-seg:hover,
html[data-theme="dark"] .pre-seg:hover,
html[data-theme="dark"] .cli-detail:hover,
html[data-theme="dark"] .cli-copy:hover,
html[data-theme="dark"] .ui-icon-action:hover,
html[data-theme="dark"] .cuo-modal-close:hover{
  background:var(--ct-surface-3);
  border-color:#354a68;
  color:#fff;
}
/* Botones sólidos y estados activos */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-success:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .ui-btn-dark,
html[data-theme="dark"] .ui-btn-dark:hover,
html[data-theme="dark"] .dash-btn-accent:hover,
html[data-theme="dark"] .cli-btn-dark,
html[data-theme="dark"] .cli-btn-dark:hover,
html[data-theme="dark"] .cuo-btn-dark,
html[data-theme="dark"] .cuo-btn-dark:hover,
html[data-theme="dark"] .pre-btn-dark,
html[data-theme="dark"] .pre-btn-dark:hover,
html[data-theme="dark"] .cuo-cobrar,
html[data-theme="dark"] .cuo-cobrar:hover,
html[data-theme="dark"] .pre-ver,
html[data-theme="dark"] .pre-ver:hover,
html[data-theme="dark"] .ui-action-dark,
html[data-theme="dark"] .ui-action-dark:hover,
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark,
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark:hover,
html[data-theme="dark"] .cfg-tab.active,
html[data-theme="dark"] .por-loan-tab.active,
html[data-theme="dark"] .ui-page.active,
html[data-theme="dark"] .dash-page.active,
html[data-theme="dark"] .cli-page.active,
html[data-theme="dark"] .cuo-page.active,
html[data-theme="dark"] .pre-page.active,
html[data-theme="dark"] .ui-seg button.active,
html[data-theme="dark"] .ui-seg-btn.active,
html[data-theme="dark"] .cuo-seg.active,
html[data-theme="dark"] .pre-seg.active{color:#fff;}
html[data-theme="dark"] .ui-btn-dark,
html[data-theme="dark"] .ui-btn-dark:hover,
html[data-theme="dark"] .cli-btn-dark,
html[data-theme="dark"] .cli-btn-dark:hover,
html[data-theme="dark"] .cuo-btn-dark,
html[data-theme="dark"] .cuo-btn-dark:hover,
html[data-theme="dark"] .pre-btn-dark,
html[data-theme="dark"] .pre-btn-dark:hover,
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark,
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark:hover,
html[data-theme="dark"] .cfg-tab.active,
html[data-theme="dark"] .por-loan-tab.active,
html[data-theme="dark"] .ui-page.active,
html[data-theme="dark"] .dash-page.active,
html[data-theme="dark"] .cli-page.active,
html[data-theme="dark"] .cuo-page.active,
html[data-theme="dark"] .pre-page.active,
html[data-theme="dark"] .ui-seg button.active,
html[data-theme="dark"] .ui-seg-btn.active,
html[data-theme="dark"] .cuo-seg.active,
html[data-theme="dark"] .pre-seg.active{
  background:var(--navy,#2f6fbf);
  border-color:var(--navy,#2f6fbf);
}
html[data-theme="dark"] .dash-btn-accent{background:var(--teal,#14b8a6);color:#04231f;}
html[data-theme="dark"] .dash-btn-ghost{background:rgba(255,255,255,.1);color:#eaf2fb;border-color:rgba(255,255,255,.28);}
html[data-theme="dark"] .btn-light{background:var(--ct-surface-2);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .btn-primary{background:var(--primary-blue);color:#fff;}
html[data-theme="dark"] .btn-primary:hover{background:var(--primary-light);color:#fff;}
html[data-theme="dark"] .btn-success{background:var(--accent);color:#fff;}
html[data-theme="dark"] .btn-success:hover{background:#047857;color:#fff;}
html[data-theme="dark"] .btn-danger{background:var(--danger);color:#fff;}
html[data-theme="dark"] .btn-outline-primary{background:transparent;color:#93c5fd;border-color:#3b82f6;}
html[data-theme="dark"] .btn-outline-primary:hover{background:#3b82f6;color:#fff;}
html[data-theme="dark"] .nav-link.active{color:#fff !important;}
html[data-theme="dark"] .dashboard-hero,
html[data-theme="dark"] .dashboard-hero h1{color:#fff;}
html[data-theme="dark"] .ct-btn-danger,
html[data-theme="dark"] .ui-seg button.danger.active,
html[data-theme="dark"] .ui-seg-btn.danger.active,
html[data-theme="dark"] .cuo-seg.danger.active,
html[data-theme="dark"] .pre-seg.danger.active,
html[data-theme="dark"] .ct-btn-danger:hover{background:#b42318;border-color:#b42318;color:#fff;}
html[data-theme="dark"] .ui-seg button.danger,
html[data-theme="dark"] .ui-seg-btn.danger,
html[data-theme="dark"] .cuo-seg.danger,
html[data-theme="dark"] .pre-seg.danger{background:rgba(239,68,68,.1);border-color:rgba(239,68,68,.3);color:#fca5a5;}
html[data-theme="dark"] .ui-seg button.danger b,
html[data-theme="dark"] .ui-seg-btn.danger b,
html[data-theme="dark"] .cuo-seg.danger b,
html[data-theme="dark"] .pre-seg.danger b{color:#fca5a5;}
html[data-theme="dark"] .dash-cobrar{background:rgba(16,185,129,.14);border-color:rgba(16,185,129,.35);color:#6ee7b7;}
html[data-theme="dark"] .dash-cobrar:hover{background:#0fae9e;border-color:#0fae9e;color:#04231f;}
html[data-theme="dark"] .ui-action-soft{background:var(--ct-surface-2);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .ui-action-soft:hover{background:var(--ct-surface-3);border-color:#354a68;color:#fff;}

/* Segmented controls */
html[data-theme="dark"] .dash-seg,
html[data-theme="dark"] .cli-seg{background:var(--ct-surface-2);border-color:var(--ct-line);}
html[data-theme="dark"] .dash-seg button,
html[data-theme="dark"] .cli-seg button{background:transparent;border-color:transparent;}
html[data-theme="dark"] .dash-seg button.active,
html[data-theme="dark"] .cli-seg button.active{background:#2a3b54;color:#fff;box-shadow:none;}
html[data-theme="dark"] .dash-seg button.active{color:var(--text-primary);}

/* ===================== Chips, pills y avatares ===================== */
html[data-theme="dark"] .ui-pill-info,
html[data-theme="dark"] .dash-pill-today,
html[data-theme="dark"] .cli-pill-info,
html[data-theme="dark"] .cuo-pill-info,
html[data-theme="dark"] .pre-pill-info,
html[data-theme="dark"] .por-pill-info,
html[data-theme="dark"] .badge-info-soft{background:rgba(59,130,246,.18);color:#93c5fd;}

html[data-theme="dark"] .ui-pill-teal,
html[data-theme="dark"] .dash-pill-ok,
html[data-theme="dark"] .cli-pill-success,
html[data-theme="dark"] .cuo-pill-teal,
html[data-theme="dark"] .pre-pill-teal,
html[data-theme="dark"] .por-pill-ok,
html[data-theme="dark"] .badge-success-soft,
html[data-theme="dark"] .cfg-estado.on,
html[data-theme="dark"] .sec-estado.on{background:rgba(16,185,129,.16);color:#6ee7b7;}

html[data-theme="dark"] .ui-pill-muted,
html[data-theme="dark"] .cli-pill-muted,
html[data-theme="dark"] .cuo-pill-muted,
html[data-theme="dark"] .pre-pill-muted,
html[data-theme="dark"] .por-pill-muted,
html[data-theme="dark"] .badge-soft,
html[data-theme="dark"] .cfg-estado.off,
html[data-theme="dark"] .sec-estado.off{background:rgba(148,163,184,.16);color:#cbd5e1;}

html[data-theme="dark"] .ui-pill-danger,
html[data-theme="dark"] .dash-pill-late,
html[data-theme="dark"] .cli-pill-danger,
html[data-theme="dark"] .cuo-pill-danger,
html[data-theme="dark"] .pre-pill-danger,
html[data-theme="dark"] .por-pill-danger,
html[data-theme="dark"] .badge-danger-soft{background:rgba(239,68,68,.18);color:#fca5a5;}

html[data-theme="dark"] .ui-pill-warning,
html[data-theme="dark"] .cli-pill-warning,
html[data-theme="dark"] .badge-warning-soft{background:rgba(245,158,11,.18);color:#fcd34d;}

html[data-theme="dark"] .ui-chip,
html[data-theme="dark"] .dash-chip,
html[data-theme="dark"] .cuo-chip,
html[data-theme="dark"] .ui-count-chip,
html[data-theme="dark"] .dash-count-chip,
html[data-theme="dark"] .dash-mode-chip,
html[data-theme="dark"] .cli-count-chip,
html[data-theme="dark"] .pre-count-chip,
html[data-theme="dark"] .cfg-tab b,
html[data-theme="dark"] .ui-avatar,
html[data-theme="dark"] .dash-avatar,
html[data-theme="dark"] .cli-avatar,
html[data-theme="dark"] .cuo-avatar,
html[data-theme="dark"] .pre-avatar{
  background:rgba(59,130,246,.16);
  color:#9ec1f5;
}
html[data-theme="dark"] .ui-chip.is-liquida,
html[data-theme="dark"] .cuo-chip.cancelacion,
html[data-theme="dark"] .cli-delta,
html[data-theme="dark"] .dash-kpi-delta,
html[data-theme="dark"] .dash-kpi-delta,
html[data-theme="dark"] .dash-pill-ok{background:rgba(16,185,129,.16);color:#6ee7b7;}
html[data-theme="dark"] .his-metodo-efectivo{background:rgba(16,185,129,.16);color:#6ee7b7;}
html[data-theme="dark"] .his-metodo-transferencia{background:rgba(59,130,246,.18);color:#93c5fd;}
html[data-theme="dark"] .his-metodo-otro{background:rgba(148,163,184,.16);color:#cbd5e1;}
html[data-theme="dark"] .cfg-tab.active b{background:rgba(255,255,255,.18);color:#fff;}
html[data-theme="dark"] .ui-pill b,
html[data-theme="dark"] .ui-pill strong{color:inherit;}

/* Iconos suaves */
html[data-theme="dark"] .ui-kpi-icon,
html[data-theme="dark"] .dash-kpi-icon,
html[data-theme="dark"] .cli-kpi-icon,
html[data-theme="dark"] .cuo-kpi-icon,
html[data-theme="dark"] .pre-kpi-icon,
html[data-theme="dark"] .por-kpi-icon,
html[data-theme="dark"] .met-panel-icon,
html[data-theme="dark"] .bg-soft-primary,
html[data-theme="dark"] .admin-dashboard .stat-icon{background:rgba(59,130,246,.16);color:#93c5fd;}
html[data-theme="dark"] .ui-kpi-icon.is-teal,
html[data-theme="dark"] .cuo-kpi-icon.is-teal,
html[data-theme="dark"] .pre-kpi-icon.is-teal,
html[data-theme="dark"] .por-kpi-icon.is-teal,
html[data-theme="dark"] .met-clients-icon,
html[data-theme="dark"] .bg-soft-success{background:rgba(16,185,129,.16);color:#6ee7b7;}
html[data-theme="dark"] .ui-kpi-icon.is-red,
html[data-theme="dark"] .cuo-kpi-icon.is-red,
html[data-theme="dark"] .cli-kpi.accent-red .cli-kpi-icon,
html[data-theme="dark"] .bg-soft-danger{background:rgba(239,68,68,.18);color:#fca5a5;}
html[data-theme="dark"] .ui-kpi-icon.is-amber,
html[data-theme="dark"] .bg-soft-warning{background:rgba(245,158,11,.18);color:#fcd34d;}
html[data-theme="dark"] .bg-soft-warning{color:#fcd34d;}

/* WhatsApp */
html[data-theme="dark"] .cli-wa,
html[data-theme="dark"] .cuo-wa{background:rgba(18,140,74,.2);color:#4ade80;border-color:transparent;}
html[data-theme="dark"] .cli-wa:hover,
html[data-theme="dark"] .cuo-wa:hover{background:#128c4a;color:#fff;}

/* Barras de progreso */
html[data-theme="dark"] .ui-bar,
html[data-theme="dark"] .dash-bar,
html[data-theme="dark"] .cli-bar,
html[data-theme="dark"] .cuo-bar,
html[data-theme="dark"] .pre-bar,
html[data-theme="dark"] .pre-progreso-bar,
html[data-theme="dark"] .por-bar,
html[data-theme="dark"] .met-dist-bar,
html[data-theme="dark"] .dash-ring{background:#22314a;}
html[data-theme="dark"] .dash-ring{
  background:conic-gradient(var(--teal,#14b8a6) calc(var(--p,0) * 1%), #22314a 0);
}
html[data-theme="dark"] .dash-ring::before{background:var(--ct-surface);}
html[data-theme="dark"] .dash-ring span{color:#c3d0e0;}

/* ===================== Alertas ===================== */
html[data-theme="dark"] .alert-success{background:rgba(16,185,129,.14);color:#6ee7b7;border-left-color:#10b981;}
html[data-theme="dark"] .alert-danger{background:rgba(239,68,68,.14);color:#fca5a5;border-left-color:#ef4444;}
html[data-theme="dark"] .alert-warning{background:rgba(245,158,11,.14);color:#fcd34d;border-left-color:#f59e0b;}
html[data-theme="dark"] .alert-info{background:rgba(59,130,246,.14);color:#93c5fd;border-left-color:#3b82f6;}
html[data-theme="dark"] .alert .close{color:inherit;text-shadow:none;}
html[data-theme="dark"] .auth-form-card .alert-info{background:rgba(59,130,246,.14);color:#93c5fd;}
html[data-theme="dark"] .auth-form-card .alert-danger{background:rgba(239,68,68,.14);color:#fca5a5;}

/* ===================== Sidebar ===================== */
html[data-theme="dark"] .crediton-sidebar{
  background:var(--sidebar-bg);
  border-right-color:var(--sidebar-border);
  box-shadow:var(--shadow);
}
html[data-theme="dark"] .crediton-sidebar .sidebar-header,
html[data-theme="dark"] .crediton-sidebar .sidebar-bottom,
html[data-theme="dark"] .crediton-sidebar .sidebar-ubicacion,
html[data-theme="dark"] .crediton-sidebar .sidebar-user{border-color:var(--sidebar-border);}
html[data-theme="dark"] .crediton-sidebar .brand,
html[data-theme="dark"] .crediton-sidebar .sidebar-user-info b{color:var(--sidebar-text);}
html[data-theme="dark"] .crediton-sidebar .sidebar-toggle,
html[data-theme="dark"] .mobile-hamburger{background:#142033;border-color:var(--sidebar-border);color:#cbd5e1;}
html[data-theme="dark"] .crediton-sidebar .sidebar-toggle:hover,
html[data-theme="dark"] .mobile-hamburger:hover{background:#1b2a41;border-color:#354a68;}
html[data-theme="dark"] .crediton-sidebar .nav-seccion{color:#7c8ea3;}
html[data-theme="dark"] .crediton-sidebar .nav-link{color:#cbd5e1 !important;}
html[data-theme="dark"] .crediton-sidebar .nav-link i{color:#7c8ea3;}
html[data-theme="dark"] .crediton-sidebar .nav-link:hover{background:#16233a;color:#fff !important;}
html[data-theme="dark"] .crediton-sidebar .nav-link:hover i{color:#93c5fd;}
html[data-theme="dark"] .crediton-sidebar .nav-link.active{background:rgba(59,130,246,.18);color:#eaf2fb !important;}
html[data-theme="dark"] .crediton-sidebar .nav-link.active::before{background:#60a5fa;}
html[data-theme="dark"] .crediton-sidebar .nav-link.active i{color:#93c5fd;}
html[data-theme="dark"] .crediton-sidebar .sidebar-ubicacion{background:var(--ct-surface-2);}
html[data-theme="dark"] .crediton-sidebar .sidebar-ubicacion small{color:#7c8ea3;}
html[data-theme="dark"] .crediton-sidebar .sidebar-ubicacion b{color:#c3d0e0;}
html[data-theme="dark"] .crediton-sidebar .sidebar-user{background:var(--ct-surface-2);}
html[data-theme="dark"] .crediton-sidebar .sidebar-user-info small{color:#7c8ea3;}
html[data-theme="dark"] .crediton-sidebar .sidebar-user-out{background:var(--ct-surface);border-color:var(--sidebar-border);color:#9fb0c7;}
html[data-theme="dark"] .crediton-sidebar .sidebar-user-out:hover{background:rgba(239,68,68,.16);border-color:#7f1d1d;color:#fca5a5;}
html[data-theme="dark"] .crediton-sidebar .version-badge{background:var(--ct-surface-2);border-color:var(--sidebar-border);color:#c3d0e0;}
html[data-theme="dark"] .crediton-sidebar .sidebar-user-avatar,
html[data-theme="dark"] .app-sheet-avatar,
html[data-theme="dark"] .app-topbar-avatar,
html[data-theme="dark"] .portal-user-avatar{background:#2f6fbf;color:#fff;}
html[data-theme="dark"] .crediton-sidebar .sidebar-theme:hover{background:#16233a;color:#fff !important;}
html[data-theme="dark"] .crediton-sidebar .sidebar-theme:hover i{color:#93c5fd;}
@media (min-width:993px){
  html[data-theme="dark"] body.with-sidebar:not(.sidebar-collapsed) .crediton-sidebar .sidebar-logo .logo-full:not(.logo-full-light){display:none !important;}
  html[data-theme="dark"] body.with-sidebar:not(.sidebar-collapsed) .crediton-sidebar .sidebar-logo .logo-full.logo-full-light{display:block !important;}
}

/* Botón de tema dentro de la hoja móvil */
.app-sheet-theme{width:100%;background:none;border:none;font-family:inherit;text-align:left;cursor:pointer;}

/* ===================== App shell móvil ===================== */
@media (max-width:992px){
  html[data-theme="dark"] body{background:var(--bg-light);}
  html[data-theme="dark"] .app-topbar{
    background:rgba(13,23,40,.94);
    border-bottom-color:rgba(34,49,74,.95);
  }
  html[data-theme="dark"] .app-topbar-back{background:rgba(59,130,246,.16);border-color:#2a3b54;color:#93c5fd;}
  html[data-theme="dark"] .app-topbar-page{color:var(--text-primary);}
  html[data-theme="dark"] .app-topbar-kicker{color:#7c8ea3;}
  html[data-theme="dark"] .app-topbar-avatar{border-color:var(--ct-surface);box-shadow:0 0 0 1px #2a3b54,0 8px 18px -12px rgba(0,0,0,.8);}
  html[data-theme="dark"] .app-tabbar{
    background:rgba(13,23,40,.96);
    border-top-color:rgba(34,49,74,.95);
  }
  html[data-theme="dark"] .app-tab{color:#7c8ea3;}
  html[data-theme="dark"] .app-tab:hover{color:#c3d0e0;}
  html[data-theme="dark"] .app-tab.active,
  html[data-theme="dark"] body.app-sheet-open .app-tab-more{color:#eaf2fb;}
  html[data-theme="dark"] .app-tab.active .app-tab-icon,
  html[data-theme="dark"] body.app-sheet-open .app-tab-more .app-tab-icon{background:rgba(59,130,246,.18);color:#93c5fd;}
  html[data-theme="dark"] .app-sheet{
    background:var(--ct-surface);
    box-shadow:0 -24px 60px -34px rgba(0,0,0,.85);
  }
  html[data-theme="dark"] .app-sheet-grip{background:#2a3b54;}
  html[data-theme="dark"] .app-sheet-head,
  html[data-theme="dark"] .app-sheet-foot{border-color:var(--ct-line);}
  html[data-theme="dark"] .app-sheet-user b{color:var(--text-primary);}
  html[data-theme="dark"] .app-sheet-user small,
  html[data-theme="dark"] .app-sheet-section{color:#7c8ea3;}
  html[data-theme="dark"] .app-sheet-close{background:var(--ct-surface-2);border-color:#2a3b54;color:#9fb0c7;}
  html[data-theme="dark"] .app-sheet-link{color:#cbd5e1;}
  html[data-theme="dark"] .app-sheet-link > i:first-child{background:rgba(59,130,246,.14);color:#93c5fd;}
  html[data-theme="dark"] .app-sheet-link:hover{background:var(--ct-surface-2);color:#fff;}
  html[data-theme="dark"] .app-sheet-link.active{background:rgba(59,130,246,.16);color:#eaf2fb;}
  html[data-theme="dark"] .app-sheet-link.active > i:first-child{background:rgba(59,130,246,.24);color:#bfdbfe;}
  html[data-theme="dark"] .app-sheet-logout{background:rgba(239,68,68,.14);color:#fca5a5;}
  html[data-theme="dark"] .app-sheet-logout:hover{background:rgba(239,68,68,.22);color:#fecaca;}
  html[data-theme="dark"] .app-sheet-backdrop{background:rgba(3,8,18,.65);}
}

/* ===================== Menús, modales y avisos ===================== */
html[data-theme="dark"] .ui-menu,
html[data-theme="dark"] .cli-menu,
html[data-theme="dark"] .pre-menu,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .ct-modal,
html[data-theme="dark"] .soc-modal,
html[data-theme="dark"] .cuo-modal,
html[data-theme="dark"] .ct-toast,
html[data-theme="dark"] .ct-loading-card{
  background:var(--ct-surface);
  border-color:var(--ct-line);
  color:var(--text-primary);
}
html[data-theme="dark"] .ui-menu a,
html[data-theme="dark"] .cli-menu a,
html[data-theme="dark"] .pre-menu a,
html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .app-sheet-link{color:#c3d0e0;}
html[data-theme="dark"] .ui-menu a:hover,
html[data-theme="dark"] .cli-menu a:hover,
html[data-theme="dark"] .pre-menu a:hover,
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus{background:var(--ct-surface-2);color:#fff;}
html[data-theme="dark"] .ui-menu a i,
html[data-theme="dark"] .cli-menu a i,
html[data-theme="dark"] .pre-menu a i{color:#7c8ea3;}
html[data-theme="dark"] .dropdown-divider{border-top-color:var(--ct-line);}
html[data-theme="dark"] .close{color:#c3d0e0;text-shadow:none;opacity:.8;}
html[data-theme="dark"] .close:hover{color:#fff;}

html[data-theme="dark"] .ct-toast-body b,
html[data-theme="dark"] .ct-modal-title,
html[data-theme="dark"] .ct-loading-card b{color:var(--text-primary);}
html[data-theme="dark"] .ct-toast-body span,
html[data-theme="dark"] .ct-modal-text,
html[data-theme="dark"] .ct-loading-card small{color:var(--text-secondary);}
html[data-theme="dark"] .ct-toast-x{color:#7c8ea3;}
html[data-theme="dark"] .ct-toast-x:hover{color:#c3d0e0;}
html[data-theme="dark"] .ct-modal-icon.is-info{background:rgba(59,130,246,.16);color:#93c5fd;}
html[data-theme="dark"] .ct-modal-icon.is-success{background:rgba(16,185,129,.16);color:#6ee7b7;}
html[data-theme="dark"] .ct-modal-icon.is-danger{background:rgba(239,68,68,.18);color:#fca5a5;}
html[data-theme="dark"] .ct-toast-success .ct-toast-icon{background:rgba(16,185,129,.16);color:#6ee7b7;}
html[data-theme="dark"] .ct-toast-error .ct-toast-icon{background:rgba(239,68,68,.18);color:#fca5a5;}
html[data-theme="dark"] .ct-toast-warning .ct-toast-icon{background:rgba(245,158,11,.18);color:#fcd34d;}
html[data-theme="dark"] .ct-toast-info .ct-toast-icon{background:rgba(59,130,246,.16);color:#93c5fd;}
html[data-theme="dark"] .ct-modal-actions .ui-btn{background:var(--ct-surface-2);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .ct-modal-actions .ui-btn:hover{background:var(--ct-surface-3);border-color:#354a68;color:#fff;}
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark,
html[data-theme="dark"] .ct-modal-actions .ui-btn-dark:hover{background:var(--navy,#2f6fbf);border-color:var(--navy,#2f6fbf);color:#fff;}
html[data-theme="dark"] .ct-modal-actions .ct-btn-danger,
html[data-theme="dark"] .ct-modal-actions .ct-btn-danger:hover{background:#b42318;border-color:#b42318;color:#fff;}
html[data-theme="dark"] .ct-loading-overlay{background:rgba(3,8,18,.55);}
html[data-theme="dark"] .ct-spinner{border-color:#2a3b54;border-top-color:#14b8a6;}
html[data-theme="dark"] .soc-overlay,
html[data-theme="dark"] .cuo-overlay{background:rgba(3,8,18,.65);}
html[data-theme="dark"] .cuo-modal-close{background:var(--ct-surface-2);border-color:#2a3b54;color:#9fb0c7;}

/* ===================== Textos con colores fijos ===================== */
html[data-theme="dark"] .cli-adv{background:var(--ct-surface-2);border-color:var(--ct-line);}
html[data-theme="dark"] .cli-phone,
html[data-theme="dark"] .cli-date-cell,
html[data-theme="dark"] .cuo-fecha,
html[data-theme="dark"] .pre-modalidad,
html[data-theme="dark"] .por-num,
html[data-theme="dark"] .soc-mob-socio b,
html[data-theme="dark"] .met-box-pct,
html[data-theme="dark"] .met-row-head,
html[data-theme="dark"] .met-dist-head,
html[data-theme="dark"] .his-leyenda span,
html[data-theme="dark"] .ui-summary-item > b,
html[data-theme="dark"] .ui-summary-head b,
html[data-theme="dark"] .por-loan-top b,
html[data-theme="dark"] .sec-secreto{color:var(--text-primary);}
html[data-theme="dark"] .cli-id,
html[data-theme="dark"] .cli-date-cell span,
html[data-theme="dark"] .dash-kpi-value small,
html[data-theme="dark"] .por-kpi-value small{color:#8fa6c2;}
html[data-theme="dark"] .dash-link,
html[data-theme="dark"] .pre-kpi-foot a,
html[data-theme="dark"] .ui-kpi-foot a,
html[data-theme="dark"] .soc-detalle-toggle,
html[data-theme="dark"] .por-loan-link{color:#7fb3f5;}
html[data-theme="dark"] .sec-texto,
html[data-theme="dark"] .sec-pasos,
html[data-theme="dark"] .sec-lista li{color:#c3d0e0;}
html[data-theme="dark"] .sec-nota{color:var(--text-secondary);}
html[data-theme="dark"] .cuo-nota{color:#fcd34d;}
html[data-theme="dark"] .cuo-kpi-note.is-red,
html[data-theme="dark"] .met-diff,
html[data-theme="dark"] .cfg-field label .req{color:#fca5a5;}
html[data-theme="dark"] .pre-progreso-top em,
html[data-theme="dark"] .met-checks i{color:#5eead4;}
html[data-theme="dark"] .met-checks i.warn{color:#fca5a5;}
html[data-theme="dark"] .met-split .sep{color:#4b5f7a;}
html[data-theme="dark"] .met-split b{color:var(--text-primary);}
html[data-theme="dark"] .soc-mob-total{color:#9ec1f5;}
html[data-theme="dark"] .soc-chart-leyenda,
html[data-theme="dark"] .soc-mob-socio,
html[data-theme="dark"] .his-leyenda{color:var(--text-secondary);}
html[data-theme="dark"] .soc-page .soc-input input:disabled{background:#16233a;color:#6f8199;}
html[data-theme="dark"] .soc-input{background:#0f1a2b;border-color:#2a3b54;}
html[data-theme="dark"] .soc-chip-id{color:#7fb3f5;}
html[data-theme="dark"] .soc-socio:hover{background:var(--ct-surface-2);}
html[data-theme="dark"] .sec-secreto{background:var(--ct-surface-2);border-color:#2a3b54;}
html[data-theme="dark"] .admin-dashboard .qa-item{background:var(--ct-surface-2);border-color:var(--ct-line);color:var(--text-primary);}
html[data-theme="dark"] .admin-dashboard .qa-item:hover{background:var(--ct-surface-3);}
html[data-theme="dark"] .admin-dashboard .qa-item i{color:#8fa6c2;}
html[data-theme="dark"] .cuop-switch{color:#c3d0e0;}
html[data-theme="dark"] .cuop-pay-note i{color:#5eead4;}
html[data-theme="dark"] .soc-detalle-box,
html[data-theme="dark"] .cfg-rol-foot,
html[data-theme="dark"] .met-line,
html[data-theme="dark"] .cfg-form-foot{border-color:var(--ct-line-soft);}
html[data-theme="dark"] .ui-card-head h3,
html[data-theme="dark"] .por-card-head h3,
html[data-theme="dark"] .met-detail-head h3,
html[data-theme="dark"] .met-panel-head h3,
html[data-theme="dark"] .soc-modal-head h3,
html[data-theme="dark"] .cuo-modal-head h3,
html[data-theme="dark"] .dash-card-head h3,
html[data-theme="dark"] .cli-head h1,
html[data-theme="dark"] .cuo-head h1,
html[data-theme="dark"] .pre-head h1,
html[data-theme="dark"] .ui-head h1,
html[data-theme="dark"] .por-loan-top b,
html[data-theme="dark"] .soc-socio-main b,
html[data-theme="dark"] .soc-mob-mes{color:var(--text-primary);}
html[data-theme="dark"] .ui-card-head h3 i,
html[data-theme="dark"] .por-card-head h3 i,
html[data-theme="dark"] .dash-card-head h3 i,
html[data-theme="dark"] .met-detail-head h3 i,
html[data-theme="dark"] .sec-card-head i{color:#7c8ea3;}

/* ===================== DataTables ===================== */
html[data-theme="dark"] .dataTables_wrapper,
html[data-theme="dark"] .dataTables_info,
html[data-theme="dark"] .dataTables_length label,
html[data-theme="dark"] .dataTables_filter label{color:var(--text-secondary);}
html[data-theme="dark"] .page-link{background:var(--ct-surface-2);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .page-link:hover{background:var(--ct-surface-3);border-color:#354a68;color:#fff;}
html[data-theme="dark"] .page-item.active .page-link{background:#2f6fbf;border-color:#2f6fbf;color:#fff;}
html[data-theme="dark"] .page-item.disabled .page-link{background:var(--ct-surface);border-color:var(--ct-line);color:#5b6b7d;}
html[data-theme="dark"] .dt-spinner{background:rgba(17,28,46,.94);}
html[data-theme="dark"] .dt-spinner-inner{border-color:#22314a;border-top-color:#14b8a6;}

/* ===================== Portal del cliente ===================== */
html[data-theme="dark"] body.portal-body{
  color:var(--text-primary);
  background:
    radial-gradient(760px 400px at 8% 0%, rgba(20,184,166,.10), transparent 62%),
    radial-gradient(820px 440px at 96% 100%, rgba(59,130,246,.12), transparent 64%),
    linear-gradient(180deg,#0b1220 0%,#0d1728 100%);
}
html[data-theme="dark"] .portal-topbar{background:rgba(13,23,40,.92);border-bottom-color:var(--ct-line);}
html[data-theme="dark"] .portal-brand b{color:var(--text-primary);}
html[data-theme="dark"] .portal-brand small{color:#7c8ea3;}
html[data-theme="dark"] .portal-user-name{color:#cbd5e1;}
html[data-theme="dark"] .portal-logout{background:var(--ct-surface-2);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .portal-logout:hover{background:rgba(239,68,68,.16);border-color:#7f1d1d;color:#fca5a5;}
html[data-theme="dark"] .por-loan.is-ref{border-color:#2f527d;box-shadow:0 0 0 3px rgba(59,130,246,.1);}
html[data-theme="dark"] .por-info-item b{color:var(--text-primary);}
html[data-theme="dark"] .por-hero,
html[data-theme="dark"] .soc-protocol,
html[data-theme="dark"] .dash-hero{border:1px solid rgba(255,255,255,.06);}

/* ===================== Acceso (login / 2FA) ===================== */
html[data-theme="dark"] body.auth-body{
  color:var(--text-primary);
  background:
    radial-gradient(780px 420px at 10% 4%, rgba(20,184,166,.12), transparent 62%),
    radial-gradient(820px 460px at 92% 96%, rgba(59,130,246,.14), transparent 64%),
    linear-gradient(180deg,#0b1220 0%,#0d1728 100%);
}
html[data-theme="dark"] .auth-card-head b{color:var(--text-primary);}
html[data-theme="dark"] .auth-card-head small{color:#7c8ea3;}
html[data-theme="dark"] .auth-form-card{background:var(--ct-surface);border-color:var(--ct-line);box-shadow:0 30px 70px -38px rgba(0,0,0,.8);}
html[data-theme="dark"] .auth-card h1,
html[data-theme="dark"] .auth-card .h5{color:var(--text-primary);}
html[data-theme="dark"] .brand-subtitle{color:var(--text-secondary);}
html[data-theme="dark"] .auth-form-card label{color:#9fb0c7;}
html[data-theme="dark"] .auth-form-card .input-group,
html[data-theme="dark"] .otp-field{background:#0f1a2b;border-color:#2a3b54;}
html[data-theme="dark"] .auth-form-card .input-group:focus-within,
html[data-theme="dark"] .otp-field:focus-within{border-color:#3b82f6;box-shadow:0 0 0 4px rgba(59,130,246,.16);}
html[data-theme="dark"] .auth-form-card .input-group-text,
html[data-theme="dark"] .otp-field-icon{color:#7c8ea3;background:transparent;border-color:transparent;}
html[data-theme="dark"] .auth-form-card .form-control,
html[data-theme="dark"] .otp-field input{background:transparent !important;color:var(--text-primary);}
html[data-theme="dark"] .auth-form-card .form-control::placeholder,
html[data-theme="dark"] .otp-field input::placeholder{color:#5f7290;}
html[data-theme="dark"] .password-toggle{color:#7c8ea3;}
html[data-theme="dark"] .password-toggle:hover{color:#c3d0e0;}
html[data-theme="dark"] .otp-help,
html[data-theme="dark"] .otp-auto-hint{color:#7c8ea3;}
html[data-theme="dark"] .otp-feedback{background:rgba(239,68,68,.14);color:#fca5a5;}
html[data-theme="dark"] .otp-paste-btn{background:rgba(59,130,246,.14);border-color:#2a3b54;color:#c3d0e0;}
html[data-theme="dark"] .otp-paste-btn i{color:#93c5fd;}
html[data-theme="dark"] .otp-paste-btn:active{background:rgba(59,130,246,.24);}
html[data-theme="dark"] body.auth-body::after{color:#6f8199;}
html[data-theme="dark"] .auth-form-card .btn-primary{background:linear-gradient(135deg,#2f6fbf 0%,#1d4f8f 100%);color:#fff;}

/* ===================== Ajustes puntuales de vistas ===================== */
html[data-theme="dark"] #soc-consulta-error,
html[data-theme="dark"] #soc-pago-error{
  background:rgba(239,68,68,.14) !important;
  border-color:#7f1d1d !important;
  color:#fca5a5 !important;
}
html[data-theme="dark"] #dash-export{
  background:var(--ct-surface-2) !important;
  border-color:#2a3b54 !important;
  color:#c3d0e0 !important;
}
html[data-theme="dark"] .dash-hero p,
html[data-theme="dark"] .por-hero p,
html[data-theme="dark"] .soc-protocol > p{color:#b6c7d9;}

/* ===================== Impresión ===================== */
@media print{
  html[data-theme="dark"] body,
  html[data-theme="dark"] .content-wrapper,
  html[data-theme="dark"] .content{background:#fff !important;color:#111 !important;}
  html[data-theme="dark"] .crediton-sidebar,
  html[data-theme="dark"] .app-topbar,
  html[data-theme="dark"] .app-tabbar{display:none !important;}
  html[data-theme="dark"] .card,
  html[data-theme="dark"] .ui-card,
  html[data-theme="dark"] .dash-card,
  html[data-theme="dark"] .cli-card,
  html[data-theme="dark"] .cuo-card,
  html[data-theme="dark"] .pre-card,
  html[data-theme="dark"] .por-card{background:#fff !important;border-color:#ddd !important;box-shadow:none !important;}
  html[data-theme="dark"] .table th,
  html[data-theme="dark"] .table td{color:#111 !important;border-color:#ddd !important;}
}
