@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --auth-navy: #17263d;
    --auth-deep: #102033;
    --auth-text: #283648;
    --auth-muted: #737d89;
    --auth-line: #dce0e4;
    --auth-soft: #f3f4f3;
    --auth-paper: #fafaf8;
    --auth-font: 'DM Sans', 'Segoe UI', sans-serif;
    --auth-serif: var(--auth-font);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--auth-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--auth-text);
}

/* Page */

body.login-page,
body.signup-page,
body.verify-page,
body.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 28px;
    background: var(--auth-paper);
    color: var(--auth-text);
}

/* A simple architectural detail, rather than a decorative background. */

body.login-page::before,
body.signup-page::before,
body.verify-page::before,
body.auth-page::before {
    content: "";
    position: fixed;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--auth-navy);
    pointer-events: none;
}

a {
    color: var(--auth-navy);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

img,
svg {
    max-width: 100%;
}

/* Form surface */

.login-card,
.verify-card,
.auth-card {
    position: relative;
    width: 100%;
    max-width: 470px;
    min-width: 0;
    padding: 36px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--auth-text);
}

.login-card::before,
.verify-card::before,
.auth-card::before {
    content: none;
}

.auth-container,
.signup-page .auth-container {
    display: block;
    width: 100%;
    max-width: 580px;
    min-width: 0;
    margin-inline: auto;
}

.auth-container .auth-card,
.signup-page .auth-container .auth-card {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Remove the old floating shapes and coin illustration. */

.auth-left {
    display: none;
}

/* Branding */

.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-height: 42px;
    margin: 0 0 42px;
    text-align: left;
}

.auth-logo {
    display: block;
    width: auto;
    max-width: 200px;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
}

.auth-name,
.logo > span {
    color: var(--auth-navy);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .02em;
    overflow-wrap: anywhere;
}

.auth-initials {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--auth-navy);
    border-radius: 3px;
    background: var(--auth-navy);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
}

/* Navigation */

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--auth-line);
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 400;
}

.back-home:hover {
    color: var(--auth-navy);
}

/* Headings */

h1,
h2,
h3 {
    margin: 0;
    color: var(--auth-navy);
    font-family: var(--auth-font);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.04em;
}

.login-card h2,
.verify-card h2,
.auth-card h2,
.card-header h3 {
    margin: 0;
    font-size: clamp(29px, 4vw, 36px);
    font-weight: 500;
    text-align: left;
}

.subtitle,
.card-header p {
    max-width: 44ch;
    margin: 12px 0 30px;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.8;
    text-align: left;
}

.card-header {
    margin-bottom: 30px;
}

.card-header p {
    margin-bottom: 0;
}

/* Fields */

form {
    min-width: 0;
    margin: 0;
}

.form-group {
    position: relative;
    min-width: 0;
    margin: 0 0 20px;
}

.form-group > label {
    display: block;
    margin-bottom: 8px;
    color: var(--auth-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]),
select,
textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #cfd5db;
    border-radius: 3px;
    outline: none;
    background: #fff;
    color: var(--auth-text);
    font-size: 16px !important;
    font-weight: 400;
    line-height: 1.5;
    box-shadow: none;
    scroll-margin-top: 24px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9aA1aa;
    opacity: 1;
}

input:not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus {
    border-color: var(--auth-navy);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(23, 38, 61, .08);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    caret-color: var(--auth-navy);
}

.auth-card form > input:not([type=hidden]):not([type=checkbox]):not([type=radio]) {
    margin-bottom: 20px;
}

/* Password visibility */

.password-group input {
    padding-right: 54px !important;
}

.password-toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: #7d8793;
    cursor: pointer;
    user-select: none;
}

.password-toggle:hover {
    background: var(--auth-soft);
    color: var(--auth-navy);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.password-group:has(> label) .password-toggle {
    top: 30px;
}

/* Remember me and password recovery */

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 24px;
    font-size: 12px;
}

.form-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    color: var(--auth-muted);
    cursor: pointer;
}

.form-options input[type=checkbox] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--auth-navy);
    flex-shrink: 0;
}

.forgot-link {
    font-size: 12px;
    font-weight: 500;
}

/* Primary action */

.btn-login,
.login-card button[type=submit],
.verify-card button[type=submit],
.auth-card button[type=submit] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 50px;
    padding: 13px 20px;
    border: 1px solid var(--auth-navy);
    border-radius: 3px;
    background: var(--auth-navy);
    color: #fff;
    font: 500 13px/1.5 var(--auth-font);
    letter-spacing: .01em;
    box-shadow: none;
    transition: background .15s ease;
}

.btn-login:hover,
.login-card button[type=submit]:hover,
.verify-card button[type=submit]:hover,
.auth-card button[type=submit]:hover {
    background: #263c58;
    box-shadow: none;
}

.btn-login:active,
.login-card button[type=submit]:active,
.auth-card button[type=submit]:active {
    background: #102033;
}

/* Supporting links */

.register-text,
.auth-footer {
    margin: 28px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.8;
    text-align: left;
}

.register-text a,
.auth-footer a {
    margin-left: 4px;
    color: var(--auth-navy);
    font-weight: 600;
}

.note {
    margin: 22px 0 0;
    color: var(--auth-muted);
    font-size: 11px;
    line-height: 1.8;
    text-align: left;
}

/* Feedback */

.error-box,
.alert-error,
.alert-success,
.success-box,
.info-box {
    margin: 0 0 22px;
    padding: 12px 14px;
    border: 0;
    border-left: 2px solid;
    border-radius: 0;
    font-size: 12px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.error-box,
.alert-error {
    border-color: #a54646;
    background: #f8eeee;
    color: #873e3e;
}

.alert-success,
.success-box {
    border-color: #46765d;
    background: #edf4ef;
    color: #39614a;
}

.info-box {
    border-color: #627b99;
    background: #edf1f5;
    color: #4b617c;
}

.error-box p,
.alert-error p {
    margin: 0;
}

.error-box p + p,
.alert-error p + p {
    margin-top: 5px;
}

.field-error {
    margin: 7px 0 13px;
    color: #984747;
    font-size: 12px;
    line-height: 1.6;
}

input.is-invalid,
input[aria-invalid=true] {
    border-color: #b76d6d !important;
    background: #fff !important;
}

/* Email verification actions */

.verify-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px !important;
    margin-top: 26px !important;
}

.verify-actions form {
    min-width: 0;
}

.verify-card .verify-actions button {
    min-height: 48px;
    border-radius: 3px;
    font: 500 12px/1.5 var(--auth-font);
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
}

.verify-card .verify-actions .btn-primary {
    border: 1px solid var(--auth-navy) !important;
    background: var(--auth-navy) !important;
    color: #fff !important;
}

.verify-card .verify-actions .btn-link {
    padding-inline: 20px;
    border: 1px solid var(--auth-line) !important;
    background: transparent !important;
    color: var(--auth-navy) !important;
}

.verify-card .verify-actions .btn-link:hover {
    background: #fff !important;
}

/* Language selector */

.auth-lang {
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

.lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 0 8px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--auth-muted);
    font-size: 12px;
}

.lang-trigger i {
    font-size: 9px;
}

.lang-flag {
    font-size: 15px;
}

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    display: none;
    width: 210px;
    max-width: calc(100vw - 48px);
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5px;
    border: 1px solid var(--auth-line);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 38, 61, .08);
}

.auth-lang.open .lang-menu {
    display: block;
}

.lang-menu button {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--auth-text);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
}

.lang-menu button:hover,
.lang-menu button:focus-visible {
    background: var(--auth-soft);
}

a:focus-visible,
button:focus-visible,
[role=button]:focus-visible {
    outline: 2px solid #627b99;
    outline-offset: 4px;
}

/* Mobile */

@media (max-width: 760px) {
    body.login-page,
    body.signup-page,
    body.verify-page,
    body.auth-page {
        padding: 32px 24px;
    }

    .auth-container,
    .signup-page .auth-container {
        max-width: 470px;
    }

    .login-card,
    .verify-card,
    .auth-card {
        padding-block: 20px;
    }
}

@media (max-width: 480px) {
    body.login-page,
    body.signup-page,
    body.verify-page,
    body.auth-page {
        align-items: flex-start;
        padding: 24px;
    }

    body.login-page::before,
    body.signup-page::before,
    body.verify-page::before,
    body.auth-page::before {
        inset: 0 0 auto;
        width: auto;
        height: 4px;
    }

    .login-card,
    .verify-card,
    .auth-card {
        margin: auto 0;
        padding: 12px 0 24px;
    }

    .signup-page .auth-card {
        margin: 0;
    }

    .logo {
        margin-bottom: 32px;
    }

    .auth-logo {
        max-width: 180px;
        max-height: 44px;
    }

    .auth-top {
        margin-bottom: 26px;
        padding-bottom: 14px;
    }

    .form-options {
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .verify-actions {
        grid-template-columns: 1fr;
    }

    .auth-name,
    .logo > span {
        font-size: 13px;
    }
}

@media (max-height: 650px) {
    body.login-page,
    body.verify-page,
    body.auth-page {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}