@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    --auth-bg: #f5efe4;
    --auth-surface: #fffdf9;
    --auth-surface-soft: #eee5d8;
    --auth-ink: #302a2a;
    --auth-muted: #79716d;
    --auth-line: #e4dacf;
    --auth-accent: #9a725d;
    --auth-accent-strong: #75513f;
    --auth-accent-soft: #ead9c9;
    --auth-shadow: 0 24px 70px rgba(70, 51, 39, .11);
    --auth-danger-bg: #f9e7e4;
    --auth-danger: #a6423c;
    --auth-success-bg: #e7f2e8;
    --auth-success: #347347;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --auth-bg: #1e1b1a;
    --auth-surface: #292523;
    --auth-surface-soft: #342d29;
    --auth-ink: #f4eee9;
    --auth-muted: #c0b3aa;
    --auth-line: #49403b;
    --auth-accent: #d2a98b;
    --auth-accent-strong: #ebc7aa;
    --auth-accent-soft: #49382f;
    --auth-shadow: 0 24px 70px rgba(0, 0, 0, .3);
    --auth-danger-bg: #482c2b;
    --auth-danger: #ffc2b8;
    --auth-success-bg: #263c2d;
    --auth-success: #b5e5c0;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
    min-height: 100vh;
    min-height: 100svh;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-family: 'Manrope', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

button, input { font: inherit; }
a { color: inherit; }

.auth-page {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, .92fr);
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(1.25rem, 4vw, 3.5rem);
    gap: clamp(2rem, 6vw, 6rem);
    overflow: hidden;
    background:
        radial-gradient(ellipse at 12% 8%, rgba(255, 255, 255, .55), transparent 34%),
        var(--auth-bg);
}

.auth-top-actions {
    position: absolute;
    z-index: 2;
    top: clamp(1rem, 3vw, 2rem);
    left: clamp(1rem, 3vw, 2rem);
    right: clamp(1rem, 3vw, 2rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.auth-top-actions > * { pointer-events: auto; }

.auth-back,
.auth-theme-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    background: var(--auth-surface);
    color: var(--auth-ink);
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(70, 51, 39, .06);
    transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}

.auth-back { width: 44px; padding: 0; }
.auth-theme-toggle { padding: 0 .95rem; font-size: .78rem; font-weight: 800; cursor: pointer; }
.auth-back:hover, .auth-theme-toggle:hover { transform: translateY(-1px); background: var(--auth-surface-soft); }
.auth-back svg, .auth-theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-theme-toggle .auth-icon-moon { display: none; }
:root[data-theme="dark"] .auth-theme-toggle .auth-icon-sun { display: none; }
:root[data-theme="dark"] .auth-theme-toggle .auth-icon-moon { display: block; }

.auth-brand {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(4.5rem, 8vh, 7rem) 0 0 clamp(0rem, 4vw, 3.5rem);
}

.brand-mark { position: relative; z-index: 1; display: flex; align-items: center; gap: .65rem; }
.brand-mark img { width: auto; max-width: min(180px, 45vw); height: 42px; object-fit: contain; }
.brand-mark .wordmark-fallback { display: none; color: var(--auth-ink); font-family: 'Fraunces', Georgia, serif; font-size: 1.8rem; font-weight: 700; letter-spacing: .12em; }

.brand-copy { position: relative; z-index: 1; width: min(100%, 540px); padding: 3rem 0; }
.brand-copy::before { content: 'WEAR'; display: block; margin-bottom: 1.2rem; color: var(--auth-accent); font-size: .68rem; font-weight: 800; letter-spacing: .24em; }
.brand-copy h1 { max-width: 560px; margin: 0 0 1rem; color: var(--auth-ink); font-family: 'Fraunces', Georgia, serif; font-size: clamp(2.5rem, 5vw, 4.65rem); font-weight: 600; line-height: 1.04; letter-spacing: -.04em; }
.brand-copy p { max-width: 470px; margin: 0; color: var(--auth-muted); font-size: clamp(.94rem, 1.2vw, 1.04rem); line-height: 1.8; }
.brand-foot { color: var(--auth-muted); font-size: .78rem; }

.auth-form-panel { display: flex; min-width: 0; align-items: center; justify-content: center; padding: clamp(3rem, 7vh, 5rem) 0 0; }
.auth-card { width: min(100%, 470px); padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--auth-line); border-radius: 28px; background: var(--auth-surface); box-shadow: var(--auth-shadow); }
.auth-card .eyebrow { margin: 0 0 .55rem; color: var(--auth-accent-strong); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.auth-card h2 { margin: 0 0 .45rem; color: var(--auth-ink); font-family: 'Fraunces', Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.35rem); font-weight: 600; letter-spacing: -.025em; }
.auth-card .sub { margin: 0 0 1.8rem; color: var(--auth-muted); font-size: .88rem; line-height: 1.6; }

.field { min-width: 0; margin-bottom: 1.05rem; }
.field label { display: block; margin-bottom: .45rem; color: var(--auth-ink); font-size: .78rem; font-weight: 800; }
.field input { display: block; width: 100%; min-height: 48px; padding: .75rem .9rem; border: 1px solid var(--auth-line); border-radius: 13px; outline: 0; background: var(--auth-bg); color: var(--auth-ink); font-size: .88rem; transition: border-color .15s ease, box-shadow .15s ease, background-color .2s ease; }
.field input::placeholder { color: var(--auth-muted); opacity: .75; }
.field input:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-accent) 18%, transparent); }

.btn-primary { display: inline-flex; width: 100%; min-height: 50px; align-items: center; justify-content: center; margin-top: .25rem; border: 0; border-radius: 999px; background: var(--auth-ink); color: var(--auth-surface); font-size: .88rem; font-weight: 800; cursor: pointer; box-shadow: 0 9px 20px rgba(60, 45, 35, .13); transition: transform .15s ease, opacity .15s ease; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.auth-switch { margin: 1.35rem 0 0; color: var(--auth-muted); font-size: .81rem; text-align: center; line-height: 1.6; }
.auth-switch a { color: var(--auth-accent-strong); font-weight: 800; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; text-underline-offset: 3px; }

.alert { margin-bottom: 1.1rem; padding: .8rem .95rem; border: 1px solid transparent; border-radius: 13px; font-size: .8rem; line-height: 1.5; }
.alert-danger { border-color: color-mix(in srgb, var(--auth-danger) 22%, transparent); background: var(--auth-danger-bg); color: var(--auth-danger); }
.alert-success { border-color: color-mix(in srgb, var(--auth-success) 22%, transparent); background: var(--auth-success-bg); color: var(--auth-success); }
.alert ul { margin: 0; padding-left: 1.1rem; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.row-2 .field { min-width: 0; }

@media (max-width: 900px) {
    .auth-page { grid-template-columns: minmax(0, .85fr) minmax(360px, 1fr); gap: 2rem; padding: 1.5rem 2rem; }
    .auth-brand { padding-left: 0; }
    .brand-copy h1 { font-size: clamp(2.3rem, 5vw, 3.3rem); }
    .auth-card { padding: 1.7rem; }
}

@media (max-width: 700px) {
    .auth-page { display: flex; min-height: 100vh; min-height: 100svh; flex-direction: column; justify-content: flex-start; gap: 1.25rem; padding: 5.25rem 1rem 1.5rem; }
    .auth-top-actions { top: .75rem; left: .75rem; right: .75rem; }
    .auth-brand { flex: 0 0 auto; min-height: 0; padding: .35rem .25rem 0; }
    .brand-mark img { height: 34px; }
    .brand-mark .wordmark-fallback { font-size: 1.5rem; }
    .brand-copy { width: 100%; padding: 1.3rem 0 .25rem; }
    .brand-copy::before { margin-bottom: .55rem; font-size: .6rem; }
    .brand-copy h1 { max-width: 620px; margin-bottom: .5rem; font-size: clamp(1.8rem, 8vw, 2.6rem); }
    .brand-copy p { display: block; max-width: 560px; font-size: .82rem; line-height: 1.55; }
    .brand-foot { display: none; }
    .auth-form-panel { flex: 1 0 auto; width: 100%; align-items: flex-start; padding: .25rem 0 0; }
    .auth-card { width: 100%; max-width: 560px; margin: 0 auto; padding: 1.35rem; border-radius: 22px; }
    .auth-card h2 { font-size: 1.8rem; }
    .auth-card .sub { margin-bottom: 1.3rem; }
}

@media (max-width: 420px) {
    .auth-page { padding-right: .8rem; padding-left: .8rem; }
    .auth-card { padding: 1.1rem; }
    .row-2 { grid-template-columns: 1fr; gap: 0; }
    .auth-theme-toggle { min-width: 44px; width: 44px; padding: 0; }
    .auth-theme-toggle [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}