:root {
    --auth-bg: #070806;
    --auth-panel: rgba(13, 14, 12, 0.92);
    --auth-gold: #d3a060;
    --auth-gold-light: #e0b478;
    --auth-border: rgba(217, 164, 98, 0.72);
    --auth-text: #f5f2ec;
    --auth-muted: #aaa9a4;
    --auth-input: rgba(26, 27, 25, 0.92);
    --auth-error: #ffb7ad;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--auth-bg);
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: "Montserrat", sans-serif;
}

.auth-page__background,
.auth-page__overlay {
    position: fixed;
    inset: 0;
}

.auth-page__background {
    background:
        radial-gradient(circle at 50% 18%, rgba(81, 57, 29, 0.22), transparent 34%);
}

.auth-page__overlay {
    background:
        linear-gradient(180deg, rgba(4, 5, 3, 0.56), rgba(4, 5, 3, 0.86) 48%, rgba(4, 5, 3, 0.97)),
        radial-gradient(circle at center, transparent 0, rgba(0, 0, 0, 0.52) 78%);
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(100%, 760px);
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(34px, 7vh, 76px) 28px 44px;
    flex-direction: column;
    align-items: center;
}

.auth-brand {
    width: 100%;
    text-align: center;
}

.auth-brand__shield {
    display: block;
    width: clamp(92px, 12vw, 136px);
    height: clamp(92px, 12vw, 136px);
    margin: 0 auto 20px;
    object-fit: contain;
}

.auth-brand__mission,
.auth-footer,
.auth-return,
.auth-field label,
.auth-button {
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.auth-brand__mission {
    margin: 0 0 18px;
    color: #d6a888;
    font-size: clamp(0.67rem, 1.7vw, 0.84rem);
    font-weight: 500;
}

.auth-brand h1 {
    margin: 0;
    color: #fff;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(3rem, 8vw, 5.35rem);
    font-weight: 500;
    letter-spacing: 0.015em;
    line-height: 0.94;
    text-transform: uppercase;
}

.auth-brand__subtitle {
    margin: 13px 0 30px;
    color: #c6c5c1;
    font-size: clamp(0.86rem, 2vw, 1.04rem);
}

.auth-card {
    width: 100%;
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    background: var(--auth-panel);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(10px);
}

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

.auth-fragment-heading {
    margin-bottom: 25px;
    text-align: center;
}

.auth-fragment-heading h2 {
    margin: 0 0 8px;
    color: #fff;
    font-family: "Cormorant Garamond", serif;
    font-size: 2.15rem;
    font-weight: 600;
    text-transform: uppercase;
}

.auth-fragment-heading p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

.auth-field {
    display: grid;
    gap: 10px;
}

.auth-field__heading {
    display: flex;
    min-height: 20px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.auth-field label {
    color: #f6f2eb;
    font-size: 0.74rem;
    font-weight: 600;
}

.auth-field__error {
    color: var(--auth-error);
    font-size: 0.7rem;
}

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

.auth-input-wrap > i {
    position: absolute;
    top: 50%;
    left: 19px;
    z-index: 1;
    width: 20px;
    color: #bfc0bd;
    font-size: 1rem;
    text-align: center;
    transform: translateY(-50%);
}

.auth-input {
    display: block;
    width: 100%;
    height: 60px;
    padding: 0 54px 0 55px;
    border: 1px solid #4a4b47;
    border-radius: 7px;
    outline: 0;
    background: var(--auth-input);
    color: #fff;
    font: 500 0.94rem "Montserrat", sans-serif;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-input::placeholder {
    color: #848581;
}

.auth-input:focus {
    border-color: var(--auth-gold-light);
    background: rgba(31, 31, 28, 0.98);
    box-shadow: 0 0 0 3px rgba(211, 160, 96, 0.14);
}

.auth-input.is-invalid,
.auth-input.has-error {
    border-color: #b96457;
}

.auth-input.is-valid {
    border-color: #64655f;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #bfc0bd;
    cursor: pointer;
    place-items: center;
    transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    color: var(--auth-gold-light);
}

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

.auth-link,
.auth-back,
.auth-cancel {
    padding: 0;
    border: 0;
    background: transparent;
    color: #aaa9a4;
    cursor: pointer;
    font: 500 0.78rem "Montserrat", sans-serif;
}

.auth-link:hover,
.auth-link:focus-visible,
.auth-back:hover,
.auth-back:focus-visible {
    color: #fff;
}

.auth-link--gold {
    color: #d5a986;
}

.auth-button {
    display: flex;
    width: 100%;
    min-height: 60px;
    padding: 14px 24px;
    border-radius: 7px;
    align-items: center;
    justify-content: center;
    gap: 18px;
    cursor: pointer;
    font: 600 0.84rem "Montserrat", sans-serif;
    text-decoration: none;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.auth-button:hover,
.auth-button:focus-visible {
    transform: translateY(-1px);
}

.auth-button--primary {
    border: 1px solid var(--auth-gold);
    background: linear-gradient(135deg, var(--auth-gold-light), #c58e4e);
    color: #15130f;
}

.auth-button--primary:hover,
.auth-button--primary:focus-visible {
    background: linear-gradient(135deg, #e8bd82, #d59e5c);
}

.auth-button--outline {
    border: 1px solid var(--auth-border);
    background: transparent;
    color: #d6a888;
}

.auth-button--outline:hover,
.auth-button--outline:focus-visible {
    border-color: var(--auth-gold-light);
    background: rgba(211, 160, 96, 0.08);
    color: #f1c9a9;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 15px;
    color: #a4a39f;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    background: linear-gradient(90deg, transparent, #4b4b47);
    content: "";
}

.auth-divider::after {
    background: linear-gradient(90deg, #4b4b47, transparent);
}

.auth-return {
    display: flex;
    margin: 35px 0 0;
    align-items: center;
    gap: 13px;
    color: #d2a587;
    font-size: 0.72rem;
    font-weight: 500;
    text-decoration: none;
}

.auth-return:hover,
.auth-return:focus-visible {
    color: #f0c7a7;
}

.auth-footer {
    display: flex;
    margin-top: 52px;
    align-items: center;
    flex-direction: column;
    gap: 9px;
    color: #aaa9a4;
    font-size: 0.68rem;
    text-align: center;
}

.auth-footer small {
    color: #82837f;
    font-size: 0.7rem;
    letter-spacing: 0;
    text-transform: none;
}

.auth-footer__lock {
    display: grid;
    width: 42px;
    height: 42px;
    margin-bottom: 5px;
    border: 1px solid var(--auth-border);
    border-radius: 50%;
    color: #d6a888;
    place-items: center;
}

.auth-alert,
.auth-feedback {
    margin-bottom: 22px;
    padding: 13px 15px;
    border: 1px solid rgba(185, 100, 87, 0.72);
    border-radius: 7px;
    background: rgba(116, 42, 32, 0.24);
    color: #ffd4cd;
    font-size: 0.82rem;
    line-height: 1.5;
}

.auth-feedback--success {
    margin: 0;
    border-color: rgba(211, 160, 96, 0.72);
    background: rgba(211, 160, 96, 0.1);
    color: #f2d2ae;
    text-align: center;
}

.auth-context {
    margin: 0 0 22px;
    color: var(--auth-muted);
    font-size: 0.84rem;
    text-align: center;
}

.auth-back,
.auth-cancel {
    justify-self: center;
    color: #d5a986;
}

.auth-strength {
    display: grid;
    gap: 10px;
    color: #b7b7b2;
    font-size: 0.74rem;
    line-height: 1.5;
}

.auth-strength__bars {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.auth-strength__bars i {
    height: 5px;
    border-radius: 20px;
    background: #4b4c48;
}

.auth-strength__bars .pwBox {
    width: auto;
}

.auth-strength__bars .red_bg { background: #a84235; }
.auth-strength__bars .orange_bg { background: #c57a38; }
.auth-strength__bars .yellow_bg { background: #d7b44f; }
.auth-strength__bars .green_bg { background: #6d9c62; }

@media (max-width: 640px) {
    .auth-shell {
        padding: 26px 16px 34px;
    }

    .auth-brand__shield {
        margin-bottom: 15px;
    }

    .auth-brand h1 {
        font-size: clamp(2.7rem, 14vw, 4rem);
    }

    .auth-brand__subtitle {
        margin-bottom: 24px;
        line-height: 1.55;
    }

    .auth-card {
        padding: 25px 20px;
        border-radius: 14px;
    }

    .auth-form {
        gap: 22px;
    }

    .auth-input {
        height: 56px;
    }

    .auth-form__links {
        align-items: flex-end;
        flex-direction: column-reverse;
    }

    .auth-button {
        min-height: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
