fix: comprehensive security hardening, iOS voice fallback, and UX resilience
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)
- iOS voice fallback: MIME type detection + record-only mode when Web Speech API unavailable
- HF Whisper fallback for audio transcription when Gemini fails
- OpenCC s2twp layer in NLP pipeline for simplified→traditional Chinese conversion
- localStorage draft autosave (useAutosave hook) across all 6 form pages
- AI fill no longer overwrites user-entered fields (skip-if-filled pattern)
- DB transaction wrapping for record creation (prevents orphaned data)
- keyPrefix column for O(1) record lookup (replaces O(n) bcrypt scan)
- Prompt injection fix: sanitizeForPrompt + Zod array/string constraints
- Security headers: HSTS, X-Frame-Options, X-Content-Type-Options, Permissions-Policy
- CSP: removed unsafe-eval, kept unsafe-inline for HF Spaces compatibility
- AI-specific rate limiter (10 req/min), retrieve limiter tightened to 3/min
- Crypto upgrades: bcrypt 10→12 rounds, key entropy 15→32 bytes
- Role-recordType cross validation via Zod .refine()
- fileName sanitization + file array .max(…