/* Scoped auth styles — all selectors under .auth-page */

.auth-page {
    --auth-bg: #f4f6f8;
    --auth-card: #ffffff;
    --auth-fg: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-primary: #0d9488;
    --auth-primary-hover: #0f766e;
    --auth-primary-fg: #ffffff;
    --auth-danger: #dc2626;
    --auth-danger-bg: #fef2f2;
    --auth-success: #15803d;
    --auth-success-bg: #f0fdf4;
    --auth-ring: rgba(13, 148, 136, 0.35);
    --auth-radius: 12px;
    --auth-font: "DM Sans", system-ui, -apple-system, sans-serif;
    --auth-display: "Fraunces", Georgia, serif;

    margin: 0;
    min-height: 100vh;
    font-family: var(--auth-font);
    color: var(--auth-fg);
    background: var(--auth-bg);
    -webkit-font-smoothing: antialiased;
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
    box-sizing: border-box;
}

.auth-page a {
    color: var(--auth-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-page a:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.auth-page .auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* Left brand panel */
.auth-page .auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    color: #f8fafc;
    background:
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(45, 212, 191, 0.35), transparent 55%),
        radial-gradient(ellipse 70% 50% at 80% 80%, rgba(14, 116, 144, 0.45), transparent 50%),
        linear-gradient(145deg, #0f172a 0%, #134e4a 48%, #0f766e 100%);
    overflow: hidden;
}

.auth-page .auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    opacity: 0.5;
}

.auth-page .auth-brand-inner {
    position: relative;
    z-index: 1;
}

.auth-page .auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    color: inherit;
    text-decoration: none;
}

.auth-page .auth-brand-logo:hover {
    color: inherit;
    text-decoration: none;
}

.auth-page .auth-brand-img {
    display: block;
    height: 48px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.auth-page .auth-brand-img--light {
    height: 52px;
    max-width: 220px;
}

.auth-page .auth-brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.auth-page .auth-brand-name {
    font-family: var(--auth-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.auth-page .auth-brand-title {
    font-family: var(--auth-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin: 0 0 1rem;
    max-width: 18ch;
}

.auth-page .auth-brand-text {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(248, 250, 252, 0.78);
    max-width: 36ch;
}

.auth-page .auth-brand-footer {
    position: relative;
    z-index: 1;
    font-size: 0.875rem;
    color: rgba(248, 250, 252, 0.55);
}

/* Right form panel */
.auth-page .auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--auth-bg);
}

.auth-page .auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 2rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.auth-page .auth-card--wide {
    max-width: 560px;
}

.auth-page .auth-card--compact {
    padding: 1.35rem 1.5rem;
}

.auth-page .auth-card--compact .auth-card-header {
    margin-bottom: 0.85rem;
}

.auth-page .auth-card--compact .auth-card-title {
    font-size: 1.3rem;
}

.auth-page .auth-card--compact .auth-footer {
    margin-top: 0.85rem;
}

.auth-page .auth-form--compact {
    gap: 0.65rem;
}

.auth-page .auth-form--compact .auth-field {
    gap: 0.25rem;
}

.auth-page .auth-form--compact .auth-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.auth-page .auth-form--compact .auth-label {
    font-size: 0.8rem;
}

.auth-page .auth-form--compact .auth-btn {
    padding: 0.55rem 1rem;
    margin-top: 0.15rem;
}

.auth-page .auth-optional {
    color: var(--auth-muted);
    font-weight: 400;
}

.auth-page .auth-row--3 {
    grid-template-columns: 1.2fr 0.8fr 0.7fr;
}

.auth-page .auth-card-header {
    margin-bottom: 1.5rem;
}

.auth-page .auth-card-title {
    margin: 0 0 0.35rem;
    font-family: var(--auth-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.auth-page .auth-card-desc {
    margin: 0;
    font-size: 0.925rem;
    color: var(--auth-muted);
    line-height: 1.5;
}

.auth-page .auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-page .auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-page .auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.auth-page .auth-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-fg);
}

.auth-page .auth-input,
.auth-page .auth-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--auth-fg);
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-page .auth-input:focus,
.auth-page .auth-textarea:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-ring);
}

.auth-page .auth-input.is-invalid,
.auth-page .auth-textarea.is-invalid {
    border-color: var(--auth-danger);
}

.auth-page .auth-password-wrap {
    position: relative;
}

.auth-page .auth-password-wrap .auth-input {
    padding-right: 2.75rem;
}

.auth-page .auth-password-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    border-radius: 6px;
}

.auth-page .auth-password-toggle:hover {
    color: var(--auth-fg);
    background: var(--auth-bg);
}

.auth-page .auth-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-page .auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--auth-muted);
    cursor: pointer;
    user-select: none;
}

.auth-page .auth-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-page .auth-link-muted {
    font-size: 0.875rem;
    color: var(--auth-muted);
}

.auth-page .auth-link-muted:hover {
    color: var(--auth-primary);
}

.auth-page .auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--auth-primary-fg);
    background: var(--auth-primary);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.auth-page .auth-btn:hover:not(:disabled) {
    background: var(--auth-primary-hover);
}

.auth-page .auth-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.auth-page .auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-page .auth-btn-secondary {
    background: transparent;
    color: var(--auth-fg);
    border-color: var(--auth-border);
}

.auth-page .auth-btn-secondary:hover:not(:disabled) {
    background: var(--auth-bg);
}

.auth-page .auth-btn .auth-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.6s linear infinite;
    display: none;
}

.auth-page .auth-btn.is-loading .auth-spinner {
    display: inline-block;
}

.auth-page .auth-btn.is-loading .auth-btn-label {
    opacity: 0.85;
}

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

.auth-page .auth-alert {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 0.25rem;
}

.auth-page .auth-alert-error {
    background: var(--auth-danger-bg);
    color: var(--auth-danger);
    border: 1px solid #fecaca;
}

.auth-page .auth-alert-error ul {
    margin: 0;
    padding-left: 1.1rem;
}

.auth-page .auth-alert-success {
    background: var(--auth-success-bg);
    color: var(--auth-success);
    border: 1px solid #bbf7d0;
}

.auth-page .auth-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--auth-muted);
}

.auth-page .auth-footer strong {
    color: var(--auth-primary);
    font-weight: 600;
}

.auth-page .auth-footer a:hover strong {
    text-decoration: underline;
}

.auth-page .auth-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.auth-page .auth-actions-row .auth-btn {
    width: auto;
    min-width: 8rem;
}

.auth-page .auth-toggle-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 0.875rem;
    color: var(--auth-muted);
    text-decoration: underline;
    cursor: pointer;
}

.auth-page .auth-toggle-link:hover {
    color: var(--auth-primary);
}

.auth-page .auth-hidden {
    display: none !important;
}

.auth-page .auth-mobile-brand {
    display: none;
    margin-bottom: 1.25rem;
}

.auth-page .auth-mobile-brand a {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--auth-fg);
    text-decoration: none;
    font-family: var(--auth-display);
    font-weight: 600;
}

.auth-page .auth-mobile-brand .auth-brand-img {
    height: 40px;
    max-width: 160px;
}

.auth-page .auth-mobile-brand .auth-brand-mark {
    background: #0f766e;
    color: #fff;
    border: 0;
}

@media (max-width: 900px) {
    .auth-page .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-page .auth-brand {
        display: none;
    }

    .auth-page .auth-mobile-brand {
        display: block;
    }

    .auth-page .auth-main {
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 2.5rem;
    }

    .auth-page .auth-row,
    .auth-page .auth-row--3 {
        grid-template-columns: 1fr;
    }
}
