/* =============================================================================
   HIF — Sistema de Créditos — Diseño unificado (dark navy + gradiente verde-cyan)
   Panel, portal, login, cliente y cobrador — tipo app moderna
   ============================================================================= */
:root {
    /* Paleta principal: fondo oscuro tipo app */
    --hif-primary: #2B354C;
    --hif-primary-dark: #1e2a3d;
    --hif-primary-light: #364258;
    --hif-bg-dark: #2B354C;
    /* Acento: teal profesional (sin tonos fluorescentes) */
    --hif-accent: #0d9488;
    --hif-accent-end: #0f766e;
    --hif-accent-dark: #0f766e;
    --hif-accent-light: #14b8a6;
    --hif-accent-soft: rgba(13, 148, 136, 0.18);
    --hif-link: #A0B7FF;
    --hif-link-hover: #b8caff;
    --sidebar-width: 280px;
    --header-height: 60px;
    --nav-bg: var(--hif-primary);
    --nav-bg-hover: var(--hif-primary-light);
    --nav-text: #e2e8f0;
    --nav-text-muted: #94a3b8;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --border-muted: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -2px rgba(0,0,0,.04);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,.06), 0 4px 6px -4px rgba(0,0,0,.04);
    --success-bg: #e8f5f0;
    --success-border: #b8e0ce;
    --success-text: #2d5a4a;
    --danger-bg: #fcecec;
    --danger-border: #f0c4c4;
    --danger-text: #8b3a3a;
    --warning-bg: #faf5e8;
    --warning-border: #ead9b0;
    --warning-text: #7a5c2e;
    --info-bg: #eef4f8;
    --info-border: #c5d9e8;
    --info-text: #3d5a6c;
    --transition: 0.2s ease;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    /* Zona segura inferior (iPhone notch, etc.); en escritorio suele ser 0 */
    --hif-mobile-bottom-ui: env(safe-area-inset-bottom, 0px);
    /* Barra inferior fija (~72px) + hueco bajo el contenido */
    --hif-tab-bar-clearance: calc(4.5rem + var(--hif-mobile-bottom-ui));
}
/* Móvil/tablet: Android a menudo no expone safe-area → mínimo ~52px para botones del sistema */
@media (max-width: 991.98px) {
    :root {
        --hif-mobile-bottom-ui: max(env(safe-area-inset-bottom, 0px), 3.25rem);
        --hif-tab-bar-clearance: calc(4.5rem + var(--hif-mobile-bottom-ui));
    }
}

* { box-sizing: border-box; }
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}
body.hif-app {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-page);
    overflow-x: hidden;
    padding-top: var(--header-height);
}
/* Panel en móvil: permite scroll completo sin recortes */
@media (max-width: 991.98px) {
    html.hif-panel-html { height: 100%; }
    body.hif-app:not(.hif-portal-body) {
        padding-top: var(--mobile-header-offset, calc(var(--header-height) + env(safe-area-inset-top)));
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
}
/* Portal cliente/cobrador: encabezado fijo, scroll del contenido */
body.hif-app.hif-portal-body {
    --portal-header-height: 56px;
    padding-top: calc(var(--portal-header-height) + env(safe-area-inset-top, 0px));
}
body.hif-app.hif-portal-body.portal-app-body {
    min-height: 100dvh;
    min-height: 100svh;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 0;
}
body.hif-app.hif-portal-body.portal-app-body .portal-app-main,
body.hif-app.hif-portal-body.portal-app-body .collector-app-main,
body.hif-app.hif-portal-body.portal-app-body .cliente-main {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-transform: none;
    transform: none;
    position: relative;
    padding-bottom: calc(var(--hif-tab-bar-clearance) + 1.25rem);
}
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body.hif-app.hif-portal-body.portal-app-body {
        padding-bottom: calc(72px + var(--hif-mobile-bottom-ui));
    }
}
/* Escritorio/tablet: el <style> de los layouts pedía 1rem; este bloque gana por orden + viewport */
@media (min-width: 768px) {
    body.hif-app.hif-portal-body.portal-app-body .portal-app-main,
    body.hif-app.hif-portal-body.portal-app-body .collector-app-main,
    body.hif-app.hif-portal-body.portal-app-body .cliente-main {
        padding-bottom: 1.25rem;
    }
    body.hif-app.hif-portal-body.portal-app-body {
        padding-bottom: 1rem;
    }
}
body.hif-app.hif-portal-body:not(.portal-app-body) {
    padding-bottom: calc(72px + var(--hif-mobile-bottom-ui));
}
@media (max-width: 991.98px) {
    body.hif-app.hif-portal-body:not(.portal-app-body) {
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
}
.hif-portal-header .portal-header-logo {
    height: 32px;
    width: auto;
    max-height: 40px;
    max-width: 160px;
    display: block;
    object-fit: contain;
}
@media (min-width: 576px) {
    .hif-portal-header .portal-header-logo {
        height: 28px;
        max-height: 34px;
    }
}
@media (max-width: 575.98px) {
    .hif-portal-header .portal-header-logo {
        height: 36px;
        max-height: 44px;
        max-width: 180px;
    }
}

/* Section badge y page header */
.page-section { margin-bottom: 1rem; }
.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hif-accent);
    background: var(--hif-accent-soft);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}
.section-badge i { font-size: 0.75rem; }
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.page-title,
.page-header .page-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}
.page-header .page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}
@media (max-width: 575.98px) {
    .page-header .page-title { font-size: 1.25rem; }
}

/* Tarjetas: solo las que llevan .hif-card */
.card.hif-card,
.hif-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.card.hif-card:hover,
.hif-card:hover {
    box-shadow: var(--shadow);
}
.card.hif-card .card-header,
.hif-card .card-header {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    background: #f8fafc;
    padding: 1rem 1.25rem;
}
.card.hif-card .card-body,
.hif-card .card-body {
    padding: 1rem 1.1rem;
}
.card.hif-card .card-footer,
.hif-card .card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    background: #f8fafc;
}

/* Tablas */
.hif-table-wrap,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-width: 100%;
}
.table-responsive .table { min-width: 640px; margin-bottom: 0; }
.table.hif-table,
.hif-table {
    margin-bottom: 0;
    min-width: 640px;
    color: var(--text-primary);
}
@media (max-width: 991.98px) {
    .main-content .table-responsive { max-width: 100%; }
}
.table.hif-table thead th,
.hif-table thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.table.hif-table tbody td,
.hif-table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}
.table.hif-table tbody tr:hover,
.hif-table tbody tr:hover {
    background: #f8fafc;
}
.table-actions { white-space: nowrap; }
.table-actions-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

/* Formularios */
.hif-app .form-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    margin-bottom: 0.3rem;
}
.hif-app .form-control,
.hif-app .form-select,
.form-control.hif-input,
.form-select.hif-input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 0.9rem;
    min-height: 2.4rem;
    padding: 0.42rem 0.7rem;
    color: var(--text-primary);
    background-color: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.hif-app textarea.form-control {
    min-height: 3.25rem;
    line-height: 1.35;
}
.hif-app .form-control:focus,
.hif-app .form-select:focus {
    border-color: var(--hif-accent);
    box-shadow: 0 0 0 3px var(--hif-accent-soft);
    outline: 0;
}
.hif-app .input-group-text {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
    min-height: 2.4rem;
    border-color: var(--border-light);
    background: #f8fafc;
}
.hif-app .required-empty,
.hif-app .required-empty:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.12) !important;
}
.input-group .form-control,
.input-group .form-select { border-radius: var(--radius-sm); }

/* Formularios compactos: menos huecos, alineación limpia y profesional */
.hif-app form .row {
    --bs-gutter-x: 0.8rem;
    --bs-gutter-y: 0.55rem;
}
.hif-app form .mb-1 { margin-bottom: 0.2rem !important; }
.hif-app form .mb-2 { margin-bottom: 0.4rem !important; }
.hif-app form .mb-3 { margin-bottom: 0.6rem !important; }
.hif-app form .mb-4 { margin-bottom: 0.85rem !important; }
.hif-app form .mb-5 { margin-bottom: 1rem !important; }
.hif-app form .py-3 { padding-top: 0.8rem !important; padding-bottom: 0.8rem !important; }
.hif-app form .py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.hif-app .card.hif-card form:last-child,
.hif-app .hif-card form:last-child {
    margin-bottom: 0;
}
.hif-app .hif-portal-card .card-body form > :last-child {
    margin-bottom: 0 !important;
}

/* Botones — gradiente en primarios, enlaces en color link */
.hif-app .btn-primary,
.btn-hif-primary,
.btn-hif-teal {
    background: var(--hif-accent);
    border: none;
    color: #fff;
    font-weight: 600;
}
.hif-app .btn-primary:hover,
.btn-hif-primary:hover,
.btn-hif-teal:hover {
    background: var(--hif-accent-dark);
    border: none;
    color: #1e2a3d;
}
.hif-app .btn-outline-primary {
    border: 2px solid var(--hif-accent);
    color: var(--hif-accent);
    background: transparent;
}
.hif-app .btn-outline-primary:hover {
    background: var(--hif-accent-soft);
    border-color: var(--hif-accent);
    color: var(--hif-accent-dark);
}
.hif-app a:not(.btn) {
    color: var(--hif-link);
}
.hif-app a:not(.btn):hover {
    color: var(--hif-link-hover);
}

/* Badges */
.badge-hif {
    font-weight: 500;
    font-size: 0.6875rem;
    padding: 0.35em 0.65em;
    border-radius: var(--radius-sm);
}
.badge-status-success, .badge-hif-success { background: var(--success-bg); color: var(--success-text); }
.badge-status-warning, .badge-hif-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-status-danger, .badge-hif-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-status-info, .badge-hif-info { background: var(--info-bg); color: var(--info-text); }

/* Estados de cuota en tabla de amortización */
.badge.bg-estado-vencida { background-color: #fecaca; color: #991b1b; }
.badge.bg-estado-vence-hoy { background-color: #fef08a; color: #854d0e; }
.badge.bg-estado-pagado { background-color: #bbf7d0; color: #166534; }
.badge.bg-estado-pendiente { background-color: #e2e8f0; color: #475569; }

/* Sombreado de fila completa por estado de cuota (pastel) */
.cuota-fila-estado-pagado { background-color: #dcfce7 !important; }
.cuota-fila-estado-vencida { background-color: #fee2e2 !important; }
.cuota-fila-estado-vence-hoy { background-color: #fef9c3 !important; }
.cuota-fila-estado-pendiente { background-color: #f1f5f9 !important; }

/* Alertas / Notificaciones */
.hif-alert,
.notification-card,
.alert.hif-alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: hif-fadeIn 0.25s ease;
}
@keyframes hif-fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.hif-alert--success, .notification-card--success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}
.hif-alert--error, .notification-card--error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}
.hif-alert--warning, .notification-card--warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}
.hif-alert--info, .notification-card--info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}
.notification-card-close { color: var(--text-muted); opacity: 0.8; }
.notification-card-close:hover { color: var(--text-primary); }

/* Filtros */
.filter-bar {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

/* Sidebar */
.sidebar.hif-sidebar {
    background: var(--nav-bg);
    width: var(--sidebar-width);
    border-right: 1px solid rgba(0,0,0,.1);
    box-shadow: inset -1px 0 0 rgba(255,255,255,.05);
}
.sidebar.hif-sidebar .nav {
    padding: 0.65rem 0 1rem;
}
.sidebar.hif-sidebar .nav-link {
    color: var(--nav-text);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.62rem 0.9rem;
    border-radius: var(--radius-sm);
    margin: 0 0.75rem;
    font-weight: 600;
    font-size: 0.84rem;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.15s ease;
}
.sidebar.hif-sidebar .nav-link i {
    font-size: 0.95rem;
    width: 1.05rem;
    text-align: center;
    opacity: .9;
}
.sidebar.hif-sidebar .nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-color: rgba(255,255,255,.12);
    transform: translateX(2px);
}
.sidebar.hif-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(13,148,136,.22), rgba(13,148,136,.08));
    border-color: rgba(20,184,166,.45);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--hif-accent-light);
}
.sidebar.hif-sidebar .sidebar-section {
    padding: 1rem 1rem 0.35rem;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nav-text-muted);
    list-style: none;
    position: relative;
}
.sidebar.hif-sidebar .sidebar-section::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: -0.1rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(148,163,184,.25), rgba(148,163,184,0));
}
.sidebar.hif-sidebar .sidebar-logout-btn {
    color: #fecaca !important;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.sidebar.hif-sidebar .sidebar-logout-btn:hover {
    background: rgba(239,68,68,.14) !important;
    border-color: rgba(248,113,113,.35);
    color: #fee2e2 !important;
}

/* Navbar — diseño unificado escritorio y móvil */
.navbar-hif {
    background: var(--hif-primary-dark) !important;
    min-height: var(--header-height);
    box-shadow: 0 2px 12px rgba(0,0,0,.15), 0 1px 0 rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(0,0,0,.1);
}
.navbar-hif .container-fluid { align-items: center; }
.navbar-hif .navbar-text { font-size: 0.8125rem; color: var(--nav-text) !important; }
.navbar-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.navbar-user-avatar:hover {
    border-color: rgba(255,255,255,.7);
    box-shadow: 0 0 0 3px rgba(255,255,255,.12);
}
.navbar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dropdown-user-nav .dropdown-menu { margin-top: 0.35rem; }

/* ========== LOGIN / GUEST — Misma estructura que app cobrador: header fijo + contenido ========== */
body.hif-app.hif-guest-body {
    padding-top: 0;
    background: var(--hif-bg-dark);
    min-height: 100vh;
    min-height: 100dvh;
    touch-action: pan-y;
}
.hif-guest-header {
    flex-shrink: 0;
}
body.hif-guest-body .hif-guest-header .portal-header-logo,
body.hif-guest-body .hif-guest-header .hif-guest-logo,
body.hif-guest-body .hif-guest-header img {
    height: 48px !important;
    max-height: 56px !important;
    width: auto;
    object-fit: contain;
}
body.hif-guest-body .hif-guest-header .hif-guest-heading {
    font-size: 1rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
@media (max-width: 575.98px) {
    body.hif-guest-body .hif-guest-header .portal-header-logo,
    body.hif-guest-body .hif-guest-header .hif-guest-logo,
    body.hif-guest-body .hif-guest-header img {
        height: 44px !important;
        max-height: 52px !important;
        max-width: 200px;
    }
    body.hif-guest-body .hif-guest-header .hif-guest-heading {
        font-size: 0.9rem;
    }
}
.hif-guest-screen {
    min-height: calc(100vh - var(--portal-header-height, 56px));
    min-height: calc(100dvh - var(--portal-header-height, 56px));
    background: var(--hif-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, var(--hif-mobile-bottom-ui));
}
body.hif-guest-body {
    --portal-header-height: 56px;
    padding-top: var(--portal-header-height);
}
.hif-guest-card {
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: 1.25rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.hif-guest-card__header,
.hif-guest-card .card-header {
    background: transparent;
    border: none;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hif-guest-card__logo,
.hif-guest-card .card-header a[href] {
    display: block;
    text-decoration: none;
    color: #fff;
}
.hif-guest-card__logo img,
.hif-guest-card__header img,
.hif-guest-card .card-header img {
    height: 44px;
    width: auto;
    max-width: 160px;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
}
/* Título principal: destaca claramente */
.hif-guest-card__title,
.hif-guest-card .card-header > div:not(.small):not(.opacity-90) {
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin: 0 0 0.35rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
/* Subtítulo: nivel secundario, legible pero no compite */
.hif-guest-card__subtitle,
.hif-guest-card .card-header .small,
.hif-guest-card .card-header .opacity-90 {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.01em;
}
.hif-guest-card__body,
.hif-guest-card .card-body {
    padding: 1.5rem 1.5rem 1.75rem;
}
@media (max-width: 575.98px) {
    .hif-guest-card { border-radius: 1rem; }
    .hif-guest-card__header, .hif-guest-card .card-header { padding: 1.5rem 1rem 1.25rem; }
    .hif-guest-card__body, .hif-guest-card .card-body { padding: 1.25rem 1rem 1.5rem; }
}
/* Bloques de instrucción: texto legible, nivel medio */
.hif-guest-instruction {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.hif-guest-instruction strong {
    color: #fff;
    font-weight: 600;
}
/* Destacado (ej. correo enmascarado): resalta sin ser título */
.hif-guest-highlight {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Labels: claros y legibles */
.hif-guest-card .form-label {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.hif-guest-card .mb-3 { margin-bottom: 1.35rem !important; }
/* Login: campos oscuros = texto blanco; campos claros = texto negro */
.hif-guest-card .form-control {
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 0 !important;
    color: #fff !important;
    padding: 0.5rem 0 0.625rem !important;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s ease;
}
.hif-guest-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
/* Mantener texto blanco con autofill del navegador */
.hif-guest-card .form-control:-webkit-autofill,
.hif-guest-card .form-control:-webkit-autofill:hover,
.hif-guest-card .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff !important;
    box-shadow: 0 0 0 1000px transparent inset;
    transition: background-color 5000s ease-in-out 0s;
}
/* Donde el fondo sea claro o blanco, texto negro */
.hif-guest-card .bg-white,
.hif-guest-card .bg-light,
.hif-guest-card [class*="bg-opacity-10"] { color: #0f172a !important; }
.hif-guest-card .bg-white .form-control,
.hif-guest-card .bg-light .form-control { color: #0f172a !important; }
.hif-guest-card .form-control:focus {
    border-bottom-color: var(--hif-accent) !important;
    box-shadow: none !important;
    outline: 0 !important;
}
.hif-guest-card .input-group .form-control {
    border-bottom-right-radius: 0 !important;
    border-top-right-radius: 0 !important;
}
.hif-guest-card .input-group .btn-outline-secondary {
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.35) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 0 !important;
    padding: 0.5rem 0 0.625rem !important;
}
.hif-guest-card .input-group .btn-outline-secondary:hover {
    color: #fff !important;
    border-bottom-color: rgba(255, 255, 255, 0.55) !important;
}
.hif-guest-card .form-check-label {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9375rem;
    font-weight: 500;
}
.hif-guest-card .form-check-input {
    background-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
}
.hif-guest-card .form-check-input:checked {
    background-color: var(--hif-accent);
    border-color: var(--hif-accent);
}
/* Botón principal: CTA que resalta */
.hif-guest-card .btn-primary,
.hif-btn-gradient {
    background: var(--hif-accent) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 700;
    padding: 0.9375rem 1.5rem;
    border-radius: 999px;
    font-size: 1.0625rem;
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}
.hif-guest-card .btn-primary:hover,
.hif-btn-gradient:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    background: var(--hif-accent-dark) !important;
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
    color: #fff !important;
}
/* Enlaces: color que resalta */
.hif-guest-card a,
.hif-guest-screen a:not(.btn) {
    color: var(--hif-link) !important;
    text-decoration: none;
    font-weight: 500;
}
.hif-guest-card a:hover,
.hif-guest-screen a:not(.btn):hover {
    color: var(--hif-link-hover) !important;
    text-decoration: underline;
}
.hif-guest-footer-link {
    margin: 1.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.9375rem;
}
.hif-guest-footer-link a { font-weight: 600; }
/* Texto secundario: legible pero diferenciado */
.hif-guest-card .text-muted,
.hif-guest-card .small.text-muted {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 0.9375rem;
    line-height: 1.45;
}
.hif-guest-card code {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 0.25em 0.5em;
    border-radius: 6px;
    font-size: 0.875em;
    font-weight: 500;
}
.hif-guest-card .hif-alert--error {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(220, 38, 38, 0.45);
    color: #fecaca;
    border-radius: 0.75rem;
    font-weight: 500;
}
.hif-guest-card .hif-alert--success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.45);
    color: #bbf7d0;
    border-radius: 0.75rem;
    font-weight: 500;
}
.hif-guest-card .invalid-feedback {
    color: #fca5a5;
    font-size: 0.875rem;
    font-weight: 500;
}
/* Input tipo código (6 dígitos): más grande y legible */
.hif-guest-card .form-control-lg {
    font-size: 1.25rem;
    padding: 0.625rem 0 0.75rem !important;
    letter-spacing: 0.35em;
}
/* Icono de éxito en instrucciones */
.hif-guest-card .bi-envelope-check.text-success {
    color: var(--hif-accent) !important;
}

/* ========== Modal de notificaciones — mismo diseño que la interfaz ========== */
.hif-notification-modal .modal-content.hif-notification-modal__content {
    background: var(--hif-bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.hif-notification-modal .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}
.hif-notification-modal .modal-header.hif-notification-modal__header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
}
.hif-notification-modal .modal-title {
    color: #fff;
    font-weight: 700;
    font-size: 1.125rem;
}
.hif-notification-modal .modal-body.hif-notification-modal__body {
    padding: 1.25rem 1.25rem;
    color: #fff;
    font-size: 1rem;
}
.hif-notification-modal__item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}
.hif-notification-modal__item:last-child { margin-bottom: 0; }
.hif-notification-modal__item--success {
    background: rgba(13, 148, 136, 0.15);
    border: 1px solid rgba(13, 148, 136, 0.35);
}
.hif-notification-modal__item--success .hif-notification-modal__icon { color: var(--hif-accent-light); }
.hif-notification-modal__item--error {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.35);
}
.hif-notification-modal__item--error .hif-notification-modal__icon { color: #f87171; }
.hif-notification-modal__item--warning {
    background: rgba(202, 138, 4, 0.15);
    border: 1px solid rgba(202, 138, 4, 0.35);
}
.hif-notification-modal__item--warning .hif-notification-modal__icon { color: #facc15; }
.hif-notification-modal__item--info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.hif-notification-modal__item--info .hif-notification-modal__icon { color: #60a5fa; }
.hif-notification-modal__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.hif-notification-modal__text {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.5;
}
.hif-notification-modal__text strong { color: #fff; }
.hif-notification-modal .modal-footer.hif-notification-modal__footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
}
.hif-notification-modal .modal-footer .btn-primary {
    background: var(--hif-accent);
    border-color: var(--hif-accent);
    color: #fff;
}
.hif-notification-modal .modal-footer .btn-primary:hover {
    background: var(--hif-accent-dark);
    border-color: var(--hif-accent-dark);
    color: #fff;
}

/* Modal de confirmación (mismo diseño que notificaciones) */
.hif-confirm-modal .modal-content.hif-confirm-modal__content {
    background: var(--hif-bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.hif-confirm-modal .modal-backdrop { background-color: rgba(0, 0, 0, 0.6); }
.hif-confirm-modal .modal-header.hif-confirm-modal__header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
}
.hif-confirm-modal .modal-title { color: #fff; font-weight: 700; font-size: 1.125rem; }
.hif-confirm-modal .modal-body.hif-confirm-modal__body {
    padding: 1.25rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}
.hif-confirm-modal .modal-footer.hif-confirm-modal__footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
}
.hif-confirm-modal .modal-footer .btn-primary {
    background: var(--hif-accent);
    border-color: var(--hif-accent);
    color: #fff;
}
.hif-confirm-modal .modal-footer .btn-primary:hover {
    background: var(--hif-accent-dark);
    border-color: var(--hif-accent-dark);
    color: #fff;
}
.hif-confirm-modal .modal-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.hif-confirm-modal .modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Portal cliente y cobrador: mismo diseño tipo app (fondo oscuro en móvil, colores unificados) */
.hif-portal-body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--hif-bg-dark);
    padding-bottom: calc(72px + var(--hif-mobile-bottom-ui));
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
    .hif-portal-body {
        background: var(--bg-page);
    }
}
.hif-portal-header {
    --portal-header-height: 56px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--hif-bg-dark);
    color: #fff;
    padding: 0.625rem 1rem;
    padding-top: calc(0.625rem + env(safe-area-inset-top, 0px));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    min-height: var(--portal-header-height);
    min-height: calc(var(--portal-header-height) + env(safe-area-inset-top, 0px));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
/* Encabezado más compacto en app de cobranza (collector) */
body.collector-app-body .hif-portal-header {
    --portal-header-height: 48px;
    padding-top: calc(0.4rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.4rem;
}
.hif-portal-header .brand { font-weight: 700; font-size: 1.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hif-portal-header .brand > span { text-transform: uppercase; }
.hif-portal-header .d-flex.gap-2 { flex-shrink: 0; }
.hif-portal-header .app-header-btn {
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
/* Botón de perfil app cobrador: más visible y claro */
.hif-portal-header .collector-profile-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 0.35rem 0.5rem;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.hif-portal-header .collector-profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
}
.hif-portal-header .collector-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hif-accent);
    color: #fff;
    font-size: 1rem;
}
.hif-portal-header .collector-profile-btn:hover .collector-profile-avatar {
    background: var(--hif-accent-light);
}
.hif-portal-header .app-header-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.35rem 0.5rem;
    margin: -0.35rem 0;
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}
.hif-portal-header .app-header-back:hover { color: rgba(255,255,255,.95); background: rgba(255,255,255,.1); }
/* Barra inferior tipo app (tab bar) — mismo estilo oscuro en móvil */
.hif-portal-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 64px;
    padding-bottom: var(--hif-mobile-bottom-ui);
    background: var(--hif-bg-dark);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .25);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 1020;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
@media (min-width: 768px) {
    .hif-portal-nav {
        background: var(--bg-card);
        box-shadow: 0 -4px 24px rgba(15, 23, 42, .08);
        border-top: 1px solid var(--border-light);
    }
}
@media (min-width: 768px) {
    .hif-portal-nav {
        border-radius: 1rem 1rem 0 0;
        border-top: none;
    }
}
.hif-portal-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 600;
    transition: color var(--transition), background var(--transition);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
@media (min-width: 768px) {
    .hif-portal-nav a {
        color: var(--text-muted);
    }
}
.hif-portal-nav a:hover { color: var(--hif-accent); }
.hif-portal-nav a.active {
    color: var(--hif-accent);
}
.hif-portal-nav a.active::before {
    content: '';
    position: absolute;
    top: 0.25rem;
    width: 32px;
    height: 3px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hif-accent);
    border-radius: 2px;
}
.hif-portal-nav a i {
    font-size: 1.5rem;
    margin-bottom: 0.15rem;
}
.hif-portal-nav form {
    flex: 1;
    display: flex;
    min-height: 44px;
}
.hif-portal-nav form button {
    width: 100%;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 767.98px) {
    .hif-portal-nav form button.nav-item-btn,
    .hif-portal-nav .nav-item-btn {
        color: rgba(255, 255, 255, 0.7);
    }
    .hif-portal-nav form button.nav-item-btn:hover,
    .hif-portal-nav .nav-item-btn:hover {
        color: #fff;
    }
}
.hif-portal-card {
    background: var(--bg-card);
    border: none;
    border-radius: 1rem;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-light);
}
@media (max-width: 767.98px) {
    .hif-portal-body .hif-portal-card {
        box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
    }
}
.hif-portal-card .card-header {
    font-weight: 600;
    color: var(--text-primary);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
    padding: 0.875rem 1rem;
}
.hif-portal-card .card-body { padding: 1rem; }
@media (max-width: 575.98px) {
    .hif-portal-card .card-body { padding: 1rem; }
}
/* En móvil: contenido legible — tarjetas claras = texto negro; fondo oscuro = texto blanco */
@media (max-width: 767.98px) {
    .hif-portal-body .portal-app-main,
    .hif-portal-body .collector-app-main,
    .hif-portal-body .cliente-main {
        color: #fff;
        font-size: 1rem;
    }
    .hif-portal-body .hif-portal-card,
    .hif-portal-body .hif-portal-card .card-body {
        color: #0f172a !important;
        background: #fff;
    }
    .hif-portal-body .hif-portal-card .card-header {
        color: #0f172a !important;
        background: #f8fafc !important;
    }
    .hif-portal-body .hif-portal-card .text-muted,
    .hif-portal-body .hif-portal-card .small {
        color: #64748b !important;
    }
    .hif-portal-body .section-badge {
        color: var(--hif-accent);
        background: var(--hif-accent-soft);
    }
    .hif-portal-body .hif-empty,
    .hif-portal-body .text-muted {
        color: rgba(255, 255, 255, 0.9) !important;
    }
    .hif-portal-body .btn-outline-primary {
        border-color: var(--hif-accent);
        color: var(--hif-accent);
    }
    .hif-portal-body .btn-outline-primary:hover {
        background: var(--hif-accent-soft);
        color: var(--hif-accent);
    }
}

/* App cobradores: fondo claro → todo el contenido con texto oscuro y legible */
.collector-app-body .collector-app-main {
    color: #0f172a;
    font-size: 1rem;
}
.collector-app-body .collector-app-main .page-title,
.collector-app-body .collector-app-main .h1, .collector-app-body .collector-app-main .h2, .collector-app-body .collector-app-main .h3,
.collector-app-body .collector-app-main .card,
.collector-app-body .collector-app-main .card-header,
.collector-app-body .collector-app-main .card-body {
    color: #0f172a !important;
}
.collector-app-body .collector-app-main .page-subtitle,
.collector-app-body .collector-app-main .text-muted,
.collector-app-body .collector-app-main .form-label,
.collector-app-body .collector-app-main .small {
    color: #475569 !important;
}
.collector-app-body .collector-app-main .section-badge {
    color: var(--hif-accent) !important;
    background: var(--hif-accent-soft);
}
.collector-app-body .collector-app-main .form-control,
.collector-app-body .collector-app-main .form-select {
    color: #0f172a;
    background-color: #fff;
}
.collector-app-body .collector-app-main .table {
    color: #0f172a;
}
.collector-app-body .collector-app-main .table th,
.collector-app-body .collector-app-main .table td {
    color: #0f172a;
}

/* App cobradores (móvil) */
.collector-app-body {
    min-height: 100dvh;
    background: var(--bg-page);
}
body.portal-app-body.collector-app-body {
    padding-top: calc(var(--portal-header-height) + env(safe-area-inset-top, 0px));
    padding-bottom: 0;
}
.collector-app-body .hif-portal-nav a { flex: 1; }
.collector-app-body .hif-portal-nav form { flex: 1; }

/* App cliente (mi cuenta): mismo diseño que cobradores — fondo claro, texto oscuro */
.cliente-portal-body {
    min-height: 100dvh;
    background: var(--bg-page);
}
.cliente-portal-body .cliente-main {
    color: #0f172a;
    font-size: 1rem;
}
.cliente-portal-body .cliente-main .page-title,
.cliente-portal-body .cliente-main .h1, .cliente-portal-body .cliente-main .h2, .cliente-portal-body .cliente-main .h3,
.cliente-portal-body .cliente-main .card,
.cliente-portal-body .cliente-main .card-header,
.cliente-portal-body .cliente-main .card-body {
    color: #0f172a !important;
}
.cliente-portal-body .cliente-main .text-muted,
.cliente-portal-body .cliente-main .form-label,
.cliente-portal-body .cliente-main .small {
    color: #475569 !important;
}
.cliente-portal-body .cliente-main .section-badge {
    color: var(--hif-accent) !important;
    background: var(--hif-accent-soft);
}
.cliente-portal-body .cliente-main .form-control,
.cliente-portal-body .cliente-main .form-select {
    color: #0f172a;
    background-color: #fff;
}

/* KPI cards (dashboard) */
.hif-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow var(--transition);
}
.hif-kpi-card:hover { box-shadow: var(--shadow); }
.hif-kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}
.hif-kpi-card .kpi-label { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.hif-kpi-card .kpi-value { font-weight: 700; font-size: 1.5rem; color: var(--text-primary); letter-spacing: -0.02em; }

/* Empty state */
.hif-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}
.hif-empty i { font-size: 2.5rem; opacity: 0.5; margin-bottom: 0.75rem; display: block; }

/* Utilidades */
.hif-text-primary { color: var(--text-primary) !important; }
.hif-text-muted { color: var(--text-muted) !important; }
.hif-text-accent { color: var(--hif-accent) !important; }
.hif-bg-page { background: var(--bg-page); }
.form-control.no-uppercase,
input.no-uppercase,
textarea.no-uppercase { text-transform: none; }

/* Layout panel */
.layout-body {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
    flex-direction: column;
}
@media (max-width: 991.98px) {
    .layout-body {
        flex: 1;
        min-height: 0;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
}
@media (min-width: 992px) {
    .layout-body { flex-direction: row; }
}
.main-content {
    margin-left: 0;
    padding: 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1.5rem, var(--hif-mobile-bottom-ui));
    max-width: 100%;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 991.98px) {
    .main-content {
        flex: 1;
        min-height: 0;
        height: auto;
        max-height: none;
        padding-top: 0.5rem;
        /* Panel staff: espacio bajo barra del sistema Android + iOS notch/home */
        padding-bottom: calc(2rem + var(--hif-mobile-bottom-ui));
        overflow-y: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: auto;
        touch-action: auto;
        -webkit-transform: none;
        transform: none;
        position: relative;
    }
}
@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 1.75rem 2rem 2.5rem;
        height: calc(100vh - var(--header-height));
    }
}
.content-wrapper {
    max-width: 100%;
    width: 100%;
    min-height: 0;
}
@media (min-width: 1400px) { .content-wrapper { max-width: 1400px; } }
.sidebar {
    width: var(--sidebar-width);
    height: calc(100dvh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    padding-top: calc(var(--header-height) + 0.75rem);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scroll robusto: evita solapes y mantiene barras cuando corresponde */
.main-content,
.content-wrapper,
.portal-app-main,
.collector-app-main,
.cliente-main {
    scrollbar-gutter: stable both-edges;
}

.main-content .table-responsive,
.main-content .hif-table-wrap,
.main-content .overflow-auto {
    overflow-x: auto !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Detección táctil/no táctil para mejorar fluidez */
@media (pointer: coarse) {
    .main-content,
    .portal-app-main,
    .collector-app-main,
    .cliente-main {
        touch-action: pan-x pan-y;
        overscroll-behavior: auto;
    }
}

@media (pointer: fine) {
    .main-content,
    .portal-app-main,
    .collector-app-main,
    .cliente-main {
        scroll-behavior: smooth;
    }
}
/* Offcanvas menú móvil: mismos colores que sidebar escritorio */
.sidebar-offcanvas {
    width: min(var(--sidebar-width), 85vw);
    max-width: 320px;
    background: var(--nav-bg) !important;
    color: var(--nav-text);
    border-right: 1px solid rgba(0,0,0,.1);
}
.sidebar-offcanvas .offcanvas-header {
    background: transparent;
    border-bottom-color: rgba(255,255,255,.15) !important;
}
.sidebar-offcanvas .offcanvas-title { color: #fff !important; font-weight: 700; }
.sidebar-offcanvas .offcanvas-body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
}
.sidebar-offcanvas .nav {
    padding: 0.5rem 0;
}
.sidebar-offcanvas .nav-link {
    color: var(--nav-text) !important;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.62rem 0.9rem;
    border-radius: var(--radius-sm);
    margin: 0 0.75rem;
    font-weight: 600;
    font-size: 0.84rem;
    border: 1px solid transparent;
}
.sidebar-offcanvas .nav-link i {
    font-size: 0.95rem;
    width: 1.05rem;
    text-align: center;
    opacity: .9;
}
.sidebar-offcanvas .nav-link:hover {
    background: rgba(255,255,255,.06) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.12);
}
.sidebar-offcanvas .nav-link.active {
    background: linear-gradient(90deg, rgba(13,148,136,.22), rgba(13,148,136,.08)) !important;
    color: #fff !important;
    border-color: rgba(20,184,166,.45);
    box-shadow: inset 3px 0 0 var(--hif-accent-light);
}
.sidebar-offcanvas .sidebar-section {
    padding: 1rem 1rem 0.35rem;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nav-text-muted) !important;
    list-style: none;
    position: relative;
}
.sidebar-offcanvas .sidebar-section::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: -0.1rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(148,163,184,.25), rgba(148,163,184,0));
}
.sidebar-offcanvas .dropdown-menu {
    background: var(--hif-primary-light);
    border-color: rgba(0,0,0,.15);
}
.sidebar-offcanvas .dropdown-item {
    color: var(--nav-text);
}
.sidebar-offcanvas .dropdown-item:hover {
    background: var(--nav-bg-hover);
    color: #fff;
}
.sidebar-offcanvas .sidebar-logout-btn {
    color: #fca5a5 !important;
}
.sidebar-offcanvas .sidebar-logout-btn:hover {
    background: var(--nav-bg-hover) !important;
    color: #fecaca !important;
}
.dropdown-menu { border-radius: var(--radius-sm); box-shadow: 0 10px 40px rgba(0,0,0,.12); }
.total-box { background: var(--hif-accent-soft); border: 1px solid var(--hif-accent-light); }

/* Modales: ajuste a viewport en móvil para que no oculten contenido */
@media (max-width: 991.98px) {
    .modal { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .modal-dialog {
        max-height: calc(100dvh - 2rem);
        margin: 1rem auto;
        margin-bottom: max(1rem, var(--hif-mobile-bottom-ui));
    }
    .modal-content { max-height: calc(100dvh - 2rem); }
    .modal-body {
        overflow-y: auto;
        max-height: calc(100dvh - 180px);
        -webkit-overflow-scrolling: touch;
    }
}

/* Móvil: logo y perfil en la misma fila, diseño unificado */
@media (max-width: 991.98px) {
    .navbar-hif .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        flex-wrap: nowrap;
    }
    .navbar-hif .navbar-brand {
        margin-right: 0.5rem;
        flex: 1;
        min-width: 0;
    }
    .navbar-hif .navbar-brand img.navbar-logo { height: 28px; max-height: 28px; }
    .navbar-hif #navbarNav {
        display: flex !important;
        flex-grow: 0;
    }
    .navbar-hif #navbarNav .ms-auto { margin-left: 0 !important; }
    .navbar-user-avatar { width: 36px; height: 36px; }
    .offcanvas-backdrop.show { opacity: 0.5; }
}
@media (max-width: 575.98px) {
    .container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }
    .navbar-hif .navbar-text { font-size: 0.75rem !important; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .card.hif-card .card-body,
    .hif-card .card-body { padding: 1rem; }
    .page-header { flex-wrap: wrap; gap: 0.5rem; }
    .page-header .page-title { font-size: 1.25rem; }
    .d-flex.gap-2, .d-flex.gap-3 { flex-wrap: wrap; }
}

/* Móvil: contenedores y contenido sin salir de pantalla */
@media (max-width: 991.98px) {
    .main-content .container-fluid { max-width: 100%; }
    .main-content img { max-width: 100%; height: auto; }
    .main-content .card { min-width: 0; }
}

/* -------------------------------------------------------------------------- */
/* PWA: barra inferior “Instalar aplicación”                                  */
/* -------------------------------------------------------------------------- */
.hif-pwa-install-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    padding: 0.65rem 1rem;
    padding-bottom: max(0.65rem, var(--hif-mobile-bottom-ui));
    background: linear-gradient(135deg, var(--hif-pwa-bar-accent, #1f7db3) 0%, #155d84 100%);
    color: #fff;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.hif-pwa-install-bar--hide {
    opacity: 0;
    transform: translateY(110%);
    pointer-events: none;
}
.hif-pwa-install-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.hif-pwa-install-text {
    flex: 1;
    min-width: 180px;
    font-size: 0.875rem;
    line-height: 1.35;
}
.hif-pwa-install-text strong { font-size: 0.95rem; }
.hif-pwa-install-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.hif-pwa-install-actions .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}
.hif-pwa-install-actions .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    color: #fff;
}
@media (max-width: 575.98px) {
    .hif-pwa-install-bar-inner { flex-direction: column; align-items: stretch; }
    .hif-pwa-install-actions { justify-content: stretch; }
    .hif-pwa-install-actions .btn { flex: 1; }
}
