:root {
    --auth-bg: #f7f3ea;
    --auth-surface: #ffffff;
    --auth-text: #1f2937;
    --auth-muted: #6b7280;
    --auth-primary: #b89b5e;
    --auth-primary-strong: #8e6f35;
    --auth-navy: #0a1628;
    --auth-border: #e5e7eb;
    --auth-danger-bg: #fff1f0;
    --auth-danger-text: #8d2c24;
    --auth-success-bg: #edf8f0;
    --auth-success-text: #16543c;
    --auth-field-bg: #ffffff;
    --auth-shadow: 0 20px 45px rgba(10, 22, 40, 0.13);
    --auth-shadow-soft: 0 10px 26px rgba(10, 22, 40, 0.08);
}

[data-theme="dark"] {
    --auth-bg: #091221;
    --auth-surface: #101f36;
    --auth-text: #ebf1f9;
    --auth-muted: #a8b4c8;
    --auth-primary: #d4b476;
    --auth-primary-strong: #b58f4b;
    --auth-navy: #f2f6fc;
    --auth-border: #263b58;
    --auth-danger-bg: #3a1719;
    --auth-danger-text: #ffd8d8;
    --auth-success-bg: #0d3125;
    --auth-success-text: #bff4d8;
    --auth-field-bg: #142844;
    --auth-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
    --auth-shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Montserrat", "Segoe UI", Tahoma, sans-serif;
    color: var(--auth-text);
    background: radial-gradient(1200px 700px at 80% -12%, rgba(184, 155, 94, 0.24) 0%, transparent 60%),
        radial-gradient(800px 500px at -8% 108%, rgba(10, 22, 40, 0.18) 0%, transparent 60%),
        linear-gradient(165deg, color-mix(in oklab, var(--auth-bg) 72%, #fcfbf8 28%) 0%, var(--auth-bg) 100%);
    min-height: 100vh;
}

[data-theme="dark"] body {
    background: radial-gradient(1200px 700px at 80% -12%, rgba(212, 180, 118, 0.2) 0%, transparent 62%),
        radial-gradient(800px 500px at -8% 108%, rgba(125, 154, 194, 0.16) 0%, transparent 60%),
        linear-gradient(165deg, #07101e 0%, var(--auth-bg) 100%);
}

.auth-page-shell {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-aurora {
    position: absolute;
    filter: blur(8px);
    opacity: 0.5;
}

.auth-aurora-a {
    width: 340px;
    height: 340px;
    border-radius: 40% 60% 60% 40%;
    background: linear-gradient(140deg, #e3d4b3 0%, #b89b5e 100%);
    top: -80px;
    left: -120px;
}

.auth-aurora-b {
    width: 280px;
    height: 280px;
    border-radius: 62% 38% 49% 51%;
    background: linear-gradient(140deg, #1f3558 0%, #0a1628 100%);
    right: -90px;
    bottom: -90px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-brand {
    width: min(100%, 480px);
    margin-bottom: 1rem;
}

.auth-brand-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
}

.auth-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--auth-text);
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 1.35rem;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(145deg, #d8be86 0%, #b89b5e 100%);
    box-shadow: 0 0 0 6px rgba(184, 155, 94, 0.18);
}

.brand-subtitle {
    margin: 0.55rem 0 0;
    color: var(--auth-muted);
    font-size: 0.95rem;
}

.auth-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    border: 1px solid var(--auth-border);
    background: color-mix(in oklab, var(--auth-surface) 86%, transparent);
    color: var(--auth-text);
    border-radius: 999px;
    padding: 0.42rem 0.7rem;
    box-shadow: var(--auth-shadow-soft);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-theme-toggle .toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.auth-flow-links {
    margin-top: 0.72rem;
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.auth-flow-link {
    border: 1px solid var(--auth-border);
    border-radius: 999px;
    color: var(--auth-text);
    text-decoration: none;
    font-size: 0.79rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.36rem 0.7rem;
    background: color-mix(in oklab, var(--auth-surface) 85%, transparent);
}

.auth-flow-link:hover,
.auth-flow-link:focus-visible {
    border-color: var(--auth-primary);
    color: var(--auth-primary-strong);
}

.auth-card {
    width: min(100%, 480px);
    background: linear-gradient(180deg, color-mix(in oklab, var(--auth-surface) 93%, #fff 7%) 0%, color-mix(in oklab, var(--auth-surface) 85%, #e5d9bf 15%) 100%);
    border: 1px solid var(--auth-border);
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: var(--auth-shadow);
}

.auth-card-head h1 {
    margin: 0.25rem 0 0.4rem;
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-size: 1.7rem;
    color: var(--auth-navy);
}

.auth-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: var(--auth-primary-strong);
    font-weight: 700;
}

.auth-card-head p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.95rem;
}

.auth-alert {
    margin-top: 1rem;
    border-radius: 12px;
    padding: 0.72rem 0.9rem;
    border: 1px solid transparent;
    font-size: 0.92rem;
}

.auth-alert-danger {
    background: var(--auth-danger-bg);
    color: var(--auth-danger-text);
    border-color: #f8d5d2;
}

.auth-alert-success {
    background: var(--auth-success-bg);
    color: var(--auth-success-text);
    border-color: #c7ecdf;
}

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

.auth-form .form-floating > .form-control {
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    background: var(--auth-field-bg);
    color: var(--auth-text);
    height: calc(3.45rem + 2px);
    padding: 1.2rem 0.85rem 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form .form-floating > label {
    color: color-mix(in oklab, var(--auth-muted) 84%, var(--auth-text) 16%);
    padding-left: 0.84rem;
}

.auth-form .form-control:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 0.22rem rgba(184, 155, 94, 0.22);
}

.auth-form .form-control.is-invalid,
.auth-form.was-validated .form-control:invalid {
    border-color: #cb5454;
    box-shadow: 0 0 0 0.18rem rgba(203, 84, 84, 0.18);
}

.auth-form .invalid-feedback {
    font-size: 0.83rem;
    margin-top: 0.42rem;
}

.auth-field {
    display: block;
    margin-bottom: 0.85rem;
}

.auth-field > span {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.auth-field input {
    width: 100%;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    padding: 0.72rem 0.82rem;
    font: inherit;
    color: var(--auth-text);
    background: #fff;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(184, 155, 94, 0.2);
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--auth-muted);
    margin: 0.3rem 0 1rem;
}

.auth-check input {
    width: 1rem;
    height: 1rem;
    border-color: var(--auth-border);
}

.auth-check input:checked {
    background-color: var(--auth-primary-strong);
    border-color: var(--auth-primary-strong);
}

.auth-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0.06em;
    background: linear-gradient(120deg, var(--auth-primary-strong) 0%, var(--auth-primary) 60%, #d8be86 100%);
    color: #fff;
    padding: 0.82rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(184, 155, 94, 0.24);
}

.auth-button:hover {
    text-decoration: none;
    filter: brightness(1.03);
}

.auth-button:disabled,
.auth-button[aria-disabled="true"] {
    cursor: wait;
    opacity: 0.88;
    filter: none;
}

.auth-button.is-loading::after {
    content: '';
    width: 0.85rem;
    height: 0.85rem;
    margin-left: 0.55rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    animation: auth-spin 0.8s linear infinite;
}

.auth-button:focus-visible {
    outline: none;
    text-decoration: none;
    box-shadow: 0 0 0 0.25rem rgba(184, 155, 94, 0.28);
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-button-secondary {
    background: transparent;
    color: var(--auth-primary-strong);
    border: 1px solid color-mix(in oklab, var(--auth-primary) 56%, var(--auth-border) 44%);
    box-shadow: none;
}

.auth-button-secondary:hover,
.auth-button-secondary:focus-visible {
    filter: none;
    background: color-mix(in oklab, var(--auth-primary) 10%, transparent);
}

.auth-links {
    margin-top: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-links a {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 0.92rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-actions {
    margin-top: 0.95rem;
}

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

.auth-actions-inline {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.auth-actions-inline .auth-button {
    text-decoration: none;
    text-align: center;
    flex: 1 1 170px;
}

.auth-post-submit-state {
    margin-top: 0.9rem;
    border-radius: 14px;
    border: 1px solid color-mix(in oklab, var(--auth-success-text) 36%, var(--auth-border) 64%);
    background: color-mix(in oklab, var(--auth-success-bg) 76%, transparent);
    padding: 0.85rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.auth-post-submit-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-success-text);
    background: color-mix(in oklab, var(--auth-success-bg) 82%, #fff 18%);
    font-size: 0.95rem;
}

.auth-post-submit-copy {
    margin: 0;
    color: var(--auth-text);
    font-size: 0.9rem;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .auth-page {
        padding: 1.2rem 0.9rem 1.8rem;
    }

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

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

    .auth-card-head h1 {
        font-size: 1.45rem;
    }
}

/* Glassmorphism refinement pass */

:root {
    --auth-glass-bg: rgba(255, 255, 255, 0.46);
    --auth-glass-edge: rgba(255, 255, 255, 0.58);
    --auth-glass-shadow: 0 28px 60px rgba(10, 22, 40, 0.2);
    --auth-card-max: 560px;
}

[data-theme="dark"] {
    --auth-glass-bg: rgba(14, 31, 53, 0.56);
    --auth-glass-edge: rgba(146, 168, 198, 0.26);
    --auth-glass-shadow: 0 30px 64px rgba(0, 0, 0, 0.4);
}

.auth-grid-overlay {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(10, 22, 40, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(10, 22, 40, 0.1) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at center, black 38%, transparent 94%);
}

[data-theme="dark"] .auth-grid-overlay {
    background-image: linear-gradient(rgba(160, 188, 220, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 188, 220, 0.08) 1px, transparent 1px);
}

.auth-page {
    padding: clamp(1.4rem, 3.8vw, 2.6rem) 1rem;
}

.auth-stage {
    width: min(100%, var(--auth-card-max));
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-brand {
    width: 100%;
    margin-bottom: 0;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    border: 1px solid color-mix(in oklab, var(--auth-glass-edge) 72%, transparent);
    background: color-mix(in oklab, var(--auth-glass-bg) 72%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 10px 24px rgba(10, 22, 40, 0.12);
}

.auth-brand-link {
    gap: 0.72rem;
    min-height: 44px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(184, 155, 94, 0.3);
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(10, 22, 40, 0.16);
}

.brand-dot {
    display: none;
}

.brand-name {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.05;
    font-size: 1.22rem;
}

.auth-flow-links {
    margin-top: 0.82rem;
    gap: 0.62rem;
}

.auth-flow-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.auth-card {
    width: 100%;
    border-radius: 20px;
    border: 1px solid var(--auth-glass-edge);
    background: linear-gradient(180deg, color-mix(in oklab, var(--auth-glass-bg) 80%, #ffffff 20%) 0%, color-mix(in oklab, var(--auth-glass-bg) 92%, #0a1628 8%) 100%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 18px 42px rgba(10, 22, 40, 0.16);
    padding: clamp(1rem, 2.2vw, 1.5rem);
}

.auth-card-head {
    display: grid;
    gap: 0.35rem;
}

.auth-card-head h1 {
    margin: 0.08rem 0 0.2rem;
    letter-spacing: 0.012em;
}

.auth-card-head p {
    line-height: 1.52;
    max-width: 46ch;
}

.auth-form {
    margin-top: 1.05rem;
}

.auth-form .auth-button {
    margin-top: 0.45rem;
}

.auth-form .form-floating > .form-control {
    background: color-mix(in oklab, var(--auth-field-bg) 76%, transparent);
    min-height: 3.45rem;
}

.auth-form .form-floating > label {
    font-size: 0.88rem;
}

.auth-check {
    margin: 0.45rem 0 1rem;
}

.auth-links {
    margin-top: 0.85rem;
    gap: 0.4rem;
}

.auth-links a {
    width: fit-content;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0.9;
}

.auth-links a:hover,
.auth-links a:focus-visible {
    opacity: 1;
}

.auth-links-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.auth-actions-links {
    margin-top: 0.45rem;
}

.auth-actions-links a {
    font-size: 0.88rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .auth-stage {
        gap: 0.72rem;
    }

    .auth-brand {
        border-radius: 16px;
        padding: 0.85rem;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
    }
}
