:root {
    color-scheme: light;
    --login-background: #3049c7;
    --login-purple: #4a55e8;
    --login-teal: #18bdb7;
    --login-ink: #18235a;
    --login-muted: #7885b2;
    --login-input: #eef3ff;
    --login-line: #c9d7ff;
}

* { box-sizing: border-box; }
body.eg-login-page {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    color: var(--login-ink);
    background:
        radial-gradient(ellipse 70% 48% at 5% 44%, rgba(155,177,255,.55), transparent 72%),
        radial-gradient(ellipse 68% 42% at 98% 56%, rgba(128,152,255,.42), transparent 70%),
        linear-gradient(145deg, var(--login-background) 0%, var(--login-background) 48%, var(--login-background) 100%);
    font-family: Poppins, Inter, Arial, sans-serif;
}

/* Escritorio: conservar la composición previa. */
.login-top-brand { display: contents; }
.login-shell { width: 100%; min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: 10px 24px 26px; }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; min-height: 150px; }
.login-brand-logo { display: block; width: min(440px, 38vw); height: auto; max-height: 104px; object-fit: contain; }
.login-brand-actions { position: absolute; inset: 0; pointer-events: none; }
.login-decoration { position: absolute; display: block; color: #fff; pointer-events: none; }
.login-decoration-dots { top: 31px; right: max(8vw, calc((100vw - 1220px) / 2)); width: 25px; height: 25px; color: rgba(255,255,255,.9); }
.login-decoration-dots svg { width: 100%; height: 100%; fill: currentColor; stroke: none; }
.login-decoration-cap { top: 22px; right: max(4vw, calc((100vw - 1360px) / 2)); width: 72px; height: 72px; }
.login-decoration-cap svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.login-country-flag-mobile { display: none !important; }
.login-school-identity { position: relative; z-index: 3; display: flex; align-items: center; gap: 18px; width: min(625px, calc(100% - 28px)); min-height: 98px; margin: 0 auto -49px; padding: 10px 22px; border-radius: 999px; background: #fff; box-shadow: 0 12px 26px rgba(71,91,193,.2); }
.login-school-logo-card { display: flex; align-items: center; justify-content: center; width: min(250px, 40%); height: 78px; flex: 0 0 min(250px, 40%); padding: 9px 14px; overflow: hidden; border: 1px solid #e4e9f3; border-radius: 10px; background: #fff; }
.login-school-logo { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.login-school-name { flex: 1 1 auto; min-width: 0; padding-left: 17px; border-left: 2px solid #d5ddff; color: #25366f; font-size: clamp(16px, 1.4vw, 19px); font-weight: 700; line-height: 1.25; }
.login-country-flag { display: block; width: 29px; height: 20px; flex: 0 0 auto; border-radius: 2px; object-fit: cover; box-shadow: 0 1px 3px rgba(18,35,80,.16); }
span.login-country-flag { width: auto; height: auto; border-radius: 0; box-shadow: none; font-size: 29px; line-height: 1; }

.login-panel { position: relative; isolation: isolate; display: block; width: min(900px, 100%); min-height: 0; margin: 0 auto; padding: 72px 64px 40px; overflow: hidden; border-radius: 30px; background: linear-gradient(180deg, #fff 0%, #fff 72%, #f9fbff 100%); box-shadow: 0 20px 52px rgba(25,43,120,.22); }
.login-panel::before, .login-panel::after { position: absolute; z-index: -1; right: -10%; bottom: -105px; left: -10%; height: 205px; content: ""; border-radius: 50% 50% 0 0 / 52% 52% 0 0; }
.login-panel::before { bottom: -126px; background: rgba(213,225,255,.4); transform: rotate(-4deg); }
.login-panel::after { background: linear-gradient(180deg, rgba(232,240,255,.1), rgba(220,233,255,.78)); transform: rotate(3deg); }
.login-form { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 760px; margin: 0 auto; }
.login-identity-column, .login-pin-column { min-width: 0; }
.login-identity-column { display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.login-pin-column { display: flex; flex-direction: column; align-items: center; }
.login-input-wrap { display: flex; align-items: center; gap: 13px; min-height: 58px; padding: 0 20px; border: 1.5px solid var(--login-line); border-radius: 13px; background: var(--login-input); transition: border-color .16s ease, box-shadow .16s ease; }
.login-input-wrap:focus-within, .login-pin-entry:focus-within { border-color: var(--login-purple); box-shadow: 0 0 0 3px rgba(74,85,232,.1); }
.login-input-wrap > svg { width: 29px; height: 29px; flex: 0 0 auto; fill: none; stroke: var(--login-purple); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.login-input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--login-ink); background: transparent; font: inherit; font-size: 19px; }
.login-input-wrap input::placeholder { color: var(--login-muted); opacity: 1; }
.login-remember-wrap { display: none; }
.login-remember-wrap input[type="checkbox"] { display: grid; place-content: center; appearance: none; width: 17px; height: 17px; margin: 0; border: 1.5px solid #9aa7c4; border-radius: 4px; background: #fff; cursor: pointer; }
.login-remember-wrap input[type="checkbox"]::before { width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; content: ""; transform: rotate(45deg) scale(0); transition: transform .12s ease; }
.login-remember-wrap input[type="checkbox"]:checked { border-color: #19b9ae; background: #19b9ae; }
.login-remember-wrap input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }
.login-remember-wrap input[type="checkbox"]:focus-visible { outline: 3px solid rgba(25,185,174,.3); outline-offset: 2px; }
.login-pin-heading { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--login-purple); font-size: 21px; font-weight: 700; }
.login-pin-heading svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.login-pin-entry { position: relative; display: flex; justify-content: center; align-items: center; width: min(230px, 100%); height: 22px; margin: 0 auto 7px; border: 1px solid transparent; border-radius: 8px; }
.login-pin-entry:focus-within { border-color: var(--login-line); background: rgba(238,243,255,.7); }
.login-pin-entry input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; padding: 0 10px; border: 0; border-radius: inherit; outline: 0; color: var(--login-ink); background: transparent; font: inherit; font-size: 18px; letter-spacing: .32em; text-align: center; cursor: text; }
.login-pin-entry.is-manual-password input { opacity: 1; padding: 0 12px; color: var(--login-ink); background: var(--login-input); font: inherit; letter-spacing: .15em; text-align: center; }
.login-pin-dots { display: flex; justify-content: center; align-items: center; gap: 13px; pointer-events: none; }
.login-pin-entry.has-value .login-pin-dots { display: none; }
.login-pin-dots i { width: 8px; height: 8px; border-radius: 50%; background: #c8d1f5; }
.login-pin-dots i.is-filled { background: var(--login-purple); }
.login-pin-entry.is-manual-password .login-pin-dots { visibility: hidden; }
.login-keypad { display: grid; grid-template-columns: repeat(3, 102px); justify-content: center; gap: 8px; width: 322px; max-width: 100%; margin: 0 auto; }
.pin-key { min-height: 51px; padding: 0; border: 0; border-top: 0; border-radius: 11px; color: var(--login-ink); background: #f0f2ff; font: inherit; font-size: 22px; font-weight: 700; cursor: pointer; transition: background-color .14s ease, transform .14s ease; appearance: none; }
.pin-key:hover { background: #e4e8ff; }
.pin-key:active { transform: scale(.97); }
.pin-key:focus-visible, .login-submit:focus-visible { outline: 3px solid #25d7d1; outline-offset: 3px; }
.pin-key-delete { color: #707ba7; }
.pin-key-delete svg { width: 23px; height: 23px; fill: currentColor; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.pin-key-submit { display: none; color: #fff; background: var(--login-purple); }
.pin-key-submit:hover { background: #3e48d4; }
.pin-key-submit svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; opacity: .8; }
.pin-key-spacer { min-height: 51px; border: 0; background: transparent; }
.login-submit-row { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.login-form.is-manual-password .login-submit-row { position: static; display: flex; justify-content: center; width: auto; height: auto; margin: 9px auto 0; overflow: visible; clip-path: none; }
.login-submit { min-width: 150px; min-height: 42px; padding: 8px 24px; border: 0; border-radius: 11px; color: #fff; background: var(--login-purple); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.login-submit:hover { background: #3e48d4; }
.login-support-column { position: relative; z-index: 1; margin-top: 18px; text-align: center; }
.login-recovery-wrap { position: relative; z-index: 1; text-align: center; }
.login-recovery { display: inline-flex; justify-content: center; align-items: center; gap: 10px; padding: 0; border: 0; color: var(--login-teal); background: transparent; font: inherit; font-size: 15px; font-weight: 600; text-align: center; cursor: pointer; }
.login-recovery:hover { color: #079a96; }
.login-recovery svg { width: 27px; height: 27px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.login-recovery-notice { width: fit-content; max-width: 100%; margin: 9px auto 0; padding: 9px 14px; border: 1px solid #ccefeb; border-radius: 12px; color: #147e7a; background: rgba(237,251,249,.96); font-size: 13px; box-shadow: 0 6px 18px rgba(44,107,145,.1); }
.login-recovery-notice[hidden] { display: none; }
.login-environment-label { display: block; margin: 0; color: #8092d5; font-size: 11px; line-height: 1.2; text-align: center; }
.login-brand-signature { margin: 0 auto; padding: 0 10px; color: #a6aab2; font-family: Montserrat, Poppins, Inter, Arial, sans-serif; font-size: 10px; font-weight: 400; line-height: 1.35; text-align: center; }
.login-brand-signature-link { color: inherit; text-decoration: none; }
.login-brand-signature-link strong { color: inherit; font-family: Montserrat, Poppins, Inter, Arial, sans-serif; font-size: 1.02em; font-weight: 800; letter-spacing: .04em; }
.login-brand-signature-link:hover, .login-brand-signature-link:visited { color: inherit; }
.login-brand-signature-mobile { display: none; }
.login-footer { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; color: #8092d5; font-size: 12px; font-weight: 600; }
.login-footer-caption { display: flex; justify-content: center; align-items: center; gap: 12px; }
.login-footer-caption::before, .login-footer-caption::after { width: 64px; height: 1px; content: ""; background: #cad5ff; }
.login-footer img { display: block; width: 176px; height: auto; }
.login-error { position: relative; z-index: 1; margin: -10px auto 16px; padding: 9px 12px; border: 1px solid #fecaca; border-radius: 10px; color: #991b1b; background: #fff1f2; font-size: 13px; text-align: center; }

@media (min-width: 1024px) {
    .login-shell { padding-top: 0; }
    .login-brand { min-height: 112px; }
    .login-brand-logo { width: min(420px, 34vw); max-height: 86px; }
    .login-school-identity { min-height: 98px; margin-bottom: -49px; }
    .login-school-logo-card { height: 78px; flex-basis: min(250px, 40%); }
    .login-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; max-height: 85vh; padding: 72px 64px 42px; }
    .login-form { display: contents; }
    .login-error { position: absolute; top: 12px; right: 64px; left: 64px; margin: 0 auto; }
    .login-panel:has(.login-error) { padding-top: 88px; }
    .login-identity-column { grid-column: 1; grid-row: 1; gap: 0; }
    .login-pin-column { grid-column: 2; grid-row: 1 / span 2; }
    .login-support-column { grid-column: 1; grid-row: 2; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
    .login-recovery-wrap, .login-recovery { width: 100%; text-align: center; }
    .login-footer { align-items: center; text-align: center; }
    .login-footer img { width: 150px; }
}

@media (min-width: 701px) and (max-height: 850px) {
    .login-shell { padding-top: 4px; }
    .login-brand { min-height: 118px; }
    .login-brand-logo { max-height: 82px; }
    .login-school-identity { min-height: 98px; margin-bottom: -49px; }
    .login-school-logo-card { height: 78px; flex-basis: min(250px, 40%); }
    .login-panel { padding-top: 72px; }
    .login-support-column { text-align: center; }
    .login-footer img { width: 150px; }
}

/* Móvil: composición a pantalla completa, sin franjas laterales ni scroll vertical. */
@media (max-width: 700px) {
    body.eg-login-page { width: 100%; height: 100vh; height: 100svh; min-height: 100svh; overflow: hidden; background: var(--login-background); }
    .login-shell { display: flex; flex-direction: column; width: 100%; height: 100vh; height: 100svh; min-height: 0; overflow: hidden; padding: 0; }
    .login-top-brand { display: flex; flex: 0 0 38svh; flex-direction: column; width: 100%; height: 38svh; min-height: 0; padding-top: max(7px, env(safe-area-inset-top)); }
    .login-brand { position: relative; display: flex; flex: 0 0 50px; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; min-height: 50px; margin: 0; padding: 0 15px; }
    .login-brand-logo { position: static; width: min(250px, 65vw); height: 44px; max-height: 44px; margin: 0; object-position: left center; transform: none; }
    .login-brand-actions { position: static; display: flex; flex: 0 0 auto; align-items: center; gap: 12px; width: auto; }
    .login-decoration-dots { position: static; width: 19px; height: 19px; color: rgba(255,255,255,.9); }
    .login-decoration-cap { position: static; width: 29px; height: 29px; }
    .login-country-flag-mobile { display: block !important; width: 23px; height: 16px; }
    .login-school-identity { position: relative; z-index: 1; display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; align-items: center; gap: 6px; width: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; text-align: center; }
    .login-school-logo-card { display: flex; align-items: center; justify-content: center; width: min(170px, 48vw); height: clamp(78px, 12svh, 96px); flex: 0 0 auto; padding: 7px 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 17px; background: #fff; box-shadow: 0 7px 16px rgba(13,27,94,.16); }
    .login-school-logo { width: 100%; height: 100%; max-width: 100%; max-height: 100%; padding: 0; border: 0; object-fit: contain; }
    .login-school-name { flex: 0 1 auto; max-width: calc(100% - 24px); padding: 0; border: 0; color: #fff; font-size: 12px; font-weight: 650; line-height: 1.2; text-align: center; }
    .login-country-flag-desktop { display: none !important; }
    .login-panel { position: relative; isolation: auto; display: flex; flex: 0 0 62svh; flex-direction: column; width: 100%; height: 62svh; min-height: 0; margin: 0; padding: 17px 18px max(17px, env(safe-area-inset-bottom)); overflow: hidden; border: 0; border-radius: 25px 25px 0 0; background: #fff; box-shadow: 0 -7px 20px rgba(21,35,115,.12); }
    .login-panel::before, .login-panel::after { display: none; }
    .login-error { flex: 0 0 auto; margin: 0 auto 7px; }
    .login-form { display: flex; flex: 1 1 auto; flex-direction: column; gap: 8px; width: 100%; min-height: 0; max-width: 460px; margin: 0 auto; }
    .login-identity-column { display: flex; flex: 0 0 auto; flex-direction: column; justify-content: flex-start; gap: 7px; min-width: 0; }
    .login-input-wrap { min-height: 46px; padding: 0 14px; border-color: #c9d7ff; background: #eef3ff; }
    .login-input-wrap > svg { width: 23px; height: 23px; stroke: var(--login-purple); }
    .login-input-wrap input { color: var(--login-ink); font-size: 16px; }
    .login-input-wrap input::placeholder { color: var(--login-muted); }
    .login-remember-wrap { display: flex; justify-content: center; align-items: center; gap: 7px; margin: 0 auto; color: #536080; font-size: 11px; line-height: 1.15; text-align: center; }
    .login-remember-wrap input { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; accent-color: #19b9ae; }
    .login-pin-column { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: space-between; align-items: center; width: 100%; min-height: 0; margin: 0; padding: 2px 0 0; }
    .login-pin-heading { flex: 0 0 auto; gap: 8px; margin: 0 0 3px; color: #4f2384; font-size: clamp(18px, 2.8svh, 21px); }
    .login-pin-heading svg { width: 23px; height: 23px; }
    .login-pin-entry { flex: 0 0 20px; height: 20px; margin: 0 auto 4px; }
    .login-pin-dots { gap: 11px; }
    .login-pin-dots i { width: 8px; height: 8px; }
    .login-keypad { display: grid; flex: 0 0 clamp(152px, 23svh, 190px); align-content: stretch; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: clamp(4px, .8svh, 7px); width: min(100%, 340px); height: clamp(152px, 23svh, 190px); min-height: 0; margin: 0 auto; }
    .pin-key, .pin-key-spacer { min-height: 0; }
    .pin-key { border-radius: 10px; background: #edf2ff; font-size: clamp(20px, 5.5vw, 27px); font-weight: 550; }
    .pin-key:hover { background: #e2eaff; }
    .pin-key-delete svg { width: 27px; height: 27px; }
    .pin-key-spacer { display: none; }
    .pin-key-nine { grid-column: 2; grid-row: 4; }
    .pin-key-delete { grid-column: 1; grid-row: 4; }
    .pin-key-submit { display: flex; justify-content: center; align-items: center; grid-column: 3; grid-row: 4; border: 2px solid #35d4cf; border-radius: 10px; color: #fff; background: var(--login-purple); box-shadow: 0 0 0 2px rgba(53,212,207,.16); }
    .pin-key-submit:hover { background: #3e48d4; }
    .login-submit-row { display: none; }
    .login-form.is-manual-password .login-submit-row { display: none; }
    .login-support-column { position: relative; display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: 5px auto 0; padding: 6px 0 0; border-top: 1px solid #edf0f8; border-radius: 0; background: #fff; text-align: center; }
    .login-recovery-wrap { display: flex; justify-content: center; margin: 0 auto; }
    .login-recovery { display: inline-flex; justify-content: center; align-items: center; min-height: 27px; gap: 6px; padding: 2px 0; color: #079a96; font-size: 13px; font-weight: 600; }
    .login-recovery svg { display: none; }
    .login-recovery-notice { margin-top: 4px; padding: 6px 10px; font-size: 11px; }
    .login-environment-label { margin: 2px auto 0; padding: 0; color: #8092b9; font-size: 9px; }
    .login-brand-signature-mobile { display: none; }
    .login-footer { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; width: 100%; padding-bottom: 3px; color: #8092b9; font-size: 9px; text-align: center; }
    .login-footer-caption { display: none; }
    .login-footer-caption::before, .login-footer-caption::after { display: none; }
    .login-footer img { align-self: center; width: 150px; margin-inline: auto; object-fit: contain; object-position: center; }
}

@media (max-width: 360px) {
    .login-brand { padding-inline: 12px; }
    .login-brand-actions { gap: 9px; }
    .login-school-logo-card { width: min(154px, 45vw); }
    .login-panel { padding-right: 14px; padding-left: 14px; }
    .login-keypad { gap: 4px; }
}

@media (max-width: 700px) and (max-height: 620px) {
    .login-school-logo-card { height: 62px; }
    .login-panel { padding-top: 8px; }
    .login-input-wrap { min-height: 40px; }
    .login-form { gap: 5px; }
    .login-pin-heading { font-size: 17px; }
    .login-pin-heading svg { width: 19px; height: 19px; }
    .login-pin-entry { flex-basis: 16px; height: 16px; margin-bottom: 2px; }
    .login-keypad { flex-basis: clamp(118px, 22svh, 142px); height: clamp(118px, 22svh, 142px); gap: 3px; }
    .login-support-column { margin-top: 2px; padding-top: 3px; }
    .login-recovery { min-height: 22px; font-size: 12px; }
    .login-footer img { width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
