/* Faakdex · acceso móvil con fotografía. Foto: Katrin Bolovtsova / Pexels 6077123. */
:root {
    color-scheme: light;
    --login-ink: #1b2d48;
    --login-muted: #6d7b90;
    --login-accent: #294e83;
    --login-accent-hover: #203e6a;
    --login-line: #dfe5ed;
    --login-focus: 0 0 0 3px rgb(41 78 131 / 11%);
}
* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-width: 280px; min-height: 100vh; min-height: 100dvh;
    background: #eef2f7; color: var(--login-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
.skip-link { position: fixed; z-index: 100000; top: 12px; left: 12px; padding: 12px 16px; border-radius: 8px; background: var(--login-ink); color: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.login-container { display: grid; grid-template-rows: minmax(190px, 1fr) auto; width: 100%; max-width: 520px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding-bottom: max(18px, env(safe-area-inset-bottom)); background: #eef2f7; }
.login-brand { position: relative; min-height: 190px; overflow: hidden; background: #30352f; }
.login-brand::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(13 22 26 / 46%), transparent 80%); pointer-events: none; }
.login-photo { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 52% 48%; }
.brand-identity { position: absolute; z-index: 1; top: max(22px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 10px; }
.brand-logo { display: grid; place-items: center; width: 44px; height: 44px; background: #fff; border: 1px solid rgb(255 255 255 / 70%); border-radius: 13px; box-shadow: 0 4px 16px rgb(0 0 0 / 8%); }
.brand-logo img { display: block; width: 34px; height: auto; }
.brand-title { margin: 0; color: #fff; font: 400 30px/1.2 'DM Serif Display', Georgia, serif; letter-spacing: -.02em; }
.login-form-panel { position: relative; display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; margin: -38px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 27px 24px 24px; border: 1px solid rgb(219 227 239 / 80%); border-radius: 25px; background: #fff; box-shadow: 0 14px 38px -18px rgb(26 48 82 / 28%), 0 2px 6px rgb(26 48 82 / 3%); }
.login-form-panel > * { width: 100%; max-width: 400px; margin-left: auto; margin-right: auto; }
.form-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.form-title { margin: 0; color: var(--login-ink); font-size: 28px; font-weight: 600; letter-spacing: -.045em; line-height: 1.25; }
.form-header-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid #e3eaf5; border-radius: 12px; background: #f3f6fb; color: #6a82a6; }
.login-form { display: flex; flex-direction: column; gap: 22px; }
.form-group { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.form-label { margin: 0; font-size: 12px; font-weight: 600; line-height: 1.5; color: #34435c; }
.form-input {
    display: block; width: 100%; min-width: 0; min-height: 52px;
    padding: 14px 15px; border: 1px solid var(--login-line); border-radius: 10px;
    background: #f8fafc; color: var(--login-ink); font-size: 14px; line-height: 1.5;
    transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-input::placeholder { color: #8b96a9; opacity: 1; }
.form-input:hover, .email-field-fused:hover { border-color: #b1bed4; }
.form-input:focus, .email-field-fused:focus-within { border-color: var(--login-accent); box-shadow: var(--login-focus); }
.form-input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #fff inset; -webkit-text-fill-color: var(--login-ink); caret-color: var(--login-ink); }
.email-field-fused { display: flex; align-items: center; min-height: 52px; border: 1px solid var(--login-line); border-radius: 12px; background: #f8fafc; transition: border-color .15s, box-shadow .15s; }
.email-field-fused .form-input { flex: 1 1 0; width: 0; min-height: 50px; border: 0; background: transparent; border-radius: 10px 0 0 10px; }
.email-field-fused .form-input:focus { box-shadow: none; }
.email-at { padding: 10px 0 10px 12px; border-left: 1px solid #e7ebf2; color: #8895a9; font-size: 14px; }
.domain-select-inline {
    flex: 0 0 auto; width: 128px; min-height: 50px; max-width: 100%;
    padding: 12px 27px 12px 6px; border: 0; border-radius: 0 10px 10px 0;
    background: transparent; color: #46556f; font-size: 12px; font-weight: 500; cursor: pointer;
    appearance: none; outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2363718a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.domain-select-inline:focus-visible { box-shadow: inset 0 0 0 2px var(--login-accent); }
.domain-select-inline option { color: var(--login-ink); background: #fff; }
.input-wrapper { display: flex; align-items: center; position: relative; }
.input-wrapper .form-input { padding-right: 52px; }
.password-toggle {
    display: grid; place-items: center; position: absolute; right: 4px;
    width: 44px; height: 44px; border: 0; border-radius: 7px;
    background: transparent; color: #7b899f; font-size: 15px;
}
.password-toggle:hover { background: #f3f6fb; color: var(--login-accent); }
.forgot-row { display: flex; justify-content: flex-end; margin-top: -10px; }
.forgot-link { display: inline-flex; align-items: center; min-height: 36px; border-radius: 4px; color: var(--login-accent); font-size: 12px; font-weight: 500; text-decoration: none; }
.forgot-link:hover { color: var(--login-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.submit-btn {
    position: relative; display: block; width: 100%; min-height: 52px;
    margin-top: -4px; padding: 14px 20px; border: 1px solid var(--login-accent); border-radius: 10px;
    background: var(--login-accent); color: #fff; font-size: 14px; font-weight: 600;
    box-shadow: 0 4px 10px -5px rgb(49 88 199 / 40%); transition: background .15s, box-shadow .15s;
}
.submit-btn:hover { background: var(--login-accent-hover); border-color: var(--login-accent-hover); box-shadow: 0 6px 15px -6px rgb(49 88 199 / 45%); }
.submit-btn:active { background: #203e98; }
.submit-btn.loading { pointer-events: none; }
.submit-btn.loading .btn-text { visibility: hidden; }
.submit-btn.loading::after { content: ''; position: absolute; top: calc(50% - 10px); left: calc(50% - 10px); width: 20px; height: 20px; border: 2px solid #ffffff65; border-top-color: #fff; border-radius: 50%; animation: login-spin .7s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-form-extra { display: flex; flex-direction: column; gap: 19px; margin-top: 23px; }
.divider { display: flex; align-items: center; gap: 14px; color: #8a96a8; font-size: 11px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #e8edf4; }
.btn-qr { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 49px; padding: 12px 16px; background: #fff; color: #53617a; border: 1px solid var(--login-line); border-radius: 10px; font-size: 12px; font-weight: 500; transition: background .15s, border-color .15s; }
.btn-qr:hover { background: #f6f8fc; border-color: #b7c4d8; color: #304561; }
.btn-qr svg { color: #7a8aa4; }
.password-toggle:focus-visible, .forgot-link:focus-visible, .submit-btn:focus-visible, .btn-qr:focus-visible, .login-alert-dismiss:focus-visible { outline: 3px solid #a1b7ed; outline-offset: 3px; }
.login-alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 23px; padding: 13px; border: 1px solid; border-radius: 10px; line-height: 1.5; }
.login-alert-icon { flex: 0 0 19px; width: 19px; height: 19px; margin-top: 2px; }
.login-alert-content { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.login-alert-title { margin-bottom: 3px; font-size: 12px; font-weight: 600; }
.login-alert-text { font-size: 12px; }
.login-alert-dismiss { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; margin: -6px -6px 0 0; padding: 5px; border: 0; border-radius: 6px; color: inherit; background: transparent; }
.login-alert-dismiss:hover { background: rgb(0 0 0 / 5%); }
.login-alert--error { color: #a02e3a; background: #fff4f5; border-color: #f4d2d7; }
.login-alert--warning { color: #8d5b19; background: #fff9ee; border-color: #efdfbe; }
.login-alert--info { color: #305995; background: #f1f6ff; border-color: #d6e3f8; }
.login-alert--success { color: #24664d; background: #f0faf5; border-color: #cfe9dc; }
.form-group.has-error > .input-wrapper .form-input, .form-group.has-error .email-field-fused { border-color: #ca5967; box-shadow: 0 0 0 3px rgb(202 89 103 / 10%); }
.field-error { display: flex; align-items: flex-start; gap: 6px; color: #b43c4b; font-size: 11px; line-height: 1.5; }
.field-error svg { flex: 0 0 14px; width: 14px; height: 14px; margin-top: 1px; }
.input-tooltip { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 5; width: max-content; max-width: 100%; padding: 9px 12px; background: #263952; color: #fff; border-radius: 7px; font-size: 11px; line-height: 1.5; pointer-events: none; }

/* El acceso de asistencia tiene menor peso que el inicio de sesión. */
.form-input { font-size: 16px; }
.domain-select-inline { width: 148px; font-size: 16px; }
.login-form { gap: 20px; }
.form-label { font-size: 13px; }
.login-form-extra { margin-top: 25px; gap: 18px; }
.divider { display: block; height: 1px; background: #edf0f5; }
.divider::before, .divider::after { display: none; }
.btn-qr { justify-content: flex-start; min-height: 60px; gap: 12px; padding: 10px 13px; border: 1px solid #e6ecf5; background: #f5f7fb; color: #435a7c; font-size: 13px; border-radius: 14px; }
.btn-qr:hover { background: #ebeff5; }
.attendance-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid #e0e8f4; border-radius: 10px; background: #fff; color: #6c83a6; }
.attendance-icon .svg-inline--fa { width: 17px; height: 17px; }
.btn-qr .attendance-arrow { width: 16px; height: 16px; margin-left: auto; color: #7a8ba3; }
.submit-btn { min-height: 54px; border: 1px solid #294d7c; border-radius: 12px; background: linear-gradient(110deg, #294e83, #345e97); box-shadow: 0 7px 16px -8px rgb(35 75 130 / 50%); }
.submit-arrow { position: absolute; right: 17px; top: calc(50% - 9px); color: #d6e4f8; }
.submit-btn.loading .submit-arrow { visibility: hidden; }
.forgot-link { min-height: 40px; font-size: 12px; }
@media (max-width: 340px) {
    .login-form-panel { margin-right: 12px; margin-left: 12px; padding-right: 18px; padding-left: 18px; }
    .form-title { font-size: 26px; }
    .email-field-fused { flex-wrap: wrap; }
    .email-field-fused .form-input { flex-basis: 100%; width: 100%; border-radius: 10px 10px 0 0; border-bottom: 1px solid #e7ebf2; }
    .email-at { margin-left: 12px; padding-left: 0; border-left: 0; }
    .domain-select-inline { flex: 1; }
}
@media (max-height: 720px) and (max-width: 899px) {
    .login-container { grid-template-rows: minmax(140px, 1fr) auto; }
    .login-brand { min-height: 140px; }
    .login-form-panel { padding-top: 25px; }
}
@media (min-width: 600px) and (max-width: 899px) {
    body { display: flex; align-items: center; justify-content: center; padding: 24px; background: #f3f5f8; }
    .login-container { min-height: 0; padding-bottom: 0; border: 0; border-radius: 0; overflow: visible; background: transparent; }
    .login-brand { min-height: 210px; border-radius: 24px 24px 0 0; }
    .login-form-panel { padding: 30px 28px; }
}
@media (min-width: 900px) {
    body { display: flex; align-items: center; justify-content: center; padding: 32px; background: #f3f5f8; }
    .login-container { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); grid-template-rows: auto; max-width: 1040px; min-height: 660px; padding: 0; border: 1px solid #e0e5ed; border-radius: 24px; overflow: hidden; box-shadow: 0 24px 72px -36px rgb(28 44 78 / 20%); }
    .login-brand { min-height: 660px; }
    .login-photo { object-position: 58% 50%; }
    .brand-identity { top: 32px; left: 32px; }
    .brand-logo { width: 48px; height: 48px; border-radius: 14px; }
    .brand-logo img { width: 37px; }
    .brand-title { font-size: 33px; }
    .login-form-panel { justify-content: center; margin: 0; border: 0; border-radius: 0; padding: 48px clamp(36px, 5vw, 64px); box-shadow: none; }
    .form-header { margin-bottom: 32px; }
    .form-title { font-size: 30px; }
}
/* La apariencia del modal se limita al login; conserva su implementación compartida. */
.login-page .qr-modal-wrapper { padding: 16px; align-items: center; justify-content: center; }
.login-page .qr-modal-backdrop { background: rgb(16 28 45 / 38%); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.login-page .qr-card { width: min(100%, 400px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid #e7ecf3; border-radius: 28px; background: #fff; color: var(--login-ink); box-shadow: 0 28px 90px -24px rgb(15 30 54 / 35%); }
.login-page .qr-modal-body { padding: 28px 24px 20px; }
.login-page .qr-header { gap: 0; width: 100%; }
.login-page .qr-brand { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 18px; color: #243b5d; font: 400 22px/1.2 'DM Serif Display', Georgia, serif; }
.login-page .qr-brand img { width: 28px; height: 28px; object-fit: contain; }
.login-page .qr-subtitle { display: none; }
.login-page .qr-title { max-width: calc(100% - 24px); font-size: 22px; font-weight: 600; letter-spacing: -.04em; line-height: 1.25; color: #1b2d48; }
.login-page .btn-close-qr-modal { top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 12px; background: #f3f5f8; color: #6c7b91; }
.login-page .btn-close-qr-modal:hover { background: #e9eef5; color: #243b5d; }
.login-page .checar-qr-frame { --qr-size: max(214px, min(300px, calc(100vw - 64px), calc(100svh - 290px))); width: var(--qr-size); height: var(--qr-size); max-width: 100%; margin: 22px auto 0; padding: 16px; border: 1px solid #e1e7ef; border-radius: 20px; background: #fff; }
.login-page #qrcode-container { border-radius: 0; pointer-events: none; }
.login-page #qrcode-container img, .login-page #qrcode-container canvas, .login-page #qrcode-container table { border-radius: 0; }
.login-page .checar-qr-logo { display: grid; place-items: center; width: 26%; height: 26%; border: 1px solid #dce3ed; border-radius: 17%; box-shadow: 0 0 0 calc(var(--qr-size) * .012) #fff; }
.login-page .checar-qr-coco { display: block; width: 94%; height: 94%; object-fit: contain; transform: none; }
.login-page .checar-qr-hint { margin: 15px 0 0; font-size: 12px; line-height: 1.5; color: #6d7b90; }
.login-page .qr-meta { margin: 10px 0 0; font-size: 11px; line-height: 1.5; }
.login-page .qr-refresh-countdown { display: none; }
.login-page .qr-expiration { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid #deece4; border-radius: 999px; background: #f2f9f5; color: #49745d; }
.login-page .qr-expiration::before { content: ''; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%; background: #649a7c; }
.login-page .qr-meta strong { color: inherit; font-weight: 600; font-variant-numeric: tabular-nums; }
.login-page .qr-status { color: #b43c4b; font-size: 11px; line-height: 1.5; }
.login-page .qr-status:not(:empty) { margin-top: 10px; }
.login-page .qr-actions { flex-wrap: nowrap; width: 100%; margin-top: 22px; gap: 10px; }
.login-page .btn-refresh-qr, .login-page .btn-support-qr { flex: 1 1 0; max-width: none; min-height: 46px; padding: 11px 12px; border: 1px solid transparent; border-radius: 12px; font-size: 12px; font-weight: 500; }
.login-page .btn-refresh-qr { background: #294e83; color: #fff; }
.login-page .btn-refresh-qr:hover { background: #203e6a; }
.login-page .btn-support-qr { background: #f3f5f8; color: #516580; }
.login-page .btn-support-qr:hover { background: #e9eef5; }
.login-page .btn-support-qr svg { color: #5d8f73; }
.login-page .qr-powered { margin-top: 18px; opacity: .65; }
.login-page .qr-powered-coco { font-size: 13px; }
.login-page .qr-powered-time { font-size: 6px; }
@media (max-width: 340px), (max-height: 600px) {
    .login-page .checar-qr-logo { width: 24%; height: 24%; }
}
@media (min-width: 500px) and (max-height: 500px) {
    .login-page .checar-qr-frame { --qr-size: 300px; }
    .login-page .checar-qr-logo { width: 26%; height: 26%; }
}
@media (max-width: 599px) {
    .login-page .qr-modal-wrapper { padding: 0; align-items: flex-end; }
    .login-page .qr-card { width: 100%; max-height: calc(100dvh - 12px); border-radius: 28px 28px 0 0; border-bottom: 0; }
    .login-page .qr-card::before { content: ''; position: absolute; top: 9px; left: calc(50% - 18px); width: 36px; height: 4px; border-radius: 999px; background: #dde4ee; }
    .login-page .qr-modal-body { padding: 31px 24px max(20px, env(safe-area-inset-bottom)); }
    .login-page .btn-close-qr-modal { top: 17px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
@media print { body { background: #fff; } .login-container { box-shadow: none; } .btn-qr, .divider { display: none; } }
