:root {
    --ink: #26263a;
    --muted: #828398;
    --line: #e8e9f0;
    --page: #f7f8fc;
    --panel: #fff;
    --primary: #6965e8;
    --primary-dark: #5551d5;
    --primary-soft: #f0efff;
    --green: #24ad78;
    --red: #df6674;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: "DM Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(430px, .96fr);
    min-height: 100vh;
}

.brand-panel {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    padding: 26px clamp(28px, 5vw, 70px);
    overflow: hidden;
    background:
        radial-gradient(ellipse at 3% 100%, rgba(146, 139, 255, .2), transparent 40%),
        radial-gradient(ellipse at 94% 22%, rgba(196, 193, 255, .48), transparent 40%),
        #f1f0ff;
}

.brand-panel::after {
    position: absolute;
    right: -110px;
    bottom: 7%;
    width: 370px;
    height: 370px;
    border: 1px solid rgba(105, 101, 232, .12);
    border-radius: 50%;
    box-shadow: 0 0 0 32px rgba(105, 101, 232, .035), 0 0 0 68px rgba(105, 101, 232, .025);
    content: "";
    pointer-events: none;
}

.topbar,
.top-actions,
.brand-mark {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
}

.topbar {
    justify-content: space-between;
    gap: 18px;
}

.brand-mark {
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark > span,
.mini-logo {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(145deg, #8b87ff, #5d59df);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 5px 12px rgba(105, 101, 232, .2);
}

.brand-mark .brand-emblem-window,
.form-heading .brand-emblem-window {
    display: inline-block;
    padding: 0;
    border-radius: 8px;
    background: #242424;
    box-shadow: none;
}

.brand-mark .brand-emblem-window--nav {
    width: 42px;
    height: 38px;
    flex: 0 0 42px;
}

.form-heading .brand-emblem-window--mini {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.brand-mark strong {
    font-family: Manrope, "DM Sans", sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.top-actions {
    gap: 7px;
}

.ghost-link {
    display: inline-flex;
    min-width: 64px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #676780;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}

.ghost-link:hover {
    border-color: #e1dfff;
    background: rgba(255, 255, 255, .62);
    color: var(--primary-dark);
    text-decoration: none;
}

.hero-copy {
    position: relative;
    z-index: 1;
    max-width: 620px;
    padding: 50px 0;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.hero-copy h1 {
    max-width: 590px;
    margin: 0;
    color: #2b2b43;
    font-family: Manrope, "DM Sans", sans-serif;
    font-size: clamp(33px, 4.2vw, 51px);
    font-weight: 700;
    letter-spacing: -.06em;
    line-height: 1.1;
}

.hero-copy > p:last-child {
    max-width: 500px;
    margin: 18px 0 0;
    color: #73748e;
    font-size: 14px;
    line-height: 1.7;
}

.trust-strip {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}

.trust-strip span {
    min-height: 62px;
    padding: 12px;
    border: 1px solid rgba(110, 107, 188, .12);
    border-radius: 9px;
    background: rgba(255, 255, 255, .54);
    color: #73738b;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
}

.auth-panel {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 30px clamp(22px, 4vw, 60px);
    background: var(--page);
}

.auth-card {
    width: min(100%, 430px);
    max-height: calc(100vh - 50px);
    padding: 30px 32px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 13px 38px rgba(43, 42, 83, .055);
}

.mobile-auth-actions,
.mobile-auth-back {
    display: none;
}

.form-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 22px;
}

.form-heading h2 {
    margin: 0;
    color: var(--ink);
    font-family: Manrope, "DM Sans", sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.045em;
}

.input-box {
    position: relative;
    margin-bottom: 14px;
}

.input-box label {
    display: block;
    margin: 0 0 6px;
    color: #515268;
    font-size: 11px;
    font-weight: 600;
}

.input-box input,
.input-box select {
    display: block;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #dedfea;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input-box input:focus,
.input-box select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(105, 101, 232, .12);
}

.input-box small {
    display: block;
    margin-top: 6px;
    color: #85869a;
    font-size: 10px;
    line-height: 1.45;
}

.input-box input::placeholder {
    color: #a0a1b0;
}

.referral-input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.referral-input-group button {
    min-width: 82px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f7fb;
    color: #62637a;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.referral-input-group button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.referral-input-group button:disabled {
    cursor: wait;
    opacity: .65;
}

.referral-message {
    display: block;
    min-height: 16px;
    margin-top: 5px;
    color: #8b8c9e;
    font-size: 10px;
    line-height: 1.4;
}

.referral-message.success,
.success {
    color: var(--green);
}

.referral-message.error,
.error {
    color: var(--red);
}

#password,
#confirmPassword {
    padding-right: 67px;
}

.toggle-btn {
    position: absolute;
    right: 7px;
    bottom: 6px;
    min-width: 45px;
    height: 29px;
    padding: 0 7px;
    border: 0;
    border-radius: 5px;
    background: #f3f3f8;
    color: #74758a;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

#password-message {
    display: none;
    margin: -2px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafafe;
    font-size: 10px;
    line-height: 1.7;
}

.password-message-item {
    margin: 0;
    color: var(--red);
}

.password-message-item.valid {
    color: var(--green);
}

#passwordError {
    display: block;
    margin-top: 5px;
    font-size: 10px;
}

.auth-card input[type="submit"] {
    width: 100%;
    height: 42px;
    margin-top: 3px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background .15s ease, box-shadow .15s ease;
}

.auth-card input[type="submit"]:hover {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    box-shadow: 0 6px 13px rgba(105, 101, 232, .19);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    color: #a0a1b0;
    font-size: 10px;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}

.google-signin {
    display: flex;
    min-height: 41px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #525367;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}

.google-signin:hover {
    border-color: #c9c8df;
    background: #fafaff;
    color: var(--ink);
    text-decoration: none;
}

.google-signin svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.form-footer {
    display: grid;
    gap: 8px;
    margin-top: 17px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.form-footer p {
    margin: 0;
}

.form-footer a,
.auth-legal a {
    color: var(--primary);
    font-weight: 700;
}

.section-note {
    margin: -10px 0 18px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.auth-legal {
    margin-top: 18px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
    color: #9293a3;
    font-size: 9px;
    line-height: 1.55;
    text-align: center;
}

.auth-legal p {
    margin: 0;
}

.auth-legal nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 7px;
}

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

.flash {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #e9eaf1;
    border-radius: 8px;
    background: #f7f7fb;
    color: #66677d;
    font-size: 11px;
    line-height: 1.5;
}

.flash-success {
    border-color: #c9eddd;
    background: #effaf5;
    color: #1c8d60;
}

.flash-danger,
.flash-error {
    border-color: #fda29b;
    background: #fff1f0;
    color: #b42318;
    font-weight: 750;
}

.flash-warning {
    border-color: #f0dfbc;
    background: #fff9ed;
    color: #a87825;
}

.flash-info {
    border-color: #dddcfb;
    background: #f4f3ff;
    color: #5955cb;
}

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

    .brand-panel {
        min-height: auto;
        padding: 22px clamp(20px, 5vw, 44px) 24px;
    }

    .hero-copy {
        padding: 42px 0 30px;
    }

    .hero-copy h1 {
        max-width: 700px;
    }

    .trust-strip {
        margin: 0;
    }

    .auth-panel {
        min-height: auto;
        padding: 24px 18px 35px;
    }

    .auth-card {
        max-height: none;
    }
}

@media (max-width: 560px) {
    .brand-panel {
        padding: 17px;
    }

    .topbar {
        align-items: center;
        flex-direction: row;
    }

    .top-actions {
        display: none;
    }

    .auth-shell--mobile-home .brand-panel {
        min-height: 100vh;
        min-height: 100svh;
        justify-content: space-between;
        padding: max(18px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    }

    .hero-copy {
        padding: 30px 0 26px;
    }

    .hero-copy h1 {
        font-size: 31px;
    }

    .trust-strip {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .trust-strip span {
        min-height: 0;
        padding: 10px 12px;
    }

    .auth-shell--mobile-home .mobile-auth-actions {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 0 0 24px;
    }

    .mobile-auth-link {
        display: inline-flex;
        min-height: 48px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--primary);
        border-radius: 9px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 700;
        text-decoration: none;
    }

    .mobile-auth-link--primary {
        background: var(--primary);
        color: #fff;
    }

    .mobile-auth-link--secondary {
        background: rgba(255, 255, 255, .75);
        color: var(--primary-dark);
    }

    .auth-shell--mobile-home .auth-panel {
        display: none;
    }

    .auth-shell--mobile-form .brand-panel {
        display: none;
    }

    .auth-shell--mobile-form .auth-panel {
        display: flex;
        min-height: 100vh;
        min-height: 100svh;
        align-items: flex-start;
        padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
    }

    .auth-shell--mobile-form .auth-card {
        width: 100%;
        max-width: 430px;
        max-height: none;
        padding: 20px 18px;
    }

    .mobile-auth-back {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        margin: 0 0 18px;
        padding: 7px 0;
        border: 0;
        background: transparent;
        color: var(--primary-dark);
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
    }

    .auth-shell--mobile-form + .site-footer {
        display: none;
    }
}
