/* Authentication pages (sign in, sign up, reset, verify, invite).
   Self-contained "au-" namespace so it never collides with the app shell or
   the legacy .auth-* rules still used by the 404/500 pages. Colours come from
   the theme tokens in theme.css, so dark/light work automatically. */

.au-body {
    margin: 0;
    min-height: 100vh;
    background: var(--figma-bg);
    color: var(--figma-text);
    font-family: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.au-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

/* ---------- Brand panel ---------- */
.au-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: clamp(2rem, 4vw, 3.5rem);
    color: #f8f8f8;
    background:
        radial-gradient(60rem 40rem at 0% 0%, rgba(194, 122, 255, 0.35), transparent 60%),
        radial-gradient(40rem 30rem at 100% 100%, rgba(118, 71, 235, 0.45), transparent 60%),
        linear-gradient(160deg, #2a0f4d 0%, #140f20 100%);
}

.au-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
}

.au-brand > * { position: relative; z-index: 1; }

.au-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.au-logo img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
.au-logo strong { font-size: 1.25rem; letter-spacing: 0.01em; }
.au-logo span { display: block; font-size: 0.75rem; opacity: 0.65; }

.au-brand h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.7rem, 2.6vw, 2.4rem);
    line-height: 1.15;
    font-weight: 600;
}

.au-brand-lead {
    margin: 0;
    max-width: 28rem;
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(248, 248, 248, 0.75);
}

.au-points {
    list-style: none;
    margin: 1.75rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.9rem;
}

.au-points li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.95rem;
    line-height: 1.45;
    color: rgba(248, 248, 248, 0.88);
}

.au-points svg {
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0.3rem;
    box-sizing: content-box;
    border-radius: 0.6rem;
    background: rgba(194, 122, 255, 0.18);
    color: #e3c4ff;
}

.au-brand-foot { font-size: 0.8rem; color: rgba(248, 248, 248, 0.5); }

/* ---------- Form side ---------- */
.au-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem) 1rem;
}

.au-card {
    width: 100%;
    max-width: 26rem;
}

.au-mobile-logo { display: none; }

.au-card h2 {
    margin: 0 0 0.4rem;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.au-sub {
    margin: 0 0 1.5rem;
    color: var(--figma-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Progress steps (sign-up journey) */
.au-steps {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--figma-text-muted);
}

.au-steps li {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.au-steps li::before {
    content: "";
    height: 0.25rem;
    border-radius: 999px;
    background: var(--figma-border-soft);
}

.au-steps li.is-active { color: var(--figma-text); font-weight: 600; }
.au-steps li.is-active::before,
.au-steps li.is-done::before { background: var(--figma-accent); }

/* Banners */
.au-banner {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid;
    font-size: 0.9rem;
    line-height: 1.45;
}

.au-banner[hidden] { display: none; }
.au-banner svg { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.1rem; }
.au-banner strong { display: block; margin-bottom: 0.15rem; }

.au-banner--error {
    color: var(--cabinet-danger, #ff5470);
    background: var(--cabinet-danger-bg, rgba(231, 0, 11, 0.1));
    border-color: currentColor;
}

.au-banner--success {
    color: #16a34a;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
}

.au-banner--info {
    color: var(--figma-text);
    background: var(--cabinet-accent-soft, rgba(138, 91, 255, 0.18));
    border-color: var(--cabinet-accent-border, rgba(118, 71, 235, 0.25));
}

.au-banner--error span,
.au-banner--success span,
.au-banner--info span { color: var(--figma-text); }

/* Fields */
.au-form { display: grid; gap: 1.1rem; }

.au-field { display: grid; gap: 0.4rem; }

.au-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.au-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--figma-text-secondary);
}

.au-inline-link { font-size: 0.8rem; }

.au-input-wrap { position: relative; }

.au-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 0.95rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--figma-text);
    background: var(--figma-surface);
    border: 1px solid var(--figma-border-soft);
    border-radius: 0.7rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.au-input::placeholder { color: var(--figma-text-faint); }
.au-input[readonly] { opacity: 0.75; cursor: not-allowed; }

.au-input:focus {
    border-color: var(--figma-accent);
    box-shadow: 0 0 0 3px var(--cabinet-accent-soft, rgba(152, 16, 250, 0.18));
}

.au-input[aria-invalid="true"] { border-color: var(--cabinet-danger, #ff5470); }
.au-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--cabinet-danger-bg, rgba(231, 0, 11, 0.15));
}

.au-input-wrap .au-input { padding-right: 2.9rem; }

.au-eye {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--figma-text-muted);
    cursor: pointer;
}

.au-eye:hover { color: var(--figma-text); }
.au-eye:focus-visible { outline: 2px solid var(--figma-accent); }

.au-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--figma-text-muted);
}

.au-error {
    margin: 0;
    font-size: 0.8rem;
    color: var(--cabinet-danger, #ff5470);
}

.au-error[hidden] { display: none; }

/* Password strength + rules */
.au-meter {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
    margin-top: 0.1rem;
}

.au-meter i {
    height: 0.25rem;
    border-radius: 999px;
    background: var(--figma-border-soft);
    transition: background 0.2s;
}

.au-meter[data-level="1"] i:nth-child(-n+1) { background: #ef4444; }
.au-meter[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.au-meter[data-level="3"] i:nth-child(-n+3) { background: #84cc16; }
.au-meter[data-level="4"] i:nth-child(-n+4) { background: #22c55e; }

.au-rules {
    list-style: none;
    margin: 0.2rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.78rem;
    color: var(--figma-text-muted);
}

.au-rules li::before { content: "○"; display: inline-block; width: 1.1rem; }
.au-rules li.is-met { color: #16a34a; }
.au-rules li.is-met::before { content: "✓"; font-weight: 700; }

.au-match { font-size: 0.8rem; margin: 0; }
.au-match[hidden] { display: none; }
.au-match.is-ok { color: #16a34a; }
.au-match.is-bad { color: var(--cabinet-danger, #ff5470); }

/* Buttons */
.au-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(135deg, #9810fa, #7647eb);
    border: 0;
    border-radius: 0.7rem;
    cursor: pointer;
    transition: filter 0.15s, transform 0.05s;
}

.au-btn:hover { filter: brightness(1.1); }
.au-btn:active { transform: translateY(1px); }
.au-btn:focus-visible { outline: 2px solid var(--figma-accent-light); outline-offset: 2px; }
.au-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

.au-btn--ghost {
    color: var(--figma-text);
    background: transparent;
    border: 1px solid var(--figma-border-soft);
}

.au-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: au-spin 0.7s linear infinite;
}

.au-btn.is-loading .au-spinner { display: inline-block; }

@keyframes au-spin { to { transform: rotate(360deg); } }

.au-switch {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--figma-text-muted);
}

.au-card a:not(.au-btn),
.au-switch a {
    color: var(--figma-accent-light);
    font-weight: 500;
    text-decoration: none;
}

html[data-theme="light"] .au-card a:not(.au-btn),
html[data-theme="light"] .au-switch a { color: var(--figma-accent); }

.au-card a:not(.au-btn):hover { text-decoration: underline; }

.au-captcha { min-height: 4rem; }

/* Result / status screens (verify email, invitation unavailable) */
.au-result { text-align: center; }

.au-result-icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
}

.au-result-icon svg { width: 2rem; height: 2rem; }
.au-result-icon--ok { color: #16a34a; background: rgba(34, 197, 94, 0.14); }
.au-result-icon--bad { color: var(--cabinet-danger, #ff5470); background: var(--cabinet-danger-bg, rgba(231, 0, 11, 0.1)); }

.au-result .au-sub { margin-bottom: 1.5rem; }

.au-invite-chip {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    color: var(--figma-accent-light);
    background: var(--cabinet-accent-soft, rgba(138, 91, 255, 0.18));
}

html[data-theme="light"] .au-invite-chip { color: var(--figma-accent); }

/* Theme toggle sits in the corner of the form side */
.au-body .theme-switch-floating { z-index: 50; }

@media (max-width: 880px) {
    .au-shell { grid-template-columns: 1fr; }
    .au-brand { display: none; }
    .au-main { align-items: flex-start; padding-top: 4.5rem; }
    .au-mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        margin-bottom: 1.75rem;
        font-weight: 600;
        font-size: 1.1rem;
    }
    .au-mobile-logo img { width: 2rem; height: 2rem; }
}

@media (max-width: 420px) {
    .au-rules { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .au-spinner { animation-duration: 2s; }
    .au-input, .au-btn, .au-meter i { transition: none; }
}
