:root {
    --primary: #603085;
    --accent: #72482E;
    --soft: #F3E8E3;
    --ink: #2D2030;
    --muted: #735F67;
    --line: #DECFC8;
    --danger: #A61B1B;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--soft);
    color: var(--ink);
    font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(520px, .75fr);
    min-height: 100vh;
}

.auth-brand {
    position: relative;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 5rem);
    background:
        radial-gradient(circle at 85% 12%, rgba(243, 232, 227, .3), transparent 35%),
        linear-gradient(145deg, #3E1F57, var(--primary) 64%, var(--accent));
    color: #fff;
}

.auth-brand::after {
    position: absolute;
    right: -12rem;
    bottom: -14rem;
    width: 34rem;
    height: 34rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    box-shadow:
        0 0 0 4rem rgba(255, 255, 255, .04),
        0 0 0 8rem rgba(255, 255, 255, .03);
    content: "";
}

.auth-back {
    position: relative;
    z-index: 1;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.auth-close {
    display: none;
}

.brand-copy,
.trust-note {
    position: relative;
    z-index: 1;
    max-width: 42rem;
}

.brand-mark {
    display: grid;
    width: 4rem;
    height: 4rem;
    place-items: center;
    margin-bottom: 2rem;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 20px 45px rgba(45, 32, 48, .24);
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 900;
}

.eyebrow {
    margin: 0 0 .7rem;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.brand-copy h1 {
    margin: 0;
    font-size: clamp(2.7rem, 5.5vw, 5.5rem);
    line-height: .96;
    letter-spacing: -.055em;
}

.brand-copy > .brand-description {
    max-width: 35rem;
    margin: 1.8rem 0 0;
    color: rgba(255, 255, 255, .8);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.65;
}

.trust-note {
    margin: 0;
    color: rgba(255, 255, 255, .72);
    font-size: .9rem;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: clamp(1.25rem, 3vw, 3rem);
    background: var(--soft);
}

.auth-card {
    width: min(100%, 31rem);
    padding: clamp(1.5rem, 3vw, 3.25rem);
    border: 1px solid rgba(114, 72, 46, .14);
    border-radius: 1.55rem;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 28px 80px rgba(69, 32, 95, .16);
}

.auth-card.auth-card-wide {
    width: min(100%, 36rem);
}

.auth-heading h2 {
    margin: .15rem 0 .6rem;
    font-size: clamp(2rem, 3vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -.045em;
}

.auth-heading > p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.auth-heading .eyebrow {
    color: var(--primary);
}

.auth-form {
    display: grid;
    gap: 1.15rem;
    margin-top: 1.75rem;
}

.auth-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field {
    display: grid;
    min-width: 0;
    gap: .5rem;
}

.field label,
.label-row {
    color: #44363e;
    font-size: .8rem;
    font-weight: 600;
}

.optional {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 600;
}

.label-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.label-row a,
.auth-foot a {
    color: var(--primary);
}

input {
    width: 100%;
    min-height: 3.2rem;
    padding: .8rem .95rem;
    border: 1px solid var(--line);
    border-radius: .8rem;
    background: #fefcfd;
    color: var(--ink);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

input::placeholder {
    color: rgba(115, 95, 103, .62);
}

input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 .24rem rgba(96, 48, 133, .16);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 4.5rem;
}

.password-toggle {
    position: absolute;
    right: .45rem;
    top: .45rem;
    bottom: .45rem;
    padding: 0 .75rem;
    border: 0;
    border-radius: .55rem;
    background: var(--soft);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
}

.field-help {
    margin: -.55rem 0 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.45;
}

.contact-help {
    margin-top: -.75rem;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    color: var(--muted);
    font-size: .86rem;
    line-height: 1.45;
}

.check input {
    width: 1.05rem;
    min-height: 1.05rem;
    margin-top: .1rem;
    accent-color: var(--primary);
}

.submit-button {
    min-height: 3.3rem;
    border: 0;
    border-radius: .8rem;
    background: linear-gradient(115deg, var(--primary), #72409a);
    box-shadow: 0 12px 24px rgba(96, 48, 133, .24);
    color: #fff;
    font: inherit;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: transform .15s, background .15s;
}

.submit-button:hover {
    transform: translateY(-1px);
    background: var(--accent);
}

.auth-foot {
    margin: 1.5rem 0 0;
    color: var(--muted);
    text-align: center;
}

.auth-security {
    margin: .75rem 0 0;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.45;
    text-align: center;
}

.notice {
    margin-bottom: 1.4rem;
    padding: .9rem 1rem;
    border-radius: .8rem;
    font-size: .9rem;
}

.notice ul {
    margin: 0;
    padding-left: 1.2rem;
}

.notice.danger {
    border: 1px solid #F4CACA;
    background: #FFF0F0;
    color: var(--danger);
}

.notice.success {
    border: 1px solid rgba(114, 72, 46, .28);
    background: var(--soft);
    color: var(--primary);
}

.required-label {
    margin-left: .3rem;
    padding: .16rem .38rem;
    border-radius: 999px;
    background: var(--soft);
    color: var(--primary);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

input.is-valid {
    border-color: #4f8a68;
    background-color: #fbfffc;
    box-shadow: 0 0 0 .2rem rgba(79, 138, 104, .09);
}

input.is-invalid {
    border-color: #b54550;
    background-color: #fffafb;
    box-shadow: 0 0 0 .2rem rgba(181, 69, 80, .09);
}

.validation-message {
    display: none;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 500;
    line-height: 1.3;
}

.validation-message.is-visible {
    display: block;
}

.validation-message.is-success {
    color: #367453;
}

.validation-message.is-error {
    color: #a12f3d;
}

.registration-auth-form .field {
    position: relative;
    padding-bottom: .9rem;
}

.registration-auth-form .validation-message {
    position: absolute;
    left: 0;
    bottom: 0;
    max-width: 100%;
    text-align: left;
    white-space: nowrap;
}

.registration-auth-form .field.has-success > label,
.registration-auth-form .field.has-success > .label-row label {
    color: #367453;
}

.registration-auth-form .field.has-error > label,
.registration-auth-form .field.has-error > .label-row label {
    color: #a12f3d;
}

.login-auth-form .validation-message {
    margin-top: -.2rem;
}

.password-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem .65rem;
    margin-top: .55rem;
    color: #8b7b84;
    font-size: .62rem;
    font-weight: 500;
}

.password-rules span {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.password-rules span::before {
    width: .4rem;
    height: .4rem;
    flex: 0 0 .4rem;
    border-radius: 50%;
    background: #cbbdc4;
    content: "";
    transition: background .15s, box-shadow .15s;
}

.password-rules span.is-valid {
    color: #367453;
}

.password-rules span.is-valid::before {
    background: #4f8a68;
    box-shadow: 0 0 0 .18rem rgba(79, 138, 104, .1);
}

.password-rules span.is-pending {
    color: #a12f3d;
}

.password-rules span.is-pending::before {
    background: #b54550;
}

.password-rules-dropdown {
    position: absolute;
    z-index: 30;
    left: 0;
    top: calc(100% - .35rem);
    width: 100%;
    padding: .75rem .8rem;
    border: 1px solid rgba(96, 48, 133, .16);
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 16px 34px rgba(69, 32, 95, .17);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-.3rem);
    visibility: hidden;
    transition: transform .15s, visibility .15s;
}

.password-rules-dropdown > strong {
    display: block;
    color: var(--ink);
    font-size: .66rem;
    font-weight: 600;
}

.registration-auth-form .field:focus-within {
    z-index: 20;
}

.registration-auth-form .field:focus-within .password-rules-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.registration-auth-form .field:focus-within .validation-message[data-validation-for="password"] {
    opacity: 0;
    visibility: hidden;
}

@media (min-width: 1051px) {
    body.register-auth-page:not(.has-auth-errors) {
        overflow: hidden;
    }

    .register-auth-page .auth-shell {
        height: 100vh;
        min-height: 0;
    }

    .register-auth-page .auth-panel {
        min-height: 0;
        padding: clamp(.75rem, 1.6vh, 1.2rem) clamp(1rem, 2.2vw, 2.5rem);
    }

    .register-auth-page .auth-card-wide {
        max-height: calc(100vh - 1.5rem);
        padding: clamp(1.4rem, 2.5vh, 2rem) clamp(1.5rem, 2.5vw, 2.5rem);
    }

    .register-auth-page .auth-heading .eyebrow {
        margin-bottom: .4rem;
        font-size: .68rem;
    }

    .register-auth-page .auth-heading h2 {
        margin-bottom: .35rem;
        font-size: clamp(2rem, 2.45vw, 2.5rem);
    }

    .register-auth-page .auth-heading > p:last-child {
        font-size: .86rem;
        line-height: 1.4;
    }

    .register-auth-page .auth-form {
        gap: .85rem;
        margin-top: 1.15rem;
    }

    .register-auth-page .auth-form-grid {
        gap: .75rem;
    }

    .register-auth-page .field {
        gap: .3rem;
    }

    .register-auth-page .field label {
        font-size: .8rem;
    }

    .register-auth-page input {
        min-height: 2.9rem;
        padding: .62rem .8rem;
        border-radius: .7rem;
        font-size: .88rem;
    }

    .register-auth-page .password-wrap input {
        padding-right: 4rem;
    }

    .register-auth-page .password-toggle {
        top: .3rem;
        right: .3rem;
        bottom: .3rem;
        padding: 0 .65rem;
        font-size: .78rem;
    }

    .register-auth-page .field-help {
        margin-top: -.32rem;
        font-size: .68rem;
        line-height: 1.35;
    }

    .register-auth-page .contact-help {
        margin-top: -.42rem;
    }

    .register-auth-page .check {
        gap: .55rem;
        font-size: .76rem;
        line-height: 1.35;
    }

    .register-auth-page .check input {
        width: 1rem;
        min-height: 1rem;
    }

    .register-auth-page .submit-button {
        min-height: 3rem;
        border-radius: .7rem;
        font-size: .85rem;
    }

    .register-auth-page .auth-foot {
        margin-top: .95rem;
        font-size: .8rem;
    }

    .register-auth-page .auth-security {
        margin-top: .35rem;
        font-size: .65rem;
        line-height: 1.3;
    }
}

@media (min-width: 1051px) and (max-height: 680px) {
    .register-auth-page .auth-brand {
        padding-block: 1.5rem;
    }

    .register-auth-page .brand-mark {
        width: 3rem;
        height: 3rem;
        margin-bottom: 1rem;
        border-radius: .9rem;
        font-size: 1rem;
    }

    .register-auth-page .brand-copy h1 {
        font-size: clamp(2.6rem, 4.6vw, 4.5rem);
    }

    .register-auth-page .brand-copy > .brand-description {
        margin-top: 1rem;
        font-size: .92rem;
    }

    .register-auth-page .auth-card-wide {
        padding: .85rem 1.5rem;
    }

    .register-auth-page .auth-heading h2 {
        font-size: 1.85rem;
    }

    .register-auth-page .auth-heading > p:last-child {
        font-size: .76rem;
    }

    .register-auth-page .auth-form {
        gap: .5rem;
        margin-top: .65rem;
    }

    .register-auth-page input {
        min-height: 2.45rem;
        padding-block: .45rem;
        font-size: .82rem;
    }

    .register-auth-page .password-toggle {
        font-size: .72rem;
    }

    .register-auth-page .check {
        font-size: .7rem;
    }

    .register-auth-page .submit-button {
        min-height: 2.55rem;
    }

    .register-auth-page .auth-foot {
        margin-top: .5rem;
        font-size: .74rem;
    }

    .register-auth-page .auth-security {
        display: none;
    }
}

@media (max-width: 1050px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        min-height: 18rem;
        padding: 2rem;
    }

    .brand-copy {
        margin-top: 3rem;
    }

    .brand-copy h1 {
        font-size: clamp(2.4rem, 10vw, 4rem);
    }

    .brand-copy > .brand-description,
    .trust-note {
        display: none;
    }

    .auth-panel {
        padding: 1.25rem;
    }

    .auth-card {
        border-radius: 1.25rem;
    }
}

@media (max-width: 560px) {
    .auth-form-grid {
        grid-template-columns: 1fr;
    }

    .password-rules-dropdown {
        position: static;
        display: none;
        margin-top: .35rem;
        opacity: 1;
        transform: none;
        visibility: visible;
    }

    .registration-auth-form .field:focus-within .password-rules-dropdown {
        display: block;
    }
}

@media (max-width: 420px) {
    .auth-brand {
        min-height: 13rem;
        padding: 1.25rem;
    }

    .auth-back {
        font-size: .9rem;
    }

    .brand-copy {
        margin-top: 1.25rem;
    }

    .brand-mark {
        width: 2.8rem;
        height: 2.8rem;
        margin-bottom: .75rem;
        border-radius: .9rem;
        font-size: 1rem;
    }

    .brand-copy .eyebrow {
        margin-bottom: .55rem;
        font-size: .68rem;
    }

    .brand-copy h1 {
        font-size: clamp(2rem, 9vw, 2.45rem);
        line-height: 1;
    }

    .auth-panel {
        align-items: start;
        padding: .85rem;
    }

    .auth-card {
        padding: 1.2rem;
        border-radius: 1.15rem;
    }

    .auth-heading h2 {
        font-size: 2rem;
    }

    .auth-heading > p:last-child {
        font-size: .94rem;
        line-height: 1.5;
    }

    .auth-form {
        gap: 1rem;
        margin-top: 1.35rem;
    }

    input {
        min-height: 3rem;
    }

    .submit-button {
        min-height: 3.1rem;
    }

    .auth-foot {
        margin-top: 1.15rem;
        font-size: .92rem;
    }
}

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

/* Horizontal brand lockup in the authentication hero. */
.auth-body .auth-wordmark {
    display: block;
    width: clamp(168px, 18vw, 210px);
    max-width: 100%;
    height: auto;
    margin: 0 0 1.5rem;
    object-fit: contain;
}

@media (max-width: 740px) {
    .auth-body .auth-wordmark { width: 150px; margin-bottom: .8rem; }
}
