    /* Sign-in and account recovery form layout shared by the login flow templates. */
    .login-page {
        flex: 1 0 auto;
        min-height: 100%;
        padding: calc(var(--nav-height) + 32px) 16px 40px;
        display: grid;
        place-items: center;
        background: var(--page-bg-gradient), var(--page-bg);
    }
    .page {
        width: min(720px, 96vw);
        display: grid;
        gap: 20px;
    }
    .card {
        width: 100%;
        background:
            var(--liquid-linear-highlight),
            var(--glass-card-bg);
        border: 1px solid var(--panel-border);
        border-radius: 18px;
        padding: 30px 34px;
        box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
        display: grid;
        gap: 18px;
    }
    .card-intro {
        display: grid;
        gap: 6px;
    }
    .section {
        background:
            var(--liquid-linear-highlight-soft),
            var(--surface-mid);
        border: 1px solid var(--panel-border);
        border-radius: 14px;
        padding: 18px 20px;
        display: grid;
        gap: 14px;
    }
    .step-indicator {
        margin: 0;
        font-weight: 700;
        font-size: 11px;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: rgba(211, 220, 242, 0.72);
    }
    h1 {
        margin: 0;
        font-size: 26px;
        line-height: 1.16;
        letter-spacing: 0.01em;
        color: var(--text);
    }
    .subtitle {
        margin: 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.45;
    }
    .title {
        margin: 0;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: rgba(211, 220, 242, 0.72);
    }
    /* Form controls keep validation errors adjacent to fields returned by Django views. */
    .form {
        display: grid;
        gap: 14px;
    }
    .field {
        display: grid;
        gap: 6px;
    }
    .field-header {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        min-height: 18px;
    }
    label {
        font-size: 12px;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .required-star {
        color: #f28b82;
        margin-left: 4px;
    }
    .required-note {
        margin: 0;
        color: var(--muted);
        font-size: 12px;
    }
    .field-error {
        margin: 0;
        color: #f28b82;
        font-size: 12px;
        text-align: right;
    }
    input {
        width: 100%;
        background: var(--surface-muted-alt);
        border: 1px solid var(--panel-border);
        border-radius: 10px;
        padding: 12px 14px;
        color: var(--text);
        font-size: 14px;
        height: 44px;
    }
    input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    }
    .field.has-error input {
        border-color: #ff4d4f;
        box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.25);
    }
    .field.has-error input:focus {
        border-color: #ff4d4f;
        box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.3);
    }
    .field.has-error {
        animation: fieldShake 0.18s ease-in-out 2;
    }
    @keyframes fieldShake {
        0% { transform: translateX(0); }
        25% { transform: translateX(-2px); }
        50% { transform: translateX(2px); }
        75% { transform: translateX(-2px); }
        100% { transform: translateX(0); }
    }
    input:disabled {
        background: #3b1a1f;
        border-color: #ff4d4f;
        color: #ffd6d6;
        opacity: 0.9;
    }
    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus {
        -webkit-text-fill-color: var(--text);
        box-shadow: 0 0 0px 1000px var(--surface-muted-alt) inset;
        caret-color: var(--text);
        transition: background-color 9999s ease-in-out 0s;
    }
    input:autofill {
        box-shadow: 0 0 0px 1000px var(--surface-muted-alt) inset;
        -webkit-text-fill-color: var(--text);
        caret-color: var(--text);
    }
    .btn, .primary-btn {
        border: none;
        border-radius: 999px;
        padding: 12px 42px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        position: relative;
    }
    .btn.primary, .primary-btn {
        background: var(--accent);
        color: #fff;
    }
    .btn.primary:hover, .primary-btn:hover {
        background: var(--accent-dark);
    }
    .btn.secondary {
        background: var(--surface-muted-alt);
        color: var(--text);
        border: 1px solid var(--panel-border);
    }
    .btn.secondary:hover {
        background: var(--surface-hover-strong);
    }
    .btn:disabled, .primary-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
    .btn-spinner, .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid rgba(255, 255, 255, 0.4);
        border-top-color: #ffffff;
        border-right-color: #ffffff;
        border-radius: 50%;
        animation: spin 0.9s linear infinite;
        display: none;
    }
    .loading .btn-spinner, .loading .spinner {
        display: inline-block;
    }
    @keyframes spin {
        to { transform: rotate(360deg); }
    }
    .form-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 4px;
    }
    .resend-row {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .resend-link {
        background: transparent !important;
        border: none;
        padding: 0;
        color: var(--accent);
        font-size: 13px;
        cursor: pointer;
        box-shadow: none !important;
        filter: none !important;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        transition: color 0.2s ease, text-shadow 0.2s ease;
    }
    .resend-link:hover,
    .resend-link:focus-visible,
    .resend-link:active {
        box-shadow: none !important;
        filter: none !important;
        background: transparent !important;
    }
    .resend-link:hover,
    .resend-link:focus-visible {
        text-shadow: 0 0 8px rgba(0, 123, 255, 0.45);
    }
    .resend-link:disabled {
        color: var(--muted);
        cursor: not-allowed;
    }
    .resend-timer {
        color: var(--muted);
        font-size: 12px;
    }
    .login-footer {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        color: var(--muted);
        font-size: 13px;
    }
    .login-footer a {
        color: var(--accent);
        text-decoration: none;
        font-weight: 600;
    }
    .login-footer a:hover {
        text-decoration: underline;
    }
    .footer-separator {
        color: var(--muted);
        opacity: 0.75;
    }
    .oauth-grid {
        display: grid;
        gap: 10px;
    }
    .oauth-grid form {
        margin: 0;
    }
    .oauth-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 12px;
        border-radius: 999px;
        border: 1px solid var(--panel-border);
        color: #f5f5f5;
        background: var(--surface-muted-alt);
        font-size: 14px;
        width: 100%;
        cursor: pointer;
    }
    .oauth-btn:hover {
        background: var(--surface-hover-strong);
    }
    .oauth-btn:disabled {
        cursor: not-allowed;
    }
    .oauth-icon {
        width: 22px;
        height: 22px;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .oauth-icon svg {
        width: 16px;
        height: 16px;
        display: block;
    }
    .rate-limit-banner,
    .oauth-error-toast {
        background: #3b1a1f;
        border: 1px solid var(--danger);
        color: #ffd6d6;
    }
    .rate-limit-banner {
        padding: 10px 12px 10px 12px;
        border-radius: 8px;
        font-size: 14px;
        position: fixed;
        top: calc(var(--nav-height) + 8px);
        left: 50%;
        transform: translateX(-50%);
        width: min(720px, calc(100% - 32px));
        z-index: 1500;
    }
    .message-close {
        position: absolute;
        top: 6px;
        right: 10px;
        background: #3b1a1f;
        border: none;
        color: inherit;
        font-size: 18px;
        cursor: pointer;
        line-height: 1;
        padding: 2px 8px;
        border-radius: 6px;
    }
    .message-close:hover {
        background: #5a2a31;
    }
    .message.info {
        background: rgba(0, 123, 255, 0.2);
        border: 1px solid rgba(96, 165, 250, 0.6);
        color: #dbeafe;
    }
    .message.info .message-close {
        background: rgba(0, 123, 255, 0.2);
        color: #dbeafe;
    }
    .message.info .message-close:hover {
        background: rgba(0, 123, 255, 0.34);
    }
    .notice-toast {
        position: fixed;
        top: calc(var(--nav-height) + 12px);
        left: 50%;
        transform: translateX(-50%);
        width: min(720px, calc(100% - 32px));
        z-index: 1500;
    }
    .notice-banner {
        background: rgba(34, 197, 94, 0.16);
        border: 1px solid rgba(34, 197, 94, 0.45);
        color: #c3f1d5;
        padding: 10px 12px;
        border-radius: 10px;
        font-size: 13px;
    }
    .oauth-error-toast {
        position: fixed;
        top: calc(var(--nav-height) + 16px);
        left: 50%;
        transform: translateX(-50%);
        padding: 14px 36px 14px 20px;
        border-radius: 10px;
        display: flex;
        align-items: flex-start;
        gap: 14px;
        z-index: 1500;
        font-size: 14px;
        width: min(720px, calc(100% - 32px));
    }
    .oauth-error-toast span {
        flex: 1;
    }
    .oauth-error-close {
        position: absolute;
        top: 6px;
        right: 10px;
        background: #3b1a1f;
        border: none;
        color: inherit;
        font-size: 18px;
        cursor: pointer;
        line-height: 1;
        padding: 2px 8px;
        border-radius: 6px;
    }
    .oauth-error-close:hover {
        background: #5a2a31;
    }
    .email-display,
    .password-hint {
        margin: 0;
        color: var(--muted);
        font-size: 14px;
    }
    .email-display strong {
        color: var(--text);
    }
    .recaptcha-wrap {
        margin-top: 8px;
        display: grid;
        gap: 6px;
        justify-items: start;
    }
    .recaptcha-error {
        margin: 0;
        color: #f28b82;
        font-size: 12px;
    }
    .shake {
        animation: shake 0.18s ease-in-out 2;
    }
    @keyframes shake {
        0% { transform: translateX(0); }
        25% { transform: translateX(-1px); }
        50% { transform: translateX(1px); }
        75% { transform: translateX(-1px); }
        100% { transform: translateX(0); }
    }
    @media (max-width: 640px) {
        .card {
            padding: 24px 20px;
        }
        h1 {
            font-size: 24px;
        }
        .form-footer {
            flex-direction: column;
            align-items: stretch;
        }
        .form-footer .right {
            justify-content: flex-end;
        }
    }
