/* Auth shell — shared sign-in, forgot/reset, change password */

.auth-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse 80% 55% at 50% -15%, rgba(79, 70, 229, 0.28), transparent),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(99, 102, 241, 0.08), transparent),
        var(--color-bg);
}

.auth-shell {
    width: 100%;
    max-width: 420px;
}

.auth-shell:has(.auth-card--wide) {
    max-width: 460px;
}

.auth-card {
    width: 100%;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    box-shadow: var(--shadow);
}

.auth-card--wide {
    padding: var(--space-8);
}

/* Brand block */
.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md, 10px);
    background: linear-gradient(135deg, var(--color-primary, #6366f1), #4f46e5);
    color: #fff;
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.auth-brand__logo-img {
    display: block;
    width: auto;
    max-width: 12rem;
    max-height: 3.5rem;
    margin: 0 auto var(--space-4);
    object-fit: contain;
}

/* Theme-aware logos (auth shell does not load layout.css) */
.auth-brand__logo-img.brand-logo--themed.brand-logo--light {
    display: none;
}

.auth-brand__logo-img.brand-logo--themed.brand-logo--dark {
    display: block;
}

[data-theme="light"] .auth-brand__logo-img.brand-logo--themed.brand-logo--light {
    display: block;
}

[data-theme="light"] .auth-brand__logo-img.brand-logo--themed.brand-logo--dark {
    display: none;
}

.auth-brand__tagline {
    margin: 0.5rem 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: 1.4;
}

.auth-brand:has(.auth-brand__logo-img) .auth-brand__tagline {
    margin-top: 0.65rem;
}

.auth-brand:has(.auth-brand__logo-img) .auth-brand__app {
    display: none;
}

.auth-brand__app {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary, #818cf8);
}

.auth-brand__title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

.auth-brand__lead {
    margin: 0.5rem 0 0;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-muted);
}

/* Inline validation / flash (before toasts) */
.auth-inline-alerts {
    margin-bottom: 1rem;
}

.auth-alert {
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.auth-alert + .auth-alert {
    margin-top: 0.5rem;
}

.auth-alert--error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form .form-group {
    margin: 0;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-muted);
}

.auth-form .form-group input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
    font-size: var(--text-base);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: var(--color-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-form .form-group input.is-invalid {
    border-color: var(--color-danger, #f87171);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.auth-form .field-error {
    margin: 0.35rem 0 0;
    font-size: var(--text-sm);
    color: var(--color-danger, #f87171);
}

.auth-submit {
    width: 100%;
    margin-top: 0.25rem;
    min-height: 2.75rem;
    font-size: var(--text-base);
    font-weight: 600;
}

.auth-form button[type='submit']:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Footer nav */
.auth-footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
}

.auth-footer-nav a {
    color: var(--color-primary, #818cf8);
    text-decoration: none;
}

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

.auth-footer-nav__sep {
    color: var(--color-text-dim);
    user-select: none;
}

.auth-page-footer {
    margin-top: 1rem;
    text-align: center;
}

.auth-footer-note {
    margin: 0 0 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--color-text-muted);
}

.auth-copyright {
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

.auth-page-footer .auth-copyright {
    margin-top: 0.35rem;
}

.auth-page-footer .auth-footer-note + .auth-copyright {
    margin-top: 0.5rem;
}

/* Password requirements panel */
.password-requirements {
    margin-bottom: 0.25rem;
    padding: 0.85rem 1rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.password-requirements__title {
    margin: 0 0 0.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.password-requirements__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.password-requirements__list li {
    position: relative;
    padding-left: 1.35rem;
    line-height: 1.45;
    transition: color 0.15s ease;
}

.password-requirements__list li + li {
    margin-top: 0.25rem;
}

.password-requirements__list li::before {
    content: '○';
    position: absolute;
    left: 0;
    color: var(--color-text-dim);
}

.password-requirements__list li.is-met {
    color: var(--color-success, #4ade80);
}

.password-requirements__list li.is-met::before {
    content: '●';
    color: var(--color-success, #4ade80);
}

.password-strength {
    margin-top: 0.85rem;
}

.password-strength__track {
    height: 4px;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}

.password-strength__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: #ef4444;
    transition: width 0.2s ease, background 0.2s ease;
}

.password-strength__fill[data-level='1'] { background: #f97316; }
.password-strength__fill[data-level='2'] { background: #eab308; }
.password-strength__fill[data-level='3'] { background: #22c55e; }
.password-strength__fill[data-level='4'] { background: #10b981; }

.password-strength__label {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Password toggle */
.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

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

.password-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.password-toggle:hover {
    color: var(--color-text);
    background: var(--color-bg-elevated);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--color-primary, #818cf8);
    outline-offset: 2px;
}

.password-toggle__icon {
    display: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    pointer-events: none;
}

.password-toggle__icon--show {
    display: block;
}

.password-toggle[aria-pressed='true'] .password-toggle__icon--show {
    display: none;
}

.password-toggle[aria-pressed='true'] .password-toggle__icon--hide {
    display: block;
}

@media (max-width: 480px) {
    .auth-card,
    .auth-card--wide {
        padding: 1.5rem 1.25rem;
    }

    .auth-brand__title {
        font-size: 1.25rem;
    }
}

/* Theme toggle (auth shell has no layout.css) */
.auth-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.auth-theme-toggle:hover {
    color: var(--color-text);
    border-color: var(--color-primary, #6366f1);
}

.auth-theme-toggle:focus-visible {
    outline: 2px solid var(--color-primary, #818cf8);
    outline-offset: 2px;
}

.auth-theme-toggle .theme-icon[hidden] {
    display: none;
}

/* Login split layout */
.auth-body--login {
    justify-content: stretch;
    padding: 0;
}

.auth-login {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

.auth-login__panel {
    display: none;
    flex: 1;
    padding: 2.5rem 2rem;
    background:
        radial-gradient(ellipse 70% 50% at 20% 0%, rgba(99, 102, 241, 0.35), transparent),
        linear-gradient(160deg, rgba(79, 70, 229, 0.18) 0%, transparent 55%),
        var(--color-bg-elevated);
    border-right: 1px solid var(--color-border);
}

.auth-login__panel-inner {
    max-width: 22rem;
    margin: 0 auto;
}

.auth-login__panel .auth-brand {
    text-align: left;
    margin-bottom: 1.25rem;
}

.auth-login__panel .auth-brand__logo-img {
    margin-left: 0;
    margin-right: 0;
}

.auth-login__panel .auth-brand__app {
    text-align: left;
}

.auth-login__panel-lead {
    margin: 0 0 1.75rem;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-muted);
}

.auth-login__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-login__features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: var(--text-sm);
    line-height: 1.45;
    color: var(--color-text);
}

.auth-login__feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary, #818cf8);
}

.auth-login__main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-shell--login {
    max-width: 400px;
}

.auth-card--login {
    padding: var(--space-8) var(--space-6);
}

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

.auth-login__form-brand {
    display: none;
    margin-bottom: 1rem;
}

.auth-login__form-brand .auth-brand {
    margin-bottom: 0;
    text-align: center;
}

.auth-login__form-brand .auth-brand__app,
.auth-login__form-brand .auth-brand__tagline {
    display: none;
}

.auth-login__form-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

.auth-login__form-lead {
    margin: 0.4rem 0 0;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-muted);
}

.form-group__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.form-group__label-row label {
    margin-bottom: 0;
}

.form-group--icon .form-group__label-row {
    margin-bottom: 0.35rem;
}

.form-group__label-link {
    flex-shrink: 0;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-primary, #818cf8);
    text-decoration: none;
}

.form-group__label-link:hover {
    text-decoration: underline;
}

/* Icon beside field (not inside the input) */
.auth-field-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.auth-field-row__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    min-height: 2.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
}

.auth-field-row__control {
    flex: 1;
    min-width: 0;
}

.auth-field-row__control input {
    width: 100%;
}

.auth-field-row__control .password-input-wrap {
    width: 100%;
}

.auth-recaptcha {
    margin: 0.25rem 0 0;
}

.auth-recaptcha .g-recaptcha {
    transform-origin: left top;
}

@media (max-width: 400px) {
    .auth-recaptcha .g-recaptcha {
        transform: scale(0.92);
    }
}

.auth-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.auth-submit.is-loading .auth-submit__spinner {
    display: block;
}

.auth-submit.is-loading .auth-submit__label {
    opacity: 0.85;
}

.auth-submit.is-loading {
    pointer-events: none;
}

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

@media (min-width: 900px) {
    .auth-body--login {
        background: var(--color-bg);
    }

    .auth-login {
        flex-direction: row;
    }

    .auth-login__panel {
        display: flex;
        align-items: center;
        justify-content: center;
        width: min(44%, 520px);
        max-width: 520px;
        padding: 3rem 2.5rem;
    }

    .auth-login__panel-inner {
        margin: 0;
    }

    .auth-login__main {
        padding: 2rem 3rem;
    }
}

@media (max-width: 899px) {
    .auth-body--login {
        background:
            radial-gradient(ellipse 80% 55% at 50% -15%, rgba(79, 70, 229, 0.28), transparent),
            radial-gradient(ellipse 50% 40% at 100% 100%, rgba(99, 102, 241, 0.08), transparent),
            var(--color-bg);
    }

    .auth-login__form-brand {
        display: block;
    }
}

@media (max-width: 480px) {
    .auth-login__main {
        padding: 1rem;
    }

    .auth-card--login {
        padding: 1.5rem 1.25rem;
    }

    .auth-theme-toggle {
        top: 0.75rem;
        right: 0.75rem;
    }
}
