/* =============================================================================
   HIF Premium Universal — aplica a TODO el sistema (staff, portal, login, errores)
   Cargar después de hif-app.css y hif-premium.css
   ============================================================================= */

:root {
    --hif-primary: #0B4F6C;
    --hif-primary-dark: #094258;
    --hif-primary-light: #1B6CA8;
    --hif-bg-dark: #0B4F6C;
    --hif-accent: #0B4F6C;
    --hif-accent-end: #094258;
    --hif-accent-dark: #094258;
    --hif-accent-light: #1B6CA8;
    --hif-accent-soft: rgba(11, 79, 108, 0.12);
    --hif-link: #1B6CA8;
    --hif-link-hover: #0B4F6C;
    --bg-page: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-light: #DCE3EA;
    --border-muted: #DCE3EA;
    --nav-bg: #FFFFFF;
    --nav-bg-hover: #164a6e;
    --nav-text: #f8fafc;
    --nav-text-muted: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(15, 61, 94, 0.06);
    --shadow: 0 1px 3px rgba(15, 61, 94, 0.06), 0 8px 24px rgba(15, 61, 94, 0.06);
    --shadow-md: 0 4px 6px rgba(15, 61, 94, 0.04), 0 20px 40px rgba(15, 61, 94, 0.08);
    --success-bg: #E8F8ED;
    --success-border: #b8e6c8;
    --success-text: #1a7a34;
    --danger-bg: #FDE8E8;
    --danger-border: #f5c4c4;
    --danger-text: #b42318;
    --warning-bg: #F5EFE6;
    --warning-border: #ead9b0;
    --warning-text: #8a5a12;
    --info-bg: #E8EEFB;
    --info-border: #c5d4f5;
    --info-text: #1F5EFF;
}

/* —— Tipografía y fondo global —— */
body.hif-app {
    background: var(--bg-page) !important;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* —— Botones Bootstrap —— */
body.hif-app .btn-primary {
    background-color: var(--hif-blue, #1F5EFF) !important;
    border-color: var(--hif-blue, #1F5EFF) !important;
    border-radius: var(--radius-sm, 8px);
    font-weight: 600;
}

body.hif-app .btn-primary:hover,
body.hif-app .btn-primary:focus {
    background-color: #184ee6 !important;
    border-color: #184ee6 !important;
}

body.hif-app .btn-success {
    background-color: #34C759 !important;
    border-color: #34C759 !important;
    font-weight: 600;
}

body.hif-app .btn-outline-primary {
    color: var(--hif-blue, #1F5EFF);
    border-color: var(--hif-blue, #1F5EFF);
    border-radius: var(--radius-sm, 8px);
}

body.hif-app .btn-outline-secondary,
body.hif-app .btn-outline-dark {
    border-radius: var(--radius-sm, 8px);
    border-color: var(--border-light);
}

/* —— Formularios —— */
body.hif-app .form-control,
body.hif-app .form-select {
    border-radius: var(--radius-sm, 8px);
    border-color: var(--border-light);
    padding: 0.5rem 0.75rem;
}

body.hif-app .form-control:focus,
body.hif-app .form-select:focus {
    border-color: var(--hif-blue, #1F5EFF);
    box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.15);
}

/* —— Tarjetas —— */
body.hif-app .card,
body.hif-app .hif-card {
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius, 12px) !important;
    box-shadow: var(--shadow) !important;
    background: var(--bg-card) !important;
}

body.hif-app .card-header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-light) !important;
    font-weight: 600;
    color: var(--hif-navy, #0F3D5E) !important;
}

body.hif-app .dashboard-filters-card .card-header,
body.hif-app .dashboard-filters-header {
    background: var(--hif-navy, #0F3D5E) !important;
    color: #fff !important;
    border: none !important;
}

body.hif-app .dashboard-filters-card .card-header .text-white-50 {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* —— Tablas —— */
body.hif-app .table {
    --bs-table-bg: transparent;
}

body.hif-app .table thead th {
    background: var(--bg-page) !important;
    color: var(--text-secondary) !important;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light) !important;
}

body.hif-app .table-hover tbody tr:hover {
    background-color: rgba(31, 94, 255, 0.04) !important;
}

/* —— Modales (claros, estilo SaaS) —— */
body.hif-app .hif-notification-modal .modal-content.hif-notification-modal__content,
body.hif-app .hif-confirm-modal .modal-content.hif-confirm-modal__content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius, 12px) !important;
    box-shadow: var(--shadow-md) !important;
}

body.hif-app .hif-notification-modal .modal-header.hif-notification-modal__header,
body.hif-app .hif-confirm-modal .modal-header.hif-confirm-modal__header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

body.hif-app .hif-notification-modal .modal-title,
body.hif-app .hif-confirm-modal .modal-title {
    color: var(--hif-navy, #0F3D5E) !important;
}

body.hif-app .hif-notification-modal .modal-body.hif-notification-modal__body,
body.hif-app .hif-confirm-modal .modal-body,
body.hif-app .hif-confirm-modal .modal-body.hif-confirm-modal__body {
    color: var(--text-primary) !important;
}

body.hif-app .hif-notification-modal__text,
body.hif-app .hif-notification-modal__text strong,
body.hif-app .hif-notification-modal .modal-body strong,
body.hif-app .hif-confirm-modal .modal-body strong {
    color: var(--text-primary) !important;
}

body.hif-app .hif-notification-modal .modal-footer.hif-notification-modal__footer,
body.hif-app .hif-confirm-modal .modal-footer {
    background: var(--bg-page) !important;
    border-top: 1px solid var(--border-light) !important;
}

body.hif-app .modal-content {
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

body.hif-app .dropdown-menu {
    border-radius: var(--radius-sm, 8px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

body.hif-app .pagination .page-link {
    border-radius: var(--radius-sm, 8px);
    margin: 0 2px;
    border-color: var(--border-light);
}

body.hif-app .pagination .page-item.active .page-link {
    background-color: var(--hif-blue, #1F5EFF);
    border-color: var(--hif-blue, #1F5EFF);
}

/* —— KPI legacy —— */
body.hif-app .hif-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

body.hif-app .hif-kpi-card .kpi-value {
    color: var(--hif-navy, #0F3D5E);
}

/* —— Page chrome —— */
body.hif-app .page-header .page-title,
body.hif-app h1.page-title,
body.hif-app .h3.page-title {
    color: var(--hif-navy, #0F3D5E);
    font-weight: 700;
}

body.hif-app .section-badge {
    color: var(--hif-blue, #1F5EFF);
    font-weight: 600;
}

body.hif-app .breadcrumb-item.active {
    color: var(--text-muted);
}

/* —— Portal móvil (cliente / cobrador) —— */
body.hif-app .hif-portal-header {
    background: var(--hif-navy, #0F3D5E) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-sm);
}

body.hif-app .hif-portal-nav {
    background: var(--bg-card) !important;
    border-top: 1px solid var(--border-light) !important;
    box-shadow: 0 -4px 20px rgba(15, 61, 94, 0.08);
}

body.hif-app .hif-portal-nav a,
body.hif-app .hif-portal-nav .nav-item-btn {
    color: var(--text-muted) !important;
    font-weight: 600;
}

body.hif-app .hif-portal-nav a.active,
body.hif-app .collector-app-nav a.active {
    color: var(--hif-blue, #1F5EFF) !important;
}

body.hif-app .hif-portal-nav a i,
body.hif-app .collector-app-nav a i {
    color: inherit;
}

body.hif-app .hif-portal-card,
body.hif-app .hif-portal-card.card {
    border-radius: var(--radius, 12px) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow) !important;
}

body.hif-app .hif-portal-hero-card {
    background: var(--hif-navy, #0F3D5E) !important;
    color: #fff !important;
    border: none !important;
}

body.hif-app .app-header-btn {
    border-color: rgba(255, 255, 255, 0.35) !important;
}

/* —— Login / invitado —— */
body.hif-guest-body {
    background: var(--hif-navy, #0F3D5E) !important;
    min-height: 100vh;
}

body.hif-guest-body .hif-portal-header,
body.hif-guest-body .hif-guest-header {
    background: transparent !important;
    box-shadow: none !important;
}

body.hif-guest-body .hif-guest-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius, 12px) !important;
    box-shadow: var(--shadow-md) !important;
}

body.hif-guest-body .hif-guest-card__header,
body.hif-guest-body .hif-guest-card .card-header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

body.hif-guest-body .hif-guest-card__title,
body.hif-guest-body .hif-guest-card .card-header {
    color: var(--hif-navy, #0F3D5E) !important;
}

body.hif-guest-body .hif-guest-card__subtitle {
    color: var(--text-muted) !important;
}

body.hif-guest-body .hif-guest-card__body,
body.hif-guest-body .hif-guest-card .card-body {
    color: var(--text-primary) !important;
}

body.hif-guest-body .hif-guest-card .form-label {
    color: var(--text-secondary) !important;
    font-weight: 600;
}

body.hif-guest-body .hif-guest-card .form-control {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-sm, 8px) !important;
    border-bottom-width: 1px !important;
    padding: 0.5rem 0.75rem !important;
}

body.hif-guest-body .hif-guest-card .form-control:focus {
    border-color: var(--hif-blue, #1F5EFF) !important;
    box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.15) !important;
}

body.hif-guest-body .hif-guest-card .form-control::placeholder {
    color: var(--text-muted) !important;
}

body.hif-guest-body .hif-guest-card .btn-primary,
body.hif-guest-body .hif-btn-gradient {
    background: var(--hif-blue, #1F5EFF) !important;
    border: none !important;
    border-radius: var(--radius-sm, 8px) !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    padding: 0.65rem 1.25rem !important;
}

body.hif-guest-body .hif-guest-card .btn-primary:hover,
body.hif-guest-body .hif-btn-gradient:hover {
    background: #184ee6 !important;
    transform: none !important;
}

body.hif-guest-body .hif-guest-card a,
body.hif-guest-body .hif-guest-screen a:not(.btn) {
    color: var(--hif-blue, #1F5EFF) !important;
}

body.hif-guest-body .hif-guest-card .text-muted,
body.hif-guest-body .hif-guest-card .small.text-muted {
    color: var(--text-muted) !important;
}

body.hif-guest-body .hif-guest-card .form-check-label {
    color: var(--text-primary) !important;
}

body.hif-guest-body .hif-guest-card .form-check-input:checked {
    background-color: var(--hif-blue, #1F5EFF) !important;
    border-color: var(--hif-blue, #1F5EFF) !important;
}

body.hif-guest-body .hif-guest-card .input-group .btn-outline-secondary {
    border: 1px solid var(--border-light) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm, 8px) !important;
}

body.hif-guest-body .hif-guest-footer-link {
    border-top-color: var(--border-light) !important;
}

body.hif-guest-body .hif-guest-card .hif-alert--error {
    background: var(--danger-bg) !important;
    border-color: var(--danger-border) !important;
    color: var(--danger-text) !important;
}

body.hif-guest-body .hif-guest-card .hif-alert--success {
    background: var(--success-bg) !important;
    border-color: var(--success-border) !important;
    color: var(--success-text) !important;
}

body.hif-guest-body .hif-guest-card .invalid-feedback {
    color: var(--danger-text) !important;
}

/* —— Sidebar staff oscura (solo sin DS 2026) —— */
body.hif-app:not(.hif-ds-2026) .sidebar.hif-sidebar,
body.hif-app:not(.hif-ds-2026) .sidebar-offcanvas {
    background: var(--hif-navy, #0B4F6C) !important;
}

body.hif-app:not(.hif-ds-2026) .sidebar.hif-sidebar .nav-link.active,
body.hif-app:not(.hif-ds-2026) .sidebar-offcanvas .nav-link.active {
    background: var(--hif-blue, #1B6CA8) !important;
}

body.hif-app:not(.hif-ds-2026) .navbar-hif {
    background: var(--hif-navy, #0B4F6C) !important;
}

/* —— Pipeline / alerts —— */
body.hif-app .hif-pipeline-strip .card-header {
    background: var(--bg-card) !important;
    color: var(--hif-navy, #0F3D5E) !important;
}

body.hif-app .alert-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
    border-radius: var(--radius-sm, 8px);
}

body.hif-app .alert-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
    border-radius: var(--radius-sm, 8px);
}

body.hif-app .alert-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
    border-radius: var(--radius-sm, 8px);
}

/* —— Páginas de error standalone —— */
body.hif-error-page {
    min-height: 100vh;
    background: var(--bg-page);
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0;
}

body.hif-error-page .error-card {
    max-width: 440px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-md);
}

body.hif-error-page .error-code {
    font-size: 4rem;
    font-weight: 700;
    color: var(--hif-navy, #0F3D5E);
    line-height: 1;
}

body.hif-error-page .error-code--danger {
    color: #b42318;
}

body.hif-error-page .btn-hif {
    background: var(--hif-blue, #1F5EFF);
    border-color: var(--hif-blue, #1F5EFF);
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-sm, 8px);
}

body.hif-error-page .btn-hif:hover {
    background: #184ee6;
    border-color: #184ee6;
    color: #fff;
}

/* —— Registro cliente standalone —— */
body.hif-register-page {
    min-height: 100vh;
    background: var(--hif-navy, #0F3D5E);
    padding: 1.5rem 0;
}

body.hif-register-page .cliente-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-md);
}

body.hif-register-page .cliente-card .card-header {
    color: var(--hif-navy, #0F3D5E);
    border-bottom: 1px solid var(--border-light);
}

body.hif-register-page .cliente-card .btn-primary {
    background: var(--hif-blue, #1F5EFF) !important;
    border: none !important;
}

body.hif-register-page .section-title {
    color: var(--hif-navy, #0F3D5E);
}

/* —— Text accent legacy —— */
body.hif-app .hif-text-accent,
body.hif-app .text-primary {
    color: var(--hif-blue, #1F5EFF) !important;
}

body.hif-app a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--hif-link, #1F5EFF);
}

body.hif-app a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--hif-link-hover, #184ee6);
}

/* —— Offcanvas sidebar —— */
body.hif-app .sidebar-offcanvas.offcanvas {
    background: var(--hif-navy, #0F3D5E) !important;
}

/* —— List group —— */
body.hif-app .list-group-item {
    border-color: var(--border-light);
}

/* —— Nav tabs —— */
body.hif-app .nav-tabs .nav-link.active {
    color: var(--hif-blue, #1F5EFF);
    border-color: var(--border-light) var(--border-light) var(--bg-card);
}

body.hif-app .nav-tabs .nav-link {
    color: var(--text-muted);
    border-radius: var(--radius-sm, 8px) var(--radius-sm, 8px) 0 0;
}

/* —— Badges —— */
body.hif-app .badge.bg-primary {
    background-color: var(--hif-blue, #1F5EFF) !important;
}

/* —— Sin degradados heredados —— */
body.hif-app [class*="gradient"],
body.hif-app .hif-btn-gradient {
    background-image: none !important;
}

body.hif-app .progress-bar {
    background-color: var(--hif-blue, #1F5EFF);
}

body.hif-app .form-check-input:focus {
    border-color: var(--hif-blue, #1F5EFF);
    box-shadow: 0 0 0 0.2rem rgba(31, 94, 255, 0.2);
}

body.hif-app .accordion-button:not(.collapsed) {
    background-color: var(--hif-blue-soft, #E8EEFB);
    color: var(--hif-navy, #0F3D5E);
}

body.hif-app .spinner-border.text-primary {
    color: var(--hif-blue, #1F5EFF) !important;
}

/* Cobranza: filas de cuota mantienen semántica de color */
body.hif-app .cuota-fila-estado-pagada { background-color: rgba(52, 199, 89, 0.12) !important; }
body.hif-app .cuota-fila-estado-vencida { background-color: rgba(180, 35, 24, 0.1) !important; }
body.hif-app .cuota-fila-estado-parcial { background-color: rgba(245, 158, 11, 0.12) !important; }
body.hif-app .cuota-fila-estado-pendiente { background-color: transparent !important; }

/* —— Filtros / filter cards —— */
body.hif-app .filter-card,
body.hif-app .filters-card {
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border-light);
}
