/* Módulo auth — overlay estilo bloqueo de SO y formularios (sin CDN). */
.grid-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: transparent;
    color: #f2f4f8;
}
.grid-auth-overlay.auth-loading {
    pointer-events: none;
    opacity: 0.92;
}

.grid-auth-bg-root {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #0a0c10;
}
.grid-auth-bg-default {
    position: absolute;
    inset: 0;
    background: linear-gradient(165deg, #1a2332 0%, #0d1118 45%, #141c28 100%);
}
.grid-auth-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.grid-auth-bg-slideshow {
    position: absolute;
    inset: 0;
}
.grid-auth-bg-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.1s ease-in-out;
    pointer-events: none;
}
.grid-auth-bg-slide--visible {
    opacity: 1;
    z-index: 1;
}

.grid-auth-os-shell {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-height: 100dvh;
    pointer-events: none;
}
.grid-auth-os-shell .grid-auth-card-wrap {
    pointer-events: auto;
}
.grid-auth-os-top {
    flex-shrink: 0;
    padding: clamp(1.5rem, 7vh, 4rem) 1rem 0.5rem;
    text-align: center;
}
.grid-auth-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.65);
    font-variant-numeric: tabular-nums;
}
.grid-auth-clock-time {
    font-size: clamp(1.35rem, 4.5vw, 2.35rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.1;
}
.grid-auth-clock-date {
    font-size: clamp(0.52rem, 1.6vw, 0.72rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.88;
    line-height: 1.35;
}
.grid-auth-os-spacer {
    flex: 1;
    min-height: 1rem;
}
.grid-auth-card-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 1rem 1rem 2rem;
    box-sizing: border-box;
}

.grid-auth-card {
    width: min(440px, 92vw);
    max-height: min(78vh, 720px);
    overflow: auto;
    padding: 1.25rem 1.35rem;
    border-radius: 12px;
    background: rgba(22, 26, 36, 0.55);
    backdrop-filter: blur(22px) saturate(1.35);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: inherit;
}
.grid-auth-brand {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.85rem;
    letter-spacing: 0.02em;
}
.auth-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 0.85rem;
    padding: 3px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-sizing: border-box;
}
.auth-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 0.35rem 0.45rem;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.auth-tab:hover {
    background: rgba(255, 255, 255, 0.06);
}
.auth-tab:focus-visible {
    outline: 2px solid rgba(160, 195, 255, 0.95);
    outline-offset: 2px;
    z-index: 1;
}
.auth-tab-active {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
}
.auth-label {
    display: block;
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0.88;
    margin: 0.5rem 0 0.28rem;
}
.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    margin-bottom: 0.45rem;
}
.auth-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
    margin-top: 0.65rem;
}
.auth-btn {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.auth-btn-primary {
    background: linear-gradient(180deg, #5b7cfa, #3d55d8);
    color: #fff;
}
.auth-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.18);
}
.auth-link {
    background: none;
    border: none;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.9;
}
.auth-foot {
    margin-top: 0.55rem;
    text-align: center;
}
.auth-hint {
    font-size: 0.82rem;
    opacity: 0.85;
    margin: 0.25rem 0 0.5rem;
}
.auth-recovery-code {
    font-size: 1.1rem;
    text-align: center;
    margin: 0.65rem 0;
    padding: 0.55rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
}
.auth-pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    max-width: 200px;
    margin: 0.5rem auto;
}
.auth-pattern-dot {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    cursor: pointer;
    font-weight: 600;
}
.auth-pattern-seq {
    text-align: center;
    font-size: 0.85rem;
    min-height: 1.2rem;
}
.auth-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-modal {
    width: min(400px, 92vw);
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(25, 28, 38, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #eee;
}
.auth-modal--wide {
    width: min(520px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
}
.auth-muted {
    font-size: 0.82rem;
    opacity: 0.88;
    margin: 0 0 0.65rem;
    line-height: 1.4;
}
.auth-muted code {
    font-size: 0.85em;
    opacity: 0.95;
}
.auth-fieldset-login {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 0.65rem 0.75rem 0.85rem;
    margin: 0.75rem 0 0.5rem;
}
.auth-fieldset-login legend {
    padding: 0 0.35rem;
    font-size: 0.88rem;
}
.auth-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-family: inherit;
    font-size: 0.88rem;
    resize: vertical;
    margin-bottom: 0.45rem;
}
.auth-modal-title {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
}
.auth-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.45rem 0;
    font-size: 0.88rem;
}
.auth-perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}
.grid-auth-profile-fab {
    position: fixed;
    left: 14px;
    bottom: 126px;
    z-index: 9990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(40, 45, 60, 0.92);
    color: #dde4ff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    display: none;
}
.grid-auth-admin-fab {
    position: fixed;
    left: 14px;
    bottom: 72px;
    z-index: 9990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(40, 45, 60, 0.92);
    color: #dde4ff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}
.auth-toast {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(30, 35, 48, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #eee;
    font-size: 0.88rem;
    animation: authToastIn 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: min(92vw, 28rem);
    border-left: 3px solid currentColor;
}
.auth-toast .auth-toast-icon {
    color: inherit;
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
}
.auth-toast .auth-toast-text {
    text-align: left;
    word-break: break-word;
}
.auth-toast-out {
    opacity: 0;
    transition: opacity 0.35s ease;
}
@keyframes authToastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
body.grid-auth-booting .topbar,
body.grid-auth-booting .grid-container,
body.grid-auth-booting .desktop-shortcuts,
body.grid-auth-booting .taskbar,
body.grid-auth-booting .add-app-btn,
body.grid-auth-booting .config-btn {
    visibility: hidden;
}
body.grid-auth-locked .topbar,
body.grid-auth-locked .grid-container,
body.grid-auth-locked .desktop-shortcuts,
body.grid-auth-locked .taskbar,
body.grid-auth-locked .add-app-btn,
body.grid-auth-locked .config-btn {
    filter: grayscale(0.25);
    pointer-events: none;
    user-select: none;
}
