:root {
    --primary: #6B4E91;
    --primary-dark: #4E3470;
    --primary-base: #9A7ABC;
    --primary-light: #EDE6F6;
    --primary-soft: #F5F2FB;
    --gold: #BCA428;
    --gold-dark: #8C7A1E;
    --gold-light: #D4BE4E;
    --white: #FFFFFF;
    --bg: #F8F6FC;
    --border: #DDD6EC;
    --text: #3D2858;
    --text-light: #786B92;
    --error: #DC2626;
    --success: #16A34A;
    --font: 'Inter', sans-serif;
    --font-normal: 400;
    --font-medium: 500;
    --font-semi: 600;
    --font-bold: 700;
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.auth-body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--bg);
    font-family: var(--font);
    overflow-x: hidden;
}

.auth-stage {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 25%, #EFEAF8 0%, transparent 55%),
        radial-gradient(circle at 88% 70%, #E8E0F2 0%, transparent 60%),
        linear-gradient(160deg, #F5F2FB 0%, #EDE6F6 45%, #E4DAF1 100%);
}

.auth-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.auth-bg-curves {
    fill: rgba(213, 198, 232, 0.45);
}

.auth-decor {
    position: absolute;
    top: 0;
    right: 0;
    width: 560px;
    height: 560px;
    z-index: 1;
    color: var(--gold);
    opacity: 0.42;
    pointer-events: none;
}

.auth-wave {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 42vh;
    min-height: 240px;
    z-index: 0;
    pointer-events: none;
}

.auth-wave-1 {
    fill: rgba(178, 156, 206, 0.40);
}

.auth-wave-2 {
    fill: rgba(154, 122, 188, 0.48);
}

.auth-wave-3 {
    fill: rgba(107, 78, 145, 0.58);
}

.auth-wave-4 {
    fill: rgba(78, 52, 112, 0.9);
}

.auth-wave-gold {
    stroke: rgba(188, 164, 40, 0.75);
}

.auth-wave-gold-2 {
    stroke: rgba(212, 190, 78, 0.5);
}

.auth-content {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    gap: 56px;
    max-width: 1320px;
    margin: 0 auto;
    padding: 48px 56px 96px;
    box-sizing: border-box;
}

.auth-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 44px;
    min-width: 0;
}

.auth-right {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-left-body {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    flex: none;
}

.auth-left-escudo {
    width: 210px;
    flex-shrink: 0;
    margin-top: 22px;
    filter: drop-shadow(0 6px 18px rgba(78, 52, 112, 0.18));
}

.auth-left-escudo img {
    width: 100%;
    height: auto;
    display: block;
}

.auth-left-content {
    flex: 1;
    min-width: 0;
    max-width: 460px;
}

.auth-left-pretitle {
    font-size: 15px;
    color: #8B7BA5;
    margin: 0 0 8px 0;
}

.auth-left-title {
    font-size: 46px;
    font-weight: var(--font-bold);
    color: var(--primary-dark);
    line-height: 1.05;
    margin: 0 0 18px 0;
    letter-spacing: -1px;
}

.auth-left-inst {
    font-size: 17px;
    font-weight: var(--font-semi);
    color: var(--gold-dark);
    margin: 0 0 3px 0;
}

.auth-left-consejo {
    font-size: 13px;
    color: #9A8526;
    font-weight: var(--font-medium);
    margin: 0 0 18px 0;
}

.auth-left-divider {
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%);
    border-radius: 2px;
    margin-bottom: 18px;
}

.auth-left-desc {
    font-size: 14px;
    color: #6B6280;
    line-height: 1.7;
    margin: 0;
    max-width: 340px;
}

.auth-left-modules {
    display: flex;
    gap: 14px;
    flex: none;
}

.auth-module-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 14px;
    width: 124px;
    box-shadow: 0 2px 8px rgba(61, 40, 88, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-module-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(61, 40, 88, 0.12);
}

.auth-module-item svg {
    color: var(--primary-base);
    fill: var(--primary-base);
}

.auth-module-item span {
    font-size: 11px;
    font-weight: var(--font-semi);
    color: var(--primary-dark);
    text-align: center;
    line-height: 1.35;
}

.auth-pagefoot {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 24px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.auth-pagefoot-lema {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
}

.auth-pagefoot-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(212, 190, 78, 0.75);
}

.auth-pagefoot a {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: var(--font-semi);
}

.auth-pagefoot a:hover {
    color: #fff;
}

.auth-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(61, 40, 88, 0.13);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-base) 0%, var(--primary-dark) 100%);
    padding: 20px 26px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-header-logo {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.22));
}

.auth-header-text h2 {
    color: #fff;
    font-size: 19px;
    font-weight: var(--font-semi);
    margin: 0 0 3px;
}

.auth-header-text p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    margin: 0;
}

.auth-body-content {
    padding: 28px 26px;
    background: var(--white);
}

.auth-footer {
    padding: 12px 26px 18px;
    text-align: center;
    background: var(--white);
    border-top: 1px solid var(--border);
}

.auth-footer p {
    font-size: 11px;
    color: var(--text-light);
    margin: 0;
}

.auth-register-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 18px;
    border: 1.5px dashed rgba(154, 122, 188, 0.4);
    border-radius: 12px;
    background: var(--primary-soft);
}

.auth-register-info {
    flex: 1;
    min-width: 0;
}

.auth-register-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semi);
    color: var(--primary-dark);
    margin: 0 0 3px 0;
}

.auth-register-desc {
    font-size: var(--text-xs);
    color: var(--text-light);
    margin: 0;
}

.auth-register-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 9px 18px;
    border: 1.5px solid var(--primary-base);
    border-radius: 10px;
    background: transparent;
    color: var(--primary-dark);
    font-size: var(--text-sm);
    font-weight: var(--font-semi);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.auth-register-btn svg {
    fill: var(--primary-base);
    transition: fill 0.2s ease;
}

.auth-register-btn:hover {
    background: var(--primary-base);
    color: #fff;
}

.auth-register-btn:hover svg {
    fill: #fff;
}

.auth-mesa-link {
    text-align: center;
    margin-top: 14px;
}

.auth-mesa-link a {
    font-size: var(--text-sm);
    color: var(--primary-base);
    font-weight: var(--font-medium);
    text-decoration: none;
}

.auth-mesa-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.alert {
    position: relative;
    border-radius: 8px;
    padding: 10px 40px 10px 14px;
    font-size: var(--text-sm);
    margin-bottom: 16px;
    line-height: 1.5;
}

.alert-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.alert-close:hover {
    opacity: 1;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: var(--font-semi);
    color: #756A8C;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 7px;
}

.form-label svg {
    color: var(--primary-base);
    flex-shrink: 0;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 44px 0 16px;
    font-size: 16px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.input-wrap input:focus {
    border-color: var(--primary-base);
    box-shadow: 0 0 0 3px rgba(154, 122, 188, 0.16);
}

.input-wrap input::placeholder {
    color: #B5ACCB;
}

.input-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    color: #B5ACCB;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.input-btn-static {
    pointer-events: none;
}

.input-btn:hover {
    color: var(--primary-base);
}

.field-error {
    color: var(--error);
    font-size: var(--text-xs);
    display: block;
    margin-top: 5px;
}

.btn-submit {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-base) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: var(--font-semi);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(78, 52, 112, 0.28);
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transform: translateY(-1px);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: cop-spin 0.7s linear infinite;
    display: none;
    flex-shrink: 0;
}

@keyframes cop-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1100px) {
    .auth-content {
        padding: 40px 40px 88px;
        gap: 36px;
    }

    .auth-right {
        width: 388px;
    }

    .auth-left-escudo {
        width: 168px;
    }

    .auth-left-title {
        font-size: 38px;
    }

    .auth-decor {
        width: 440px;
        height: 440px;
    }
}

@media (max-width: 900px) {
    .auth-left-modules {
        display: none;
    }
}

@media (max-width: 768px) {
    .auth-content {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 28px 22px 80px;
        gap: 22px;
    }

    .auth-left {
        flex: none;
        justify-content: flex-start;
        gap: 0;
    }

    .auth-left-body {
        display: none;
    }

    .auth-decor {
        display: none;
    }

    .auth-right {
        width: 100%;
    }

    .auth-card {
        max-width: 100%;
        box-shadow: 0 12px 40px rgba(61, 40, 88, 0.22);
    }

    .auth-register-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .auth-register-btn {
        width: 100%;
        justify-content: center;
    }

    .auth-wave {
        height: 26vh;
        min-height: 160px;
    }

    .auth-pagefoot {
        position: relative;
        margin-top: 16px;
        padding: 16px 12px;
    }
}

@media (max-width: 420px) {
    .auth-content {
        padding: 24px 16px 72px;
    }

    .auth-header-logo {
        width: 68px;
        height: 68px;
    }

    .auth-card {
        border-radius: 12px;
    }

    .auth-body-content {
        padding: 24px 20px;
    }

    .auth-header {
        padding: 20px 20px 18px;
    }

    .auth-pagefoot {
        flex-direction: column;
        gap: 6px;
    }

    .auth-pagefoot-sep {
        display: none;
    }
}