/* ═══ Pulido general (claro y oscuro) ═══ */
:root { --radio: 14px; }
.card { border-radius: var(--radio); }
.card.shadow-sm, .card.shadow { border: 1px solid rgba(0,0,0,.05); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-sm { border-radius: 8px; }
.form-control, .form-select { border-radius: 10px; padding-top: .55rem; padding-bottom: .55rem; }
.form-control-sm, .form-select-sm { padding-top: .3rem; padding-bottom: .3rem; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 .22rem rgba(52,152,219,.25); border-color: #3498db; }
.form-label { font-weight: 600; font-size: .85rem; }
.badge { border-radius: 8px; }
.table > :not(caption) > * > * { padding-top: .6rem; padding-bottom: .6rem; }
.btn-tema { width: 36px; height: 36px; padding: 0; border-radius: 50% !important; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #f1c40f; }
.btn-tema:hover { background: rgba(255,255,255,.12); }

/* Popups (Bootstrap) */
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.28); overflow: hidden; }
.modal-header { border-bottom: 0; padding: 1.1rem 1.25rem .4rem; }
.modal-header .modal-title { font-weight: 700; }
.modal-footer { border-top: 0; padding: .4rem 1.25rem 1.1rem; }
.modal-body { padding: .8rem 1.25rem; }
.modal-backdrop.show { opacity: .55; }
@media (max-width: 575.98px) {            /* en celular los popups suben desde abajo */
    .modal-dialog:not(.modal-fullscreen) { margin: 0; min-height: 100%; display: flex; align-items: flex-end; max-width: none; }
    .modal-dialog:not(.modal-fullscreen) .modal-content { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; }
    .modal-dialog-scrollable { height: 100%; }
}

/* Popups (SweetAlert2) */
.swal2-popup { border-radius: 20px !important; font-family: inherit; padding: 1.4rem 1.2rem 1.2rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.swal2-title { font-size: 1.35rem; font-weight: 700; }
.swal2-styled { border-radius: 10px !important; font-weight: 600; padding: .65rem 1.3rem; }
.swal2-styled:focus { box-shadow: 0 0 0 .22rem rgba(52,152,219,.3) !important; }
.swal2-input, .swal2-select, .swal2-textarea { border-radius: 10px !important; }
.swal2-toast { border-radius: 14px !important; box-shadow: 0 8px 24px rgba(0,0,0,.25) !important; }
@media (max-width: 575.98px) { .swal2-popup:not(.swal2-toast) { width: 92vw !important; } }

/* ═══ MODO OSCURO ═══ */
[data-bs-theme="dark"] {
    --gris-fondo: #0e1522;
    --bs-body-bg: #0e1522;
    --bs-body-color: #e4e9f1;
    --bs-secondary-bg: #172131;
    --bs-tertiary-bg: #172131;
    --bs-border-color: #2a3649;
    --bs-secondary-color: #9fb0c6;
    color-scheme: dark;
}
[data-bs-theme="dark"] body { background: #0e1522; color: #e4e9f1; }
[data-bs-theme="dark"] .navbar-kiosco { background-color: #0b1220 !important; }
[data-bs-theme="dark"] .card:not([class*="bg-"]),
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light:not(.badge),
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .accordion-item { background-color: #172131 !important; color: #e4e9f1; border-color: #2a3649; }
[data-bs-theme="dark"] .card-header.bg-white, [data-bs-theme="dark"] .card-footer.bg-white,
[data-bs-theme="dark"] .card-footer.bg-light, [data-bs-theme="dark"] .card-header.bg-light { background-color: #1d2a3d !important; }
[data-bs-theme="dark"] .card.shadow-sm, [data-bs-theme="dark"] .card.shadow { border-color: #2a3649; }
[data-bs-theme="dark"] .text-dark { color: #e4e9f1 !important; }
[data-bs-theme="dark"] .text-muted, [data-bs-theme="dark"] .text-secondary { color: #9fb0c6 !important; }
[data-bs-theme="dark"] .text-primary { color: #5dade2 !important; }
[data-bs-theme="dark"] .text-success { color: #4cd08a !important; }
[data-bs-theme="dark"] .text-danger { color: #ff7b86 !important; }
[data-bs-theme="dark"] .border, [data-bs-theme="dark"] .border-bottom, [data-bs-theme="dark"] .border-top { border-color: #2a3649 !important; }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: #e4e9f1; --bs-table-border-color: #2a3649; --bs-table-striped-bg: #1b2739; --bs-table-hover-bg: #1f2d42; }
[data-bs-theme="dark"] .table-light, [data-bs-theme="dark"] .table-light > th, [data-bs-theme="dark"] .table > thead.table-light > tr > th, [data-bs-theme="dark"] thead.table-light th { --bs-table-bg: #1f2d42; --bs-table-color: #cfd9e6; background-color: #1f2d42 !important; color: #cfd9e6 !important; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] textarea { background-color: #0e1522; color: #e4e9f1; border-color: #2f3d52; }
[data-bs-theme="dark"] .form-control::placeholder { color: #6f8099; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly] { background-color: #121b2a; }
[data-bs-theme="dark"] .btn-light, [data-bs-theme="dark"] .btn-outline-dark { background-color: transparent; color: #e4e9f1; border-color: #3a4a62; }
[data-bs-theme="dark"] .btn-outline-secondary { color: #b6c3d4; border-color: #3a4a62; }
[data-bs-theme="dark"] .btn-outline-secondary:hover, [data-bs-theme="dark"] .btn-outline-dark:hover { background: #26354c; color: #fff; }
[data-bs-theme="dark"] .dropdown-item { color: #e4e9f1; }
[data-bs-theme="dark"] .dropdown-item:hover { background: #22304a; }
[data-bs-theme="dark"] .nav-tabs { border-color: #2a3649; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { background: #172131; border-color: #2a3649 #2a3649 #172131; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme="dark"] hr { border-color: #2a3649; opacity: 1; }
[data-bs-theme="dark"] .alert-secondary { background: #1d2a3d; color: #cfd9e6; border-color: #2a3649; }
/* fondos claros escritos a mano en algunas pantallas */
[data-bs-theme="dark"] [style*="background:#f8f9fa"], [data-bs-theme="dark"] [style*="background: #f8f9fa"],
[data-bs-theme="dark"] [style*="background:var(--bs-secondary-bg"], [data-bs-theme="dark"] [style*="background:#fff;"],
[data-bs-theme="dark"] [style*="background: #fff;"], [data-bs-theme="dark"] [style*="background:white"] { background: #172131 !important; color: #e4e9f1; }
[data-bs-theme="dark"] [style*="background:#d1e7dd"] { background: #123b2a !important; color: #d6f5e6; }
[data-bs-theme="dark"] [style*="background:#fff8e1"] { background: #3a3114 !important; color: #fff3c4; }
/* select2 */
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown { background-color: #0e1522; border-color: #2f3d52; color: #e4e9f1; }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__rendered { color: #e4e9f1; }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted { background: #22304a; color: #fff; }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-search__field { background: #0e1522; color: #e4e9f1; }
/* SweetAlert2 */
[data-bs-theme="dark"] .swal2-popup { background: #172131; color: #e4e9f1; }
[data-bs-theme="dark"] .swal2-title, [data-bs-theme="dark"] .swal2-html-container { color: #e4e9f1; }
[data-bs-theme="dark"] .swal2-input, [data-bs-theme="dark"] .swal2-select, [data-bs-theme="dark"] .swal2-textarea { background: #0e1522; color: #e4e9f1; border-color: #2f3d52; }
[data-bs-theme="dark"] .swal2-validation-message { background: #1d2a3d; color: #ffb3ba; }
[data-bs-theme="dark"] .btn-dark { background-color: #3498db; border-color: #3498db; color: #fff; }
[data-bs-theme="dark"] .btn-dark:hover { background-color: #2f89c7; border-color: #2f89c7; }
[data-bs-theme="dark"] .card-header.bg-dark { background-color: #0b1220 !important; }
.navbar-kiosco .btn, .navbar-kiosco .nav-link { white-space: nowrap; }
[data-bs-theme="dark"] .fila-switch { background: #1d2a3d; border-color: #2f3d52; }

/* ═══ MODO OSCURO — revisión de contraste (todas las pantallas) ═══ */
/* texto oscuro que tiene que seguir oscuro (sobre fondos claros o amarillos) */
[data-bs-theme="dark"] .bg-warning .text-dark, [data-bs-theme="dark"] .bg-warning.text-dark,
[data-bs-theme="dark"] .bg-info .text-dark, [data-bs-theme="dark"] .bg-info.text-dark,
[data-bs-theme="dark"] .bg-success.text-dark, [data-bs-theme="dark"] .btn-warning .text-dark,
[data-bs-theme="dark"] .badge.bg-light.text-dark, [data-bs-theme="dark"] .badge.bg-warning.text-dark,
[data-bs-theme="dark"] .alert-warning .text-dark, [data-bs-theme="dark"] .table-warning .text-dark { color: #212529 !important; }
[data-bs-theme="dark"] .badge.bg-light { background-color: #e9edf3 !important; }
[data-bs-theme="dark"] .badge[class*="bg-opacity"].text-dark { color: #e4e9f1 !important; }
/* botones de contorno: tonos más claros para que se lean sobre fondo oscuro */
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #6cb2ff; --bs-btn-border-color: #4a90d9; --bs-btn-hover-bg: #0d6efd; --bs-btn-hover-border-color: #0d6efd; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #0d6efd; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-success { --bs-btn-color: #4cd08a; --bs-btn-border-color: #2f9e66; --bs-btn-hover-bg: #198754; --bs-btn-hover-border-color: #198754; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #198754; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: #ff7b86; --bs-btn-border-color: #c9505b; --bs-btn-hover-bg: #dc3545; --bs-btn-hover-border-color: #dc3545; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #dc3545; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-warning { --bs-btn-color: #ffd45c; --bs-btn-border-color: #c9a227; --bs-btn-hover-bg: #ffc107; --bs-btn-hover-color: #212529; }
[data-bs-theme="dark"] .btn-outline-info { --bs-btn-color: #5fd4ea; --bs-btn-border-color: #2fa5bd; --bs-btn-hover-bg: #0dcaf0; --bs-btn-hover-color: #212529; }
[data-bs-theme="dark"] .btn-outline-secondary.active, [data-bs-theme="dark"] .btn-outline-secondary:active,
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-secondary { background: #3a4a62; color: #fff; border-color: #55678a; }
[data-bs-theme="dark"] .btn-dark { background-color: #256a9a; border-color: #256a9a; }
[data-bs-theme="dark"] .btn-dark:hover { background-color: #246b9b; border-color: #246b9b; }
.btn-celeste { background-color: #236fa3 !important; border-color: #236fa3 !important; }   /* también en claro: el blanco sobre #3498db no llegaba a 4,5 de contraste */
[data-bs-theme="dark"] .badge.bg-secondary { background-color: #586274 !important; }
[data-bs-theme="dark"] .btn-success.disabled, [data-bs-theme="dark"] .btn:disabled { opacity: .55; }
/* filas de tabla de colores (rojo/amarillo/verde/azul) */
[data-bs-theme="dark"] .table-danger  { --bs-table-bg: #46222a; --bs-table-color: #f6d5da; --bs-table-border-color: #5b2d36; }
[data-bs-theme="dark"] .table-warning { --bs-table-bg: #463a14; --bs-table-color: #fbefc4; --bs-table-border-color: #5a4a1a; }
[data-bs-theme="dark"] .table-success { --bs-table-bg: #143a2a; --bs-table-color: #d3f3e2; --bs-table-border-color: #1c4c37; }
[data-bs-theme="dark"] .table-info    { --bs-table-bg: #123a45; --bs-table-color: #d0f1f8; --bs-table-border-color: #1b4d5b; }
[data-bs-theme="dark"] .table-primary { --bs-table-bg: #172d4f; --bs-table-color: #d6e4fb; --bs-table-border-color: #213d68; }
[data-bs-theme="dark"] .table-danger .text-muted, [data-bs-theme="dark"] .table-warning .text-muted { color: #c9b5b8 !important; }
[data-bs-theme="dark"] .alert-danger  { background: #46222a; color: #f6d5da; border-color: #5b2d36; }
[data-bs-theme="dark"] .alert-warning { background: #463a14; color: #fbefc4; border-color: #5a4a1a; }
[data-bs-theme="dark"] .alert-success { background: #143a2a; color: #d3f3e2; border-color: #1c4c37; }
[data-bs-theme="dark"] .alert-info    { background: #123a45; color: #d0f1f8; border-color: #1b4d5b; }
[data-bs-theme="dark"] .alert-primary { background: #172d4f; color: #d6e4fb; border-color: #213d68; }
[data-bs-theme="dark"] .bg-primary.bg-opacity-10, [data-bs-theme="dark"] .bg-primary.bg-opacity-25 { background-color: rgba(52,152,219,.22) !important; }
[data-bs-theme="dark"] .bg-success.bg-opacity-10, [data-bs-theme="dark"] .bg-success.bg-opacity-25 { background-color: rgba(25,135,84,.28) !important; }
[data-bs-theme="dark"] .bg-danger.bg-opacity-10, [data-bs-theme="dark"] .bg-danger.bg-opacity-25 { background-color: rgba(220,53,69,.25) !important; }
[data-bs-theme="dark"] .bg-warning.bg-opacity-10, [data-bs-theme="dark"] .bg-warning.bg-opacity-25 { background-color: rgba(255,193,7,.2) !important; }
/* colores escritos a mano (style="color:#xxxxxx") y en etiquetas internas */
[data-bs-theme="dark"] [style*="color:#6c757d" i], [data-bs-theme="dark"] [style*="color: #6c757d" i] { color: #a9b6c8 !important; }
[data-bs-theme="dark"] [style*="color:#3B6D11" i], [data-bs-theme="dark"] [style*="color: #3B6D11" i] { color: #86d65c !important; }
[data-bs-theme="dark"] [style*="color:#185FA5" i], [data-bs-theme="dark"] [style*="color: #185FA5" i], [data-bs-theme="dark"] [style*="color:#378ADD" i] { color: #6cb2ff !important; }
[data-bs-theme="dark"] [style*="color:#A32D2D" i], [data-bs-theme="dark"] [style*="color: #A32D2D" i] { color: #ff8e8e !important; }
[data-bs-theme="dark"] [style*="color:#BA7517" i], [data-bs-theme="dark"] [style*="color: #BA7517" i] { color: #f0b04a !important; }
[data-bs-theme="dark"] [style*="color:#534AB7" i], [data-bs-theme="dark"] [style*="color: #534AB7" i] { color: #aaa3ff !important; }
[data-bs-theme="dark"] [style*="color:#856404" i], [data-bs-theme="dark"] [style*="color: #856404" i] { color: #ffd45c !important; }
[data-bs-theme="dark"] [style*="color:#000" i], [data-bs-theme="dark"] [style*="color: #000" i]:not(.btn) { color: #e4e9f1; }
[data-bs-theme="dark"] .caja-seccion, [data-bs-theme="dark"] .kpi-label { color: #a9b6c8 !important; }
[data-bs-theme="dark"] small.text-primary, [data-bs-theme="dark"] small[style*="0d6efd" i] { color: #6cb2ff !important; }
[data-bs-theme="dark"] .badge.bg-light .text-muted, [data-bs-theme="dark"] .badge.bg-light.text-muted { color: #566070 !important; }
[data-bs-theme="dark"] .card[class*="bg-warning"] { color: #212529; }
[data-bs-theme="dark"] [style*="color:#0d6efd" i], [data-bs-theme="dark"] [style*="color: #0d6efd" i] { color: #6cb2ff !important; }
/* tarjetas de colores (claro y oscuro): el texto blanco no se leía sobre el celeste y se aclaraba demasiado */
.card.bg-info, .card.bg-info .text-white, .bg-info.text-white { color: #052c36 !important; }
.card[class*="bg-success"] .opacity-75, .card[class*="bg-danger"] .opacity-75, .card[class*="bg-primary"] .opacity-75,
.card[class*="bg-secondary"] .opacity-75, .card[class*="bg-dark"] .opacity-75, .card[class*="bg-info"] .opacity-75 { opacity: 1 !important; }
.card[class*="bg-success"] .kpi-label, .card[class*="bg-danger"] .kpi-label, .card[class*="bg-secondary"] .kpi-label { color: rgba(255,255,255,.92) !important; }
.card.bg-info .kpi-label { color: #0b4452 !important; }
[data-bs-theme="dark"] .card.bg-warning .kpi-label, [data-bs-theme="dark"] .card[class*="bg-warning"] .kpi-label { color: #5a4500 !important; }
[data-bs-theme="dark"] .card[class*="bg-primary"] .kpi-label { color: rgba(255,255,255,.92) !important; }
.card[class*="bg-success"] .text-white-50, .card[class*="bg-danger"] .text-white-50, .card[class*="bg-primary"] .text-white-50, .card[class*="bg-secondary"] .text-white-50 { color: rgba(255,255,255,.95) !important; }
.card.bg-info .text-white-50, .card.bg-info .text-white-50 * { color: #0b4452 !important; }
[class*="bg-primary"] .opacity-75, [class*="bg-danger"] .opacity-75, [class*="bg-success"] .opacity-75, [class*="bg-dark"] .opacity-75, [class*="bg-secondary"] .opacity-75 { opacity: .95 !important; }
/* fondos "suaves" propios de cada sistema (bg-soft-*): son claros, el texto oscuro se queda oscuro */
[data-bs-theme="dark"] [class*="bg-soft-"].text-dark, [data-bs-theme="dark"] [class*="bg-soft-"] .text-dark { color: #212529 !important; }
/* resumen de "Clientes/Deudores" en celular: la caja roja tenía fondo claro fijo */
[data-bs-theme="dark"] .resumen-deudores h4 { background: #46222a !important; border-color: #5b2d36 !important; }
/* modo claro: el celeste de contorno no llegaba a 2:1 sobre fondo claro */
.btn-outline-info { --bs-btn-color: #0a7490; --bs-btn-border-color: #0a7490; --bs-btn-hover-bg: #0a7490; --bs-btn-hover-border-color: #0a7490; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #0a7490; --bs-btn-active-color: #fff; }
