﻿/* ───────────────
   Paleta de colores (variables CSS genéricas)
─────────────── */
:root {
    --primary: #ffce00;
    --primary-hover: #e6ba00;
    --background: #F5F6FA;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --black: #000000;
    --border: #e5e7eb;
    --bs-primary: var(--primary);
}

body {
    background-color: var(--background);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: var(--text-main);
}

/* Personalización de componentes estándar usando variables genéricas */

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--black) !important;
    font-weight: 600;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: var(--primary-hover) !important;
        border-color: var(--primary-hover) !important;
        color: var(--black) !important;
    }

.navbar {
    background-color: var(--primary) !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--black);
    font-weight: 700;
}

.card {
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(17,24,39,0.03);
    overflow: visible;
}

/* Cards que contienen tablas/gridviews: contiene el border-radius sin bloquear scroll horizontal */
.card-table {
    overflow: hidden;
}

    .card-table .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
    }

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.btn {
    border-radius: 8px;
}

/* No sobrescribir los colores de estado de Bootstrap (success, danger, warning, info) */

/* ───────────────
   SweetAlert2 — Personalización
─────────────── */
.swal-popup {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    border-radius: 14px;
}

.swal-title {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 700;
    color: var(--black);
}

.swal-text {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: var(--text-secondary);
}

/* ── Botón base ── */
.swal-btn-confirm,
.swal-btn-cancel {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 28px;
    border-radius: 8px;
    border: none;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

    .swal-btn-confirm:focus,
    .swal-btn-cancel:focus {
        outline: none;
        box-shadow: none;
    }

/* ── Colores exactos Bootstrap 5 ── */

/* Primary */
.swal-btn-primary {
    background-color: #0d6efd;
    color: #fff;
}

    .swal-btn-primary:hover {
        background-color: #0b5ed7;
        color: #fff;
    }

/* Success */
.swal-btn-success {
    background-color: #198754;
    color: #fff;
}

    .swal-btn-success:hover {
        background-color: #157347;
        color: #fff;
    }

/* Danger / Error */
.swal-btn-error {
    background-color: #dc3545;
    color: #fff;
}

    .swal-btn-error:hover {
        background-color: #bb2d3b;
        color: #fff;
    }

/* Warning */
.swal-btn-warning {
    background-color: #ffc107;
    color: #000;
}

    .swal-btn-warning:hover {
        background-color: #ffca2c;
        color: #000;
    }

/* Info */
/* Info → Secondary */
.swal-btn-info {
    background-color: #6c757d;
    color: #fff;
}

    .swal-btn-info:hover {
        background-color: #5c636a;
        color: #fff;
    }

/* Question / Secondary */
.swal-btn-question {
    background-color: #6c757d;
    color: #fff;
}

    .swal-btn-question:hover {
        background-color: #5c636a;
        color: #fff;
    }

/* ── Botón cancelar (btn-secondary outline) ── */
.swal-btn-cancel {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
    margin-right: 8px;
}

    .swal-btn-cancel:hover {
        background-color: #6c757d;
        color: #fff;
    }

/* ───────────────
   Login
─────────────── */
:root {
    --login-brand: #1A1A1A;
    --login-accent: #F5C518;
    --login-accent-hover: #ddb015;
    --login-left-bg: #fafafa;
    --login-input-border: #e2e5ea;
    --login-input-focus: #1A1A1A;
}

.login-body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--login-left-bg);
}

.login-wrapper {
    display: flex;
    height: 100vh;
}

/* ── Panel izquierdo ── */
.login-left {
    width: 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--login-left-bg);
    padding: 48px 40px;
    position: relative;
}

    /* Borde de acento izquierdo */
    .login-left::before {
        content: '';
        position: absolute;
        left: 0;
        top: 10%;
        height: 80%;
        width: 3px;
        background: var(--login-accent);
        border-radius: 0 3px 3px 0;
    }

.login-form-container {
    width: 100%;
    max-width: 380px;
}

/* ── Logo ── */
.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-img {
    display: block;
    max-width: 200px;
    margin: 0 auto 10px;
}

.login-logo-text {
    display: block;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--login-brand);
    line-height: 1;
}

.login-logo-sub {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    background: var(--login-brand);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 8px;
}

/* ── Título ── */
.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--login-brand);
    text-align: left;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Línea separadora bajo el título */
.login-title-divider {
    width: 36px;
    height: 3px;
    background: var(--login-accent);
    border-radius: 2px;
    margin-bottom: 28px;
}

/* ── Labels ── */
.login-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--login-brand);
    margin-bottom: 6px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Inputs ── */
.login-input {
    border: 1.5px solid var(--login-input-border) !important;
    border-radius: 8px !important;
    padding: 11px 14px !important;
    font-size: 0.95rem;
    background: #fff !important;
    color: var(--login-brand) !important;
    box-shadow: 0 1px 3px rgba(26,26,26,0.04) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

    .login-input:focus {
        border-color: var(--login-input-focus) !important;
        box-shadow: 0 0 0 3px rgba(245,197,24,0.2), 0 1px 3px rgba(26,26,26,0.06) !important;
        background: #fff !important;
        outline: none !important;
    }

    .login-input::placeholder {
        color: #b0b5be;
    }

/* ── Link olvidé contraseña ── */
.login-forgot {
    font-size: 0.82rem;
    color: var(--login-brand);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

    .login-forgot:hover {
        border-bottom-color: var(--login-accent);
        color: var(--login-brand);
        text-decoration: none;
    }

/* ── Botón principal ── */
.login-btn {
    background: var(--login-brand) !important;
    border: 2px solid var(--login-brand) !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    border-radius: 8px;
    padding: 12px;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    box-shadow: 0 2px 8px rgba(26,26,26,0.14);
}

    .login-btn:hover {
        background: var(--login-accent) !important;
        border-color: var(--login-accent) !important;
        color: var(--login-brand) !important;
        box-shadow: 0 4px 16px rgba(245,197,24,0.35);
        transform: translateY(-1px);
    }

    .login-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 6px rgba(26,26,26,0.12);
    }

    .login-btn:disabled,
    .login-btn[disabled] {
        background: #e5e7eb !important;
        border-color: #e5e7eb !important;
        color: #9ca3af !important;
        box-shadow: none;
        transform: none;
        cursor: not-allowed;
    }

/* ── Nota de ayuda ── */
.login-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

/* ── Checkbox personalizado ── */
.login-check-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* Ocultar el input nativo que genera ASP.NET */
.login-check-input input[type="checkbox"],
input.login-check-input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Caja visual del checkbox */
.login-check-box {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

    .login-check-box svg {
        width: 12px;
        height: 10px;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

/* Hover sobre el label */
.login-check-label:hover .login-check-box {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}

/* Estado: checked */
.login-check-label input[type="checkbox"]:checked ~ .login-check-box,
.login-check-input:checked + span.login-check-box {
    background-color: var(--login-accent);
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px rgba(245,197,24,0.2);
}

    .login-check-label input[type="checkbox"]:checked ~ .login-check-box svg,
    .login-check-input:checked + span.login-check-box svg {
        opacity: 1;
        transform: scale(1);
    }

/* Texto del label */
.login-check-text {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1;
}

/* ── Panel derecho ── */
.login-right {
    width: 58%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.login-right-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.55) saturate(0.85);
}

/* Gradiente sobre la foto para unificar */
.login-right-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient( to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.75) 100% );
    z-index: 1;
}

/* Contenido flotante sobre la imagen */
.login-right-content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 0 52px;
}

.login-right-quote {
    max-width: 420px;
}

.login-right-logo {
    display: block;
    height: 44px;
    width: auto;
    margin-bottom: 40px;
    filter: brightness(0) invert(1); /* blanco sobre fondo oscuro */
    opacity: 0.92;
}

.login-right-quote-mark {
    display: block;
    font-size: 5rem;
    line-height: 0.6;
    color: var(--login-accent);
    font-weight: 900;
    margin-bottom: 20px;
    font-family: Georgia, serif;
}

.login-right-tagline {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin: 0 0 24px 0;
}

.login-right-accent-bar {
    display: block;
    width: 48px;
    height: 4px;
    background: var(--login-accent);
    border-radius: 2px;
}

/* Bloque inferior del panel derecho */
.login-right-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: var(--login-accent);
    padding: 18px 36px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.login-right-bottom-link {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.login-right-bottom-logo {
    max-width: 200px;
    display: block;
    filter: brightness(0) saturate(100%);
    transition: opacity 0.15s;
}

.login-right-bottom-link:hover .login-right-bottom-logo {
    opacity: 0.75;
}

.login-right-bottom-arrow {
    font-size: 1.4rem;
    color: var(--login-brand);
    opacity: 0.45;
    transition: opacity 0.15s, transform 0.15s;
}

.login-right-bottom-link:hover ~ .login-right-bottom-arrow,
.login-right-bottom:hover .login-right-bottom-arrow {
    opacity: 0.85;
    transform: translate(2px, -2px);
}

/* ── Logo imagen ── */
.login-logo-img {
    display: block;
    max-width: 200px;
    margin: 0 auto 6px;
}

/* ── Loader ── */
#login-loader {
    position: fixed;
    inset: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

    #login-loader img {
        width: 56px;
    }

/* ── GridView portal (reutilizable en todas las páginas) ── */

/* Focus estandarizado en tono gris (anula el azul de Bootstrap) */
.form-control:focus,
.form-select:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.25);
    outline: none;
}

.portal-grid {
    min-width: 580px;
    width: 100%;
    /* Neutraliza el hover de Bootstrap table-hover en toda la tabla */
    --bs-table-hover-bg: transparent;
    --bs-table-hover-color: inherit;
}

    .portal-grid thead th,
    .portal-grid tfoot td,
    .portal-grid tr.pager td {
        background-color: #f8f9fa !important;
    }

    .portal-grid th {
        background: #f8f9fa;
        color: var(--text-main);
        font-size: 0.8rem;
        font-weight: 600;
        padding: 9px 12px;
        white-space: nowrap;
        user-select: none;
        border-bottom: 2px solid var(--border) !important;
        border-top: none !important;
    }

        /* Link de ordenación: sin subrayado, con icono indicador */
        .portal-grid th a {
            color: var(--text-main) !important;
            text-decoration: none !important;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

            .portal-grid th a:hover {
                color: var(--text-main) !important;
                background: none !important;
                text-decoration: none !important;
            }

            .portal-grid th a::after {
                content: "\F127"; /* bi-arrow-down-up */
                font-family: "bootstrap-icons";
                font-size: 0.7rem;
                color: var(--text-muted);
                opacity: 0.6;
            }

            .portal-grid th a:hover::after {
                opacity: 1;
            }

    .portal-grid td {
        font-size: 0.82rem;
        padding: 8px 12px;
        vertical-align: middle;
        color: var(--text-main);
        border-color: var(--border) !important;
    }

    .portal-grid tbody tr:not(.grid-pager):hover td {
        background-color: var(--background) !important;
    }

    /* Pager row: nunca hover */
    .portal-grid tbody tr.grid-pager:hover td,
    .portal-grid tbody tr.grid-pager td {
        background-color: #fff !important;
    }

/* Botón PDF */
.btn-pdf {
    color: #dc2626;
    font-size: 1.15rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    line-height: 1;
}

    .btn-pdf:hover {
        color: #991b1b;
        transform: scale(1.18);
    }

/* Botón exportar Excel */
.btn-excel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    padding: 4px 12px;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    text-decoration: none !important;
    white-space: nowrap;
}

    .btn-excel i {
        font-size: 0.95rem;
    }

    .btn-excel:hover {
        background: rgba(255,255,255,0.28);
        border-color: rgba(255,255,255,0.6);
        color: #fff;
    }

/* Paginador */
.grid-pager td {
    padding: 10px 0 4px;
    text-align: right;
}

    .grid-pager td a,
    .grid-pager td span {
        display: inline-block;
        padding: 3px 9px;
        margin: 0 2px;
        border-radius: 6px;
        font-size: 0.8rem;
        font-weight: 500;
        border: 1px solid var(--border);
        color: var(--text-main);
        text-decoration: none;
        background: #fff;
        transition: none;
    }

        .grid-pager td a:hover {
            background: #fff !important;
            color: var(--text-main) !important;
            border-color: var(--border) !important;
            text-decoration: none !important;
        }

    /* Página activa */
    .grid-pager td span {
        background: var(--text-main);
        color: #fff;
        border-color: var(--text-main);
    }

/* ── UpdateProgress overlay ── */
.update-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.update-progress-spinner {
    background: #fff;
    border-radius: .75rem;
    padding: 1.25rem 1.75rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    display: flex;
    align-items: center;
    gap: .85rem;
    font-size: .9rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
}

/* ── Responsive Login ── */
@media (max-width: 768px) {
    .login-body {
        overflow: auto;
        height: auto;
    }

    .login-wrapper {
        flex-direction: column;
        height: auto;
    }

    .login-left {
        width: 100%;
        padding: 40px 24px;
    }

    .login-right {
        width: 100%;
    }

    .login-right-image {
        min-height: 220px;
    }
}

/* ── Backdrop mobile ── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 249;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: all;
    }

/* ───────────────
   App Layout — MasterPage
─────────────── */
.app-page {
    margin: 0;
    padding: 0;
    background: var(--background);
    overflow-x: hidden;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: width 0.22s ease;
    overflow: visible;
}

    .sidebar.collapsed {
        width: 64px;
    }

    /* Scroll vertical solo en modo expandido */
    .sidebar:not(.collapsed) .sidebar-nav {
        overflow-y: auto;
    }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 60px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo {
    max-width: 150px;
    max-height: 36px;
    object-fit: contain;
    transition: opacity 0.15s, width 0.22s;
}

.sidebar.collapsed .sidebar-logo {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.sidebar-toggle-inner {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    font-size: 1.15rem;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    margin-left: auto;
}

    .sidebar-toggle-inner:hover {
        background: var(--background);
        color: var(--text-main);
    }

.sidebar.collapsed .sidebar-toggle-inner {
    margin-left: 0;
}

/* Nav links */
.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    overflow: visible;
}

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 9px 12px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 8px;
        margin-bottom: 2px;
        white-space: nowrap;
        transition: background 0.15s, color 0.15s;
    }

        .sidebar-nav a:hover {
            background: var(--background);
            color: var(--text-main);
        }

        .sidebar-nav a.active {
            background: var(--primary);
            color: var(--black);
            font-weight: 600;
        }

        .sidebar-nav a i {
            font-size: 1.1rem;
            flex-shrink: 0;
            width: 20px;
            text-align: center;
        }

    .sidebar-nav .nav-label {
        transition: opacity 0.15s, max-width 0.22s;
        overflow: hidden;
        max-width: 160px;
        white-space: nowrap;
    }

.sidebar.collapsed .nav-label {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 10px;
}

/* ── Sección colapsable del sidebar (ej. Configuración) ── */
.nav-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.nav-section-label {
    padding: 0 12px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s, max-height 0.22s;
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
    max-height: 0;
    padding: 0;
}

.nav-section-toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 2px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

    .nav-section-toggle:hover {
        background: var(--background);
        color: var(--text-main);
    }

    .nav-section-toggle[aria-expanded="true"] {
        color: var(--text-main);
    }

    .nav-section-toggle i:first-child {
        font-size: 1.1rem;
        flex-shrink: 0;
        width: 20px;
        text-align: center;
    }

.nav-section-chevron {
    font-size: 0.72rem;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.22s ease;
    opacity: 0.6;
}

.nav-section-toggle[aria-expanded="true"] .nav-section-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Animación de apertura con max-height */
.nav-section-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 12px;
    position: relative;
}

    .nav-section-items::before {
        content: "";
        position: absolute;
        left: 19px;
        top: 4px;
        bottom: 4px;
        width: 1.5px;
        background: var(--border);
        border-radius: 2px;
    }

    .nav-section-items.open {
        max-height: 400px;
    }

    /* Sub-enlaces dentro de la sección */
    .nav-section-items a {
        padding-left: 20px;
        font-size: 0.845rem;
    }

        .nav-section-items a.active {
            background: var(--primary);
            color: var(--black);
            font-weight: 600;
        }

            .nav-section-items a.active::before {
                background: var(--primary-hover);
            }

/* ── Sidebar colapsado ── */
.sidebar.collapsed .nav-section {
    border-top: 1px solid var(--border);
    padding-top: 6px;
    margin-top: 4px;
}

.sidebar.collapsed .nav-section-toggle {
    justify-content: center;
    padding: 10px;
    position: relative;
}

    .sidebar.collapsed .nav-section-toggle .nav-section-chevron {
        display: none;
    }

    .sidebar.collapsed .nav-section-toggle::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #1f2937;
        color: #fff;
        padding: 5px 10px;
        border-radius: 6px;
        font-size: 0.78rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 300;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }

    .sidebar.collapsed .nav-section-toggle::before {
        content: "";
        position: absolute;
        left: calc(100% + 4px);
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #1f2937;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 300;
    }

    .sidebar.collapsed .nav-section-toggle:hover::after,
    .sidebar.collapsed .nav-section-toggle:hover::before {
        opacity: 1;
    }

.sidebar.collapsed .nav-section-items {
    display: none !important;
}

.sidebar-close-btn {
    display: none;
}

/* ── Tooltip en sidebar colapsado ── */
.sidebar.collapsed .sidebar-nav a {
    position: relative;
}

    .sidebar.collapsed .sidebar-nav a::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #1f2937;
        color: #fff;
        padding: 5px 10px;
        border-radius: 6px;
        font-size: 0.78rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 300;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }

    .sidebar.collapsed .sidebar-nav a::before {
        content: "";
        position: absolute;
        left: calc(100% + 4px);
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #1f2937;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 300;
    }

    .sidebar.collapsed .sidebar-nav a:hover::after,
    .sidebar.collapsed .sidebar-nav a:hover::before {
        opacity: 1;
    }

/* ── App body ── */
.app-body {
    flex: 1;
    min-width: 0; /* flex items no se encogen por debajo de su contenido sin esto */
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.22s ease;
}

    .app-body.sidebar-collapsed {
        margin-left: 64px;
    }

/* ── Topbar ── */
.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

    .topbar-hamburger:hover {
        background: var(--background);
        color: var(--text-main);
    }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User button */
.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    transition: background 0.15s, border-color 0.15s;
}

    .user-btn:hover,
    .user-btn.show {
        background: var(--border);
        border-color: #d1d5db;
    }

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--black);
    flex-shrink: 0;
}

.user-chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ── User dropdown menu ── */
.dropdown-menu .dropdown-item {
    font-size: 0.875rem;
    color: var(--text-main);
    padding: 7px 16px;
    border-radius: 6px;
    transition: background-color 0.12s ease, color 0.12s ease;
}

    .dropdown-menu .dropdown-item:hover,
    .dropdown-menu .dropdown-item:focus {
        background-color: var(--background);
        color: var(--text-main);
    }

    .dropdown-menu .dropdown-item:active {
        background-color: #e5e7eb;
        color: var(--text-main);
    }

    .dropdown-menu .dropdown-item.text-danger:hover,
    .dropdown-menu .dropdown-item.text-danger:focus {
        background-color: #fef2f2;
        color: #dc2626;
    }

    .dropdown-menu .dropdown-item.text-danger:active {
        background-color: #fee2e2;
        color: #dc2626;
    }

/* ── Estado de cuenta ── */
.edo-cuenta-body {
    font-size: 14px;
}

    /* Los h6 de título de tabla no deben sobresalir */
    .edo-cuenta-body h6 {
        font-size: 14px;
    }

    /* Columna de etiqueta en info general */
    .edo-cuenta-body .info-edo-cuenta td:first-child {
        width: 200px;
        white-space: nowrap;
    }

    /* Las tablas de resumen no necesitan el min-width del portal-grid
       porque solo tienen 2 columnas: eliminar el scroll horizontal */
    .edo-cuenta-body .portal-grid {
        min-width: 0;
    }

/* Responsivo: tableta (< 768 px)
   — las dos columnas de info general se apilan solas con col-md-6,
     pero reducimos el ancho fijo de la etiqueta */
@media (max-width: 767px) {
    .edo-cuenta-body .info-edo-cuenta td:first-child {
        width: 160px;
    }
}

/* Responsivo: móvil (< 576 px)
   — etiqueta encima del valor en la info general */
@media (max-width: 575px) {
    .edo-cuenta-body .info-edo-cuenta tr {
        display: flex;
        flex-direction: column;
    }

    .edo-cuenta-body .info-edo-cuenta td {
        display: block;
        width: 100% !important;
        padding-top: 2px;
        padding-bottom: 2px;
    }

        .edo-cuenta-body .info-edo-cuenta td:first-child {
            padding-bottom: 0;
            color: var(--text-secondary);
            font-weight: 600;
        }
}

/* ── Main content ── */
.main-content {
    flex: 1;
    padding: 28px 32px;
    /* Evita que Bootstrap .row con gutters desborde el viewport */
    overflow-x: clip;
}

/* ── Footer ── */
.app-footer {
    height: 42px;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

    .app-footer a {
        color: var(--text-secondary);
        font-weight: 600;
        text-decoration: none;
        margin-left: 3px;
    }

        .app-footer a:hover {
            text-decoration: underline;
        }

/* ───────────────
           Páginas internas — estilos comunes
        ─────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-header-icon {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--black);
    flex-shrink: 0;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-header-brikon {
    background: var(--text-main);
    color: #fff;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
}

.btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background-color: #dc2626;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
    white-space: nowrap;
}

    .btn-pdf i {
        font-size: 1rem;
    }

    .btn-pdf:hover,
    .btn-pdf:focus {
        background-color: #b91c1c;
        color: #fff;
        box-shadow: 0 4px 10px rgba(220, 38, 38, 0.45);
        transform: translateY(-1px);
        text-decoration: none;
    }

    .btn-pdf:active {
        background-color: #991b1b;
        transform: translateY(0);
        box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
    }

.btn-excel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background-color: #16a34a;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
    white-space: nowrap;
}

    .btn-excel i {
        font-size: 1rem;
    }

    .btn-excel:hover,
    .btn-excel:focus {
        background-color: #15803d;
        color: #fff;
        box-shadow: 0 4px 10px rgba(22, 163, 74, 0.45);
        transform: translateY(-1px);
        text-decoration: none;
    }

    .btn-excel:active {
        background-color: #166534;
        transform: translateY(0);
        box-shadow: 0 1px 4px rgba(22, 163, 74, 0.3);
    }

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

/* ── Responsive App (debe ir al final para sobrescribir estilos desktop) ── */
@media (max-width: 768px) {

    /* Sidebar: overlay, no empuja contenido */
    .app-body,
    .app-body.sidebar-collapsed {
        margin-left: 0 !important;
    }

    /* Topbar encima del sidebar → ☰ siempre accesible */
    .topbar {
        z-index: 300 !important;
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
    }

    /* El contenido debe compensar el topbar fijo */
    .main-content {
        padding: 80px 16px 20px;
    }

    /* Sidebar desliza desde la izquierda, debajo del topbar */
    .sidebar {
        top: 60px !important;
        left: -240px !important;
        width: 240px !important;
        z-index: 250 !important;
        transition: left 0.25s ease !important;
        box-shadow: none;
        min-height: calc(100vh - 60px) !important;
    }

        .sidebar.open {
            left: 0 !important;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        }

    /* Backdrop debajo del topbar */
    .sidebar-backdrop {
        top: 60px;
        z-index: 249;
    }

    /* Sin tooltips en mobile */
    .sidebar .sidebar-nav a::after,
    .sidebar .sidebar-nav a::before {
        display: none !important;
    }

    /* GridView en móvil: celdas más compactas */
    .portal-grid th,
    .portal-grid td {
        font-size: 0.78rem;
        padding: 7px 8px;
    }

    .btn-pdf {
        font-size: 1rem;
    }
}

/* ── Nav Tabs — override Bootstrap (anula azul, usa grises del sistema) ── */
.nav-tabs {
    border-bottom-color: var(--border);
}

    .nav-tabs .nav-link {
        color: var(--text-secondary);
        border-color: transparent;
        font-size: 0.875rem;
        font-weight: 500;
        padding: 9px 16px;
        border-radius: 8px 8px 0 0;
        transition: color 0.15s, background 0.15s, border-color 0.15s;
    }

        .nav-tabs .nav-link i {
            color: var(--text-muted);
            transition: color 0.15s;
        }

        .nav-tabs .nav-link:hover {
            color: var(--text-main);
            background: var(--background);
            border-color: transparent;
        }

            .nav-tabs .nav-link:hover i {
                color: var(--text-secondary);
            }

        .nav-tabs .nav-link:focus {
            color: var(--text-main);
            border-color: transparent;
            box-shadow: none;
            outline: none;
        }

        .nav-tabs .nav-link.active {
            color: var(--text-main);
            font-weight: 600;
            background: #fff;
            border-color: var(--border) var(--border) #fff;
        }

            .nav-tabs .nav-link.active i {
                color: var(--text-main);
            }

/* Tarjetas de acceso rápido */
.quick-card {
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

    .quick-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.10) !important;
    }

.quick-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-primary-soft {
    background-color: rgba(255, 206, 0, 0.18);
}

.bg-secondary-soft {
    background-color: rgba(107, 114, 128, 0.12);
}

.text-icon-primary {
    color: var(--black);
}

.text-icon-secondary {
    color: var(--text-secondary);
}
