html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #ffffff, 0 0 0 0.25rem rgba(37, 99, 235, 0.35);
}

/* =========================================================
   VARIABLES GENERALES
   ========================================================= */

:root {
    --sidebar-width: 270px;
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --sidebar-background-start: #172554;
    --sidebar-background-end: #1e3a8a;
    --sidebar-text: #dbeafe;
    --sidebar-text-secondary: #bfdbfe;
    --page-background: #f3f6fb;
    --panel-background: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #172033;
    --text-secondary: #64748b;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --cyan-color: #0891b2;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;
    margin: 0;
    color: #1f2937;
    background: radial-gradient( circle at top left, rgba(37, 99, 235, 0.08), transparent 32% ), #f4f7fb;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 2.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 18px;
    font-size: 2rem;
}

.login-title {
    margin-bottom: 0.25rem;
    color: #172033;
    font-size: 1.65rem;
    font-weight: 700;
}

.login-subtitle {
    margin-bottom: 0;
    color: #6b7280;
}

.login-card .form-label {
    color: #374151;
    font-weight: 600;
}

.login-card .form-control {
    min-height: 46px;
    border-color: #d9e0ea;
    border-radius: 10px;
}

    .login-card .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
    }

.login-button {
    min-height: 46px;
    border-radius: 10px;
    font-weight: 600;
}

.login-recovery {
    font-size: 0.92rem;
    color: #6b7280;
    line-height: 1.5;
}

    .login-recovery a {
        font-weight: 600;
        text-decoration: none;
    }

        .login-recovery a:hover {
            text-decoration: underline;
        }

/* =========================================================
   ESTRUCTURA PRINCIPAL
   ========================================================= */

.app-body {
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
    background: radial-gradient( circle at top right, rgba(37, 99, 235, 0.05), transparent 28% ), var(--page-background);
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    width: var(--sidebar-width);
    padding: 1.5rem;
    flex-direction: column;
    color: #ffffff;
    background: linear-gradient( 180deg, var(--sidebar-background-start) 0%, var(--sidebar-background-end) 100% );
    border-right: none;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 13px;
    font-size: 1.5rem;
}

.sidebar-brand-title {
    color: #ffffff;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand-subtitle {
    margin-top: 0.15rem;
    color: var(--sidebar-text-secondary);
    font-size: 0.85rem;
}

.sidebar-navigation {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 46px;
    padding: 0.7rem 0.9rem;
    color: var(--sidebar-text);
    border-radius: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

    .sidebar-link:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.12);
        transform: translateX(2px);
    }

.sidebar-link-active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 4px 0 0 #60a5fa;
}

.sidebar-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-size: 1.1rem;
}

.sidebar-link-disabled {
    color: var(--sidebar-text-secondary);
    cursor: default;
    opacity: 0.68;
}

    .sidebar-link-disabled:hover {
        color: var(--sidebar-text-secondary);
        background: transparent;
        transform: none;
    }

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    color: #1e3a8a;
    background: #dbeafe;
    border-radius: 50%;
    font-weight: 700;
}

.sidebar-user-information {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

    .sidebar-user-information strong {
        overflow: hidden;
        color: #ffffff;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.sidebar-user-label {
    color: var(--sidebar-text-secondary);
    font-size: 0.75rem;
}

.sidebar-logout-button {
    width: 100%;
    color: #ffffff;
    background: rgba(239, 68, 68, 0.17);
    border: 1px solid rgba(254, 202, 202, 0.35);
    border-radius: 10px;
    font-weight: 600;
}

    .sidebar-logout-button:hover {
        color: #ffffff;
        background: var(--danger-color);
        border-color: var(--danger-color);
    }

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.app-content {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem;
}

/* =========================================================
   ENCABEZADO MÓVIL
   ========================================================= */

.mobile-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 64px;
    padding: 0 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.mobile-menu-button {
    padding: 0.35rem 0.65rem;
    color: #1e3a8a;
    font-size: 1.4rem;
    line-height: 1;
}

.mobile-header-title {
    color: #172033;
    font-weight: 700;
}

.mobile-sidebar {
    width: 290px;
    color: #ffffff;
    background: linear-gradient( 180deg, var(--sidebar-background-start) 0%, var(--sidebar-background-end) 100% );
}

    .mobile-sidebar .offcanvas-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    .mobile-sidebar .offcanvas-title {
        color: #ffffff;
    }

    .mobile-sidebar .text-muted {
        color: var(--sidebar-text-secondary) !important;
    }

    .mobile-sidebar .btn-close {
        filter: invert(1);
    }

/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.dashboard-welcome {
    position: relative;
    padding-left: 1rem;
}

    .dashboard-welcome::before {
        position: absolute;
        top: 0.15rem;
        bottom: 0.15rem;
        left: 0;
        width: 5px;
        content: "";
        background: linear-gradient( 180deg, #2563eb, #60a5fa );
        border-radius: 999px;
    }

.dashboard-title {
    margin-bottom: 0.35rem;
    color: #172033;
    font-size: 1.8rem;
    font-weight: 700;
}

.dashboard-date {
    margin: 0;
    color: var(--text-secondary);
}

.dashboard-clock {
    padding: 0.7rem 1rem;
    color: #1e3a8a;
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

/* =========================================================
   TARJETAS DE RESUMEN
   ========================================================= */

.dashboard-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 150px;
    padding: 1.4rem;
    background: var(--panel-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

    .dashboard-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    }

    .dashboard-card::after {
        position: absolute;
        right: -30px;
        bottom: -35px;
        width: 110px;
        height: 110px;
        content: "";
        border-radius: 50%;
        opacity: 0.13;
    }

.dashboard-card-content {
    position: relative;
    z-index: 2;
}

.dashboard-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-card-label {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.dashboard-card-value {
    margin: 0;
    color: #172033;
    font-size: 2rem;
    font-weight: 700;
}

.dashboard-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 14px;
    font-size: 1.4rem;
}

.dashboard-card-link {
    color: inherit;
    text-decoration: none;
}

    .dashboard-card-link:hover {
        color: inherit;
    }

.dashboard-card-blue {
    border-top: 4px solid #2563eb;
}

    .dashboard-card-blue::after {
        background: #2563eb;
    }

    .dashboard-card-blue .dashboard-card-icon {
        color: #1d4ed8;
        background: #dbeafe;
    }

.dashboard-card-cyan {
    border-top: 4px solid var(--cyan-color);
}

    .dashboard-card-cyan::after {
        background: var(--cyan-color);
    }

    .dashboard-card-cyan .dashboard-card-icon {
        color: #0e7490;
        background: #cffafe;
    }

.dashboard-card-orange {
    border-top: 4px solid var(--warning-color);
}

    .dashboard-card-orange::after {
        background: var(--warning-color);
    }

    .dashboard-card-orange .dashboard-card-icon {
        color: #b45309;
        background: #fef3c7;
    }

.dashboard-card-green {
    border-top: 4px solid var(--success-color);
}

    .dashboard-card-green::after {
        background: var(--success-color);
    }

    .dashboard-card-green .dashboard-card-icon {
        color: #15803d;
        background: #dcfce7;
    }

/* =========================================================
   PANELES DE CONTENIDO
   ========================================================= */

.content-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--panel-background);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.04);
}

.content-panel-title {
    margin: 0;
    color: #172033;
    font-size: 1.15rem;
    font-weight: 700;
}

/* =========================================================
   TABLAS
   ========================================================= */

.table {
    color: #334155;
}

    .table thead th {
        padding-top: 1rem;
        padding-bottom: 1rem;
        color: #475569;
        background: #f8fafc;
        border-bottom: 1px solid #dbe3ee;
        font-size: 0.88rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .table tbody td {
        padding-top: 1rem;
        padding-bottom: 1rem;
        border-color: #edf2f7;
    }

    .table tbody tr {
        transition: background-color 0.15s ease;
    }

        .table tbody tr:hover {
            background: #f8fbff;
        }

/* =========================================================
   BOTONES Y FORMULARIOS GENERALES
   ========================================================= */

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }

.btn-outline-primary {
    color: var(--primary-color);
    border-color: #93c5fd;
}

    .btn-outline-primary:hover {
        color: #ffffff;
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

.form-control,
.form-select {
    border-color: #d9e0ea;
    border-radius: 10px;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
    }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 2rem 1.5rem;
        border-radius: 14px;
    }

    .login-title {
        font-size: 1.4rem;
    }

    .dashboard-header {
        flex-direction: column;
    }

    .dashboard-title {
        font-size: 1.5rem;
    }

    .dashboard-clock {
        width: 100%;
        text-align: center;
    }

    .dashboard-card {
        min-height: 135px;
    }

    .app-content {
        padding: 1rem;
    }

    .content-panel {
        padding: 1rem;
    }
}
/* =========================================================
   BADGES DEL SISTEMA
   ========================================================= */

.badge-system {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 85px;
    padding: 0.35rem .80rem;
    border-radius: 999px;
    font-size: .80rem;
    font-weight: 600;
}

.badge-activo {
    color: #166534;
    background: #DCFCE7;
}

.badge-inactivo {
    color: #991B1B;
    background: #FEE2E2;
}

.badge-pendiente {
    color: #92400E;
    background: #FEF3C7;
}

.badge-pagado {
    color: #065F46;
    background: #D1FAE5;
}

.sidebar-section-title {
    margin: 1.25rem 0 0.45rem;
    padding: 0 0.9rem;
    color: var(--sidebar-text-secondary) !important;
    /*color: rgba(255, 255, 255, 0.55);*/
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-link-icon {
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
}