Two bugs:
1. mainContentEl teardown crash on logout — the $effect cleanup used
non-null assertion (!) on an element that becomes null when the DOM
is destroyed during logout. Changed to optional chaining (?.).
This TypeError was blocking the render, causing the spinner to hang
instead of showing the login form.
2. deactivate_session was clearing last_user_id, which broke offline
mode after logout. The user's data stays on disk — only factory
reset should clear the last_user_id marker.
cc