:root {
    --color-primary-blue: #27569a;
    --color-primary-light: #7db7ff;
    --color-accent: #ff7a5c;
    --color-surface: #eff6ff;
    --color-surface-2: #ffffff;
    --color-text-dark: #17304a;
    --color-text-light: #667890;
    --color-border: rgba(39, 77, 138, 0.12);
    --color-success: #3f8f5c;
    --color-error: #d32f2f;
    --shadow-sm: 0 4px 10px rgba(39, 77, 138, 0.08);
    --shadow-md: 0 10px 24px rgba(39, 77, 138, 0.12);
    --shadow-lg: 0 18px 48px rgba(39, 77, 138, 0.16);
    --transition: all 0.32s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    color: var(--color-text-dark);
    line-height: 1.65;
}

button,
input,
select,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
}

body {
    min-width: 0;
    overflow-x: hidden;
}

body:not(.body-login) {
    background-size: cover;
}

main,
section,
article,
aside,
header,
footer,
form,
fieldset,
.page-header,
.main-content,
.footer-content,
.topbar,
.hero-panel,
.workspace-grid,
.dashboard-grid,
.area-grid,
.form-grid,
.filters-grid,
.controls-grid,
.settings-grid,
.table-wrapper,
.table-zone,
.panel,
.form-panel,
.list-panel,
.report-panel,
.database-panel {
    min-width: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper,
.table-zone,
.report-table-wrapper,
.attendance-table-wrapper,
.students-table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

.user-info {
    color: #344d6b;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid rgba(39, 86, 154, 0.18);
    border-radius: 8px;
    background: #ffffff;
    color: #173f7c;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 5px 14px rgba(39, 77, 138, 0.08);
    transition: var(--transition);
}

.btn-logout:hover,
.btn-logout:focus-visible {
    border-color: rgba(39, 86, 154, 0.35);
    transform: translateY(-1px);
}

.student-select-combo {
    position: relative;
    width: 100%;
}

.student-select-search {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.student-select-search:focus {
    outline: 3px solid rgba(125, 183, 255, 0.32);
    border-color: rgba(39, 86, 154, 0.36);
}

.student-select-search:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.student-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 80;
    display: grid;
    gap: 4px;
    max-height: 260px;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid rgba(39, 77, 138, 0.16);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(23, 48, 74, 0.16);
}

.student-select-dropdown[hidden] {
    display: none;
}

.student-select-option {
    display: grid;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-dark);
    text-align: left;
    cursor: pointer;
}

.student-select-option:hover,
.student-select-option:focus-visible {
    background: #eef6ff;
    outline: 0;
}

.student-select-option strong {
    font-size: 13px;
    line-height: 1.15;
}

.student-select-option span,
.student-select-empty {
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.2;
}

.student-select-empty {
    padding: 10px;
}

.student-select-native-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Marca de agua del sistema */
body:not(.body-login) {
    position: relative;
}

body:not(.body-login)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("../images/educadmaule icono png.png");
    background-repeat: repeat;
    background-size: 260px 260px;
    background-position: 28px 34px;
    opacity: 0.028;
    filter: grayscale(1);
}

body:not(.body-login) .page-header,
body:not(.body-login) .main-content,
body:not(.body-login) .footer,
body:not(.body-login) .footer-content,
body:not(.body-login) main,
body:not(.body-login) header,
body:not(.body-login) section {
    position: relative;
    z-index: 1;
}

@media screen and (max-width: 640px) {
    body:not(.body-login)::after {
        background-size: 190px 190px;
        background-position: 12px 18px;
        opacity: 0.024;
    }
}

/* ========================================
   DENSIDAD COMODA GLOBAL
   Reduce espacios excesivos sin cambiar la identidad visual.
   ======================================== */
@media screen {
    .page-header,
    .main-content,
    .footer-content {
        width: min(1240px, calc(100% - 32px)) !important;
    }

    .topbar {
        min-height: 58px !important;
        padding-block: 6px !important;
        gap: 14px !important;
    }

    .brand {
        gap: 9px !important;
    }

    .brand img {
        width: 38px !important;
        height: 38px !important;
    }

    .topbar-actions,
    .form-actions,
    .preview-actions {
        gap: 8px !important;
    }

    .hero-panel {
        min-height: auto !important;
        margin-block: 4px 14px !important;
        padding: clamp(14px, 2vw, 20px) !important;
        gap: clamp(12px, 2vw, 18px) !important;
    }

    .hero-copy,
    .section-header,
    .panel-heading,
    .area-heading div {
        gap: 5px !important;
    }

    .hero-panel h1,
    .hero-copy h1 {
        font-size: clamp(28px, 3vw, 38px) !important;
        line-height: 1.05 !important;
    }

    .hero-description,
    .hero-panel p,
    .section-header p,
    .panel-heading p,
    .area-heading p,
    .empty-state p {
        line-height: 1.42 !important;
    }

    .quick-summary,
    .summary-grid,
    .hero-summary {
        gap: 8px !important;
    }

    .quick-summary div,
    .summary-grid div,
    .hero-summary div {
        min-height: 58px !important;
        padding: 9px 12px !important;
    }

    .main-content {
        padding-bottom: 18px !important;
    }

    .area-section,
    .database-panel,
    .report-controls,
    .empty-state,
    .panel,
    .form-panel,
    .role-panel,
    .list-panel,
    .info-panel,
    .import-panel,
    .register-panel,
    .chart-panel,
    .report-panel,
    .filters-panel,
    .control-panel,
    .schedule-panel,
    .justification-panel,
    .course-picker,
    .grade-book,
    .attendance-book,
    .settings-card,
    .section-manual,
    .section-masiva,
    .preview-section {
        padding: clamp(14px, 1.8vw, 18px) !important;
        margin-bottom: 14px !important;
    }

    .area-heading,
    .panel-header,
    .attendance-header,
    .preview-header {
        gap: 10px !important;
        margin-bottom: 12px !important;
        padding-bottom: 12px !important;
    }

    .section-header {
        margin-bottom: 12px !important;
    }

    .section-header h2,
    .panel-heading h2,
    .panel-header h2,
    .area-heading h2,
    .empty-state h2 {
        font-size: clamp(20px, 2.2vw, 24px) !important;
        line-height: 1.15 !important;
    }

    .workspace-grid,
    .container-alumnos,
    .dashboard-grid,
    .area-grid,
    .metric-grid,
    .filters-grid,
    .form-grid,
    .controls-grid,
    .picker-grid,
    .justification-selectors,
    .justifier-grid,
    .upload-grid,
    .settings-grid {
        gap: 12px !important;
    }

    .area-grid,
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important;
    }

    .dashboard-card,
    .metric-card,
    .role-card,
    .permission-card,
    .course-students-card,
    .status-card,
    .donut-card,
    .list-card,
    .student-summary div,
    .general-average,
    .card-upload,
    .info-box {
        min-height: auto !important;
        padding: clamp(12px, 1.6vw, 16px) !important;
        gap: 7px !important;
    }

    .dashboard-card {
        grid-template-rows: auto auto auto 1fr auto !important;
    }

    .featured-card {
        min-height: auto !important;
        padding: clamp(13px, 1.6vw, 16px) !important;
    }

    .card-icon,
    .featured-card .card-icon,
    .upload-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 22px !important;
    }

    .dashboard-card h3,
    .role-card h3,
    .card-upload h3,
    .list-card h3 {
        font-size: clamp(17px, 1.8vw, 19px) !important;
        line-height: 1.16 !important;
    }

    .dashboard-card p,
    .role-card p,
    .metric-card p,
    .card-upload p,
    .info-box p,
    .list-card p {
        line-height: 1.38 !important;
    }

    .card-link,
    .btn-secondary,
    .btn-primary,
    .btn-warning,
    .btn-submit,
    .btn-upload,
    .btn-login,
    .btn-logout,
    .btn-back,
    .download-button {
        min-height: 36px !important;
        padding-inline: 12px !important;
    }

    input,
    select,
    textarea,
    .custom-student-button,
    .credential-display,
    .selected-file,
    .selected-file-preview {
        min-height: 40px !important;
    }

    textarea {
        min-height: 84px !important;
    }

    .formulario-alumnos,
    .teacher-form,
    .user-form,
    .late-form,
    .settings-form,
    .justification-form,
    .evaluation-form {
        gap: 12px !important;
    }

    .table-wrapper,
    .table-zone {
        margin-top: 8px !important;
    }

    .footer {
        margin-top: 16px !important;
        padding-block: 16px !important;
    }
}

@media screen and (max-width: 980px) {
    .hero-panel,
    .workspace-grid,
    .container-alumnos,
    .filters-panel,
    .control-panel {
        grid-template-columns: 1fr !important;
    }

    .quick-summary,
    .summary-grid,
    .hero-summary,
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media screen and (max-width: 680px) {
    .page-header,
    .main-content,
    .footer-content {
        width: min(100% - 22px, 1240px) !important;
    }

    .topbar {
        padding-block: 10px !important;
    }

    .hero-panel {
        padding: 14px !important;
    }

    .quick-summary,
    .summary-grid,
    .hero-summary,
    .metric-grid,
    .area-grid,
    .dashboard-grid,
    .filters-grid,
    .form-grid,
    .controls-grid,
    .picker-grid,
    .justification-selectors,
    .justifier-grid,
    .upload-grid,
    .student-summary,
    .signature-grid {
        grid-template-columns: 1fr !important;
    }

    .area-section,
    .database-panel,
    .report-controls,
    .empty-state,
    .panel,
    .form-panel,
    .role-panel,
    .list-panel,
    .info-panel,
    .import-panel,
    .register-panel,
    .chart-panel,
    .report-panel,
    .filters-panel,
    .control-panel,
    .schedule-panel,
    .justification-panel,
    .course-picker,
    .grade-book,
    .attendance-book,
    .settings-card,
    .section-manual,
    .section-masiva,
    .preview-section {
        padding: 13px !important;
    }
}

/* ========================================
   CAPA MOVIL TIPO APP PARA MODULOS
   No modifica Home; Login tiene su propia capa movil.
   ======================================== */
@media screen and (max-width: 680px) {
    body:not(.body-home):not(.body-login) {
        min-height: 100dvh;
        background: linear-gradient(180deg, #f8fbff 0%, #edf4fb 100%) !important;
        overflow-x: hidden;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
        -webkit-tap-highlight-color: transparent;
    }

    body:not(.body-home):not(.body-login) .page-header,
    body:not(.body-home):not(.body-login) .main-content,
    body:not(.body-home):not(.body-login) .footer-content {
        width: min(100% - 18px, 1240px) !important;
    }

    body:not(.body-home):not(.body-login) .topbar {
        position: sticky !important;
        top: 0;
        z-index: 30;
        min-height: 58px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 10px !important;
        margin-inline: -9px !important;
        padding: max(8px, env(safe-area-inset-top)) 9px 8px !important;
        background: rgba(248, 251, 255, 0.92) !important;
        border-bottom: 1px solid rgba(39, 77, 138, 0.08);
        backdrop-filter: blur(14px);
    }

    body:not(.body-home):not(.body-login) .brand {
        min-width: 0;
        gap: 8px !important;
    }

    body:not(.body-home):not(.body-login) .brand img {
        width: 34px !important;
        height: 34px !important;
    }

    body:not(.body-home):not(.body-login) .brand span {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 13px !important;
    }

    body:not(.body-home):not(.body-login) .topbar-actions {
        width: auto !important;
        max-width: 48vw;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 7px !important;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    body:not(.body-home):not(.body-login) .topbar-actions::-webkit-scrollbar {
        display: none;
    }

    body:not(.body-home):not(.body-login) .topbar-actions a,
    body:not(.body-home):not(.body-login) .topbar-actions button,
    body:not(.body-home):not(.body-login) .btn-secondary,
    body:not(.body-home):not(.body-login) .btn-primary,
    body:not(.body-home):not(.body-login) .btn-warning,
    body:not(.body-home):not(.body-login) .btn-submit,
    body:not(.body-home):not(.body-login) .btn-back,
    body:not(.body-home):not(.body-login) .btn-upload,
    body:not(.body-home):not(.body-login) .download-button {
        width: auto !important;
        min-height: 34px !important;
        flex: 0 0 auto;
        padding-inline: 11px !important;
        border-radius: 8px !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
        box-shadow: 0 5px 14px rgba(39, 77, 138, 0.08);
        white-space: nowrap;
    }

    body:not(.body-home):not(.body-login) .hero-panel {
        min-height: auto !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin: 10px 0 12px !important;
        padding: 15px !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 24px rgba(39, 77, 138, 0.12) !important;
    }

    body:not(.body-home):not(.body-login) .hero-copy,
    body:not(.body-home):not(.body-login) .section-title,
    body:not(.body-home):not(.body-login) .panel-heading,
    body:not(.body-home):not(.body-login) .panel-header > div,
    body:not(.body-home):not(.body-login) .book-title {
        gap: 5px !important;
    }

    body:not(.body-home):not(.body-login) .eyebrow,
    body:not(.body-home):not(.body-login) .section-label,
    body:not(.body-home):not(.body-login) .area-label {
        font-size: 10px !important;
        letter-spacing: 0.08em !important;
    }

    body:not(.body-home):not(.body-login) .hero-panel h1,
    body:not(.body-home):not(.body-login) .hero-copy h1 {
        font-size: 25px !important;
        line-height: 1.08 !important;
    }

    body:not(.body-home):not(.body-login) .hero-panel p,
    body:not(.body-home):not(.body-login) .hero-description {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    body:not(.body-home):not(.body-login) .quick-summary,
    body:not(.body-home):not(.body-login) .hero-summary,
    body:not(.body-home):not(.body-login) .summary-grid,
    body:not(.body-home):not(.body-login) .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    body:not(.body-home):not(.body-login) .quick-summary div,
    body:not(.body-home):not(.body-login) .hero-summary div,
    body:not(.body-home):not(.body-login) .summary-grid div,
    body:not(.body-home):not(.body-login) .metric-card,
    body:not(.body-home):not(.body-login) .status-card {
        min-height: 56px !important;
        padding: 9px 10px !important;
        border-radius: 8px !important;
    }

    body:not(.body-home):not(.body-login) .main-content {
        padding-bottom: 8px !important;
        min-width: 0 !important;
    }

    body:not(.body-home):not(.body-login) .area-section,
    body:not(.body-home):not(.body-login) .database-panel,
    body:not(.body-home):not(.body-login) .report-controls,
    body:not(.body-home):not(.body-login) .empty-state,
    body:not(.body-home):not(.body-login) .panel,
    body:not(.body-home):not(.body-login) .form-panel,
    body:not(.body-home):not(.body-login) .role-panel,
    body:not(.body-home):not(.body-login) .list-panel,
    body:not(.body-home):not(.body-login) .info-panel,
    body:not(.body-home):not(.body-login) .import-panel,
    body:not(.body-home):not(.body-login) .register-panel,
    body:not(.body-home):not(.body-login) .chart-panel,
    body:not(.body-home):not(.body-login) .report-panel,
    body:not(.body-home):not(.body-login) .filters-panel,
    body:not(.body-home):not(.body-login) .control-panel,
    body:not(.body-home):not(.body-login) .schedule-panel,
    body:not(.body-home):not(.body-login) .justification-panel,
    body:not(.body-home):not(.body-login) .course-picker,
    body:not(.body-home):not(.body-login) .grade-book,
    body:not(.body-home):not(.body-login) .attendance-book,
    body:not(.body-home):not(.body-login) .settings-card,
    body:not(.body-home):not(.body-login) .section-manual,
    body:not(.body-home):not(.body-login) .section-masiva,
    body:not(.body-home):not(.body-login) .preview-section {
        margin-bottom: 12px !important;
        padding: 12px !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(39, 77, 138, 0.07) !important;
    }

    body:not(.body-home):not(.body-login) .panel-header,
    body:not(.body-home):not(.body-login) .panel-heading,
    body:not(.body-home):not(.body-login) .book-header,
    body:not(.body-home):not(.body-login) .attendance-header,
    body:not(.body-home):not(.body-login) .preview-header,
    body:not(.body-home):not(.body-login) .area-heading {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 9px !important;
        margin-bottom: 10px !important;
        padding-bottom: 10px !important;
    }

    body:not(.body-home):not(.body-login) .panel-heading h2,
    body:not(.body-home):not(.body-login) .panel-header h2,
    body:not(.body-home):not(.body-login) .book-title h2,
    body:not(.body-home):not(.body-login) .area-heading h2,
    body:not(.body-home):not(.body-login) .empty-state h2,
    body:not(.body-home):not(.body-login) .course-picker h2 {
        font-size: 20px !important;
        line-height: 1.14 !important;
    }

    body:not(.body-home):not(.body-login) .workspace-grid,
    body:not(.body-home):not(.body-login) .container-alumnos,
    body:not(.body-home):not(.body-login) .filters-panel,
    body:not(.body-home):not(.body-login) .control-panel,
    body:not(.body-home):not(.body-login) .course-picker,
    body:not(.body-home):not(.body-login) .filters,
    body:not(.body-home):not(.body-login) .filters-grid,
    body:not(.body-home):not(.body-login) .form-grid,
    body:not(.body-home):not(.body-login) .form-row,
    body:not(.body-home):not(.body-login) .controls-grid,
    body:not(.body-home):not(.body-login) .picker-grid,
    body:not(.body-home):not(.body-login) .justification-selectors,
    body:not(.body-home):not(.body-login) .justifier-grid,
    body:not(.body-home):not(.body-login) .upload-grid,
    body:not(.body-home):not(.body-login) .settings-grid,
    body:not(.body-home):not(.body-login) .bulk-actions {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    body:not(.body-home):not(.body-login) label,
    body:not(.body-home):not(.body-login) .form-group {
        gap: 5px !important;
        font-size: 12px !important;
    }

    body:not(.body-home):not(.body-login) input,
    body:not(.body-home):not(.body-login) select,
    body:not(.body-home):not(.body-login) textarea,
    body:not(.body-home):not(.body-login) .custom-student-button,
    body:not(.body-home):not(.body-login) .credential-display,
    body:not(.body-home):not(.body-login) .selected-file,
    body:not(.body-home):not(.body-login) .selected-file-preview {
        min-height: 46px !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        line-height: 1.25 !important;
    }

    body:not(.body-home):not(.body-login) textarea {
        min-height: 92px !important;
    }

    body:not(.body-home):not(.body-login) .form-actions,
    body:not(.body-home):not(.body-login) .bulk-actions,
    body:not(.body-home):not(.body-login) .data-actions,
    body:not(.body-home):not(.body-login) .lock-actions,
    body:not(.body-home):not(.body-login) .preview-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    body:not(.body-home):not(.body-login) .form-actions a,
    body:not(.body-home):not(.body-login) .form-actions button,
    body:not(.body-home):not(.body-login) .bulk-actions a,
    body:not(.body-home):not(.body-login) .bulk-actions button,
    body:not(.body-home):not(.body-login) .data-actions a,
    body:not(.body-home):not(.body-login) .data-actions button,
    body:not(.body-home):not(.body-login) .lock-actions a,
    body:not(.body-home):not(.body-login) .lock-actions button,
    body:not(.body-home):not(.body-login) .preview-actions a,
    body:not(.body-home):not(.body-login) .preview-actions button {
        width: 100% !important;
        min-height: 44px !important;
        justify-content: center !important;
        font-size: 14px !important;
    }

    body:not(.body-home):not(.body-login) .topbar-actions a,
    body:not(.body-home):not(.body-login) .topbar-actions button {
        width: auto !important;
        min-height: 34px !important;
        font-size: 12px !important;
    }

    body:not(.body-home):not(.body-login) .settings-nav {
        position: sticky !important;
        top: 58px !important;
        z-index: 20;
        display: flex !important;
        gap: 6px !important;
        width: calc(100% + 4px) !important;
        margin: 0 -2px 12px !important;
        padding: 5px !important;
        overflow-x: auto;
        border: 1px solid rgba(39, 77, 138, 0.1);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 8px 18px rgba(39, 77, 138, 0.08);
        backdrop-filter: blur(14px);
        scrollbar-width: none;
    }

    body:not(.body-home):not(.body-login) .settings-nav::-webkit-scrollbar {
        display: none;
    }

    body:not(.body-home):not(.body-login) .settings-nav button,
    body:not(.body-home):not(.body-login) .settings-nav a {
        flex: 0 0 auto;
        width: auto !important;
        min-height: 36px !important;
        padding: 0 12px !important;
        border-radius: 8px !important;
        white-space: nowrap;
    }

    body:not(.body-home):not(.body-login) .dashboard-card,
    body:not(.body-home):not(.body-login) .role-card,
    body:not(.body-home):not(.body-login) .permission-card,
    body:not(.body-home):not(.body-login) .course-students-card,
    body:not(.body-home):not(.body-login) .list-card,
    body:not(.body-home):not(.body-login) .card-upload,
    body:not(.body-home):not(.body-login) .info-box {
        border-radius: 8px !important;
        box-shadow: 0 8px 18px rgba(39, 77, 138, 0.07) !important;
    }

    body:not(.body-home):not(.body-login) .table-wrapper,
    body:not(.body-home):not(.body-login) .table-zone,
    body:not(.body-home):not(.body-login) .records-list,
    body:not(.body-home):not(.body-login) .list-wrapper {
        border-radius: 8px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    body:not(.body-home):not(.body-login) .toast,
    body:not(.body-home):not(.body-login) .access-toast {
        right: 9px !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        left: 9px !important;
        max-width: none !important;
        border-radius: 8px !important;
    }

    body:not(.body-home):not(.body-login) table th,
    body:not(.body-home):not(.body-login) table td {
        vertical-align: middle !important;
    }
}

@media screen and (max-width: 380px) {
    body:not(.body-home):not(.body-login) .brand span {
        max-width: 145px;
    }

    body:not(.body-home):not(.body-login) .topbar-actions {
        max-width: 44vw;
    }

    body:not(.body-home):not(.body-login) .hero-panel h1,
    body:not(.body-home):not(.body-login) .hero-copy h1 {
        font-size: 23px !important;
    }

    body:not(.body-home):not(.body-login) .quick-summary,
    body:not(.body-home):not(.body-login) .hero-summary,
    body:not(.body-home):not(.body-login) .summary-grid,
    body:not(.body-home):not(.body-login) .metric-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   ENCABEZADOS COMPACTOS TIPO HOME
   Unifica los headers de todos los modulos sin tocar cada HTML.
   ======================================== */
@media screen {
    html body:not(.body-login) header.page-header,
    html body:not(.body-login) main.main-content,
    html body:not(.body-login) .footer-content {
        width: min(1240px, calc(100% - 32px)) !important;
        margin-inline: auto !important;
    }

    html body:not(.body-login) header.page-header .topbar {
        min-height: 64px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 24px !important;
        padding: 8px 0 !important;
    }

    html body:not(.body-login) header.page-header .brand {
        display: inline-flex !important;
        align-items: center !important;
        gap: 10px !important;
        color: #0b2442 !important;
        text-decoration: none !important;
        font-size: 14px !important;
        font-weight: 800 !important;
    }

    html body:not(.body-login) header.page-header .brand img {
        width: 42px !important;
        height: 42px !important;
        object-fit: contain !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 12px !important;
    }

    html body:not(.body-login) header.page-header .hero-panel {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(300px, 360px) !important;
        gap: 18px !important;
        align-items: stretch !important;
        min-height: 168px !important;
        margin: 4px 0 16px !important;
        padding: 20px 22px !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, #17304a 0%, #27569a 58%, #4d8ccf 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 14px 30px rgba(39, 77, 138, 0.14) !important;
    }

    html body:not(.body-login) header.page-header .hero-panel:not(:has(.quick-summary)):not(:has(.hero-summary)):not(:has(.summary-grid)) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    html body:not(.body-login) header.page-header .hero-copy {
        display: grid !important;
        align-content: center !important;
        gap: 8px !important;
    }

    html body:not(.body-login) header.page-header .eyebrow {
        margin: 0 !important;
        color: inherit !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        letter-spacing: 0.12em !important;
        opacity: 0.76 !important;
        text-transform: uppercase !important;
    }

    html body:not(.body-login) header.page-header .hero-panel h1,
    html body:not(.body-login) header.page-header .hero-copy h1 {
        margin: 0 !important;
        color: #ffffff !important;
        font-size: clamp(28px, 3.5vw, 38px) !important;
        line-height: 1.04 !important;
        font-weight: 900 !important;
    }

    html body:not(.body-login) header.page-header .hero-panel p,
    html body:not(.body-login) header.page-header .hero-description,
    html body:not(.body-login) header.page-header .hero-copy p:last-child {
        max-width: 690px !important;
        margin: 0 !important;
        color: rgba(255, 255, 255, 0.92) !important;
        font-size: 15px !important;
        line-height: 1.45 !important;
    }

    html body:not(.body-login) header.page-header .quick-summary,
    html body:not(.body-login) header.page-header .hero-summary,
    html body:not(.body-login) header.page-header .summary-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)) !important;
        gap: 8px !important;
        align-content: center !important;
    }

    html body:not(.body-login) header.page-header .quick-summary div,
    html body:not(.body-login) header.page-header .hero-summary div,
    html body:not(.body-login) header.page-header .summary-grid div {
        display: grid !important;
        gap: 2px !important;
        min-height: 74px !important;
        align-content: center !important;
        padding: 10px 14px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.16) !important;
        color: #ffffff !important;
        backdrop-filter: blur(4px);
    }

    html body:not(.body-login) header.page-header .quick-summary strong,
    html body:not(.body-login) header.page-header .hero-summary strong,
    html body:not(.body-login) header.page-header .summary-grid strong {
        color: #ffffff !important;
        font-size: 23px !important;
        line-height: 1 !important;
    }

    html body:not(.body-login) header.page-header .quick-summary span,
    html body:not(.body-login) header.page-header .hero-summary span,
    html body:not(.body-login) header.page-header .summary-grid span {
        color: rgba(255, 255, 255, 0.8) !important;
        font-size: 12px !important;
        font-weight: 700 !important;
    }
}

@media screen and (max-width: 980px) {
    html body:not(.body-login) header.page-header .hero-panel {
        grid-template-columns: 1fr !important;
    }
}

@media screen and (max-width: 680px) {
    html body:not(.body-login) header.page-header,
    html body:not(.body-login) main.main-content,
    html body:not(.body-login) .footer-content {
        width: min(100% - 18px, 1240px) !important;
    }

    html body:not(.body-login) header.page-header .topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 30 !important;
        min-height: 58px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 10px !important;
        margin-inline: -9px !important;
        padding: max(8px, env(safe-area-inset-top)) 9px 8px !important;
        background: rgba(247, 251, 255, 0.9) !important;
        border-bottom: 1px solid rgba(39, 77, 138, 0.08) !important;
        backdrop-filter: blur(14px);
    }

    html body:not(.body-login) header.page-header .brand {
        min-width: 0 !important;
        gap: 8px !important;
    }

    html body:not(.body-login) header.page-header .brand img {
        width: 34px !important;
        height: 34px !important;
    }

    html body:not(.body-login) header.page-header .brand span {
        max-width: 185px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 13px !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions {
        width: auto !important;
        max-width: 48vw !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 8px !important;
        overflow-x: auto !important;
        overscroll-behavior-x: contain !important;
        scrollbar-width: none !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions::-webkit-scrollbar {
        display: none !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions a,
    html body:not(.body-login) header.page-header .topbar-actions button,
    html body:not(.body-login) header.page-header .btn-logout {
        width: auto !important;
        min-height: 34px !important;
        flex: 0 0 auto !important;
        padding: 0 11px !important;
        border-radius: 8px !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    html body:not(.body-login) header.page-header .user-info {
        display: none !important;
    }

    html body:not(.body-login) header.page-header .hero-panel {
        min-height: auto !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin: 10px 0 12px !important;
        padding: 15px !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 24px rgba(39, 77, 138, 0.13) !important;
    }

    html body:not(.body-login) header.page-header .hero-copy {
        gap: 6px !important;
    }

    html body:not(.body-login) header.page-header .eyebrow {
        font-size: 11px !important;
        letter-spacing: 0.1em !important;
    }

    html body:not(.body-login) header.page-header .hero-panel h1,
    html body:not(.body-login) header.page-header .hero-copy h1 {
        font-size: 25px !important;
        line-height: 1.08 !important;
    }

    html body:not(.body-login) header.page-header .hero-panel p,
    html body:not(.body-login) header.page-header .hero-description {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    html body:not(.body-login) header.page-header .quick-summary,
    html body:not(.body-login) header.page-header .hero-summary,
    html body:not(.body-login) header.page-header .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)) !important;
        gap: 7px !important;
    }

    html body:not(.body-login) header.page-header .quick-summary div,
    html body:not(.body-login) header.page-header .hero-summary div,
    html body:not(.body-login) header.page-header .summary-grid div {
        min-height: 54px !important;
        justify-items: center !important;
        padding: 8px 6px !important;
        text-align: center !important;
    }

    html body:not(.body-login) header.page-header .quick-summary strong,
    html body:not(.body-login) header.page-header .hero-summary strong,
    html body:not(.body-login) header.page-header .summary-grid strong {
        font-size: 18px !important;
    }

    html body:not(.body-login) header.page-header .quick-summary span,
    html body:not(.body-login) header.page-header .hero-summary span,
    html body:not(.body-login) header.page-header .summary-grid span {
        font-size: 10px !important;
    }
}

/* ========================================
   CONTROL DE ACCESO
   ======================================== */
.access-disabled {
    cursor: not-allowed !important;
    opacity: 0.52 !important;
    pointer-events: none;
}

[hidden],
.access-hidden {
    display: none !important;
}

.dashboard-card.access-card-locked {
    position: relative;
    border-color: rgba(185, 28, 28, 0.22) !important;
    background: #fff8f8 !important;
    filter: grayscale(0.1);
    cursor: not-allowed;
}

.dashboard-card.access-card-locked > * {
    opacity: 0.62;
}

.dashboard-card.access-card-locked::after,
.dashboard-card.access-card-readonly::after {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.dashboard-card.access-card-locked::after {
    content: "En mantencion";
    background: #fee2e2;
    color: #991b1b;
}

.dashboard-card.access-card-readonly::after {
    content: "Solo ver";
    background: #e7f4ff;
    color: #064a88;
}

.access-readonly input:not([type="search"]):not([type="hidden"]),
.access-readonly textarea,
.access-readonly .access-disabled {
    background: #f4f7fb !important;
    color: #667890 !important;
}

.access-lock-panel {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    padding: 34px 20px;
    border: 1px solid rgba(39, 77, 138, 0.1);
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 8px 22px rgba(39, 77, 138, 0.07);
}

.access-lock-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 28px;
    font-weight: 900;
}

.access-lock-panel h2 {
    margin: 0;
    color: #17304a;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 900;
}

.access-lock-panel p {
    max-width: 460px;
    margin: 0;
    color: #667890;
    font-size: 14px;
    line-height: 1.5;
}

.access-lock-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 8px;
    background: #e7f4ff;
    color: #064a88;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.access-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: none;
    max-width: calc(100vw - 48px);
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
    background: #ffffff;
    color: #991b1b;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(39, 77, 138, 0.16);
}

.access-toast.show {
    display: block;
}

.access-toast.session-timeout-warning {
    border-left-color: #f59e0b;
    color: #92400e;
}

/* ========================================
   ADAPTACION FLUIDA PARA NOTEBOOK, TABLET Y CELULAR
   ======================================== */
@media screen and (max-width: 1180px) {
    html body:not(.body-login) .page-header,
    html body:not(.body-login) .main-content,
    html body:not(.body-login) .footer-content {
        width: min(100% - 28px, 1120px) !important;
    }

    html body:not(.body-login) .hero-panel {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    html body:not(.body-login) .hero-panel h1,
    html body:not(.body-login) .hero-copy h1 {
        font-size: clamp(25px, 3vw, 34px) !important;
    }

    html body:not(.body-login) .workspace-grid,
    html body:not(.body-login) .container-alumnos,
    html body:not(.body-login) .report-layout,
    html body:not(.body-login) .settings-layout,
    html body:not(.body-login) .users-layout,
    html body:not(.body-login) .teachers-layout,
    html body:not(.body-login) .attendance-layout,
    html body:not(.body-login) .schedule-layout {
        grid-template-columns: 1fr !important;
    }

    html body:not(.body-login) .dashboard-grid,
    html body:not(.body-login) .area-grid,
    html body:not(.body-login) .metric-grid {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
    }
}

@media screen and (max-width: 900px) {
    html body:not(.body-login) .topbar {
        align-items: start !important;
        flex-wrap: wrap !important;
    }

    html body:not(.body-login) .topbar-actions {
        max-width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 2px !important;
    }

    html body:not(.body-login) .form-grid,
    html body:not(.body-login) .filters-grid,
    html body:not(.body-login) .controls-grid,
    html body:not(.body-login) .picker-grid,
    html body:not(.body-login) .upload-grid,
    html body:not(.body-login) .settings-grid,
    html body:not(.body-login) .justifier-grid,
    html body:not(.body-login) .justification-selectors {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    }

    html body:not(.body-login) .form-actions,
    html body:not(.body-login) .preview-actions,
    html body:not(.body-login) .panel-actions,
    html body:not(.body-login) .report-actions {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
}

@media screen and (max-width: 680px) {
    html body:not(.body-login) {
        line-height: 1.45;
    }

    html body:not(.body-login) .page-header,
    html body:not(.body-login) .main-content,
    html body:not(.body-login) .footer-content {
        width: min(100% - 18px, 1240px) !important;
    }

    html body:not(.body-login) .dashboard-grid,
    html body:not(.body-login) .area-grid,
    html body:not(.body-login) .metric-grid,
    html body:not(.body-login) .quick-summary,
    html body:not(.body-login) .summary-grid,
    html body:not(.body-login) .hero-summary,
    html body:not(.body-login) .form-grid,
    html body:not(.body-login) .filters-grid,
    html body:not(.body-login) .controls-grid,
    html body:not(.body-login) .picker-grid,
    html body:not(.body-login) .upload-grid,
    html body:not(.body-login) .settings-grid,
    html body:not(.body-login) .student-summary,
    html body:not(.body-login) .signature-grid {
        grid-template-columns: 1fr !important;
    }

    html body:not(.body-login) .topbar-actions a,
    html body:not(.body-login) .topbar-actions button,
    html body:not(.body-login) .btn-primary,
    html body:not(.body-login) .btn-secondary,
    html body:not(.body-login) .btn-warning,
    html body:not(.body-login) .btn-submit,
    html body:not(.body-login) .btn-upload,
    html body:not(.body-login) .download-button {
        min-height: 38px !important;
        white-space: normal !important;
    }

    html body:not(.body-login) input,
    html body:not(.body-login) select,
    html body:not(.body-login) textarea {
        width: 100% !important;
        font-size: 16px !important;
    }

    html body:not(.body-login) table {
        min-width: 680px;
    }
}

@media screen and (max-width: 430px) {
    html body:not(.body-login) .page-header,
    html body:not(.body-login) .main-content,
    html body:not(.body-login) .footer-content {
        width: min(100% - 14px, 1240px) !important;
    }

    html body:not(.body-login) .topbar {
        margin-inline: -7px !important;
    }

    html body:not(.body-login) .hero-panel,
    html body:not(.body-login) .area-section,
    html body:not(.body-login) .database-panel,
    html body:not(.body-login) .report-controls,
    html body:not(.body-login) .panel,
    html body:not(.body-login) .form-panel,
    html body:not(.body-login) .list-panel,
    html body:not(.body-login) .report-panel,
    html body:not(.body-login) .filters-panel,
    html body:not(.body-login) .control-panel,
    html body:not(.body-login) .schedule-panel,
    html body:not(.body-login) .course-picker,
    html body:not(.body-login) .grade-book,
    html body:not(.body-login) .attendance-book,
    html body:not(.body-login) .settings-card {
        padding: 12px !important;
    }

    html body:not(.body-login) .hero-panel h1,
    html body:not(.body-login) .hero-copy h1 {
        font-size: 23px !important;
    }

    html body:not(.body-login) .section-header h2,
    html body:not(.body-login) .panel-heading h2,
    html body:not(.body-login) .panel-header h2,
    html body:not(.body-login) .area-heading h2 {
        font-size: 19px !important;
    }
}

@media screen and (min-width: 901px) and (max-height: 780px) {
    html body:not(.body-login) .topbar {
        min-height: 52px !important;
    }

    html body:not(.body-login) .hero-panel {
        margin-block: 0 10px !important;
        padding: 13px 16px !important;
    }

    html body:not(.body-login) .area-section,
    html body:not(.body-login) .database-panel,
    html body:not(.body-login) .report-controls,
    html body:not(.body-login) .panel,
    html body:not(.body-login) .form-panel,
    html body:not(.body-login) .list-panel,
    html body:not(.body-login) .report-panel,
    html body:not(.body-login) .filters-panel,
    html body:not(.body-login) .control-panel,
    html body:not(.body-login) .schedule-panel,
    html body:not(.body-login) .course-picker,
    html body:not(.body-login) .grade-book,
    html body:not(.body-login) .attendance-book,
    html body:not(.body-login) .settings-card {
        padding: 13px !important;
        margin-bottom: 10px !important;
    }
}

/* ========================================
   CAPA FINAL MOBILE/IPHONE
   ======================================== */
@media screen and (max-width: 520px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    html body:not(.body-login) .page-header,
    html body:not(.body-login) .main-content,
    html body:not(.body-login) .footer-content {
        width: calc(100% - 14px) !important;
        max-width: calc(100% - 14px) !important;
        margin-inline: auto !important;
    }

    html body:not(.body-login) .topbar {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin-inline: 0 !important;
        padding-block: 10px !important;
    }

    html body:not(.body-login) .brand {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    html body:not(.body-login) .brand span {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.2 !important;
    }

    html body:not(.body-login) .topbar-actions {
        width: 100% !important;
        max-width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    html body:not(.body-login) .topbar-actions a,
    html body:not(.body-login) .topbar-actions button,
    html body:not(.body-login) .topbar-actions .user-info {
        width: 100% !important;
        min-width: 0 !important;
        justify-content: center !important;
        text-align: center !important;
    }

    html body:not(.body-login) .hero-panel,
    html body:not(.body-login) .workspace-grid,
    html body:not(.body-login) .dashboard-grid,
    html body:not(.body-login) .area-grid,
    html body:not(.body-login) .featured-grid,
    html body:not(.body-login) .support-grid,
    html body:not(.body-login) .summary-grid,
    html body:not(.body-login) .quick-summary,
    html body:not(.body-login) .hero-summary,
    html body:not(.body-login) .metric-grid,
    html body:not(.body-login) .form-grid,
    html body:not(.body-login) .filters-grid,
    html body:not(.body-login) .controls-grid,
    html body:not(.body-login) .picker-grid,
    html body:not(.body-login) .report-grid,
    html body:not(.body-login) .pdf-report-grid,
    html body:not(.body-login) .upload-grid,
    html body:not(.body-login) .settings-grid,
    html body:not(.body-login) .justifier-grid,
    html body:not(.body-login) .justification-selectors,
    html body:not(.body-login) .signature-grid,
    html body:not(.body-login) .report-bottom-grid {
        grid-template-columns: 1fr !important;
    }

    html body:not(.body-login) .hero-panel,
    html body:not(.body-login) .area-section,
    html body:not(.body-login) .panel,
    html body:not(.body-login) .report-controls,
    html body:not(.body-login) .database-panel,
    html body:not(.body-login) .form-panel,
    html body:not(.body-login) .list-panel,
    html body:not(.body-login) .info-panel,
    html body:not(.body-login) .import-panel,
    html body:not(.body-login) .register-panel,
    html body:not(.body-login) .chart-panel,
    html body:not(.body-login) .filters-panel,
    html body:not(.body-login) .control-panel,
    html body:not(.body-login) .schedule-panel,
    html body:not(.body-login) .justification-panel,
    html body:not(.body-login) .course-picker,
    html body:not(.body-login) .grade-book,
    html body:not(.body-login) .attendance-book,
    html body:not(.body-login) .settings-card,
    html body:not(.body-login) .empty-state {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 12px !important;
        overflow-wrap: anywhere;
    }

    html body:not(.body-login) .dashboard-card,
    html body:not(.body-login) .featured-card,
    html body:not(.body-login) .metric-card,
    html body:not(.body-login) .role-card,
    html body:not(.body-login) .permission-card,
    html body:not(.body-login) .course-students-card,
    html body:not(.body-login) .status-card,
    html body:not(.body-login) .list-card,
    html body:not(.body-login) .card-upload,
    html body:not(.body-login) .info-box {
        width: 100% !important;
        min-width: 0 !important;
        min-height: auto !important;
    }

    html body:not(.body-login) input,
    html body:not(.body-login) select,
    html body:not(.body-login) textarea,
    html body:not(.body-login) button {
        max-width: 100% !important;
    }

    html body:not(.body-login) .table-wrapper,
    html body:not(.body-login) .table-zone,
    html body:not(.body-login) .records-list,
    html body:not(.body-login) .list-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Encabezado fijo global y acceso a Sistema de matriculas en todos los modulos. */
html body:not(.body-login) {
    padding-top: 78px !important;
}

html body:not(.body-login) header.page-header {
    position: relative !important;
    z-index: 2147483000 !important;
}

html body:not(.body-login) header.page-header .topbar {
    position: fixed !important;
    top: 0 !important;
    left: 50% !important;
    right: auto !important;
    z-index: 2147483000 !important;
    width: min(1240px, calc(100% - 32px)) !important;
    max-width: calc(100% - 32px) !important;
    min-height: 64px !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    transform: translateX(-50%) !important;
    background: rgba(238, 243, 249, 0.96) !important;
    border-bottom: 1px solid rgba(39, 77, 138, 0.08) !important;
    box-shadow: 0 10px 28px rgba(39, 77, 138, 0.08) !important;
    backdrop-filter: blur(14px) !important;
}

html body:not(.body-login) header.page-header .topbar,
html body:not(.body-login) header.page-header .topbar * {
    z-index: auto;
}

html body:not(.body-login) header.page-header .topbar {
    z-index: 2147483000 !important;
}

html body:not(.body-login) header.page-header .topbar-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    min-width: 0 !important;
}

html body:not(.body-login) header.page-header .matricula-launch-button {
    position: relative !important;
    isolation: isolate !important;
    flex: 0 0 auto !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 6px 14px 6px 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.42) !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #0f3c72 0%, #2f74bd 58%, #1aa39a 100%) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    box-shadow: 0 8px 20px rgba(15, 60, 114, 0.18) !important;
    overflow: hidden !important;
}

html body:not(.body-login) header.page-header .matricula-launch-button::before {
    content: "";
    position: absolute;
    inset: -60% auto -60% -35%;
    z-index: -1;
    width: 34%;
    background: rgba(255, 255, 255, 0.32);
    transform: rotate(18deg);
}

html body:not(.body-login) header.page-header .matricula-launch-icon {
    position: relative !important;
    width: 32px !important;
    height: 32px !important;
    display: grid !important;
    place-items: center !important;
    flex: 0 0 32px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.22) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 8px 18px rgba(0, 0, 0, 0.12) !important;
}

html body:not(.body-login) header.page-header .matricula-launch-icon::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #9ff7e8;
    box-shadow: 0 0 12px rgba(159, 247, 232, 0.95);
}

html body:not(.body-login) header.page-header .matricula-launch-icon svg {
    width: 20px !important;
    height: 20px !important;
    fill: none !important;
    stroke: #ffffff !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

html body:not(.body-login) header.page-header .matricula-launch-button span:last-child {
    display: grid !important;
    gap: 1px !important;
    line-height: 1.1 !important;
}

html body:not(.body-login) header.page-header .matricula-launch-button strong {
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
}

html body:not(.body-login) header.page-header .matricula-launch-button small {
    color: rgba(255, 255, 255, 0.82) !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

@media screen and (max-width: 680px) {
    html body:not(.body-login) {
        padding-top: 126px !important;
    }

    html body:not(.body-login) header.page-header .topbar {
        width: calc(100% - 18px) !important;
        max-width: calc(100% - 18px) !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        align-items: stretch !important;
        padding: max(8px, env(safe-area-inset-top)) 0 8px !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions {
        width: 100% !important;
        max-width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr auto auto !important;
        gap: 8px !important;
        overflow: visible !important;
    }

    html body:not(.body-login) header.page-header .matricula-launch-button {
        min-width: 0 !important;
        min-height: 38px !important;
        gap: 8px !important;
        padding: 5px 10px 5px 6px !important;
    }

    html body:not(.body-login) header.page-header .matricula-launch-icon {
        width: 28px !important;
        height: 28px !important;
        flex-basis: 28px !important;
    }

    html body:not(.body-login) header.page-header .matricula-launch-button small {
        display: none !important;
    }
}

@media screen and (max-width: 390px) {
    html body:not(.body-login) header.page-header .topbar-actions {
        grid-template-columns: 1fr auto !important;
    }

    html body:not(.body-login) header.page-header .matricula-launch-button span:last-child {
        display: none !important;
    }
}
/* Mobile application shell. Desktop styles remain unchanged. */
@media screen and (max-width: 680px) {
    html {
        background: #f2f2f7;
        -webkit-tap-highlight-color: transparent;
    }

    html body:not(.body-login) {
        min-height: 100dvh;
        padding-top: calc(70px + env(safe-area-inset-top)) !important;
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        color: #1c1c1e;
        background: #f2f2f7 !important;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    }

    html body:not(.body-login)::before,
    html body:not(.body-login)::after {
        display: none !important;
    }

    html body:not(.body-login) .page-header,
    html body:not(.body-login) .main-content,
    html body:not(.body-login) .footer-content {
        width: 100% !important;
        max-width: none !important;
        padding-inline: 12px !important;
    }

    html body:not(.body-login) header.page-header .topbar {
        position: fixed !important;
        inset: 0 0 auto !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        min-height: calc(60px + env(safe-area-inset-top)) !important;
        padding: max(8px, env(safe-area-inset-top)) 12px 8px !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(60, 60, 67, .18) !important;
        border-radius: 0 !important;
        background: rgba(249, 249, 249, .88) !important;
        box-shadow: none !important;
        backdrop-filter: saturate(180%) blur(20px) !important;
        transform: none !important;
    }

    html body:not(.body-login) header.page-header .brand {
        min-width: 0 !important;
        gap: 8px !important;
    }

    html body:not(.body-login) header.page-header .brand img {
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
    }

    html body:not(.body-login) header.page-header .brand span {
        max-width: 145px !important;
        color: #1c1c1e !important;
        font-size: 13px !important;
        line-height: 1.12 !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions {
        display: flex !important;
        width: auto !important;
        max-width: 48vw !important;
        gap: 7px !important;
        overflow-x: auto !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions a,
    html body:not(.body-login) header.page-header .topbar-actions button,
    html body:not(.body-login) header.page-header .topbar-actions .user-info {
        min-height: 36px !important;
        padding: 7px 10px !important;
        border: 0 !important;
        border-radius: 8px !important;
        color: #007aff !important;
        background: rgba(118, 118, 128, .11) !important;
        box-shadow: none !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    html body:not(.body-login) .hero-panel {
        display: block !important;
        margin: 10px 0 14px !important;
        padding: 4px 4px 10px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    html body:not(.body-login) .hero-panel h1,
    html body:not(.body-login) .hero-copy h1 {
        margin: 2px 0 0 !important;
        color: #1c1c1e !important;
        font-size: 28px !important;
        line-height: 1.05 !important;
        font-weight: 800 !important;
    }

    html body:not(.body-login) .hero-description,
    html body:not(.body-login) .hero-copy > p:last-child {
        display: none !important;
    }

    html body:not(.body-login) .quick-summary,
    html body:not(.body-login) .hero-summary,
    html body:not(.body-login) .summary-grid,
    html body:not(.body-login) .metric-grid {
        display: flex !important;
        gap: 8px !important;
        margin-top: 12px !important;
        overflow-x: auto !important;
        scroll-snap-type: x proximity;
    }

    html body:not(.body-login) .quick-summary > *,
    html body:not(.body-login) .hero-summary > *,
    html body:not(.body-login) .summary-grid > *,
    html body:not(.body-login) .metric-grid > * {
        flex: 0 0 112px !important;
        min-height: 68px !important;
        padding: 10px !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: #fff !important;
        box-shadow: 0 .5px 0 rgba(60, 60, 67, .18) !important;
        scroll-snap-align: start;
    }

    html body:not(.body-login) .main-content {
        display: grid !important;
        gap: 16px !important;
        padding-top: 0 !important;
    }

    html body:not(.body-login) .area-section,
    html body:not(.body-login) .panel,
    html body:not(.body-login) .form-panel,
    html body:not(.body-login) .list-panel,
    html body:not(.body-login) .report-panel,
    html body:not(.body-login) .filters-panel,
    html body:not(.body-login) .control-panel,
    html body:not(.body-login) .schedule-panel,
    html body:not(.body-login) .course-picker,
    html body:not(.body-login) .grade-book,
    html body:not(.body-login) .attendance-book,
    html body:not(.body-login) .settings-card,
    html body:not(.body-login) .database-panel,
    html body:not(.body-login) .report-controls,
    html body:not(.body-login) .section-manual,
    html body:not(.body-login) .section-masiva,
    html body:not(.body-login) .preview-section {
        padding: 14px !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: #fff !important;
        box-shadow: 0 .5px 0 rgba(60, 60, 67, .18) !important;
    }

    html body.body-home .area-section {
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    html body:not(.body-login) .area-heading,
    html body:not(.body-login) .panel-heading,
    html body:not(.body-login) .panel-header,
    html body:not(.body-login) .book-header,
    html body:not(.body-login) .attendance-header {
        gap: 8px !important;
        margin-bottom: 10px !important;
        padding: 0 2px !important;
    }

    html body:not(.body-login) .area-heading h2,
    html body:not(.body-login) .panel-heading h2,
    html body:not(.body-login) .panel-header h2,
    html body:not(.body-login) .book-title h2 {
        color: #1c1c1e !important;
        font-size: 20px !important;
        line-height: 1.15 !important;
    }

    html body:not(.body-login) .area-heading p:not(.area-label),
    html body:not(.body-login) .area-badge,
    html body:not(.body-login) .card-kicker,
    html body:not(.body-login) .dashboard-card p,
    html body:not(.body-login) .card-link {
        display: none !important;
    }

    html body:not(.body-login) .dashboard-grid,
    html body:not(.body-login) .area-grid,
    html body:not(.body-login) .compact-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 14px 8px !important;
    }

    html body:not(.body-login) .dashboard-card,
    html body:not(.body-login) .featured-card {
        display: grid !important;
        grid-template-columns: 1fr !important;
        justify-items: center !important;
        align-content: start !important;
        min-width: 0 !important;
        min-height: 96px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        color: #1c1c1e !important;
        background: transparent !important;
        box-shadow: none !important;
        text-align: center !important;
    }

    html body:not(.body-login) .dashboard-card .card-icon {
        display: grid !important;
        place-items: center !important;
        width: 58px !important;
        height: 58px !important;
        margin: 0 auto 6px !important;
        border-radius: 8px !important;
        color: #fff !important;
        background: #007aff !important;
        box-shadow: 0 5px 12px rgba(0, 122, 255, .2) !important;
        font-size: 25px !important;
    }

    html body:not(.body-login) .dashboard-card:nth-child(4n + 2) .card-icon { background: #34c759 !important; }
    html body:not(.body-login) .dashboard-card:nth-child(4n + 3) .card-icon { background: #ff9500 !important; }
    html body:not(.body-login) .dashboard-card:nth-child(4n + 4) .card-icon { background: #5856d6 !important; }

    html body:not(.body-login) .dashboard-card h3 {
        width: 100% !important;
        margin: 0 !important;
        color: #1c1c1e !important;
        font-size: 11px !important;
        line-height: 1.18 !important;
        font-weight: 600 !important;
        overflow-wrap: anywhere;
    }

    html body:not(.body-login) input,
    html body:not(.body-login) select,
    html body:not(.body-login) textarea {
        min-height: 44px !important;
        border: 1px solid rgba(60, 60, 67, .18) !important;
        border-radius: 8px !important;
        background: #fff !important;
        font-size: 16px !important;
        box-shadow: none !important;
    }

    html body:not(.body-login) button,
    html body:not(.body-login) .btn-primary,
    html body:not(.body-login) .btn-secondary,
    html body:not(.body-login) .btn-warning,
    html body:not(.body-login) .btn-submit,
    html body:not(.body-login) .btn-upload,
    html body:not(.body-login) .download-button {
        min-height: 44px !important;
        border-radius: 8px !important;
    }

    html body:not(.body-login) .table-wrapper,
    html body:not(.body-login) .table-zone,
    html body:not(.body-login) .records-list,
    html body:not(.body-login) .list-wrapper {
        border-radius: 8px !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    html body:not(.body-login) .footer {
        display: none !important;
    }
}

html body:not(.body-login) header.page-header .app-header-logo,
html body:not(.body-login) nav.topbar .app-header-logo {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    z-index: 2 !important;
    width: clamp(118px, 11vw, 170px) !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 10px !important;
    border: 1px solid rgba(13, 148, 136, 0.14) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.78) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
    pointer-events: none !important;
    transform: translate(-50%, -50%) !important;
}

html body:not(.body-login) header.page-header .app-header-logo img,
html body:not(.body-login) nav.topbar .app-header-logo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 0 !important;
}

html body:not(.body-login) header.page-header .brand .app-logo-mark,
html body:not(.body-login) nav.topbar .brand .app-logo-mark {
    display: none !important;
}

@media (max-width: 900px) {
    html body:not(.body-login) header.page-header .app-header-logo,
    html body:not(.body-login) nav.topbar .app-header-logo {
        width: clamp(96px, 18vw, 132px) !important;
        height: 36px !important;
        padding-inline: 7px !important;
    }
}

@media (max-width: 680px) {
    html body:not(.body-login) header.page-header .app-header-logo,
    html body:not(.body-login) nav.topbar .app-header-logo {
        display: none !important;
    }
}

.global-mobile-menu-button {
    display: none;
}

@media screen and (max-width: 680px) {
    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready {
        grid-template-columns: minmax(0, 1fr) 42px !important;
        align-items: center !important;
        gap: 10px !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .brand {
        grid-column: 1 !important;
        min-width: 0 !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .brand span {
        max-width: min(58vw, 230px) !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .global-mobile-menu-button {
        grid-column: 2 !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        display: grid !important;
        place-content: center !important;
        gap: 4px !important;
        border: 1px solid rgba(0, 122, 255, 0.1) !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.92) !important;
        color: #0b63b6 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
        cursor: pointer !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .global-mobile-menu-button span {
        width: 18px !important;
        height: 2px !important;
        display: block !important;
        border-radius: 999px !important;
        background: currentColor !important;
        transition: transform 0.18s ease, opacity 0.18s ease !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .global-mobile-menu-button[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(6px) rotate(45deg) !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .global-mobile-menu-button[aria-expanded="true"] span:nth-child(2) {
        opacity: 0 !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .global-mobile-menu-button[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg) !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions {
        position: fixed !important;
        top: calc(62px + env(safe-area-inset-top)) !important;
        left: 12px !important;
        right: 12px !important;
        z-index: 2147483600 !important;
        width: auto !important;
        max-width: none !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 10px !important;
        border: 1px solid rgba(60, 60, 67, 0.14) !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        overflow: visible !important;
        transform: translateY(-8px) !important;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready.mobile-menu-open .topbar-actions {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions a,
    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions button,
    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions .user-info,
    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions .btn-logout {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 42px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 8px 12px !important;
        border: 1px solid rgba(60, 60, 67, 0.12) !important;
        border-radius: 8px !important;
        background: #f8f9fb !important;
        color: #17304a !important;
        box-shadow: none !important;
        font-size: 13px !important;
        font-weight: 800 !important;
        line-height: 1.18 !important;
        text-align: center !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .topbar-actions .user-info {
        justify-content: flex-start !important;
        background: #eef6ff !important;
        color: #173f7c !important;
    }
}

@media screen and (max-width: 680px) {
    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 40px !important;
        justify-items: stretch !important;
        align-items: center !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .brand {
        justify-self: start !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready .global-mobile-menu-button {
        grid-column: 2 !important;
        justify-self: end !important;
        align-self: center !important;
        margin-left: auto !important;
        margin-right: 0 !important;
    }
}

/* Encabezado: el usuario activo se adapta y nunca tapa acciones */
html body:not(.body-login) header.page-header .topbar {
    min-width: 0 !important;
}

html body:not(.body-login) header.page-header .topbar .brand {
    min-width: 0 !important;
    flex: 0 1 auto !important;
}

html body:not(.body-login) header.page-header .topbar-actions {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

html body:not(.body-login) header.page-header .topbar-actions .user-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: clamp(140px, 28vw, 360px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

html body:not(.body-login) header.page-header .topbar-actions a,
html body:not(.body-login) header.page-header .topbar-actions button,
html body:not(.body-login) header.page-header .topbar-actions .btn-logout {
    flex: 0 0 auto !important;
}

@media screen and (max-width: 680px) {
    html body:not(.body-login) header.page-header .topbar-actions {
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        overflow: visible !important;
    }

    html body:not(.body-login) header.page-header .topbar-actions .user-info {
        display: inline-flex !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: flex-start !important;
    }
}

@media screen and (max-width: 680px) {
    html body:not(.body-login):not(.body-home) header.page-header .topbar > .topbar-actions {
        position: fixed !important;
        top: calc(62px + env(safe-area-inset-top)) !important;
        left: 12px !important;
        right: 12px !important;
        z-index: 2147483600 !important;
        width: auto !important;
        max-width: none !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 10px !important;
        border: 1px solid rgba(60, 60, 67, 0.14) !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        overflow: hidden !important;
        transform: translateY(-6px) !important;
        transition: none !important;
    }

    html body:not(.body-login):not(.body-home) header.page-header .topbar.global-mobile-menu-ready.mobile-menu-open > .topbar-actions {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        overflow: visible !important;
        transform: translateY(0) !important;
        transition: opacity 0.14s ease, transform 0.14s ease !important;
    }
}

/* Encabezado estable: usuario activo junto al nombre del sistema */
html body:not(.body-login) header.page-header .brand,
html body:not(.body-login) header.topbar .brand {
    min-width: 0 !important;
    max-width: min(46vw, 560px) !important;
    flex: 1 1 360px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow: hidden !important;
}

html body:not(.body-login) [data-system-brand-name="true"] {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

html body:not(.body-login) .active-user-banner {
    position: static !important;
    max-width: clamp(150px, 18vw, 260px) !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    flex: 0 1 auto !important;
    padding: 0 11px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    transform: none !important;
}

html body:not(.body-login) header.page-header .topbar-actions,
html body:not(.body-login) header.topbar .topbar-actions {
    min-width: 0 !important;
    flex: 0 1 auto !important;
}

@media (max-width: 1100px) {
    html body:not(.body-login) header.page-header .brand,
    html body:not(.body-login) header.topbar .brand {
        max-width: min(38vw, 420px) !important;
        flex-basis: 300px !important;
    }

    html body:not(.body-login) .active-user-banner {
        max-width: clamp(130px, 16vw, 210px) !important;
    }
}

@media (max-width: 900px) {
    html body:not(.body-login) header.page-header .brand,
    html body:not(.body-login) header.topbar .brand {
        max-width: min(58vw, 280px) !important;
        flex-basis: auto !important;
    }
}

@media (max-width: 680px) {
    html body:not(.body-login) .active-user-banner {
        display: none !important;
    }
}

.save-feedback-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 24px;
    background: rgba(15, 35, 58, 0.34);
    backdrop-filter: blur(5px) saturate(0.95);
    pointer-events: all;
    touch-action: none;
    cursor: wait;
}

.save-feedback-overlay[hidden] {
    display: none !important;
}

.save-feedback-card {
    width: min(420px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(63, 123, 201, 0.18);
    border-radius: 8px;
    background: #ffffff;
    color: #17304a;
    box-shadow: 0 24px 60px rgba(15, 35, 58, 0.24);
}

.save-feedback-mark {
    width: 58px;
    height: 58px;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef6ff;
    box-shadow: inset 0 0 0 1px rgba(63, 123, 201, 0.12);
}

.save-feedback-mark::before {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #c8dcf5;
    border-top-color: #3f7bc9;
    animation: save-feedback-spin 0.9s linear infinite;
}

.save-feedback-mark span {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #20a095;
    opacity: 0.78;
    animation: save-feedback-pulse 1.2s ease-in-out infinite;
}

.save-feedback-mark span:nth-child(1) {
    top: 12px;
    right: 14px;
}

.save-feedback-mark span:nth-child(2) {
    right: 11px;
    bottom: 16px;
    animation-delay: 0.16s;
}

.save-feedback-mark span:nth-child(3) {
    left: 14px;
    bottom: 14px;
    animation-delay: 0.32s;
}

.save-feedback-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.save-feedback-copy p,
.save-feedback-copy h2,
.save-feedback-copy span {
    margin: 0;
}

.save-feedback-copy p {
    color: #3f7bc9;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.save-feedback-copy h2 {
    color: #17304a;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 800;
}

.save-feedback-copy span {
    color: #52677f;
    font-size: 13px;
    line-height: 1.45;
}

.save-feedback-progress {
    grid-column: 1 / -1;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef7;
}

.save-feedback-progress span {
    display: block;
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #20a095, #3f7bc9, #ff7a5c);
    animation: save-feedback-progress 1.15s ease-in-out infinite;
}

body.student-loading-active,
html.student-loading-active {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

@keyframes save-feedback-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes save-feedback-pulse {
    0%,
    100% {
        transform: scale(0.82);
        opacity: 0.44;
    }
    45% {
        transform: scale(1.18);
        opacity: 0.95;
    }
}

@keyframes save-feedback-progress {
    0% {
        transform: translateX(-105%);
    }
    100% {
        transform: translateX(270%);
    }
}

@media (max-width: 560px) {
    .save-feedback-card {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .save-feedback-mark {
        width: 48px;
        height: 48px;
    }

    .save-feedback-mark::before {
        width: 28px;
        height: 28px;
    }

    .save-feedback-copy h2 {
        font-size: 17px;
    }
}

.home-communications-status {
    margin: 12px 22px 22px;
    padding-top: 12px;
    border-top: 1px solid rgba(17, 45, 78, .1);
}

.home-communications-status h3 {
    margin: 0 0 12px;
    color: #17314d;
    font-size: 15px;
    font-weight: 950;
}

.home-communications-empty {
    padding: 14px;
    border-radius: 12px;
    color: #5d6f84;
    background: #f5f8fb;
    font-size: 13px;
    font-weight: 750;
}

.home-communications-status-list {
    display: block;
}

.home-communications-read-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid rgba(15, 127, 115, .18);
    border-radius: 12px;
    color: #0f625a;
    background: #effbf8;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.home-communications-read-button svg,
.home-communications-status-actions svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-communications-status-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(12, 31, 48, .56);
    backdrop-filter: blur(8px);
}

.home-communications-status-modal[hidden] {
    display: none;
}

.home-communications-status-dialog {
    width: min(920px, 100%);
    max-height: min(760px, calc(100dvh - 44px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(15, 127, 115, .2);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(13, 31, 48, .34);
}

.home-communications-status-dialog > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(17, 45, 78, .1);
}

.home-communications-status-dialog > header span {
    display: block;
    color: #0f7f73;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.home-communications-status-dialog h2 {
    margin: 4px 0 0;
    color: #17314d;
    font-size: 23px;
    line-height: 1.15;
}

.home-communications-status-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-communications-status-actions button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(17, 45, 78, .12);
    border-radius: 11px;
    color: #17314d;
    background: #f7fafc;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.home-communications-status-actions [data-communications-print] {
    color: #ffffff;
    background: linear-gradient(135deg, #0f7f73, #19bba7);
}

.home-communications-status-actions [data-communications-print],
.home-communications-status-actions [data-communications-print] span,
.home-communications-status-actions [data-communications-print] svg {
    color: #ffffff !important;
}

.home-communications-status-actions [data-communications-status-close] {
    width: 38px;
    padding: 0;
}

.home-communications-status-body {
    overflow: auto;
    padding: 18px 22px 22px;
}

.home-communications-opening-notice {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(12, 31, 48, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease;
}

.home-communications-opening-notice.show {
    opacity: 1;
}

.home-communications-opening-notice > div {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid rgba(15, 127, 115, .2);
    border-radius: 16px;
    color: #17314d;
    background: #ffffff;
    box-shadow: 0 22px 60px rgba(13, 31, 48, .28);
}

.home-communications-opening-notice span {
    width: 22px;
    height: 22px;
    border: 3px solid #d8fbf5;
    border-top-color: #0f7f73;
    border-radius: 50%;
    animation: communications-opening-spin .7s linear infinite;
}

.home-communications-opening-notice strong {
    font-size: 14px;
    font-weight: 950;
}

@keyframes communications-opening-spin {
    to {
        transform: rotate(360deg);
    }
}

.home-communications-status-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding: 13px 14px;
    border: 1px solid rgba(17, 45, 78, .1);
    border-radius: 12px;
    background: #f8fbfd;
}

.home-communications-status-card strong,
.home-communications-status-card span,
.home-communications-status-card small,
.home-communications-status-card em {
    display: block;
}

.home-communications-status-card strong {
    color: #122a44;
    font-size: 14px;
    font-weight: 950;
}

.home-communications-status-card span,
.home-communications-status-card small {
    margin-top: 3px;
    color: #52677f;
    font-size: 12px;
    font-weight: 750;
}

.home-communications-status-card em {
    margin-top: 7px;
    color: #0f7f73;
    font-size: 12px;
    font-style: normal;
    font-weight: 850;
}

.home-communications-status-card > b {
    min-width: 58px;
    min-height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #9b3b36;
    background: #ffeceb;
    font-size: 18px;
    font-weight: 950;
    text-align: center;
}

.home-communications-status-card > b.is-read {
    color: #0b6f64;
    background: #ddfbf6;
}

.home-communications-status-card > b small {
    margin: -9px 0 0;
    color: inherit;
    font-size: 10px;
    line-height: 1;
}
/* Bloqueo visual global para descargas y exportaciones. */
.liceo-download-guard {
    position: fixed;
    inset: 0;
    z-index: 2147483645;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(24, 39, 52, .42);
    backdrop-filter: blur(5px);
}

body:not(.liceo-download-active) .liceo-download-guard {
    display: none;
}

.liceo-download-guard-card {
    width: min(360px, calc(100vw - 34px));
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 26px 24px 24px;
    overflow: hidden;
    border: 1px solid rgba(207, 222, 232, .9);
    border-radius: 8px;
    color: #17304a;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 24px 58px rgba(15, 31, 48, .26);
}

.liceo-download-guard-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #d9f7f4;
    border-top-color: #15988e;
    border-radius: 50%;
    animation: liceo-download-spin .72s linear infinite;
}

.liceo-download-guard-card strong,
.liceo-download-guard-card p {
    display: block;
    margin: 0;
}

.liceo-download-guard-card strong {
    font-size: 16px;
    font-weight: 900;
}

.liceo-download-guard-card p {
    margin-top: 8px;
    color: #60758d;
    font-size: 12px;
    font-weight: 800;
}

.liceo-download-guard-card i {
    position: relative;
    display: block;
    height: 5px;
    width: min(210px, 100%);
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eff7;
}

.liceo-download-guard-card i::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, #15988e, #0f579e);
    animation: liceo-download-progress 1.15s ease-in-out infinite;
}

[data-download-guard-active="true"] {
    cursor: wait !important;
    opacity: .72;
}

@keyframes liceo-download-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes liceo-download-progress {
    0% {
        transform: translateX(-110%);
    }

    55% {
        transform: translateX(85%);
    }

    100% {
        transform: translateX(260%);
    }
}
