:root {
    --azul: #003b71;
    --azul-oscuro: #002f5c;
    --amarillo: #ffc400;
    --amarillo-hover: #f0b800;
    --fondo: #f5f6f8;
    --texto: #003b71;
    --texto-suave: #526b87;
    --blanco: #ffffff;
    --sombra: 0 12px 35px rgba(0,0,0,0.08);
    --radio: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--fondo);
    color: var(--texto);
}

/* NAVBAR */
.navbar {
    background: var(--blanco) !important;
    min-height: 88px;
    padding: 14px 40px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

.navbar-brand {
    color: var(--azul) !important;
    font-size: 26px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 14px;
}

.navbar-brand::before {
    content: "MG";
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--amarillo);
    color: var(--azul);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 900;
}

.navbar .nav-link {
    color: var(--azul) !important;
    font-weight: 800;
    border-radius: 14px;
    padding: 14px 18px !important;
    margin: 0 4px;
    transition: .2s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: var(--amarillo);
    color: var(--azul) !important;
    box-shadow: 0 8px 22px rgba(255,196,0,.35);
}

.navbar .text-white,
.navbar .text-white a {
    color: var(--azul) !important;
    font-weight: 800;
}

/* CONTENEDOR */
main.container {
    max-width: 1320px;
    padding-top: 34px !important;
}

/* TÍTULOS */
.page-title,
h1,
h2 {
    color: var(--azul);
    font-weight: 900;
    margin-bottom: 18px;
}

.text-muted,
p {
    color: var(--texto-suave) !important;
}

/* HERO / CABECERA */
.page-title + p {
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 28px;
    text-align: center;
    font-size: 18px;
    margin-bottom: 34px !important;
}

/* TARJETAS */
.card,
.app-card {
    background: var(--blanco);
    border: none;
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

.card {
    border-top: 5px solid var(--amarillo);
}

.card-body {
    padding: 32px;
}

.card-title {
    color: var(--azul);
    font-weight: 900;
}

/* DASHBOARD */
.dashboard-card {
    display: block;
    min-height: 260px;
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    text-decoration: none;
    color: var(--azul);
    padding: 34px;
    transition: .2s;
    border-top: 5px solid var(--amarillo);
}

.dashboard-card:hover {
    transform: translateY(-6px);
    color: var(--azul);
    box-shadow: 0 16px 42px rgba(0,0,0,0.12);
}

.dashboard-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--amarillo);
    color: var(--azul);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 28px;
    box-shadow: 0 10px 25px rgba(255,196,0,0.35);
}

.dashboard-card h4 {
    color: var(--azul);
    font-weight: 900;
    font-size: 24px;
    margin-bottom: 14px;
}

.dashboard-card p {
    color: var(--texto-suave) !important;
    line-height: 1.6;
}

/* BOTONES */
.btn {
    border-radius: 14px;
    font-weight: 900;
    padding: 12px 18px;
}

.btn-institucional,
.btn-primary,
.btn-login {
    background: var(--amarillo) !important;
    color: var(--azul) !important;
    border: none !important;
}

.btn-institucional:hover,
.btn-primary:hover,
.btn-login:hover {
    background: var(--amarillo-hover) !important;
    color: var(--azul) !important;
}

.btn-success {
    border: none !important;
    font-weight: 900;
}

/* FORMULARIOS */
.form-label,
label {
    font-weight: 800;
    color: var(--azul);
    margin-bottom: 10px;
}

.form-control,
.form-select {
    height: 54px;
    border: none;
    border-radius: 14px;
    background: #f3f4f6;
    padding: 0 18px;
    color: var(--azul);
    font-size: 15px;
}

.form-control:focus,
.form-select:focus {
    border: 2px solid var(--amarillo);
    background: var(--blanco);
    box-shadow: none;
}

.form-control::placeholder {
    color: #7a8797;
}

/* TABLAS */
.table {
    color: var(--azul);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--azul) !important;
    color: var(--amarillo) !important;
    border: none;
    padding: 16px;
}

.table tbody td {
    vertical-align: middle;
    padding: 14px 16px;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #f8fafc;
}

.table tbody tr:hover td {
    background: #fff8db;
}

/* DATATABLE */
.dt-search input,
.dt-length select {
    border: none !important;
    border-radius: 12px !important;
    background: #f3f4f6 !important;
    min-height: 42px;
}

.dt-paging .page-link {
    color: var(--azul);
    border: none;
    border-radius: 10px;
    margin: 0 2px;
    font-weight: 800;
}

.dt-paging .active .page-link {
    background: var(--amarillo);
    color: var(--azul);
}

/* BADGES */
.badge-presente,
.badge.bg-success {
    background: #198754 !important;
}

.badge-tardanza {
    background: #ffc107;
    color: #111;
}

.badge-falta,
.badge.bg-danger {
    background: #dc3545 !important;
}

.badge-justificado {
    background: #0dcaf0;
    color: #111;
}

/* ALERTAS */
.alert-info,
.alert-success {
    background: #fff8db;
    color: var(--azul);
    border: 1px solid #ffe68a;
    border-radius: 14px;
    font-weight: 800;
}

.alert-danger,
.alert.error {
    background: #ffe5e5;
    color: #b00020;
    border: 1px solid #ffd1d1;
    border-radius: 14px;
    font-weight: 800;
}

/* MODALES */
.modal-content {
    border: none;
    border-radius: 22px;
    overflow: hidden;
}

.modal-header {
    background: var(--azul);
    color: var(--amarillo);
}

.modal-title {
    font-weight: 900;
}

/* LOGIN / CONSULTA DNI */
body.login-body {
    min-height: 100vh;
    background: var(--fondo);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    max-width: 430px;
    width: 100%;
    margin: 0 auto;
    padding: 35px;
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: 'MG';
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: var(--amarillo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    color: var(--azul);
    box-shadow: 0 10px 25px rgba(255,196,0,.35);
}

.login-title {
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    color: var(--azul);
}

.login-subtitle {
    text-align: center;
    color: var(--texto-suave);
    font-size: clamp(15px, 2vw, 21px);
    margin-bottom: 34px;
}

.login-card {
    width: 100%;
    background: var(--blanco);
    border-radius: var(--radio);
    padding: 35px;
    box-shadow: var(--sombra);
    text-align: left;
}

.btn-login {
    height: 56px;
    font-size: 18px;
}

.login-info {
    text-align: center;
    margin-top: 25px;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
    color: var(--texto-suave);
    font-size: 0.85rem;
}

.role-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--azul);
    font-weight: 900;
    font-size: 12px;
    margin: 0.15rem;
}

/* TABS LOGIN */
.nav-tabs {
    border: none;
    margin-bottom: 1.5rem;
    background: #f3f4f6;
    border-radius: 14px;
    padding: 0.25rem;
}

.nav-tabs .nav-item {
    flex: 1;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 12px;
    font-weight: 900;
    padding: 0.75rem 1rem;
    text-align: center;
    color: var(--texto-suave);
    background: transparent;
}

.nav-tabs .nav-link.active {
    background: var(--amarillo);
    color: var(--azul) !important;
    box-shadow: 0 6px 18px rgba(255,196,0,0.35);
}

/* RESPONSIVE */
@media (max-width: 992px) {
    .navbar {
        padding: 14px 20px;
    }

    .navbar-brand {
        font-size: 22px;
    }

    .dashboard-card {
        min-height: 220px;
    }
}

@media (max-width: 768px) {
    main.container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .login-card,
    .login-container {
        padding: 28px;
    }

    .login-container::before,
    .navbar-brand::before {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }

    .navbar-nav {
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .login-card,
    .login-container {
        padding: 22px;
        border-radius: 20px;
    }

    .form-control,
    .form-select,
    .btn-login {
        height: 52px;
        font-size: 15px;
    }

    .dashboard-card {
        min-height: auto;
        padding: 28px;
    }

    .nav-tabs .nav-link {
        padding: 0.65rem 0.6rem;
        font-size: 0.85rem;
    }
}

.admin-hero {
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    padding: 38px 30px;
    text-align: center;
    margin-bottom: 34px;
}

.admin-hero h1 {
    font-size: clamp(34px, 5vw, 48px);
    font-weight: 900;
    color: #003b71;
    margin-bottom: 14px;
}

.admin-hero p {
    font-size: 18px;
    color: #526b87 !important;
    margin: 0;
}

.section-title {
    position: relative;
    font-size: 32px;
    font-weight: 900;
    color: #003b71;
    margin-bottom: 28px;
    padding-left: 18px;
}

.section-title::before {
    content: "";
    width: 5px;
    height: 36px;
    background: #ffc400;
    border-radius: 20px;
    position: absolute;
    left: 0;
    top: 2px;
}

.module-card {
    min-height: 360px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    border-top: 5px solid #ffc400;
    padding: 36px;
    display: flex;
    flex-direction: column;
    transition: .2s ease;
}

.module-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 42px rgba(0,0,0,0.12);
}

.module-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: #ffc400;
    color: #003b71;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 28px;
    box-shadow: 0 10px 25px rgba(255,196,0,0.35);
}

.module-card h3 {
    font-size: 26px;
    font-weight: 900;
    color: #003b71;
    margin-bottom: 14px;
}

.module-card p {
    font-size: 16px;
    line-height: 1.6;
    color: #526b87 !important;
    margin-bottom: 28px;
}

.module-btn {
    margin-top: auto;
    display: block;
    width: 100%;
    text-align: center;
    background: #ffc400;
    color: #003b71;
    text-decoration: none;
    border-radius: 14px;
    padding: 15px 18px;
    font-weight: 900;
    font-size: 17px;
}

.module-btn:hover {
    background: #f0b800;
    color: #003b71;
}

@media (max-width: 768px) {
    .module-card {
        min-height: auto;
        padding: 30px;
    }

    .admin-hero {
        padding: 30px 22px;
    }
}

/* CORRECCIÓN FINAL NAVBAR */
.navbar {
    overflow: visible;
}

.navbar .container-fluid {
    max-width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.navbar-brand {
    flex: 0 0 auto;
    font-size: 24px;
    margin-right: 25px;
}

.navbar-collapse {
    flex: 1 1 auto;
    min-width: 0;
}

.navbar-nav.me-auto {
    flex: 1 1 auto;
    justify-content: center;
    gap: 6px;
}

.navbar .nav-link {
    font-size: 16px;
    padding: 10px 12px !important;
}

.navbar-user {
    flex: 0 0 auto;
    max-width: 260px;
    color: #0056a6 !important;
    font-size: 14px;
    font-weight: 800;
    white-space: normal;
    line-height: 1.3;
    text-align: right;
}

.navbar-user a {
    color: #0056a6 !important;
    font-weight: 900;
}

@media (max-width: 1200px) {
    .navbar-brand {
        font-size: 21px;
        margin-right: 12px;
    }

    .navbar .nav-link {
        font-size: 14px;
        padding: 8px 9px !important;
    }

    .navbar-user {
        max-width: 190px;
        font-size: 13px;
    }
}

@media (max-width: 992px) {
    .navbar .container-fluid {
        flex-wrap: wrap;
    }

    .navbar-collapse {
        flex-basis: 100%;
    }

    .navbar-nav.me-auto {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .navbar-user {
        max-width: 100%;
        text-align: left;
        margin-top: 12px;
    }
}

/* ===== PORTAL DEL ESTUDIANTE - CORRECCIÓN FINAL ===== */

.student-portal {
    width: 100%;
    padding-bottom: 45px;
}

.student-topbar {
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    padding: 35px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 5px solid #ffc400;
}

.student-topbar h1 {
    font-size: 42px;
    font-weight: 900;
    color: #003b71;
    margin-bottom: 8px;
}

.student-topbar p {
    font-size: 17px;
    color: #526b87 !important;
    margin: 0;
}

.student-exit-btn {
    background: #ffc400;
    color: #003b71 !important;
    text-decoration: none;
    border-radius: 14px;
    padding: 14px 28px;
    font-weight: 900;
}

.student-profile-card {
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    padding: 30px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.student-avatar {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 20px;
    background: #ffc400;
    color: #003b71;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 900;
}

.student-profile-info h2 {
    font-size: 32px;
    font-weight: 900;
    color: #003b71;
    margin-bottom: 8px;
}

.student-profile-info p {
    color: #526b87 !important;
    margin: 0;
    font-size: 16px;
}

.student-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.student-summary-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    padding: 24px;
    border-top: 5px solid #ffc400;
}

.student-summary-card.presente {
    border-top-color: #198754;
}

.student-summary-card.tardanza {
    border-top-color: #ffc107;
}

.student-summary-card.falta {
    border-top-color: #dc3545;
}

.student-summary-card.justificado {
    border-top-color: #0dcaf0;
}

.student-summary-card .summary-label {
    display: block;
    color: #526b87;
    font-weight: 800;
    margin-bottom: 8px;
}

.student-summary-card strong {
    display: block;
    font-size: 38px;
    font-weight: 900;
    color: #003b71;
    margin-bottom: 8px;
}

.student-summary-card small {
    color: #526b87;
}

.student-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 28px;
}

.student-info-card,
.student-table-card,
.student-alert {
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
    padding: 30px;
    border-top: 5px solid #ffc400;
}

.student-info-card h3,
.student-table-card h3,
.student-alert h3 {
    color: #003b71;
    font-weight: 900;
    margin-bottom: 12px;
}

.student-info-card p,
.student-table-card p,
.student-alert p {
    color: #526b87 !important;
}

.student-table-header {
    margin-bottom: 20px;
}

#tablaEstudiante {
    width: 100% !important;
}

.badge-presente,
.badge-tardanza,
.badge-falta,
.badge-justificado {
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 900;
}

@media (max-width: 992px) {
    .student-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .student-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .student-topbar,
    .student-profile-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .student-summary-grid {
        grid-template-columns: 1fr;
    }

    .student-exit-btn {
        width: 100%;
        text-align: center;
    }
}