:root {
    --auth-primary: #0b3d91;
    --auth-primary-dark: #082b66;
    --auth-accent: #4f46e5;
    --auth-surface: rgba(255, 255, 255, 0.97);
    --auth-border: #dbe3f3;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
}

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

body.auth-page {
    margin: 0;
    min-height: 100vh;
    padding: 1.5rem;
    font-family: "Inter", "Segoe UI", sans-serif;
    color: var(--auth-text);
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(11, 61, 145, 0.1), transparent 26%),
        linear-gradient(135deg, #ffffff 0%, #eef3ff 52%, #f8fbff 100%);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 3rem);
}

.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: min(100%, 980px);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(219, 227, 243, 0.85);
    border-radius: 2rem;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(14px);
}

.auth-brand,
.auth-card {
    padding: clamp(1.75rem, 4vw, 2.5rem);
}

.auth-brand {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 1.5rem;
    background:
        radial-gradient(circle at top right, rgba(99, 72, 242, 0.16), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
}

.auth-brand__logo {
    width: min(100%, 21rem);
    height: auto;
}

.auth-brand__copy {
    max-width: 24rem;
    text-align: center;
}

.auth-brand__eyebrow,
.auth-card__eyebrow {
    margin: 0 0 0.5rem;
    color: var(--auth-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.auth-brand h1,
.auth-card__title {
    margin: 0;
    color: var(--auth-primary);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.auth-brand p:last-child,
.auth-card__text {
    margin: 0.9rem 0 0;
    color: var(--auth-muted);
    line-height: 1.7;
}

.auth-card {
    display: grid;
    gap: 1.25rem;
    width: min(100%, 31rem);
    background: var(--auth-surface);
}

.auth-form-card {
    width: 100%;
}

.auth-card--narrow {
    width: min(100%, 31rem);
    border: 1px solid rgba(219, 227, 243, 0.85);
    border-radius: 1.8rem;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
}

.auth-card--center {
    text-align: center;
}

.auth-card__header,
.auth-card__footer {
    display: grid;
    gap: 0.25rem;
}

.auth-card__footer--center {
    justify-items: center;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-field {
    display: grid;
    gap: 0.45rem;
}

.auth-field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-label {
    color: var(--auth-text);
    font-size: 0.84rem;
    font-weight: 800;
}

.auth-input,
.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--auth-border);
    border-radius: 1rem;
    background: #ffffff;
    color: var(--auth-text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus {
    outline: none;
    border-color: #9db1ff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.auth-password {
    position: relative;
}

.auth-password .auth-form input[type="password"],
.auth-password .auth-form input[type="text"] {
    padding-right: 5rem;
}

.auth-password .auth-input,
.auth-password input {
    padding-right: 5rem;
}

.auth-password__toggle {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    transform: translateY(-50%);
    border: 0;
    background: #eef2ff;
    color: var(--auth-accent);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--auth-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.auth-check input {
    margin-top: 0.15rem;
}

.auth-inline-link {
    display: flex;
    justify-content: flex-start;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.95rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

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

.auth-button--block {
    width: 100%;
}

.auth-button--primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    color: #ffffff;
    box-shadow: 0 20px 34px rgba(11, 61, 145, 0.2);
}

.auth-button--secondary {
    background: #ffffff;
    border-color: var(--auth-border);
    color: var(--auth-text);
}

.auth-link {
    color: var(--auth-primary);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-primary-dark);
}

.auth-link--button {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.auth-message {
    color: #b91c1c;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.5;
}

.auth-message--success {
    color: #166534;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal__dialog {
    width: min(100%, 42rem);
    max-height: 85vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.auth-modal__header,
.auth-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
}

.auth-modal__header {
    border-bottom: 1px solid #eef2ff;
}

.auth-modal__body {
    padding: 1rem 1.15rem;
    color: var(--auth-muted);
    line-height: 1.7;
}

.auth-modal__body h4,
.auth-modal__body p,
.auth-modal__body ol {
    margin-top: 0;
}

.auth-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--auth-accent);
    cursor: pointer;
    text-transform: uppercase;
}

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

@media (max-width: 640px) {
    body.auth-page {
        padding: 0.75rem;
        min-height: 100dvh;
    }

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

    /* Hide the logo/brand panel on phones — show only the form */
    .auth-brand {
        display: none;
    }

    .auth-field__row {
        align-items: flex-start;
        flex-direction: column;
    }

    /* iOS zoom prevention */
    .auth-input,
    select {
        font-size: 16px !important;
    }
}

@media (max-width: 400px) {
    body.auth-page {
        padding: 0.5rem;
    }

    .auth-card {
        padding: 1.25rem;
    }
}
