<div class="cm-stack {{ class }}" data-block="corporate-modernist:auth-form">
	<input type="radio" name="cm-auth-tab" id="cm-auth-login" class="cm-auth-radio" style="display:none;"{% if default_tab != "register" %} checked{% endif %}>
	<input type="radio" name="cm-auth-tab" id="cm-auth-register" class="cm-auth-radio" style="display:none;"{% if default_tab == "register" %} checked{% endif %}>
	<div class="cm-auth-tabs" style="display:flex; gap:1.5rem; border-bottom:1px solid hsl(var(--border));">
		<label for="cm-auth-login" class="cm-auth-tab cm-label" style="cursor:pointer; padding:0.75rem 0;">Sign in</label>
		<label for="cm-auth-register" class="cm-auth-tab cm-label" style="cursor:pointer; padding:0.75rem 0;">Create account</label>
	</div>
	<div id="auth-message" role="status" aria-live="polite"></div>
	<form class="cm-auth-panel cm-auth-panel-login cm-form" hx-post="/api/auth/login" hx-target="#auth-message" hx-swap="innerHTML">
		<div class="cm-field cm-field--full"><label class="cm-label" for="cm-login-email">Email</label><input class="cm-input" type="email" name="email" id="cm-login-email" required></div>
		<div class="cm-field cm-field--full"><label class="cm-label" for="cm-login-password">Password</label><input class="cm-input" type="password" name="password" id="cm-login-password" required></div>
		<button type="submit" class="cm-btn-primary" hx-disabled-elt="this" style="width:100%; justify-content:center;">Sign in</button>
		<p class="cm-form-note" style="text-align:center;"><a href="/forgot-password" style="color: hsl(var(--accent)); text-decoration: underline; text-underline-offset: 2px;">Forgot password?</a></p>
	</form>
	<form class="cm-auth-panel cm-auth-panel-register cm-form" hx-post="/api/auth/register" hx-target="#auth-message" hx-swap="innerHTML">
		<div class="cm-field cm-field--full"><label class="cm-label" for="cm-reg-username">Username</label><input class="cm-input" type="text" name="username" id="cm-reg-username" required pattern="[a-zA-Z0-9_-]{3,30}"></div>
		<div class="cm-field cm-field--full"><label class="cm-label" for="cm-reg-email">Email</label><input class="cm-input" type="email" name="email" id="cm-reg-email" required></div>
		<div class="cm-field cm-field--full"><label class="cm-label" for="cm-reg-password">Password</label><input class="cm-input" type="password" name="password" id="cm-reg-password" required minlength="8"></div>
		<button type="submit" class="cm-btn-primary" hx-disabled-elt="this" style="width:100%; justify-content:center;">Create account</button>
	</form>
	<style>.cm-auth-panel{display:none;} #cm-auth-login:checked ~ .cm-auth-panel-login{display:grid;} #cm-auth-register:checked ~ .cm-auth-panel-register{display:grid;}</style>
</div>
