:root {
    --auth-primary: #dc2626;
    --auth-primary-dark: #991b1b;
    --auth-primary-rgb: 220, 38, 38;
    --auth-background: #f4f7fb;
    --auth-surface: #ffffff;
    --auth-border: #dce3ed;
    --auth-text: #10223a;
    --auth-muted: #64748b;
    --auth-success: #11875d;
    --auth-warning: #d98b12;
    --auth-error: #c83d4f;
    --auth-radius: 20px;
    --auth-shadow: 0 20px 55px rgba(28, 42, 67, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--auth-background); }
body.auth-page {
    min-height: 100vh;
    margin: 0;
    color: var(--auth-text);
    background:
        radial-gradient(circle at 94% 5%, rgba(var(--auth-primary-rgb), .14), transparent 28%),
        radial-gradient(circle at 4% 92%, rgba(15, 23, 42, .08), transparent 24%),
        var(--auth-background);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--auth-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.auth-topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px clamp(18px, 5vw, 72px);
    border-bottom: 1px solid rgba(148, 163, 184, .22);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.auth-brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: var(--auth-text); }
.auth-brand:hover { text-decoration: none; }
.auth-brand-logo {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px; overflow: hidden;
    display: grid; place-items: center; background: rgba(var(--auth-primary-rgb), .1);
    color: var(--auth-primary); border: 1px solid rgba(var(--auth-primary-rgb), .18);
}
.auth-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-brand-copy { display: grid; line-height: 1.08; min-width: 0; }
.auth-brand-copy strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-brand-copy span { margin-top: 5px; color: var(--auth-muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.auth-nav a {
    min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 12px; border-radius: 10px; color: #334155; font-size: 13px; font-weight: 800;
}
.auth-nav a:hover { background: #eef2f7; text-decoration: none; }
.auth-nav .auth-nav-primary { color: #fff; background: var(--auth-primary); box-shadow: 0 8px 22px rgba(var(--auth-primary-rgb), .2); }
.auth-nav .auth-nav-primary:hover { background: var(--auth-primary-dark); }

.auth-shell { min-height: calc(100vh - 120px); display: grid; place-items: safe center; padding: 28px 18px 34px; }
.auth-card {
    width: min(950px, 100%);
    display: grid;
    grid-template-columns: minmax(290px, .93fr) minmax(380px, 1.07fr);
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow);
}
.auth-information {
    position: relative;
    min-height: 535px;
    padding: 34px;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(4, 8, 18, .95), rgba(17, 24, 39, .92)),
        var(--auth-side-image, none) center/cover no-repeat;
    color: #fff;
}
.auth-information::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 12% 8%, rgba(var(--auth-primary-rgb), .46), transparent 30%),
        linear-gradient(180deg, transparent 45%, rgba(2,6,23,.42));
    pointer-events: none;
}
.auth-information > * { position: relative; z-index: 1; }
.auth-eyebrow {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08);
    font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
}
.auth-information h1 { margin: 20px 0 12px; font-size: clamp(29px, 3.6vw, 40px); line-height: 1.05; letter-spacing: -.035em; }
.auth-information > p { margin: 0; max-width: 520px; color: #d7deea; line-height: 1.7; font-size: 14px; }
.auth-benefits { display: grid; gap: 10px; margin-top: 24px; }
.auth-benefit { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 13px; align-items: center; padding: 12px 13px; border: 1px solid rgba(255,255,255,.11); border-radius: 15px; background: rgba(255,255,255,.07); }
.auth-benefit-icon { width: 46px; height: 46px; display: grid; place-items: center; align-self: center; border-radius: 13px; background: rgba(var(--auth-primary-rgb), .27); color: #fff; font-size: 18px; line-height: 1; text-align: center; }
.auth-benefit-icon i { display: block; line-height: 1; }
.auth-benefit > span:last-child { min-width: 0; align-self: center; }
.auth-benefit strong { display: block; margin: 0 0 4px; font-size: 13px; line-height: 1.3; }
.auth-benefit > span:last-child > span { display: block; color: #cbd5e1; font-size: 12px; line-height: 1.45; }
.auth-side-note { margin-top: 28px; display: flex; align-items: flex-start; gap: 10px; color: #d7deea; font-size: 12px; line-height: 1.5; }
.auth-side-note i { color: #86efac; margin-top: 2px; }

.auth-form-panel { padding: 34px 36px; min-width: 0; }
.auth-form-heading { display: flex; align-items: flex-start; gap: 13px; }
.auth-form-heading-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 13px; color: var(--auth-primary); background: rgba(var(--auth-primary-rgb), .1); border: 1px solid rgba(var(--auth-primary-rgb), .14); }
.auth-form-heading h2 { margin: 0; color: var(--auth-text); font-size: 22px; letter-spacing: -.025em; }
.auth-form-heading p { margin: 7px 0 0; color: var(--auth-muted); font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 14px; margin-top: 20px; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-field { min-width: 0; }
.auth-field label { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; color: var(--auth-text); font-size: 13px; font-weight: 850; }
.auth-field label i { color: var(--auth-primary); width: 15px; text-align: center; }
.auth-optional { margin-left: auto; color: #94a3b8; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.auth-input-wrap { position: relative; }
.auth-input-wrap input,
.auth-input-wrap textarea,
.auth-input-wrap select {
    width: 100%; min-height: 45px; padding: 9px 44px 9px 51px; border: 1px solid var(--auth-border);
    border-radius: 11px; background: #fff; color: var(--auth-text); outline: none; font-size: 13px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-input-wrap textarea { min-height: 100px; resize: vertical; padding-top: 13px; }
.auth-input-wrap select { appearance: none; }
.auth-input-wrap input:hover,
.auth-input-wrap textarea:hover,
.auth-input-wrap select:hover { border-color: #b8c3d1; }
.auth-input-wrap input:focus,
.auth-input-wrap textarea:focus,
.auth-input-wrap select:focus { border-color: var(--auth-primary); box-shadow: 0 0 0 4px rgba(var(--auth-primary-rgb), .1); }
.auth-input-wrap input[aria-invalid="true"], .auth-input-wrap select[aria-invalid="true"], .auth-input-wrap textarea[aria-invalid="true"] { border-color: var(--auth-error); box-shadow: 0 0 0 4px rgba(200,61,79,.09); }
.auth-input-icon { position: absolute; top: 50%; left: 7px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #718096; background: #f1f5f9; transform: translateY(-50%); pointer-events: none; z-index: 1; }
.auth-password-toggle { position: absolute; top: 50%; right: 6px; width: 33px; height: 33px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #758399; transform: translateY(-50%); cursor: pointer; }
.auth-password-toggle:hover { background: #f1f5f9; color: var(--auth-primary); }
.auth-field small, .auth-help { display: block; margin-top: 6px; color: var(--auth-muted); font-size: 11.5px; line-height: 1.45; }
.field-error { min-height: 0; margin-top: 5px; color: var(--auth-error); font-size: 12px; font-weight: 750; }
.field-error:not(:empty) { min-height: 18px; }
.auth-form-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; }
.auth-check { display: inline-flex; align-items: flex-start; gap: 9px; color: #475569; font-size: 12px; line-height: 1.45; cursor: pointer; }
.auth-check input { width: 17px; height: 17px; margin: 0; flex: 0 0 17px; accent-color: var(--auth-primary); }
.auth-check--terms { padding: 11px 12px; border: 1px solid var(--auth-border); border-radius: 11px; background: #f8fafc; }
.auth-submit { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 11px; background: var(--auth-primary); color: #fff; font-weight: 850; cursor: pointer; box-shadow: 0 13px 28px rgba(var(--auth-primary-rgb), .22); transition: transform .16s ease, background .16s ease, opacity .16s ease; }
.auth-submit:hover { background: var(--auth-primary-dark); transform: translateY(-1px); }
.auth-submit:disabled { cursor: wait; opacity: .7; transform: none; }
.auth-submit .fa-spinner { animation: auth-spin .85s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-secondary-link { text-align: center; color: var(--auth-muted); font-size: 12.5px; }
.auth-secondary-link a { font-weight: 850; }
.auth-security-note, .auth-guide-box, .auth-trial-box { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 11px 12px; border-radius: 12px; font-size: 11.5px; line-height: 1.5; }
.auth-security-note { color: #166534; border: 1px solid #bbf7d0; background: #f0fdf4; }
.auth-guide-box { color: #1e40af; border: 1px solid #bfdbfe; background: #eff6ff; }
.auth-trial-box { color: #6d28d9; border: 1px solid #ddd6fe; background: #f5f3ff; }
.auth-security-note > i, .auth-guide-box > i, .auth-trial-box > i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.72); }
.auth-security-note strong, .auth-guide-box strong, .auth-trial-box strong { display: block; margin-bottom: 2px; }
.auth-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.auth-alert--error { color: #991b1b; background: #fff1f2; border: 1px solid #fecdd3; }
.auth-alert--success { color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; }
.auth-alert--warning { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; }
.auth-alert--info { color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; }
.password-strength { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #e8ecf2; }
.password-strength span { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--auth-error); transition: width .2s ease, background .2s ease; }
.auth-footer { border-top: 3px solid var(--auth-primary); background: #0f172a; color: #cbd5e1; }
.auth-footer-inner { width: min(1240px, calc(100% - 36px)); min-height: 58px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 10px 0; font-size: 11px; }
.auth-footer-brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.auth-footer-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: rgba(var(--auth-primary-rgb), .9); }
.auth-footer-brand strong, .auth-footer-brand small { display: block; }
.auth-footer-brand strong { color: #fff; font-size: 12px; }
.auth-footer-brand small { margin-top: 2px; color: #94a3b8; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.auth-footer-copy { text-align: center; }
.auth-footer-links { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.auth-footer a { color: #e2e8f0; font-weight: 800; }
.auth-footer a:hover { color: #fff; }
input::placeholder, textarea::placeholder { color: #98a2b3; opacity: 1; font-size: 12.5px; font-weight: 400; }
input:focus::placeholder, textarea:focus::placeholder { color: transparent; }

@media (max-width: 820px) {
    .auth-topbar { position: static; }
    .auth-nav a span { display: none; }
    .auth-card { grid-template-columns: 1fr; }
    .auth-form-panel { grid-row: 1; padding: 30px 24px; }
    .auth-information { grid-row: 2; min-height: auto; padding: 30px 24px; }
    .auth-information h1 { font-size: 30px; }
    .auth-benefits { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .auth-topbar { padding: 10px 14px; }
    .auth-brand-copy span { display: none; }
    .auth-nav a { width: 38px; height: 38px; padding: 0; }
    .auth-shell { padding: 18px 10px 28px; }
    .auth-card { border-radius: 18px; }
    .auth-form-panel { padding: 25px 18px; }
    .auth-information { padding: 25px 18px; }
    .auth-benefits, .auth-grid { grid-template-columns: 1fr; }
    .auth-form-options { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Evita que controles nativos del navegador se superpongan con nuestros iconos. */
.auth-input-wrap input::-webkit-credentials-auto-fill-button,
.auth-input-wrap input::-webkit-contacts-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
}
.auth-input-wrap input[type="password"]::-ms-reveal,
.auth-input-wrap input[type="password"]::-ms-clear { display: none; }
.auth-input-wrap:focus-within .auth-input-icon { color: var(--auth-primary); background: rgba(var(--auth-primary-rgb), .09); }
.auth-security-note > i { color: #15803d; }
.auth-guide-box > i { color: #2563eb; }
.auth-trial-box > i { color: #7c3aed; }
.auth-page-registro .auth-shell { place-items: start center; }
.auth-page-registro .auth-card { margin-top: 0; }

@media (max-width: 820px) {
    .auth-footer-inner { grid-template-columns: 1fr; justify-items: center; gap: 8px; padding: 13px 0; }
    .auth-footer-copy { order: 3; }
    .auth-footer-links { justify-content: center; flex-wrap: wrap; }
}


/* Ajustes 8.2: iconos descriptivos y textos guía más compactos. */
@media (max-width: 560px) {
    .auth-benefit { grid-template-columns: 42px minmax(0, 1fr); gap: 11px; }
    .auth-benefit-icon { width: 42px; height: 42px; font-size: 17px; }
}


/* ======================================================================
   Experiencia pública 8.4
   La imagen configurada vuelve a ser visible como fondo general, sin
   perjudicar la lectura de los formularios.
   ====================================================================== */
body.auth-page {
    background:
        linear-gradient(135deg, rgba(244,247,251,.80), rgba(255,255,255,.70) 46%, rgba(var(--auth-primary-rgb), .10)),
        var(--auth-page-image, none) center / cover fixed no-repeat;
}
.auth-card {
    background: rgba(255,255,255,.88);
    border-color: rgba(255,255,255,.72);
    box-shadow: 0 24px 68px rgba(15,23,42,.18);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}
.auth-form-panel {
    background: rgba(255,255,255,.94);
}
.auth-information {
    background:
        linear-gradient(145deg, rgba(4,8,18,.83), rgba(17,24,39,.79)),
        var(--auth-side-image, none) center / cover no-repeat;
}
.auth-information::before {
    background:
        radial-gradient(circle at 12% 8%, rgba(var(--auth-primary-rgb), .38), transparent 31%),
        linear-gradient(180deg, rgba(2,6,23,.05), rgba(2,6,23,.32));
}
@media (max-width: 780px) {
    body.auth-page { background-attachment: scroll; }
    .auth-card { background: rgba(255,255,255,.94); }
}


/* ======================================================================
   Experiencia pública 8.5
   La imagen configurada ocupa el fondo real de la página. Se elimina el
   velo gris anterior y se refuerza la calidad visual de la tarjeta.
   ====================================================================== */
body.auth-page {
    background-color: #eef2f7;
    background-image: var(--auth-page-image, none);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
body.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(115deg, rgba(255,255,255,.12), rgba(255,255,255,.03) 55%, rgba(var(--auth-primary-rgb), .06));
}
.auth-card {
    background: rgba(255,255,255,.97);
    border: 1px solid rgba(255,255,255,.92);
    box-shadow: 0 28px 76px rgba(15,23,42,.25), 0 2px 8px rgba(15,23,42,.08);
    backdrop-filter: blur(7px) saturate(112%);
    -webkit-backdrop-filter: blur(7px) saturate(112%);
}
.auth-form-panel { background: rgba(255,255,255,.985); }
.auth-information {
    background:
        linear-gradient(145deg, rgba(4,8,18,.84), rgba(17,24,39,.80)),
        var(--auth-side-image, none) center / cover no-repeat;
}
@media (max-width: 780px) {
    body.auth-page { background-attachment: scroll; }
    .auth-card { background: rgba(255,255,255,.985); }
}


/* ======================================================================
   Fondo real 8.6: la imagen configurada queda detrás de todos los formularios
   ====================================================================== */
html { background: #0f172a !important; }
body.auth-page {
    position: relative;
    isolation: isolate;
    background: transparent !important;
    background-image: none !important;
}
.auth-page-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #dfe6ee;
    background-image: var(--auth-page-image, none);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}
.auth-page-background::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(255,255,255,.08), rgba(255,255,255,.02) 55%, rgba(var(--auth-primary-rgb), .035));
}
.auth-topbar,
.auth-shell,
.auth-footer {
    position: relative;
    z-index: 1;
}
.auth-shell {
    background: transparent !important;
}
.auth-card {
    background: rgba(255,255,255,.985) !important;
    border-color: rgba(255,255,255,.96) !important;
    box-shadow: 0 28px 76px rgba(15,23,42,.28), 0 2px 10px rgba(15,23,42,.10) !important;
    backdrop-filter: blur(4px) saturate(108%) !important;
    -webkit-backdrop-filter: blur(4px) saturate(108%) !important;
}
.auth-form-panel { background: rgba(255,255,255,.985) !important; }
@media (max-width: 780px) {
    .auth-page-background { background-attachment: scroll; }
}


/* ======================================================================
   Fondo de autenticación 8.7
   Usa la imagen real assets/img/fondo.jpg como respaldo visible en Login,
   Registro, Solicitar reset y Restablecer contraseña.
   ====================================================================== */
body.auth-page {
    background: transparent !important;
}
.auth-page-background {
    background-color: #0f172a !important;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}
.auth-page-background::after {
    background: linear-gradient(115deg, rgba(2, 6, 23, .12), rgba(2, 6, 23, .025) 52%, rgba(var(--auth-primary-rgb), .065)) !important;
}
.auth-card {
    background: rgba(255, 255, 255, .965) !important;
    border-color: rgba(255, 255, 255, .92) !important;
    backdrop-filter: blur(3px) saturate(108%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(108%) !important;
}
.auth-form-panel { background: rgba(255, 255, 255, .975) !important; }
@media (max-width: 780px) {
    .auth-page-background { background-attachment: scroll !important; }
}
