:root {
    --auth-maroon: #7A1E2C;
    --auth-deep-maroon: #4A0F19;
    --auth-dark-maroon: #5D1823;
    --auth-red: #C64747;
    --auth-cream: #F5E9E5;
    --auth-soft-cream: #FFF9F6;
    --auth-gold: #D97706;
    --auth-text: #2B2020;
    --auth-muted: #786B67;
    --auth-white: #FFFFFF;
    --auth-danger: #C9363E;
    --auth-success: #23835B;
    --auth-warning: #B7791F;
    --auth-card-width: 540px;
}

* {
    box-sizing: border-box;
}

html,
body.auth-portal-body {
    min-width: 320px;
}

body.auth-portal-body {
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    color: var(--auth-text);
    background-color: var(--auth-deep-maroon);
    background-image:
        linear-gradient(115deg, rgba(57, 7, 16, .82), rgba(122, 30, 44, .68) 55%, rgba(198, 71, 71, .58)),
        var(--auth-background-image, linear-gradient(135deg, #351017, #7A1E2C 55%, #B74449));
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    isolation: isolate;
}

body.auth-portal-body::before,
body.auth-portal-body::after {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
}

body.auth-portal-body::before {
    opacity: .22;
    background-image:
        linear-gradient(rgba(255, 255, 255, .22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .22) 1px, transparent 1px);
    background-size: 38px 38px;
}

body.auth-portal-body::after {
    background: radial-gradient(circle at center, transparent 24%, rgba(38, 4, 10, .33) 100%);
}

.auth-portal-body .ss-auth-shell {
    min-height: 100vh;
    min-height: 100svh;
}

.auth-portal {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: 56px 20px;
}

.auth-card {
    position: relative;
    width: min(100%, var(--auth-card-width));
    overflow: hidden;
    padding: clamp(28px, 4vw, 42px);
    border: 1px solid rgba(255, 255, 255, .52);
    border-radius: 32px;
    background: linear-gradient(145deg, rgba(255, 249, 246, .96), rgba(245, 233, 229, .94));
    box-shadow: 0 32px 80px rgba(39, 5, 11, .36), inset 0 1px 0 rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: authCardIn 520ms cubic-bezier(.2, .8, .2, 1) both;
}

.auth-card__orb {
    position: absolute;
    top: -82px;
    right: -72px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(122, 30, 44, .075);
    pointer-events: none;
}

.auth-header {
    position: relative;
    z-index: 1;
    margin-bottom: 28px;
    text-align: center;
}

.auth-logo {
    display: block;
    width: 86px;
    height: 86px;
    margin: 0 auto 17px;
    object-fit: contain;
    border: 5px solid rgba(255, 255, 255, .78);
    border-radius: 50%;
    background: var(--auth-white);
    box-shadow: 0 12px 30px rgba(74, 15, 25, .16);
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 7px 15px;
    border: 1px solid rgba(198, 71, 71, .32);
    border-radius: 999px;
    color: var(--auth-dark-maroon);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .035em;
    line-height: 1;
    text-transform: uppercase;
}

.auth-badge span {
    width: 34px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--auth-red), var(--auth-gold));
}

.auth-header h1 {
    margin: 17px 0 8px;
    color: var(--auth-dark-maroon);
    font-family: "Playfair Display", Merriweather, Georgia, serif;
    font-size: clamp(2rem, 5vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.08;
}

.auth-header p {
    max-width: 430px;
    margin: 0 auto;
    color: var(--auth-muted);
    font-size: .97rem;
    font-weight: 600;
    line-height: 1.62;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--auth-dark-maroon);
    font-size: .84rem;
    font-weight: 800;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    top: 50%;
    left: 18px;
    z-index: 2;
    color: var(--auth-red);
    font-size: 1.05rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-input {
    display: block;
    width: 100%;
    min-height: 56px;
    padding: 12px 18px 12px 51px;
    border: 1.5px solid rgba(122, 30, 44, .14);
    border-radius: 18px;
    outline: 3px solid transparent;
    color: var(--auth-text);
    background: rgba(255, 255, 255, .96);
    box-shadow: inset 0 1px 2px rgba(74, 15, 25, .03), 0 6px 16px rgba(74, 15, 25, .04);
    font: 600 .94rem/1.3 Inter, system-ui, sans-serif;
    transition: border-color 180ms ease, box-shadow 180ms ease, outline-color 180ms ease, background-color 180ms ease;
}

.auth-input::placeholder {
    color: #9A9290;
    opacity: 1;
}

.auth-input:hover {
    border-color: rgba(122, 30, 44, .3);
}

.auth-input:focus {
    border-color: var(--auth-red);
    outline-color: rgba(198, 71, 71, .14);
    background: var(--auth-white);
    box-shadow: 0 8px 22px rgba(122, 30, 44, .1);
}

.auth-input.is-invalid,
.auth-input[aria-invalid="true"] {
    border-color: var(--auth-danger);
    outline-color: rgba(201, 54, 62, .1);
}

.auth-input:disabled {
    cursor: not-allowed;
    opacity: .68;
    background: #EEE6E3;
}

.auth-input[readonly] {
    color: var(--auth-dark-maroon);
    background: rgba(245, 233, 229, .72);
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    box-shadow: 0 0 0 1000px var(--auth-white) inset, 0 8px 22px rgba(122, 30, 44, .1);
    transition: background-color 9999s ease-out;
}

.auth-input-wrap--action .auth-input {
    padding-right: 62px;
}

.auth-input-action {
    position: absolute;
    top: 50%;
    right: 8px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    color: var(--auth-red);
    background: rgba(122, 30, 44, .065);
    transform: translateY(-50%);
    cursor: pointer;
    transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.auth-input-action:hover {
    color: var(--auth-deep-maroon);
    background: rgba(122, 30, 44, .12);
}

.auth-input-action:focus-visible,
.auth-alert__close:focus-visible,
.auth-button:focus-visible,
.auth-link:focus-visible,
.auth-check input:focus-visible {
    outline: 3px solid rgba(217, 119, 6, .35);
    outline-offset: 3px;
}

.auth-field-error {
    margin: 7px 4px 0;
    color: var(--auth-danger);
    font-size: .79rem;
    font-weight: 700;
    line-height: 1.4;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 1px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--auth-dark-maroon);
    font-size: .84rem;
    font-weight: 750;
    cursor: pointer;
}

.auth-check input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--auth-maroon);
    cursor: pointer;
}

.auth-link {
    border-radius: 5px;
    color: var(--auth-dark-maroon);
    font-size: .84rem;
    font-weight: 800;
    text-decoration: none;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

.auth-link:hover {
    color: var(--auth-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-link--center {
    display: block;
    margin-top: 18px;
    text-align: center;
}

.auth-link-button {
    padding: 0;
    border: 0;
    border-radius: 5px;
    color: var(--auth-dark-maroon);
    background: transparent;
    font: 800 .84rem/1.4 Inter, system-ui, sans-serif;
    cursor: pointer;
}

.auth-link-button:hover {
    color: var(--auth-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 11px 20px;
    border-radius: 999px;
    font: 800 .92rem/1.2 Inter, system-ui, sans-serif;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.auth-button--primary {
    border: 1px solid transparent;
    color: var(--auth-white);
    background: linear-gradient(110deg, var(--auth-red), var(--auth-maroon) 58%, var(--auth-dark-maroon));
    box-shadow: 0 14px 28px rgba(122, 30, 44, .22);
}

.auth-button--primary:hover {
    color: var(--auth-white);
    box-shadow: 0 17px 32px rgba(122, 30, 44, .3);
    transform: translateY(-1px);
}

.auth-button--primary:active {
    transform: translateY(0);
}

.auth-button--secondary {
    border: 1.5px solid rgba(122, 30, 44, .25);
    color: var(--auth-dark-maroon);
    background: rgba(255, 255, 255, .58);
}

.auth-button--secondary:hover {
    border-color: rgba(122, 30, 44, .45);
    color: var(--auth-deep-maroon);
    background: rgba(255, 255, 255, .9);
}

.auth-notice {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 11px;
    align-items: start;
    margin-top: 21px;
    padding: 15px 16px;
    border: 1px solid rgba(122, 30, 44, .16);
    border-radius: 16px;
    color: #625653;
    background: rgba(122, 30, 44, .055);
    font-size: .8rem;
    font-weight: 650;
    line-height: 1.5;
}

.auth-notice i {
    margin-top: 1px;
    color: var(--auth-maroon);
    font-size: .98rem;
}

.auth-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 17px;
}

.auth-chips span {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 13px;
    border: 1px solid rgba(122, 30, 44, .09);
    border-radius: 999px;
    color: var(--auth-dark-maroon);
    background: rgba(255, 255, 255, .72);
    font-size: .73rem;
    font-weight: 800;
}

.auth-support {
    margin: 12px 0 0;
    color: var(--auth-muted);
    font-size: .74rem;
    text-align: center;
}

.auth-card--verification .auth-header {
    margin-bottom: 20px;
}

.auth-card--support {
    --auth-card-width: 560px;
}

.auth-card--support .auth-header {
    margin-bottom: 22px;
}

.auth-support-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 17px;
    border: 1px solid rgba(122, 30, 44, .15);
    border-radius: 18px;
    background: rgba(255, 255, 255, .58);
}

.auth-support-panel__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: var(--auth-maroon);
    background: rgba(122, 30, 44, .09);
    font-size: 1.2rem;
}

.auth-support-panel h2,
.auth-recovery-steps h2 {
    margin: 0;
    color: var(--auth-dark-maroon);
    font-family: Inter, system-ui, sans-serif;
    font-size: .92rem;
    font-weight: 850;
    letter-spacing: 0;
}

.auth-support-panel p {
    margin: 5px 0 0;
    color: var(--auth-muted);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.55;
}

.auth-recovery-steps {
    margin: 21px 0;
}

.auth-recovery-steps > h2 {
    margin-bottom: 12px;
}

.auth-recovery-steps ol {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-recovery-steps li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.auth-recovery-steps li > span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(122, 30, 44, .14);
    border-radius: 50%;
    color: var(--auth-maroon);
    background: rgba(255, 255, 255, .72);
    font-size: .75rem;
    font-weight: 850;
}

.auth-recovery-steps strong,
.auth-recovery-steps small {
    display: block;
}

.auth-recovery-steps strong {
    color: var(--auth-text);
    font-size: .8rem;
    font-weight: 800;
}

.auth-recovery-steps small {
    margin-top: 2px;
    color: var(--auth-muted);
    font-size: .73rem;
    font-weight: 600;
    line-height: 1.4;
}

.auth-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -2px 0 18px;
    padding: 12px 14px;
    border-radius: 15px;
    color: var(--auth-dark-maroon);
    background: rgba(217, 119, 6, .08);
}

.auth-contact > i {
    font-size: 1.05rem;
}

.auth-contact span,
.auth-contact strong {
    display: block;
}

.auth-contact span {
    color: var(--auth-muted);
    font-size: .69rem;
    font-weight: 700;
}

.auth-contact strong {
    margin-top: 1px;
    overflow-wrap: anywhere;
    font-size: .77rem;
    font-weight: 800;
}

.auth-notice--compact {
    margin-top: 15px;
    padding: 12px 14px;
}

.auth-inline-action {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 18px;
    color: var(--auth-muted);
    font-size: .82rem;
    font-weight: 700;
}

.auth-password-help {
    padding: 12px 14px;
    border: 1px solid rgba(122, 30, 44, .14);
    border-radius: 15px;
    color: var(--auth-muted);
    background: rgba(255, 255, 255, .56);
    font-size: .8rem;
    font-weight: 650;
    line-height: 1.55;
}

.auth-email-panel {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid rgba(122, 30, 44, .13);
    border-radius: 16px;
    background: rgba(255, 255, 255, .55);
}

.auth-email-panel > i {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    color: var(--auth-maroon);
    background: rgba(122, 30, 44, .09);
    font-size: 1.12rem;
}

.auth-email-panel span,
.auth-email-panel strong {
    display: block;
}

.auth-email-panel span {
    margin-bottom: 2px;
    color: var(--auth-muted);
    font-size: .72rem;
    font-weight: 700;
}

.auth-email-panel strong {
    overflow-wrap: anywhere;
    color: var(--auth-dark-maroon);
    font-size: .88rem;
}

.auth-field--otp label {
    text-align: center;
}

.auth-otp-input {
    min-height: 66px;
    padding: 12px 12px 12px 20px;
    border-radius: 18px;
    background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(16.666% - 1px), rgba(122, 30, 44, .09) calc(16.666% - 1px), rgba(122, 30, 44, .09) 16.666%);
    font-size: 1.65rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: .72em;
    line-height: 1;
    text-align: center;
    text-indent: .72em;
}

.auth-field-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px 14px;
    margin: 8px 3px 0;
    color: var(--auth-muted);
    font-size: .72rem;
    font-weight: 650;
}

.auth-secondary-form {
    margin-top: 12px;
}

.auth-secondary-form p {
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: .72rem;
    text-align: center;
}

.auth-cancel-form {
    margin-top: 10px;
    text-align: center;
}

.auth-link--button {
    min-height: 40px;
    padding: 6px 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.auth-alert-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2400;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.auth-alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 13px;
    align-items: start;
    max-height: 220px;
    margin: 0;
    padding: 15px 12px 15px 15px;
    overflow: hidden;
    border: 1px solid #E7E2E1;
    border-left-width: 4px;
    border-radius: 10px;
    opacity: 1;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 44px rgba(34, 15, 18, .17);
    transform: translateY(0);
    pointer-events: auto;
    animation: authAlertIn 260ms ease both;
    transition: opacity 220ms ease, transform 220ms ease, max-height 300ms ease, margin 300ms ease, padding 300ms ease, border-width 300ms ease, box-shadow 220ms ease;
}

.auth-alert.is-closing {
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    opacity: 0;
    box-shadow: none;
    transform: translateY(-10px);
    pointer-events: none;
}

.auth-alert__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.05rem;
}

.auth-alert__title,
.auth-alert__message {
    display: block;
}

.auth-alert__title {
    margin: 1px 0 2px;
    color: #172033;
    font-size: .9rem;
    font-weight: 850;
}

.auth-alert__message {
    overflow-wrap: anywhere;
    color: #65748C;
    font-size: .85rem;
    line-height: 1.48;
}

.auth-alert__close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: -3px -3px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #64748B;
    background: transparent;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}

.auth-alert__close:hover {
    color: #1E293B;
    background: #F1F5F9;
}

.auth-alert--error { border-left-color: var(--auth-danger); }
.auth-alert--success { border-left-color: var(--auth-success); }
.auth-alert--warning { border-left-color: var(--auth-warning); }
.auth-alert--info { border-left-color: #3478B8; }
.auth-alert--error .auth-alert__icon { color: #A71D2A; background: #FDE4E6; }
.auth-alert--success .auth-alert__icon { color: #166B49; background: #DDF5EA; }
.auth-alert--warning .auth-alert__icon { color: #8A5A13; background: #FEF0CF; }
.auth-alert--info .auth-alert__icon { color: #23679D; background: #E1F0FB; }

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authAlertIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 575.98px) {
    .auth-portal {
        place-items: start center;
        padding: 20px 14px;
    }

    .auth-card {
        width: 100%;
        padding: 25px 20px;
        border-radius: 25px;
    }

    .auth-logo {
        width: 74px;
        height: 74px;
        margin-bottom: 14px;
    }

    .auth-header {
        margin-bottom: 23px;
    }

    .auth-header h1 {
        margin-top: 14px;
        font-size: clamp(1.8rem, 9.2vw, 2.25rem);
    }

    .auth-header p {
        font-size: .88rem;
    }

    .auth-form {
        gap: 17px;
    }

    .auth-input {
        min-height: 53px;
    }

    .auth-options {
        align-items: flex-start;
        font-size: .8rem;
    }

    .auth-check,
    .auth-link {
        font-size: .8rem;
    }

    .auth-notice {
        margin-top: 18px;
        padding: 13px 14px;
    }

    .auth-otp-input {
        min-height: 62px;
        font-size: 1.42rem;
        letter-spacing: .55em;
        text-indent: .55em;
    }

    .auth-field-meta {
        flex-direction: column;
        align-items: center;
    }

    .auth-support-panel {
        padding: 15px;
    }

    .auth-support-panel__icon {
        width: 40px;
        height: 40px;
    }

    .auth-alert-stack {
        top: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }

    .auth-alert {
        gap: 10px;
        padding: 13px 9px 13px 12px;
    }
}

@media (max-height: 760px) and (min-width: 576px) {
    .auth-portal {
        place-items: start center;
        padding-top: 28px;
        padding-bottom: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-alert,
    .auth-field,
    .auth-button,
    .auth-input,
    .auth-input-action,
    .auth-alert__close {
        animation: none !important;
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
