NEXORA STORE V11 — CUSTOMER ACCOUNT FLOWS

Upgrade from V10:
1. Backup both site files and your MySQL database.
2. Upload contents of the V11 changed-files archive to the existing
   telegram_bot_starter folder, keeping the folder structure.
3. Import migrations/2026_10_17_customer_account_referrals.sql once in phpMyAdmin.
   This creates a new referral_invites table and inserts a default 0.00 USDT reward.
4. Admin → Settings → Referral Program: enter the bot username and choose a
   first-delivered-order reward amount. Setting 0 leaves rewards paused.
5. Test a fresh user with /start REF... from a referral link; then test
   My Balance, Wallet History, My Orders, Order Details, and Invite & Earn.

What changed:
- My Balance includes current DB balance, summed ledger credits/debits,
  recent transactions, paginated transaction history and quick shortcuts.
- My Orders lists latest orders with pagination. Each detail screen is scoped
  to the requesting Telegram user's user_id (no order credentials displayed).
- Invite & Earn records NEW accounts created through valid /start codes,
  displays actual stats and provides a Telegram share button.
- Referral reward is optional and configurable; once per referred user on
  their first successfully DELIVERED order, with row locks and ledger credit.
- Successful auto-deliveries and admin "Mark Delivered" can trigger the
  optional reward. Pending, failed or refunded deliveries do not.

DO NOT promise customers a bonus if Referral Reward = 0.
Old users and previously sent invitation links cannot be retroactively counted
unless they joined after the new migration was enabled.

NO changes to existing top-up matching, manual approvals, credentials,
stock or purchase deductions.

Telegram presentation uses native HTML blockquotes and inline buttons, so
colors/backgrounds depend on the user's Telegram client.
