/* =========================================================
   IEP Fuente del Saber — capa global de interfaz
   Se carga después de Bootstrap y style.css, y antes de los
   <style> propios de cada página (que siempre tienen prioridad).
========================================================= */

:root {
    --app-primary: #1251c5;
    --app-primary-600: #0e43a8;
    --app-primary-700: #0b3585;
    --app-primary-rgb: 18, 81, 197;
    --app-accent: #00b4ee;
    --app-ink: #0f172a;
    --app-text: #1e293b;
    --app-muted: #64748b;
    --app-border: #e2e8f0;
    --app-surface: #ffffff;
    --app-bg: #f4f7fc;
    --app-radius-sm: 10px;
    --app-radius: 16px;
    --app-radius-lg: 24px;
    --app-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --app-shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
    --app-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    --app-shadow-lg: 0 20px 48px rgba(15, 23, 42, .14);
    --app-ease: cubic-bezier(.4, 0, .2, 1);
    --app-spring: cubic-bezier(.34, 1.56, .64, 1);
    --app-nav-h: 72px;

    --bs-primary: #1251c5;
    --bs-primary-rgb: 18, 81, 197;
    --bs-link-color: #1251c5;
    --bs-link-color-rgb: 18, 81, 197;
    --bs-link-hover-color: #0b3585;
    --bs-link-hover-color-rgb: 11, 53, 133;
    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-border-radius: .625rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-color: #e2e8f0;
}

/* ── Base ── */
body {
    font-family: var(--bs-body-font-family);
    background: var(--app-bg);
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main { flex: 1 0 auto; }

::selection { background: rgba(var(--app-primary-rgb), .16); color: var(--app-ink); }

:focus-visible { outline: 3px solid rgba(var(--app-primary-rgb), .35); outline-offset: 2px; }

a { transition: color .2s var(--app-ease); }

h1, h2, h3, h4, h5, h6 { letter-spacing: -.015em; }
.fw-800 { font-weight: 800 !important; }

/* ── Barra de progreso de navegación ── */
.app-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0;
    z-index: 2000;
    background: linear-gradient(90deg, var(--app-accent), #7dd3fc, var(--app-accent));
    box-shadow: 0 0 12px rgba(0, 180, 238, .7);
    opacity: 0;
    transition: width .4s var(--app-ease), opacity .3s;
    pointer-events: none;
}
.app-progress.is-active { opacity: 1; }

/* =========================================================
   NAVBAR
========================================================= */
.app-navbar.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: .7rem 0;
    background: linear-gradient(120deg, #0b3585 0%, #1251c5 55%, #1a6be0 100%) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 6px 24px rgba(11, 53, 133, .18);
    transition: padding .3s var(--app-ease), box-shadow .3s var(--app-ease), background .3s;
}
.app-navbar.navbar.scrolled {
    padding: .4rem 0;
    background: rgba(11, 53, 133, .9) !important;
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    box-shadow: 0 10px 32px rgba(11, 53, 133, .28);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: #fff !important;
    text-decoration: none;
}
.app-brand img {
    height: 44px;
    width: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25));
    transition: transform .5s var(--app-spring), height .3s var(--app-ease);
}
.app-navbar.scrolled .app-brand img { height: 38px; }
.app-brand:hover img { transform: rotate(-8deg) scale(1.06); }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.app-brand-text small {
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .7;
}
.app-brand-text strong { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }

.app-navbar .navbar-nav { gap: .2rem; }

.app-navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    padding: .55rem .9rem !important;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .86) !important;
    transition: background .2s var(--app-ease), color .2s, transform .2s var(--app-ease);
}
.app-navbar .nav-link::after { display: none; }
.app-navbar .nav-link i { font-size: .9em; opacity: .85; }
.app-navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .12);
}
.app-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, .2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.app-navbar .nav-link.dropdown-toggle::after {
    display: inline-block;
    position: static;
    width: 0;
    height: 0;
    margin-left: .35rem;
    vertical-align: .15em;
    background: none;
    border-radius: 0;
    border-top: .32em solid;
    border-right: .32em solid transparent;
    border-left: .32em solid transparent;
    border-bottom: 0;
    opacity: .7;
    transition: transform .25s var(--app-ease);
}
.app-navbar .nav-link.dropdown-toggle.show::after { transform: rotate(180deg); }

.app-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1.15rem;
    border-radius: 999px;
    background: #fff;
    color: var(--app-primary) !important;
    font-weight: 700;
    font-size: .875rem;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    transition: transform .25s var(--app-spring), box-shadow .25s;
}
.app-nav-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .22); }
.app-nav-cta i { transition: transform .25s var(--app-ease); }
.app-nav-cta:hover i { transform: translateX(3px); }

.app-navbar .navbar-toggler {
    border: 0;
    padding: .5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    box-shadow: none !important;
}
.app-burger { display: block; width: 22px; height: 16px; position: relative; }
.app-burger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .3s var(--app-ease), opacity .2s, top .3s var(--app-ease);
}
.app-burger span:nth-child(1) { top: 0; }
.app-burger span:nth-child(2) { top: 7px; }
.app-burger span:nth-child(3) { top: 14px; }
.navbar-toggler[aria-expanded="true"] .app-burger span:nth-child(1) { top: 7px; transform: rotate(45deg); }
.navbar-toggler[aria-expanded="true"] .app-burger span:nth-child(2) { opacity: 0; }
.navbar-toggler[aria-expanded="true"] .app-burger span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

/* Chip de usuario */
.app-user-chip {
    display: flex !important;
    align-items: center;
    gap: .6rem;
    padding: .3rem .8rem .3rem .3rem !important;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.app-user-chip:hover { background: rgba(255, 255, 255, .18) !important; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .85rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent), #6366f1);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
    overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar.lg { width: 48px; height: 48px; font-size: 1.05rem; box-shadow: none; }

.app-user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.app-user-meta .name {
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-user-meta .role { font-size: .68rem; font-weight: 600; color: rgba(255, 255, 255, .7); }

.app-role-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: .3rem;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}

/* Menú desplegable de usuario */
.app-user-menu { min-width: 270px; }
.app-user-menu .menu-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem .8rem 1rem;
    margin-bottom: .4rem;
    border-bottom: 1px solid var(--app-border);
}
.app-user-menu .menu-head .min-w-0 { min-width: 0; }
.app-user-menu .menu-head .name { font-weight: 700; color: var(--app-ink); font-size: .92rem; }
.app-user-menu .menu-head .mail { font-size: .75rem; color: var(--app-muted); word-break: break-all; }

/* Navbar móvil */
@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        margin-top: .8rem;
        padding: .7rem;
        border-radius: 18px;
        background: rgba(255, 255, 255, .08);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
    }
    .app-navbar .nav-link { width: 100%; border-radius: 12px; padding: .75rem 1rem !important; }
    .app-navbar .navbar-nav { align-items: stretch !important; }
    .app-nav-cta { justify-content: center; width: 100%; margin-top: .4rem; }
    .app-user-chip { margin-top: .4rem; }
    .app-navbar .dropdown-menu { box-shadow: none !important; margin-top: .4rem; }
}

/* =========================================================
   COMPONENTES BOOTSTRAP
========================================================= */

/* ── Botones ── */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--app-radius-sm);
    --bs-btn-focus-box-shadow: 0 0 0 .25rem rgba(var(--app-primary-rgb), .2);
    position: relative;
    overflow: hidden;
    letter-spacing: .005em;
    transition: transform .18s var(--app-ease), box-shadow .2s var(--app-ease),
                background-color .2s, border-color .2s, color .2s;
}
.btn:not(.btn-link):not(:disabled):not(.disabled):hover { transform: translateY(-1px); }
.btn:not(.btn-link):not(:disabled):not(.disabled):active { transform: translateY(0) scale(.97); }
.btn-sm { --bs-btn-border-radius: 8px; }
.btn-lg { --bs-btn-border-radius: 14px; }
.btn.rounded-circle, .btn.rounded-pill { --bs-btn-border-radius: 999px; }

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-600);
    --bs-btn-hover-border-color: var(--app-primary-600);
    --bs-btn-active-bg: var(--app-primary-700);
    --bs-btn-active-border-color: var(--app-primary-700);
    --bs-btn-disabled-bg: var(--app-primary);
    --bs-btn-disabled-border-color: var(--app-primary);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0));
    box-shadow: 0 4px 14px rgba(var(--app-primary-rgb), .28);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(var(--app-primary-rgb), .36); }
.btn-success:not(.btn-outline-success) { box-shadow: 0 4px 14px rgba(25, 135, 84, .22); }
.btn-danger { box-shadow: 0 4px 14px rgba(220, 53, 69, .2); }
.btn-warning { box-shadow: 0 4px 14px rgba(255, 193, 7, .25); }

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary);
    --bs-btn-hover-border-color: var(--app-primary);
    --bs-btn-active-bg: var(--app-primary-600);
    --bs-btn-active-border-color: var(--app-primary-600);
}

/* Efecto ripple (lo crea app.js) */
.app-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: currentColor;
    opacity: .22;
    pointer-events: none;
    animation: app-ripple .6s var(--app-ease) forwards;
}
@keyframes app-ripple { to { transform: scale(2.6); opacity: 0; } }

/* Estado de carga al enviar formularios */
.btn.is-loading,
.btn-modern-primary.is-loading {
    pointer-events: none;
    color: transparent !important;
}
.btn.is-loading > *,
.btn-modern-primary.is-loading > * { visibility: hidden; }
.btn.is-loading::after,
.btn-modern-primary.is-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 1.1em; height: 1.1em;
    margin: -.55em 0 0 -.55em;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    animation: app-spin .7s linear infinite;
}
.btn-light.is-loading::after,
.btn-outline-primary.is-loading::after,
.btn-outline-secondary.is-loading::after,
.btn-outline-dark.is-loading::after,
.btn-warning.is-loading::after {
    border-color: rgba(var(--app-primary-rgb), .25);
    border-top-color: var(--app-primary);
}
@keyframes app-spin { to { transform: rotate(360deg); } }

/* ── Tarjetas ── */
.card {
    --bs-card-border-radius: var(--app-radius);
    --bs-card-inner-border-radius: calc(var(--app-radius) - 1px);
    --bs-card-border-color: rgba(15, 23, 42, .06);
    --bs-card-cap-bg: #fff;
    box-shadow: var(--app-shadow-xs);
    transition: box-shadow .3s var(--app-ease), transform .3s var(--app-ease);
}
.card:hover { box-shadow: var(--app-shadow); }
.card > .card-header { border-bottom-color: var(--app-border); padding-top: .9rem; padding-bottom: .9rem; }
.card > .card-header:not([class*="bg-"]) { font-weight: 700; color: var(--app-ink); }
.card > .card-footer { border-top-color: var(--app-border); }

/* Tarjetas "interactivas" opcionales */
.card-hover:hover, .hover-lift:hover { transform: translateY(-4px); box-shadow: var(--app-shadow-lg); }

/* ── Tablas ── */
.table {
    --bs-table-hover-bg: rgba(var(--app-primary-rgb), .045);
    --bs-table-striped-bg: rgba(15, 23, 42, .022);
    --bs-table-border-color: var(--app-border);
    font-size: .9rem;
}
.table > thead th {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--app-muted);
    white-space: nowrap;
    border-bottom-width: 1px;
}
.table > thead.table-light th,
.table > thead > tr.table-light > th { --bs-table-bg: #f8fafc; }
.table > :not(caption) > * > * { padding: .8rem .9rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .55rem; }
.table > tbody > tr { transition: background-color .15s; }
.table-responsive { border-radius: inherit; scrollbar-width: thin; }

/* ── Formularios ── */
.form-control,
.form-select {
    border-radius: var(--app-radius-sm);
    border-color: #d8e0eb;
    background-color: #fff;
    transition: border-color .2s var(--app-ease), box-shadow .2s var(--app-ease), background-color .2s;
}
.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) { border-color: #b8c5d8; }
.form-control:focus,
.form-select:focus {
    border-color: rgba(var(--app-primary-rgb), .6);
    box-shadow: 0 0 0 .25rem rgba(var(--app-primary-rgb), .14);
}
.form-control::placeholder { color: #a0aec0; }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.form-check-input { transition: background-color .2s, border-color .2s, box-shadow .2s; }
.form-check-input:checked { background-color: var(--app-primary); border-color: var(--app-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .25rem rgba(var(--app-primary-rgb), .15); border-color: rgba(var(--app-primary-rgb), .5); }
.form-switch .form-check-input { cursor: pointer; }
.input-group-text { background: #f8fafc; border-color: #d8e0eb; color: #94a3b8; }
.input-group:focus-within .input-group-text { color: var(--app-primary); border-color: rgba(var(--app-primary-rgb), .6); }
.input-group > .form-control:focus,
.input-group > .form-select:focus { z-index: 5; }

/* ── Badges ── */
.badge { font-weight: 600; letter-spacing: .02em; border-radius: 999px; padding: .38em .7em; }

/* ── Alertas ── */
.alert {
    border: 0;
    border-radius: 14px;
    border-left: 4px solid currentColor;
    box-shadow: var(--app-shadow-sm);
    animation: app-slide-in .4s var(--app-ease) both;
}
.alert-success { --bs-alert-bg: #ecfdf3; --bs-alert-color: #146c43; }
.alert-danger  { --bs-alert-bg: #fef2f2; --bs-alert-color: #b42318; }
.alert-warning { --bs-alert-bg: #fffaeb; --bs-alert-color: #93370d; }
.alert-info    { --bs-alert-bg: #eff8ff; --bs-alert-color: #175cd3; }
.alert-primary { --bs-alert-bg: #eef4ff; --bs-alert-color: var(--app-primary-700); }
.alert-dismissible .btn-close { box-shadow: none; }

@keyframes app-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Modales ── */
.modal-backdrop.show { opacity: .45; }
.modal-backdrop { background: #0b1220; }
.modal-content {
    border: 0;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(11, 18, 32, .28);
    overflow: hidden;
}
.modal-header { border-bottom-color: var(--app-border); padding: 1.1rem 1.4rem; }
.modal-footer { border-top-color: var(--app-border); padding: .9rem 1.4rem; }
.modal-body { padding: 1.4rem; }
.modal.fade .modal-dialog {
    transform: translateY(24px) scale(.97);
    transition: transform .35s var(--app-spring), opacity .25s;
}
.modal.show .modal-dialog { transform: none; }

/* ── Dropdowns ── */
.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--app-primary);
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 14px;
    padding: .45rem;
    box-shadow: var(--app-shadow-lg);
}
.dropdown-menu.show { animation: app-pop .22s var(--app-ease) both; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    border-radius: 10px;
    padding: .6rem .8rem;
    font-size: .9rem;
    font-weight: 500;
    transition: background .15s, color .15s, padding-left .2s var(--app-ease);
}
.dropdown-item:hover { background: rgba(var(--app-primary-rgb), .07); color: var(--app-primary); padding-left: 1rem; }
.dropdown-item.text-danger:hover { background: #fef2f2; color: #b42318 !important; }
.dropdown-item i { width: 1.1rem; text-align: center; opacity: .8; }
@keyframes app-pop {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Navegación por pestañas ── */
.nav-pills .nav-link { border-radius: 10px; font-weight: 600; transition: background .2s, color .2s, box-shadow .2s; }
.nav-pills .nav-link.active { background: var(--app-primary); box-shadow: 0 6px 16px rgba(var(--app-primary-rgb), .25); }
.nav-tabs .nav-link { font-weight: 600; color: var(--app-muted); transition: color .2s, border-color .2s; }
.nav-tabs .nav-link.active { color: var(--app-primary); }
.tab-pane.fade { transition: opacity .25s var(--app-ease); }

/* ── Otros ── */
.list-group { --bs-list-group-border-color: var(--app-border); border-radius: var(--app-radius-sm); }
.list-group-item-action { transition: background .15s, padding-left .2s var(--app-ease); }
.list-group-item-action:hover { padding-left: 1.4rem; }
.list-group-item.active { background: var(--app-primary); border-color: var(--app-primary); }
.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-active-bg: var(--app-primary); --bs-pagination-active-border-color: var(--app-primary); gap: .25rem; }
.pagination .page-link { border-radius: 10px !important; }
.progress { border-radius: 999px; background: #e9eef5; }
.progress-bar { border-radius: 999px; transition: width .8s var(--app-ease); }
.spinner-border { --bs-spinner-border-width: .2em; }
.tooltip { --bs-tooltip-bg: #0f172a; --bs-tooltip-border-radius: 8px; font-size: .78rem; }
hr { border-color: var(--app-border); opacity: 1; }
img { max-width: 100%; }

/* =========================================================
   ANIMACIONES DE ENTRADA (app.js añade .app-reveal)
========================================================= */
.app-reveal { opacity: 0; transform: translateY(16px); }
.app-reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: opacity .55s var(--app-ease), transform .55s var(--app-ease);
    transition-delay: var(--reveal-delay, 0s);
}

/* "backwards" (no "both"): al terminar, la animación deja de aplicarse y no crea
   un contexto de apilamiento que atrape a los modales bajo el backdrop. */
.app-main > * { animation: app-page-in .45s var(--app-ease) backwards; }
@keyframes app-page-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* =========================================================
   TOASTS (window.AppUI.toast)
========================================================= */
.app-toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: min(380px, calc(100vw - 2rem));
}
.app-toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    font-size: .88rem;
    box-shadow: var(--app-shadow-lg);
    animation: app-toast-in .4s var(--app-spring) both;
}
.app-toast.is-leaving { animation: app-toast-out .3s var(--app-ease) both; }
.app-toast i { font-size: 1.05rem; margin-top: .1rem; }
.app-toast.success i { color: #4ade80; }
.app-toast.danger i  { color: #f87171; }
.app-toast.warning i { color: #fbbf24; }
.app-toast.info i    { color: #60a5fa; }
@keyframes app-toast-in  { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes app-toast-out { to { opacity: 0; transform: translateX(24px); } }

/* =========================================================
   BOTÓN VOLVER ARRIBA (global)
========================================================= */
.app-to-top {
    position: fixed;
    right: 1.4rem;
    bottom: 1.4rem;
    z-index: 1020;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
    box-shadow: 0 10px 24px rgba(var(--app-primary-rgb), .35);
    opacity: 0;
    transform: translateY(16px) scale(.9);
    pointer-events: none;
    transition: opacity .3s var(--app-ease), transform .3s var(--app-spring), box-shadow .3s;
}
.app-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.app-to-top:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(var(--app-primary-rgb), .45); }
.app-to-top svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.app-to-top svg circle { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 2; stroke-linecap: round; }

/* =========================================================
   FOOTER
========================================================= */
.app-footer {
    flex-shrink: 0;
    position: relative;
    margin-top: 4rem;
    padding: 0 !important;
    color: rgba(255, 255, 255, .78);
    background: radial-gradient(1200px 400px at 85% -10%, rgba(0, 180, 238, .22), transparent 60%),
                linear-gradient(160deg, #0b2a6b 0%, #0b3585 45%, #0a1f4d 100%) !important;
    overflow: hidden;
}
.app-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--app-primary), var(--app-accent), #6366f1);
}
.app-footer .footer-main { padding: 3.5rem 0 2rem; }
.app-footer h6 {
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 1.1rem;
}
.app-footer p { font-size: .9rem; line-height: 1.7; }
.app-footer a { color: rgba(255, 255, 255, .72); text-decoration: none; }
.app-footer a:hover { color: #fff; }
.app-footer .footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; font-size: .9rem; }
.app-footer .footer-links a { display: inline-flex; align-items: center; gap: .5rem; transition: color .2s, transform .2s var(--app-ease); }
.app-footer .footer-links a:hover { transform: translateX(4px); }
.app-footer .footer-links i { font-size: .7rem; opacity: .6; }
.app-footer .footer-contact { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; font-size: .9rem; }
.app-footer .footer-contact li { display: flex; gap: .75rem; align-items: flex-start; }
.app-footer .footer-contact i {
    width: 32px; height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: var(--app-accent);
    font-size: .85rem;
}
.app-footer .footer-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; color: #fff; }
.app-footer .footer-brand img { height: 52px; }
.app-footer .footer-brand strong { display: block; font-size: 1.1rem; font-weight: 800; }
.app-footer .footer-brand small { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.app-footer .footer-social { display: flex; gap: .55rem; margin-top: 1.2rem; }
.app-footer .footer-social a {
    width: 40px; height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    transition: background .25s, transform .25s var(--app-spring);
}
.app-footer .footer-social a:hover { background: var(--app-accent); transform: translateY(-3px); }
.app-footer .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 1.1rem 0;
    font-size: .8rem;
    color: rgba(255, 255, 255, .55);
}
.app-footer.compact .footer-bottom { border-top: 0; padding: 1.2rem 0; }
.app-footer.compact { margin-top: 3rem; }

/* =========================================================
   PORTADA — HERO
========================================================= */
.app-hero {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    color: #fff;
    min-height: 560px;
    display: flex;
    align-items: center;
    padding: 4rem 3rem;
    background: #0b3585 url('../img/escoltafs.jpg') center / cover no-repeat;
    box-shadow: 0 30px 70px rgba(11, 53, 133, .28);
    isolation: isolate;
}
.app-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, rgba(8, 30, 82, .94) 0%, rgba(18, 81, 197, .82) 50%, rgba(0, 180, 238, .35) 100%);
}
.app-hero .hero-glow,
.app-hero .hero-glow-2 { z-index: -1; }
.app-hero .hero-particles { z-index: -1; }
.app-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem 1rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    backdrop-filter: blur(10px);
    margin-bottom: 1.4rem;
    animation: fadeDown .7s ease both;
}
.app-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.035em;
    margin-bottom: 1.2rem;
    animation: fadeUp .8s ease .1s both;
}
.app-hero h1 .grad {
    background: linear-gradient(90deg, #7dd3fc, #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.app-hero .lead {
    font-size: 1.08rem;
    line-height: 1.8;
    max-width: 560px;
    opacity: .9;
    animation: fadeUp .8s ease .2s both;
}
.app-hero .hero-buttons { margin-top: 2rem; }
.app-hero .hero-stats { margin-top: 2.6rem; }
.app-hero .typed-word {
    display: inline-block;
    min-width: 1ch;
    border-right: 3px solid #7dd3fc;
    padding-right: .1em;
    animation: app-caret 1s steps(1) infinite;
}
@keyframes app-caret { 50% { border-color: transparent; } }

.app-hero-card {
    position: relative;
    border-radius: 24px;
    padding: 1.4rem;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, .25);
    animation: fadeUp .9s ease .35s both;
    transform-style: preserve-3d;
    transition: transform .2s ease-out;
}
.app-hero-card img.logo {
    width: 100%;
    max-width: 220px;
    display: block;
    margin: .5rem auto 1.2rem;
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .35));
    animation: app-float 6s ease-in-out infinite;
}
@keyframes app-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.app-hero-card .mini {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem .9rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, .1);
    font-size: .85rem;
    font-weight: 600;
}
.app-hero-card .mini + .mini { margin-top: .55rem; }
.app-hero-card .mini i {
    width: 34px; height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .16);
    color: #7dd3fc;
}

@media (max-width: 991.98px) {
    .app-hero { padding: 3rem 1.5rem; min-height: 0; text-align: center; border-radius: 22px; }
    .app-hero .lead { margin-left: auto; margin-right: auto; }
    .app-hero .hero-buttons,
    .app-hero .hero-stats { justify-content: center; }
}
@media (max-width: 575.98px) {
    .app-hero .stat-card { min-width: 0; flex: 1 1 30%; padding: 1rem .6rem; }
    .app-hero .stat-card h3 { font-size: 1.6rem; }
}

/* =========================================================
   LOGIN
========================================================= */
.auth-wrap {
    min-height: calc(100vh - var(--app-nav-h) - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
}
.auth-card {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    border-radius: 28px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 30px 80px rgba(11, 53, 133, .16);
    animation: app-page-in .6s var(--app-ease) both;
}
.auth-side {
    position: relative;
    padding: 3rem 2.6rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(150deg, rgba(8, 30, 82, .92), rgba(18, 81, 197, .85)),
                url('../img/aprendizajefs.jpg') center / cover;
    overflow: hidden;
    isolation: isolate;
}
.auth-side::after {
    content: '';
    position: absolute;
    width: 340px; height: 340px;
    right: -120px; bottom: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 180, 238, .45), transparent 70%);
    z-index: -1;
    animation: floatGlow 9s ease-in-out infinite;
}
.auth-side h2 { color: #fff; font-weight: 800; font-size: 2rem; line-height: 1.15; letter-spacing: -.03em; }
.auth-side p { opacity: .85; line-height: 1.7; }
.auth-feature { display: flex; align-items: center; gap: .75rem; font-size: .9rem; font-weight: 600; }
.auth-feature + .auth-feature { margin-top: .7rem; }
.auth-feature i {
    width: 36px; height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(255, 255, 255, .14);
    color: #7dd3fc;
}
.auth-body { padding: 3rem 2.6rem; }
.auth-body h3 { font-weight: 800; letter-spacing: -.02em; }

.field-float { position: relative; }
.field-float .field-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    transition: color .2s;
    pointer-events: none;
}
.field-float .form-control {
    height: 54px;
    padding-left: 2.8rem;
    padding-right: 3rem;
    border-radius: 14px;
    background: #f8fafc;
}
.field-float .form-control:focus { background: #fff; }
.field-float:focus-within .field-icon { color: var(--app-primary); }
.field-float .field-action {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    transition: background .2s, color .2s;
}
.field-float .field-action:hover { background: #eef2f7; color: var(--app-primary); }
.caps-hint { display: none; font-size: .75rem; color: #b45309; margin-top: .35rem; }
.caps-hint.show { display: block; animation: app-slide-in .25s ease both; }

.btn-auth {
    height: 54px;
    border-radius: 14px !important;
    font-weight: 700;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--app-primary), #1a6be0 60%, var(--app-accent)) !important;
    border: 0 !important;
    background-size: 160% 100% !important;
    transition: background-position .5s var(--app-ease), transform .2s, box-shadow .2s !important;
}
.btn-auth:hover { background-position: 100% 0 !important; }

@media (max-width: 767.98px) {
    .auth-card { grid-template-columns: 1fr; border-radius: 22px; }
    .auth-side { padding: 2rem 1.6rem; }
    .auth-side .auth-features { display: none; }
    .auth-body { padding: 2rem 1.6rem; }
}

/* =========================================================
   Accesibilidad: menos movimiento
========================================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .app-reveal { opacity: 1; transform: none; }
}

@media print {
    .app-navbar, .app-footer, .app-to-top, .app-toasts, .app-progress, .whatsapp-float { display: none !important; }
    .app-main > * { animation: none !important; }
    body { background: #fff; }
}
