/* Acceso a la consola: pantalla de inicio de sesión, cambio de contraseña y menú del usuario */

/* mientras no hay sesión la consola no se muestra */
body.af-locked header.top, body.af-locked .layout { visibility: hidden; }
body.af-locked { overflow: hidden; }

.auth { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center;
    background: radial-gradient(120% 90% at 15% 10%, #2E2970 0%, #1B1846 45%, #110F2E 100%); color: #fff; overflow: hidden;
    transition: opacity .6s ease, transform .6s ease; }
.auth.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }
.auth canvas.auth-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.auth::after { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, rgba(17, 15, 46, .15) 0%, rgba(17, 15, 46, .0) 40%, rgba(17, 15, 46, .55) 100%); }

/* auroras */
.auth-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; will-change: transform; }
.auth-blob.b1 { width: 520px; height: 520px; background: #E15750; left: -140px; bottom: -180px; opacity: .35; animation: blob1 18s ease-in-out infinite alternate; }
.auth-blob.b2 { width: 460px; height: 460px; background: #4C48A8; right: 8%; top: -160px; animation: blob2 22s ease-in-out infinite alternate; }
.auth-blob.b3 { width: 300px; height: 300px; background: #8E3B6E; left: 40%; top: 55%; opacity: .3; animation: blob3 16s ease-in-out infinite alternate; }
@keyframes blob1 { to { transform: translate(180px, -120px) scale(1.15); } }
@keyframes blob2 { to { transform: translate(-160px, 140px) scale(.9); } }
@keyframes blob3 { to { transform: translate(-120px, -160px) scale(1.2); } }

/* lado izquierdo */
.auth-hero { position: relative; z-index: 2; padding: 0 4vw 0 6vw; max-width: 820px; }
.auth-hero .wm { font-weight: 600; font-size: 40px; letter-spacing: -1px; display: flex; align-items: baseline; gap: 2px; line-height: 1; }
.auth-hero .wm .i { background: var(--grad-i); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero .wm-tag { font-size: 11px; font-weight: 600; letter-spacing: 2.5px; color: #FFB4AE; border: 1px solid rgba(255, 180, 174, .35);
    background: rgba(225, 87, 80, .14); border-radius: 999px; padding: 3px 11px; margin-left: 12px; align-self: center; }
.auth-hero h1 { color: #fff; font-size: clamp(30px, 3.2vw, 46px); line-height: 1.12; font-weight: 600; letter-spacing: -1px; margin: 34px 0 16px; }
.auth-hero h1 em { font-style: normal; background: linear-gradient(90deg, #FF8E86, #E15750 40%, #B9B6FF 100%); background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s ease-in-out infinite alternate; }
@keyframes shine { to { background-position: 100% 0; } }
.auth-hero .typed { font-size: 16px; color: #C9C6EE; min-height: 26px; }
.auth-hero .typed b { color: #fff; font-weight: 600; }
.auth-hero .typed .caret { display: inline-block; width: 2px; height: 18px; background: #FF8E86; vertical-align: -3px; margin-left: 2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.auth-feats { list-style: none; padding: 0; margin: 34px 0 0; display: grid; gap: 12px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #E4E2FA; opacity: 0; transform: translateX(-14px);
    animation: featIn .7s cubic-bezier(.2, .8, .2, 1) forwards; }
.auth-feats li:nth-child(1) { animation-delay: .35s; } .auth-feats li:nth-child(2) { animation-delay: .5s; }
.auth-feats li:nth-child(3) { animation-delay: .65s; } .auth-feats li:nth-child(4) { animation-delay: .8s; }
@keyframes featIn { to { opacity: 1; transform: none; } }
.auth-feats i { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12); flex: 0 0 34px; }
.auth-feats svg { width: 17px; height: 17px; stroke: #FFB4AE; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-legend { margin-top: 38px; display: flex; gap: 18px; font-size: 11.5px; color: #A9A6D6; }
.auth-legend span { display: inline-flex; align-items: center; gap: 7px; }
.auth-legend span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }

/* tarjeta */
.auth-side { position: relative; z-index: 2; display: flex; justify-content: center; padding: 24px; }
.auth-card { position: relative; width: 100%; max-width: 420px; border-radius: 26px; padding: 1.5px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(5, 3, 30, .55); animation: cardIn .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.auth-card::before { content: ""; position: absolute; inset: -60%; animation: spin 7s linear infinite;
    background: conic-gradient(from 0deg, rgba(255, 255, 255, .08) 0 55%, #E15750 70%, #B9B6FF 82%, rgba(255, 255, 255, .08) 95%); }
@keyframes spin { to { transform: rotate(1turn); } }
.auth-inner { position: relative; background: #fff; color: var(--ink); border-radius: 24.5px; padding: 34px 34px 26px; }
.auth-card.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.auth-step { display: none; }
.auth-step.on { display: block; animation: stepIn .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } }
.auth-inner h2 { font-size: 23px; font-weight: 600; letter-spacing: -.4px; }
.auth-inner .lead { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.auth-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: .5px; color: var(--ok);
    background: var(--ok-bg); border-radius: 999px; padding: 4px 11px; margin-bottom: 16px; }
.auth-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }

/* campos con etiqueta flotante */
.fl { position: relative; margin-bottom: 14px; }
.fl input { width: 100%; height: 56px; border: 1.5px solid var(--line); border-radius: 15px; padding: 20px 46px 6px 46px; font-size: 14.5px;
    background: var(--surface-2); outline: none; transition: border-color .2s, background .2s, box-shadow .2s; }
.fl input:focus { border-color: var(--indigo); background: #fff; box-shadow: 0 0 0 4px rgba(76, 72, 168, .12); }
.fl label { position: absolute; left: 46px; top: 18px; font-size: 14px; color: var(--muted); pointer-events: none; transition: .18s ease; }
.fl input:focus + label, .fl input:not(:placeholder-shown) + label { top: 8px; font-size: 11px; color: var(--indigo); font-weight: 500; }
.fl > svg { position: absolute; left: 15px; top: 18px; width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.fl:focus-within > svg { stroke: var(--indigo); }
.fl .eye { position: absolute; right: 8px; top: 9px; width: 38px; height: 38px; border: 0; background: none; border-radius: 10px; cursor: pointer;
    display: grid; place-items: center; color: var(--muted); }
.fl .eye:hover { background: var(--info-bg); color: var(--ink); }
.fl .eye svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fl.bad input { border-color: var(--bad); animation: none; }
.caps { font-size: 11.5px; color: var(--warn); margin: -8px 0 10px 4px; display: flex; gap: 6px; align-items: center; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 18px; font-size: 12.5px; color: var(--ink-soft); }
.auth-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-row input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.auth-err { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 14px;
    display: flex; gap: 8px; align-items: flex-start; animation: stepIn .3s ease; }
.auth-info { background: var(--info-bg); color: var(--ink-soft); border-radius: 12px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 14px; }

.auth-btn { position: relative; width: 100%; height: 52px; border: 0; border-radius: 15px; cursor: pointer; overflow: hidden; color: #fff;
    font-weight: 600; font-size: 15px; letter-spacing: .2px; background: linear-gradient(100deg, #24205A 0%, #3B3690 55%, #E15750 130%);
    background-size: 160% 100%; transition: background-position .5s, transform .15s, box-shadow .3s; box-shadow: 0 10px 24px rgba(36, 32, 90, .28);
    display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-btn:hover { background-position: 100% 0; box-shadow: 0 14px 30px rgba(225, 87, 80, .3); }
.auth-btn:active { transform: scale(.985); }
.auth-btn::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-18deg); animation: sheen 3.8s ease-in-out infinite; }
@keyframes sheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.auth-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.auth-btn:hover svg { transform: translateX(4px); }
.auth-btn[disabled] { cursor: progress; opacity: .9; }
.auth-btn .spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
.auth-link { background: none; border: 0; color: var(--indigo); font-weight: 500; cursor: pointer; padding: 0; font-size: 12.5px; text-decoration: underline;
    text-underline-offset: 3px; text-decoration-color: rgba(76, 72, 168, .3); }
.auth-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.auth-foot svg { width: 15px; height: 15px; stroke: var(--ok); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 15px; }

/* verificación de sesión */
.auth-check { display: none; position: absolute; inset: 0; z-index: 3; place-items: center; text-align: center; }
.auth.checking .auth-check { display: grid; }
.auth.checking .auth-hero, .auth.checking .auth-side { display: none; }
.auth-check .ring { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #FF8E86; animation: spin .9s linear infinite; margin: 18px auto 0; }

/* medidor de fortaleza */
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: -4px 2px 6px; }
.meter b { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .35s cubic-bezier(.2, .8, .2, 1), background .35s; }
.meter-l { font-size: 11.5px; color: var(--muted); margin: 0 2px 10px; display: flex; justify-content: space-between; }
.reqs { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; font-size: 12px; color: var(--muted); }
.reqs li { display: flex; align-items: center; gap: 7px; transition: color .2s; }
.reqs li::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #CFD1E3; flex: 0 0 15px; transition: .25s; }
.reqs li.ok { color: var(--ok); }
.reqs li.ok::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/11px no-repeat;
    transform: scale(1.08); }
.suggest { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed #CFD1E3; border-radius: 12px; padding: 8px 10px; margin: 0 0 14px; font-size: 12px; }
.suggest .tag { font-size: 10.5px; font-weight: 600; letter-spacing: .6px; color: var(--muted); text-transform: uppercase; }
.suggest code { flex: 1; background: none; font-size: 13px; letter-spacing: .5px; color: var(--ink); overflow-wrap: anywhere; }

/* menú del usuario en la cabecera */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px 4px 4px; cursor: pointer; }
.user-btn:hover { border-color: #CFD1E3; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12.5px;
    background: linear-gradient(135deg, #4C48A8, #E15750); flex: 0 0 32px; }
.user-btn .who { text-align: left; line-height: 1.15; }
.user-btn .who b { display: block; font-size: 12.5px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who span { font-size: 10.5px; color: var(--muted); }
.user-drop { position: absolute; right: 0; top: calc(100% + 8px); width: 270px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 18px 44px rgba(36, 32, 90, .16); padding: 8px; z-index: 40; animation: stepIn .2s ease; }
.user-drop .hd { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.user-drop .hd b { display: block; font-size: 13px; }
.user-drop .hd .sub { display: block; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; margin-bottom: 5px; }
.user-drop .hd > div { min-width: 0; }
.user-drop button { display: flex; width: 100%; align-items: center; gap: 10px; background: none; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer;
    font-size: 13px; color: var(--ink); text-align: left; }
.user-drop button:hover { background: var(--surface-2); }
.user-drop button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-drop .note { margin: 4px 6px 6px; font-size: 11.5px; }

/* gestión de usuarios */
#navAdmin .cat { margin-top: 18px; }
.role { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .4px; border-radius: 999px; padding: 2px 9px; }
.role-ADMIN { background: #EDE1F7; color: #6A2C91; } .role-ANALISTA { background: var(--info-bg); color: var(--indigo); } .role-CONSULTA { background: var(--surface-2); color: var(--ink-soft); }
.secret { display: flex; gap: 8px; align-items: center; background: var(--warn-bg); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.secret code { flex: 1; font-size: 14px; background: #fff; padding: 4px 8px; letter-spacing: .5px; }

@media (max-width: 980px) {
    .auth { grid-template-columns: minmax(0, 1fr); align-content: center; overflow-y: auto; }
    .auth-hero { padding: 28px 24px 0; text-align: center; }
    .auth-hero .wm { justify-content: center; font-size: 32px; }
    .auth-hero h1 { font-size: 26px; margin: 18px 0 8px; }
    .auth-hero .typed, .auth-feats, .auth-legend { display: none; }
    .auth-side { padding: 18px 16px 28px; }
    .auth-inner { padding: 26px 22px 20px; }
    .user-btn .who { display: none; }
    .user-btn { padding: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-blob, .auth-card::before, .auth-btn::after, .auth-hero h1 em, .auth-feats li { animation: none !important; }
    .auth-feats li { opacity: 1; transform: none; }
    .auth-card, .auth-step.on { animation: none; }
}
td.actions .icon-btn { width: 34px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; margin: 0 2px; }
td.actions .icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
