.auth-page,
.profile-page {
    position: relative;
    display: grid;
    min-height: calc(100svh - 77px);
    overflow: hidden;
    place-items: center;
    padding: 120px 16px 70px;
    background: transparent;
}

.auth-card {
    position: relative;
    width: min(100%, 460px);
    padding: clamp(28px, 4vw, 40px);
    border: 1px solid color-mix(in srgb, var(--foreground) 15%, transparent);
    border-radius: 24px;
    background: color-mix(in srgb, var(--background) 72%, transparent);
    box-shadow: 0 24px 80px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 5%);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    backdrop-filter: blur(18px) saturate(120%);
    font-family: "Inter", Arial, sans-serif;
    letter-spacing: 0;
}

[data-theme="light"] .auth-card {
    box-shadow: 0 24px 80px rgb(0 0 0 / 8%), inset 0 1px 0 rgb(255 255 255 / 60%);
}

.auth-card__heading {
    margin-bottom: 28px;
}

.auth-eyebrow {
    margin-bottom: 18px;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
}

.profile-card h1 {
    margin-bottom: 14px;
    font-size: clamp(2.5rem, 7vw, 4.2rem);
}

.auth-card h1 {
    margin: 0;
    font-size: clamp(1.75rem, 5vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1.2;
}

.auth-form {
    display: grid;
    min-width: 0;
    gap: 16px;
}

.field {
    display: grid;
    min-width: 0;
    gap: 8px;
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    font-weight: 500;
}

.field > input,
.password-field {
    min-width: 0;
    width: 100%;
    min-height: 50px;
    border: 1px solid color-mix(in srgb, var(--foreground) 14%, transparent);
    border-radius: 12px;
    outline: none;
    background: var(--input);
    color: var(--foreground);
    font-size: 0.82rem;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.field > input {
    padding: 0 16px;
}

.field__hint {
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.5;
}

.auth-form input:is(:-webkit-autofill, :autofill) {
    -webkit-text-fill-color: var(--foreground);
    caret-color: var(--foreground);
    box-shadow: inset 0 0 0 100px var(--input);
}

.auth-form input:is(:-webkit-autofill, :autofill):focus {
    box-shadow: inset 0 0 0 100px var(--input), 0 0 0 3px color-mix(in srgb, var(--ring) 9%, transparent);
}

.field > input:focus,
.password-field:focus-within {
    border-color: color-mix(in srgb, var(--foreground) 48%, transparent);
    background: color-mix(in srgb, var(--foreground) 7%, var(--input));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 9%, transparent);
}

.password-field {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.password-field input {
    min-width: 0;
    flex: 1;
    padding: 0 8px 0 16px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--foreground);
    font-size: 0.82rem;
}

.password-field button {
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 0.6875rem;
    transition: color 160ms ease;
}

.password-field button:hover {
    color: var(--foreground);
}

.captcha-wrap {
    max-width: 100%;
    overflow: hidden;
    border-radius: 10px;
}

.form-submit {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 0 19px;
    border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--foreground) 9%, transparent);
    color: var(--foreground);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background 180ms ease, border-color 180ms ease;
}

.form-submit:hover {
    background: color-mix(in srgb, var(--foreground) 14%, transparent);
    border-color: color-mix(in srgb, var(--foreground) 34%, transparent);
}

.auth-card :is(button, a):focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 3px;
}

.password-field button:focus-visible {
    outline-offset: -4px;
}

.auth-switch {
    margin: 22px 0 0;
    color: var(--muted-foreground);
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.7;
}

.auth-switch a {
    color: var(--foreground);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent);
    text-underline-offset: 4px;
}

.auth-switch a:hover {
    text-decoration-color: currentColor;
}

.flash-list {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.72rem;
}

.flash--error {
    border-color: color-mix(in srgb, var(--destructive) 32%, var(--border));
    background: color-mix(in srgb, var(--destructive) 7%, var(--background));
    color: var(--destructive);
}

.flash--success {
    border-color: color-mix(in srgb, var(--chart-5) 36%, var(--border));
    background: color-mix(in srgb, var(--chart-5) 9%, var(--background));
}

.profile-page {
    background: transparent;
}

.profile-card {
    width: min(calc(100% - 32px), 850px);
    padding: clamp(28px, 6vw, 64px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--card);
}

.profile-card__top {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 58px;
}

.profile-card__top .auth-eyebrow {
    margin-bottom: 10px;
}

.profile-card__top h1 {
    margin: 0;
}

.profile-avatar {
    display: grid;
    width: clamp(70px, 10vw, 96px);
    aspect-ratio: 1;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 24px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 600;
}

[data-theme="light"] .profile-avatar {
    border: 1px solid #d4d4d4;
    box-shadow: 0 6px 24px rgb(0 0 0 / 8%);
}

.profile-details {
    margin: 0 0 46px;
    border-top: 1px solid var(--border);
}

.profile-details div {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    padding-block: 19px;
    border-bottom: 1px solid var(--border);
}

.profile-details dt {
    color: var(--muted-foreground);
    font-size: 0.72rem;
}

.profile-details dd {
    margin: 0;
    font-size: 0.78rem;
}

.profile-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.profile-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chart-5);
}

.logout-button {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--background);
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 0.7rem;
}

@media (max-width: 400px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .g-recaptcha {
        transform: scale(0.78);
        transform-origin: left top;
    }

    .captcha-wrap {
        height: 65px;
    }

    .profile-details div {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}

@media (max-width: 600px) {
    .auth-page { padding-top: 150px; padding-bottom: 40px; }
    .auth-form input { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card :is(input, button, .password-field) { transition: none; }
}
