VERSION 5 · SUNRISE  (package N5.0.0, built from TrendGain N2.9.33)
=====================================================================

What it is
----------
A new selectable UI version ("sunrise5") built on the Sunrise UI kit
(https://github.com/Dali254/CLAUDEFRONTEND-SKILLS, MIT). Same backend, same
database, same combined wallet and wallet names as TrendGain (profiz6).
All other versions (Classic, Profiz 1/3, Version 4, HELAHIVE, TrendGain) are
unchanged and still selectable in Admin -> Theme Settings.

Uploading this package switches the site to Version 5 once (like earlier
packages). Switch back any time: Admin -> Theme Settings -> "Switch to a
different site version".

Member area
-----------
* Shell: floating sidebar rail with colour icons, glass top bar (notifications,
  light/dark, account menu ending in Log out), phone tab bar with a raised
  Withdraw button, phone drawer (profile card first) and an "Ways to earn"
  bottom sheet.
* Dashboard: greeting, team banner, ticket-style balance card (Withdraw /
  Invite), gradient stat cards (Today / Withdrawn / Lifetime, Lifetime leaves
  out Spin as in TrendGain), phone shortcuts, feature tiles with lock badges,
  one reward coin per commission wallet, latest activity.
* Every other member page (wallet, tasks, team, loans, account, tournament...)
  runs inside the new shell and is re-skinned through assets/sunrise5/sr5.css
  (Profiz tokens mapped to Sunrise tokens), so it follows the theme colours,
  fonts, radius and dark themes automatically.
* Sign in / sign up / forgot / activate: Sunrise card with a gradient header;
  on computers a gradient brand panel sits on the left.

Icons and brand mark
--------------------
* Icons are Phosphor duotone FONT icons (self-hosted, assets/vendor/phosphor),
  tinted by each card's colour. Helper: sr5_icon('wallet').
* The logo mark and the balance-card illustration use a vector mark made with
  Higgsfield (growth arrow rising from coins): assets/sunrise5/mark.svg.
  Replace that one file to change the mark everywhere.

Task visibility (all UI versions)
---------------------------------
* Admin -> Tasks -> Task Visibility: an on/off switch for every member task
  (Chat & Earn, Teach Swahili, Hotels, Apps Rating, Walk & Earn, Surveys, AI
  Training, Digital/Premium Products, TikTok, YouTube, Spin, Forex, Y99,
  Tournament, Loans) plus every custom feature.
* Off = gone for members: menus, Earn sheet, dashboard tiles; the page and its
  API answer "not available" (old links go to the dashboard with a notice).
* On again = back exactly as before. Nothing is deleted. Stored in the setting
  "hidden_tasks"; code in includes/task-visibility.php.

Withdrawal M-Pesa number lock (all UI versions)
-----------------------------------------------
* Default: the number on the withdrawal page is read-only (lock icon + note)
  and the server always pays the member's registered phone, even if a
  different number is sent.
* Admin -> Payment Settings -> "Withdrawal M-Pesa Number" -> tick "Let members
  change the M-Pesa number" to allow editing; untick to lock again.
  Setting: withdraw_phone_editable (0 = locked).

Teach Swahili (new design, works like Hotels — all UI versions)
---------------------------------------------------------------
* Page: green hero + stats, Chat & Earn wallet with Withdraw, student cards
  (name, flag, level, goal, payout, session length), bottom-sheet session:
  ready -> live chat with timer and teaching counter -> claim -> credited.
* Admin -> Chat Tasks -> add with section "Teach Swahili": title = student
  name, text = why they want to learn, Earn = payout, Min secs = session
  length, Min chars = teaching needed, plus country and level.
* Section unlock fee unchanged (Chat Tasks -> Unlock Prices).
* Each student once per member per day; payout credited by the server to the
  Chat & Earn wallet (chat_talk_balance), withdrawable like the Hotels wallet.
* The server times every session and counts the member's own teaching text
  (api/tasks/swahili-session.php); claims before that are refused.
* Students are AI practice partners, labelled that way. They reply with the
  built-in Swahili student engine (includes/swahili-engine.php): 723 words
  and phrases (core list + includes/swahili-lexicon-extra.php: greetings,
  numbers, days/months, colours, body/health, clothes/home, weather, food,
  market, travel, animals, verbs, feelings, work/school, music, proverbs).
  Understands how people teach in English: "X means Y", "X = Y", "Y in
  Swahili is X", "the word for Y is X", "we say X for Y", "to say Y, say X",
  "Y is called X", "X (Y)". Remembers what it learned and answers quizzes
  ("what does maji mean?", "how do you say tea?", "what have you learned?"),
  repeats/spells on request, takes corrections ("no, it's asante sana"),
  glosses short Swahili sentences, and has a consistent persona for small
  talk (age, job, why learning, been to Kenya, food, hobbies). Personal
  questions get natural answers: "Where are you from?" → "Japan! I grew up
  in Osaka — people there love food and comedy. And you? Are you from
  Nairobi?" (hometown, weather and food per country), and it reacts to what
  the member says about themselves ("I'm from Kisumu", "My name is Brian",
  "I'm 29", "I'm a teacher") and asks back. Also
  checks meanings, asks for the next word that fits the student's goal and
  level, answers "are you real?" honestly, ignores gibberish/repeats. Instant
  (≈0.3 ms per reply), free, no API key. Admin -> Chat Tasks -> "Teach
  Swahili — student replies" can switch to the Chat Profiles AI provider
  (engine stays as backup) and sets the Swahili words needed per session
  (default 2) — the claim is refused until they are taught.
* Art made with Higgsfield, stored in assets/img/teach-swahili (WebP, 176 KB):
  hero teacher illustration, 8 passport-style AI photos of fictional people
  (photo-1..8, always shown with an "AI" badge), 8 cartoon avatars, and
  empty-state / payout illustrations. Pick a picture per student in
  Admin -> Chat Tasks -> Avatar (Automatic = an AI photo).

Readability
-----------
* Measured with an automated contrast check on every member page and the
  sign-in pages, light and dark, phone and computer: every text passes WCAG AA
  (4.5:1, large text 3:1). Fixes live in section 8 of assets/sunrise5/sr5.css
  (white-text-safe gradients, deeper stat cards, readable placeholders,
  disabled buttons, and dark-mode versions of older hard-coded colours).

Theme (admin)
-------------
* Admin -> Theme Settings -> "Version 5 · Sunrise — Theme": preset, 3 brand
  colours, dark theme (10 built in), heading font, corner radius.
* Or live: sign in to /admin, open any member page, Account menu ->
  Theme studio -> Publish (POST /api/sr5-theme, admin session + CSRF only,
  values whitelisted). Stored in the setting "sr5_theme".

Files
-----
New:      assets/sunrise/ (kit, verbatim + fonts + Phosphor), assets/sunrise5/
          (sr5.css, sr5-auth.css, sr5-boot.js, sr5.js), includes/sr5/header.php,
          includes/sr5/footer.php, dashboard/sr5.php, api/sr5-theme.php
Changed:  includes/ui.php (version entry + helpers), includes/header.php,
          includes/footer.php, dashboard/index.php (routing),
          includes/functions.php (sunrise5 gets TrendGain wallet rules),
          admin/theme-settings.php (Sunrise section), assets/css/pz1.css
          (heading rule skips sr-* classes), config/constants.php
          (ASSET_VER N5.0.0), config/ui-version.txt (sunrise5)
No database changes.

Notes
-----
* .env is NOT in this zip — keep the one already on your server.
* The new shell, dashboard and auth pieces use no inline event handlers and
  load no third-party CDNs. Older pages keep their own scripts and form checks.


Payment Accounts (Admin -> Payment Accounts) — several business IDs
--------------------------------------------------------------------
* Add LipaLink business IDs (optional own API key) and Daraja paybills/tills
  (shortcode, till/Party B, passkey, consumer key/secret, sandbox/production).
  Each account has its own on/off switch and can take all payments, only
  activation & pay-for-client, or only tasks/unlocks/deposits/features.
* Master switch (default OFF): while off, payments use Payment Settings
  exactly as before. Turn it on to use the list.
* Active account per payment kind, chosen by admin. If it is switched off,
  the first account that is on is used.
* Automatic backup (failover, own toggle): when the active account can't be
  reached, is not set up, or the gateway refuses the request, the next
  account that's on takes the payment. Never used after a timeout where the
  member may already have a prompt, so nobody is prompted twice. Each
  failover is listed under "Recent alerts".
* Planned switch: one-time changeover to an account at a set date and time
  (e.g. a new paybill from the 1st). Applied automatically when due.
* Per-account totals (today / 30 days), health (working / failed tries).
* Statement for your bank: CSV of every M-Pesa payment (date, reference,
  M-Pesa code, type, amount, member ID, receiving account) for 7/30/90 days.
* LipaLink: one API key serves several businesses — create each business on
  LipaLink's Businesses page, add its business ID here, and set each
  business's Webhook URL to <your site>/api/payment/webhook.
* Editable base URL: "LipaLink connection (default)" sets the base URL and
  API key for all LipaLink payments (same setting as Payment Settings).
  Each account can also have its own base URL / API key (blank = default).
  "Check" / "Check connection" asks the status endpoint about a made-up
  payment: reports bad key (401), billing not set up (402), KYC (403), wrong
  address, or connected. Nobody is charged or prompted.
* Amounts are never changed — members always pay the price shown.
* Status checks (polling, webhook verify, reconcile cron) use the account
  that took the payment (Daraja credentials per account).
* Settings: pay_accounts, pay_accounts_on, pay_failover_on, pay_primary,
  pay_schedule, pay_health, pay_alerts. No database changes.
* Files: includes/pay-accounts.php, admin/payment-accounts.php (new);
  api/payment/lipalink.php, api/payment/webhook.php,
  cron/reconcile_payments.php, includes/functions.php,
  includes/admin-header.php, .htaccess (changed).


Bulk Prices & Access (Admin -> Bulk Prices & Access)
----------------------------------------------------
* One page with a tab per group: Digital products, Tasks & features,
  Surveys, Hotel reviews, App reviews, Chat profiles, Loans, Chat tasks,
  Video tasks.
* Edit in the table (price / unlock price / application fee, commission %,
  member %, upline L1-L3 %, rewards, minimum seconds/characters) and press
  Save changes — only changed cells are sent; changed cells are highlighted
  and can be undone before saving.
* Tick items (or "all N items") and: Set to / Raise by % / Lower by % / Add /
  Subtract on any field (prices rounded to whole shillings after a % change,
  percentages kept 0-100); Make free; Paid again; On; Off.
* Make free = price 0, which the whole app already treats as free: instant
  access, no M-Pesa prompt, no upline commission. The old price is saved
  (setting bulk_free_saved) and shown as "was KES …"; Paid again restores it.
* Every change is written to admin_audit_log (before/after).
* Files: includes/bulk-pricing.php, admin/bulk-pricing.php (new);
  includes/admin-header.php, .htaccess (changed). No database changes.


Database (one file): database/helawave.sql
------------------------------------------
* Still the only SQL file. Updated for Version 5: chat_tasks gets
  student_country, student_level, student_avatar (in CREATE TABLE and in the
  safe "add if missing" upgrade section), and default settings rows for
  pay_accounts_on=0, pay_failover_on=0, withdraw_phone_editable=0,
  swahili_reply_mode=builtin, swahili_min_words=2 (INSERT IGNORE).
* Everything else in Version 5 (payment accounts, bulk prices, hidden tasks,
  theme) is stored in the settings table — no new tables.
* Checked: imports on an empty database, re-imports cleanly, and upgrades a
  copy of an existing site without touching members, balances or settings;
  the resulting schema matches the app's own schema exactly.


Teach Swahili — add students in bulk (Admin -> Chat Tasks)
----------------------------------------------------------
* "Add Teach Swahili students in bulk" panel, like the hotel/app sample
  buttons: how many (5-100), country (mixed or one), level (mixed or one),
  pictures (mixed / AI photos / cartoons), reward min-max (rounded to 10),
  session seconds, minimum characters, active now.
* Generated students get a fictional name from that country, a reason for
  learning that fits their level, and a picture of the matching gender.
  Names already used are skipped.
* "Or paste your own list": one per line — Name, country, level, reason,
  reward, f/m. Only the name is required; the rest uses the panel choices.
  Country may be a code (de) or a name (Germany). Known first names get a
  matching picture automatically.
* Uses the existing chat_tasks columns — no database changes.


Sign-in pages rebuilt with the Sunrise kit + theme switch fix
-------------------------------------------------------------
* Login, register, forgot password and account activation now use the kit's
  own auth layout (demo/login.html, register.html, forgot.html): gradient
  brand panel on computers, theme button top-right, centred logo, one big
  card, kit inputs with icons, password eye, strength meter on sign-up,
  "Have a referral code?" link (or "Invited by …" when the invite link was
  used), kit alerts, soft secondary button. Files: includes/sr5/auth.php,
  auth-login.php, auth-register.php, auth-forgot.php, auth-activate.php and
  assets/sunrise5/sr5-auth2.css. The PHP checks in auth/*.php are unchanged;
  other versions keep their own pages.
* Sign-up fits one phone screen (390x844 and 360x640): country and phone
  share one row, the badge and footer are hidden on phones.
* Theme switch: the older app.js replaced the Sunrise toggleTheme() with one
  that only changed data-theme, so on some pages the button did nothing
  visible. sr5-boot.js now takes the name back after app.js loads and
  catches clicks on older theme buttons, so every switch uses the Sunrise
  engine (html.dark) and the choice is remembered on every page.
* Asset version bumped to N5.0.4 so browsers fetch the new files.


All member pages in Sunrise kit components (N5.0.5)
---------------------------------------------------
* includes/sr5/kitify.php — every member page inside the Sunrise shell is
  re-drawn with the kit's own components, without touching page logic:
  - page headings (and the custom ones on Accounts, Commissions and the
    Tournament) become the kit page hero (sr-page-hero tone-*, glyph,
    kicker, title, text) with an icon and colour per section;
  - legacy classes are swapped for kit classes: card → sr-panel,
    btn/btn-primary → sr-btn sr-btn--primary, form-input → sr-input
    sr-input--soft, form-label → sr-label, alert-* → sr-alert tone-*,
    badge-* → sr-badge tone-*, table → sr-table, pagination → kit pager,
    chips → sr-chip-btn, stat grids → sr-metrics, and the withdraw form →
    sr-affix / sr-pct-chips / sr-receipt / sr-verified / sr-bal-card.
  Ids, names and data-* attributes are untouched, so scripts keep working.
* Rebuilt directly from kit markup (includes/sr5/pages/*, helpers in
  includes/sr5/kit.php): Transactions (kit stats, tabs, ledger rows,
  server pager, empty state) and My Team (§6e level cards, search toolbar,
  status tabs, member rows with WhatsApp reminder, pager).
* The old "super-compact" text rules in pz1.css no longer apply to Version 5
  (they shrank kit numbers and titles); level cards darkened so white text
  passes contrast in light and dark.
* Checked: 91 member pages, no PHP errors, no sideways scrolling at 390px,
  text contrast passes on the reworked pages in light and dark; withdraw
  amount chips, wallet switch, team search and transaction filters work.


One field per fee (admin) + phone layout fixes (N5.0.7)
------------------------------------------------------
* Payment Settings no longer repeats fees that are set elsewhere:
  - "Min Withdrawal" removed (it was never used — each wallet has its own
    minimum in Wallets);
  - "Transaction Cost" moved to Wallets as "Fee when no tier matches", next
    to the fee tiers;
  - Hotel & Survey "Processing Fee %" and "Upline % of fee" moved onto the
    Hotel & Survey wallet's own M-Pesa prompt fee (moved once automatically,
    includes/fees.php; values kept). The block now only holds the waiting
    days and the message;
  - "Product Purchase — Upline Commission %" removed (Commission Rates →
    Digital product sales is the place);
  - Activation commission shows read-only when Commission Rates owns it.
* Task unlock prices: Task Settings is the one editor for built-in tasks
  (Chat Tasks and Video Tasks show the prices with a link); custom features
  are edited only in Features (no longer repeated in Task Settings).
* Bulk Prices hides commission columns when Commission Rates sets one
  commission for that category (shows the rate and a link instead).
* Dashboard: the Withdraw / Earn / Team / History / Ranks shortcut icons are
  removed.
* Sign-in pages on phones now match the reference app: card centred,
  subtitle, badge, helper text, divider + secondary button and footer shown.
* Kit QA tools (qa_all.py, qa.py) run on 24 member pages and the sign-in
  pages at 360/390/412/768/1280/1440 px, light and dark: 0 failures (fixed:
  survey money chips on tablets, product buttons wrapping on small phones,
  Teach Swahili filter row and low-contrast labels, tournament numbers,
  hidden loan sheet).

Dashboard wallet cards (N5.0.8)
-------------------------------
* "Team bonuses" coins replaced by "My wallets": slim gradient cards (one per
  commission wallet) — WALLET NAME, big amount, where it comes from, glass
  icon tile on the right. One column on phones, two from 768px, three from
  1280px; each card opens that wallet's withdraw page. Styles: sr5.css §11.
  Kit QA: 0 failures at 360/412/1280 light and dark.

Names & Labels — easy renaming (N5.0.9)
---------------------------------------
* New Admin → Names & Labels (admin/display-names.php, includes/display-names.php):
  - Wallets: rename each "My wallets" card and its small line. The name is
    the wallet's own name (wallet_config.label), so the withdraw page and
    history change too.
  - Tasks: title, tag and description of each "Ways to earn" card. The title
    also renames the menu item (all Profiz/Version 4/5 menus) and the page
    heading in Version 5.
  - Empty box = default (shown as the grey placeholder). One Save button.
* When an admin is signed in on the same browser, the member dashboard shows
  a pencil "Rename" link next to "Ways to earn" and "My wallets".
* Stored in one setting (display_names) — no database changes.

Payment accounts — daily limit per business ID
----------------------------------------------
* Each account (Admin → Payment Accounts → Edit) has "Daily limit (KES)"
  (0 = no limit) — set it to the paybill's or till's real limit.
* When the active account has taken its limit today (successful payments plus
  prompts still open from the last 15 minutes), the next account that is on
  and still has room takes the payment automatically. No manual switching.
  Counts reset at midnight, so the active account takes over again next day.
* Alerts (once a day per account): "<account> reached its daily limit …
  payments now go to <next>", and "every account has reached its daily
  limit" if none has room (members then see "Payments are busy right now").
* Each card shows a usage bar: KES used / limit (amber from 80%, red when full).
* Amounts are never changed. Settings only — no database changes.

AI Training — 7 separate tasks under one unlock (N5.1.0)
--------------------------------------------------------
* /tasks/ai-training is now a hub. One AI Training unlock (Task Settings →
  task_unlock_ai_training, price + upline commission unchanged) opens seven
  separate tasks, each with its own page /tasks/ai-training/{type}:
    label    Image Labeling     pick the label that fits a photo
    annotate Image Annotation   press-and-drag boxes on a photo, each box labelled
    map      Map Reviews        check a place listing (name / type / hours) + stars + review
    model    AI Model Reviews   compare two AI answers (A / B / both good / both bad) + reason
    app      App Testing        mark each test step Works / Broken, device, rating, bug note
    web      Website Testing    same as App Testing for web pages
    text     Text Tagging       tag the mood / topic / spam of a customer message
* One task at a time with Skip; progress bar; reward shown on every task.
* Rewards go to a new member wallet "AI Training Earnings" (ai_earn_balance,
  wallet key ai_earn, transaction type ai_task_earn) — withdrawable, listed in
  Wallets, History, Revoke, Bulk Prices (group "AI Training") and the
  dashboard "AI Training" card (earned total + "Up to KES x per task").
* Checks: optional correct answer per task — a wrong answer is saved but pays
  0; time on task (default 6 s); minimum words in reviews (default 4); daily
  task limit (default 40); tasks open again each day (or once per member).
* Admin → AI Training (admin/tasks/ai-training.php):
  - Task types: switch each on/off and rename it (members see the names).
  - Rules, "Add ready tasks" (31 tasks with pictures), bulk paste
    (type | title | picture or message | options | answer | reward),
    same reward for a whole type, add/edit any task (fields change per type,
    picture link or upload), hide/delete, bulk delete.
  - Latest answers + "Download answers (CSV)" = the labelled dataset.
* The 31 ready tasks are added automatically the first time AI Training is
  opened (only if there are no AI tasks yet).
* Pictures: 22 images made with Higgsfield in assets/ai-tasks/*.webp.
* Files: includes/ai-tasks.php, api/tasks/ai-training.php,
  site-tasks/ai-training/index.php, admin/tasks/ai-training.php,
  assets/css/ai-tasks.css. Kit classes used in Version 5 (sr-module, sr-ic,
  sr-glyph, sr-choice, sr-check, sr-btn); same look in every other version.
* Fixes: unpicked radio groups no longer show the checkbox "minus" (sr5.css §12);
  the Withdraw wallet picker is marked as a swipe row (sr-snap).
* Database (database/helawave.sql): tables ai_tasks, ai_task_submissions;
  balances.ai_earn_balance; wallet_config row ai_earn; setting ai_tasks_cfg.
  Verified: fresh import, re-import and upgrade give the same schema as the app.

Separate task categories + optional lock like Hotels (N5.2.0)
-------------------------------------------------------------
* AI Training now holds only the AI data tasks (Image Labeling, Image
  Annotation, AI Model Reviews, Text Tagging) behind its one unlock.
* Three stand-alone tasks, each with its own menu item (every UI version),
  page, dashboard card, Task Visibility switch, Names & Labels entry and
  earnings wallet — like Hotels:
    Map Reviews      /tasks/map-reviews   wallet map_earn     (map_earn_balance, txn map_review_earn)
    App Testing      /tasks/app-testing   wallet apptest_earn (apptest_earn_balance, txn app_test_earn)
    Website Testing  /tasks/web-testing   wallet webtest_earn (webtest_earn_balance, txn web_test_earn)
  Pages: site-tasks/{map-reviews,app-testing,web-testing}/index.php → shared
  includes/ai-task-page.php. Every category shows a Hotels-style card grid
  (photo, reward, Start / Unlock / Done today) and one task per page.
* Optional lock (Admin → AI Training → "Categories & locks"): switch Lock on
  for a category and members unlock each task separately (payment type
  ai_unlock, task_identifier aiunlock:<id>, table ai_task_unlocks). Price per
  task (0 = always open) or one price for a whole category; also editable in
  Bulk Prices & Access. Upline L1/L2/L3 % per task, or one rate in
  Commission Rates ("AI, map & testing task unlocks", default 20/10/5) —
  paid into the AI Royalties wallet. Works with STK, the webhook / reconcile
  cron, manual (non-Kenya) payments, the commission audit and admin reports.
* 90 new ready tasks with their own Higgsfield pictures
  (assets/ai-tasks/m01–m30, a01–a30, w01–w30.webp, data in
  includes/ai-tasks-seed.php): 30+ places for Map Reviews, 30+ app screens
  for App Testing, 30+ homepages for Website Testing. Added automatically
  once (only what is missing), or with "Add ready tasks".
* Admin menu: AI Training, Map Reviews, App Testing, Website Testing (the
  last three open the same admin page filtered to that category).
* Database: ai_tasks.unlock_price / commission_l1..3, table ai_task_unlocks,
  balances.map_earn_balance / apptest_earn_balance / webtest_earn_balance,
  wallet_config rows map_earn / apptest_earn / webtest_earn.
* Never run out (includes/ai-tasks-gen.php): a generator makes new, different
  tasks for every type from the bundled pictures and question banks — no
  duplicates, no new pictures needed:
    Text Tagging     messages from phrase banks (mood / topic / spam, English + Kiswahili)  — unlimited
    AI Model Reviews maths, money, travel time, units, dates, capital cities (good vs weak answer, checked) — unlimited
    Map Reviews      every place photo × business name × town × hours; ~1 in 4 listings shows the
                     wrong type of place on purpose (checked: answering "Yes" earns 0) — unlimited
    App / Website Testing  every screenshot × 5 check types × 6 devices (~990 / ~990)
    Image Labeling   every picture × several questions (~250)
    Image Annotation every picture × things to box + screen elements on every screenshot (~500)
  Admin → AI Training → "Generate more tasks" (25–1000 per type at a time) and,
  on by default, "Never run out": when a member has fewer than 8 open tasks in
  a type, 24 more are added (limit "Most tasks per type", default 5,000).
  Settings: ai_tasks_cfg.autofill / max_per_type; generator positions ai_gen_seq_<type>.

Heavy-traffic safety (N5.2.1)
-----------------------------
* Fixed: member rewards could be paid twice when the same member submitted the
  same task at the same moment from two phones/logins (test: 2 of 30 members
  paid twice). reward_lock() (includes/functions.php) now locks the member's
  balances row inside the payout transaction, and "already done today" and the
  daily task limit are re-checked inside that lock; RewardDenied refuses.
  Applied to: api/tasks/ai-training.php (AI Training, Map Reviews, App Testing,
  Website Testing), api/tasks/app-reviews.php, hotel-reviews.php,
  chat-tasks.php (incl. Teach Swahili) and video-tasks.php.
  Already safe: surveys + chat-profile rewards (unique keys), Walk & Earn and
  Spin (row locks), withdrawals (per-member lock + one-time form code + balance
  check), payment settlement (row lock on the payment).
* Task generator: one run per type at a time (GET_LOCK) — no duplicate tasks
  when many members trigger the auto top-up together.
* Load tests (tools kept outside the package):
    1,600 payments (activation, AI unlock, hotel, app, survey, chat profile,
    product, task unlock) settled by 12 racing workers = 19,200 attempts:
    every payment once, 2,800 commission lines, 0 missed, 0 doubled, upline
    wallets exact. Late confirmations after "failed": all credited once.
    Same task × 6 logins × 30 members: paid once each (AI, app, hotel).
    Daily limit with 3 slots left, 20 tasks at once: 3 accepted.
    12 simultaneous withdrawals of KES 600 from KES 1,000: 1 created, KES 400 left.
    Rush hour: 750 page loads while 1,600 payments settled — 0 server errors,
    median 0.16 s, 95% under 0.7 s.

Real places for Map Reviews (N5.2.2)
------------------------------------
* includes/ai-places.php + Admin → AI Training → "Real places for Map Reviews".
  Upload the free "Kenya Points of Interest (OpenStreetMap Export)" from HDX
  (data.humdata.org, Humanitarian OpenStreetMap Team) — points CSV or GeoJSON,
  zipped or not; overpass-turbo GeoJSON also works. Tick cities (Nairobi,
  Mombasa, Kakamega, Kisumu first, plus 28 more), most per city, reward range
  and % shown with a wrong type (checked). Re-importing skips places already added.
* Each real business → a Map Review: real name, type, address, opening hours
  (or "Hours not listed — check on Google Maps"), "Open in Google Maps" (name
  search) and "Exact map pin" (OpenStreetMap). The picture is an example of that
  type of place and says so. Credit "© OpenStreetMap contributors" on every task.
* "Real places only" switch hides the made-up practice listings and stops the
  generator from making new ones (switch off to bring them back).
* No database changes (settings only: ai_tasks_cfg.map_real_only).

== N5.2.3 — Real websites & real Play Store apps ==
* includes/ai-real-sites.php: 100 real Kenyan websites (county sites first — Nairobi, Mombasa,
  Kakamega, Kisumu, then Nakuru, Uasin Gishu, Nyeri, Kiambu, Machakos, Laikipia, Kilifi; national
  services; universities; media; shops; banks; jobs; travel) × 5 checks, and 58 real Play Store apps × 3 checks.
  Added once automatically (flag ai_starter_done = '3'); real ones are listed first.
* Admin → AI Training → "Real websites & apps": add the built-in list, paste your own
  ("address | name" or a Play Store link), "Check which websites are online" (hides sites that do not
  load; certificate-chain warnings count as online; changes nothing if the server is offline),
  and "real only" switches for Website Testing and App Testing.
* Task page: site card (name + address / Google Play), "Open the website" / "Open on Google Play" button.

== N5.3.0 — Pan-African payments & currencies ==
Inspired by how Centipid Billing collects across Africa (one gateway catalogue, a credential form per
gateway, callback per gateway, never trust a callback without re-checking with the provider).

* includes/gateways.php — 17 automatic gateways:
    Flutterwave, Paystack, pawaPay, MTN MoMo, Airtel Money, Orange Money, PesaPal, DPO Pay,
    IntaSend (M-Pesa), Hubtel, PayFast, Chapa, CinetPay, Fapshi, Paynow, Stripe, PayPal.
  Kenya keeps LipaLink / Daraja (Payment Settings) unless routed elsewhere.
* Admin → Payment Gateways: switch on, live/sandbox, keys (secrets masked), "Save & test keys",
  callback address per gateway (/api/payment/gw/{gateway}); a table choosing up to 3 gateways per
  country (failover in order) plus "All other countries"; "Fill empty countries" button.
* Flow: /api/payment/initiate converts the KES price into the member's currency (zero-decimal
  currencies rounded up; CinetPay multiples of 5), then
    - phone-prompt gateways → the page polls /api/payment/status,
    - checkout gateways → member goes to the gateway and returns to /pay/return/{gateway}
      (PayFast via /pay/go signed form).
  Callbacks only wake us up: gw_check_and_settle() asks the gateway, checks amount + currency
  (1% rounding room), then settles once (row lock). Under-payments are held ("mismatch") and the
  admin is alerted. Late payments after "failed" are still credited. Cron reconcile checks pending
  gateway payments; unfinished checkouts expire after gw_timeout_minutes (default 60).
  Tested locally with a mock Flutterwave + MTN MoMo: redirect + push flows, forged callback before
  payment (ignored), under-payment (held), 36 simultaneous callbacks/returns on 4 payments (each
  credited once).
* transactions.payment_gateway is now VARCHAR(30); mpesa_code VARCHAR(64).
* includes/currency.php — all 54 African countries + USD/GBP/EUR with live rates
  (open.er-api.com, no key), "Update exchange rates now", optional daily update, margin %, fixed-rate
  countries. Display switch: show everybody's amounts in USD (or any currency) and/or let members
  flip "Local ⇄ USD" from the top bar (/account/currency). Display only — charges use the real
  currency, wallets/commissions stay in KES.
* Before going live with a gateway: create the merchant account, paste keys in sandbox mode where
  offered, make one small real payment, then switch to live.

== N5.3.1 — "Charge members in" per gateway ==
* Checkout gateways (Paystack, Flutterwave, DPO, PesaPal, Stripe, PayPal, Chapa, CinetPay, Paynow…) get a
  "Charge members in" choice: their own currency (default) or always one currency (e.g. USD or KES for a
  Kenyan Paystack / Flutterwave account). Converted with today's rate; the wallet is still credited in KES.
  Phone-prompt wallets (MTN MoMo, Airtel, IntaSend) always charge the local currency.

== N5.4.0 — Production check & speed pass ==
Tested with 60,000 members, 600,000 transactions, 300,000 task answers, 40,000 withdrawals.
* Withdraw page 651 ms → 10 ms: the "earned commission" guard is worked out once per page view
  (was 8×) and reads two index ranges instead of every transaction of the member.
* Every page: settings that only an admin changes (max rewards, announcements, which features
  are on, commission sources, activation instructions) are shared for 60 s (qrows/qval/qcache);
  any admin save clears them at once. wallet_config is read once per request.
  Dashboard 44 → 20 database queries.
* Login: three index lookups instead of an OR that read every member.
* Lists: page links show 1 … 4 5 [6] 7 8 … last (admin Transactions page 542 KB → 27 KB,
  Users 217 KB → 60 KB). Counting a list no longer runs per-row sub-queries (db_count_slim).
* Admin Payment Gateways / AI Training totals cached (5 min / 2 min).
* New indexes: transactions(reference), transactions(payment_gateway, created_at), users(email),
  ai_task_submissions(user_id, type, earned), withdrawals(auto_status, status).
* .htaccess: CSS/JS/fonts cached 1 year (versioned), images 3 months, Brotli/gzip for text, SVG,
  JSON and fonts; pages marked private. .user.ini: bigger OPcache.
* Load test (2 CPU cores, 50 members at once, pages only): 134 → 250 pages a second; slowest 1%
  8.0 s → 0.48 s. Payments under load: 480 payments × 12 parallel settlers — every one credited
  once, 840 commission lines, none missed or doubled. Gateway checks (mock): forged callback ignored,
  under-payment held, 36 simultaneous callbacks credited once.
* Package no longer ships php.ini (it pointed at the old host's log folder) or empty host folders.

== N5.4.1–N5.4.2 — Responsive pass ==
* Checked 95 pages × 6 widths (320, 360, 390, 768, 1024, 1440) — no page wider than the screen.
* Fixed: text under 11px on phones (tab bar, kickers, tile labels, tournament numbers), small tap
  targets (breadcrumb, auth text links), admin page numbers (were 7px wide — admin had no pagination
  style), gateway-per-country table squashed on phones, admin small buttons/labels on phones.
* withdraw-pz1.php and pages/home.php no longer error when opened directly.

== N5.5.0 — Notifications, home page, Contact us, Terms ==
* Pulse notifications (assets/js/notify.js + css/notify.css) on every page (member, admin, sign-in):
  stacked glass cards, glowing icon per type, timer bar, hover pause, swipe to dismiss, actions,
  reduced-motion aware. Old Toast.* and SRToast.* calls use it automatically.
* In-app notifications (includes/notify.php, table user_notifications): payment confirmed, team
  commission (per upline, once per payment), withdrawal paid / returned, admin replies to messages.
  Bell with unread badge + list, /account/notifications, live pop-ups (polls /api/notifications every
  45 s while the tab is visible). Switch: Admin → Website & Pages → Notifications.
* Home page (pages/landing.php, assets/site/*.webp made with Higgsfield): hero with Create account /
  Log in, sticky phone buttons, ways to earn (only enabled tasks), how it works, Africa & payments,
  team bonus, FAQ, contact band. Real figures only (members ≥100, paid out, countries ≥3).
  Every text and section editable in Admin → Website & Pages; can be switched off.
* Contact us (/contact): message form with spam trap + rate limit → Admin → Messages (reply on
  WhatsApp / email / in the member's notifications, mark done, delete, count in the menu). Admin can
  switch the page to a WhatsApp button, or show both. Optional email for new messages.
* Terms & Privacy: each can be switched off (pages then go to the home page); with Terms on, sign-up
  needs the "I agree" tick (all designs). Text editable, "last updated" date set automatically.

== N5.5.1 — Home page pictures & texts, colour pickers, one colour scheme everywhere ==
* Admin → Website & Pages → Home page: edit every section title, upload your own pictures for the
  main picture, How it works, Africa, Team and each "Ways to earn" card (compressed automatically;
  "use the built-in picture" to go back), and add your own section (title, text, picture left/right,
  button + link).
* Admin → Theme & Appearance (Version 5): the Preset and Dark theme lists are now picture cards —
  each preset shows its three colours, a gradient and a sample button; each dark theme shows a small
  screen preview. Picking a preset fills the three colour boxes; changing a colour switches to Custom.
* The chosen colours now also drive the home page, Contact us, Terms/Privacy and the notification
  pop-ups/badges (site_brand()), so the whole site matches.

== N5.6.0 — Dashboard Styles: 16 looks, light + dark, phone menu types ==
* Admin → Dashboard Styles (also linked from Theme & Appearance): pick one of 16 member-area styles —
  Sunrise (original), Neon Royale, Candy Stack, Terminal, Night Glass, Azora 3D, Quest, Loud,
  Cyber HUD, Black Gold, Clean Air, Colour Blocks, Lavender Pro, Neo Brutal, Material Soft, Savanna.
  Picture previews of the real dashboard, light and dark. A style restyles every member page
  (dashboard, tasks, wallet, team, history, account) — same pages, same data, no page rewritten.
* Every style has a full light AND dark version. Members switch with the moon button; the admin
  chooses what members see first (the style's own mode, always light, always dark, or the Theme
  setting). Checked with axe-core (WCAG AA colour contrast) plus a pixel test for text on gradients
  and pictures: 16 styles × 2 modes × 8 member pages, 0 failures.
* Phone menu: bottom tab bar (as before), hamburger ☰ at the top left (no bottom bar), floating
  icon dock, or both. Computers keep the side menu.
* Layout options per part, so two sites on the same style still look different: task tiles (list /
  2-up cards / app icons), wallets (cards / full-width bars / 2-up grid / one list), balance figures
  (big cards / three small cards / one strip). "Use my theme colours" makes a style follow the
  Theme & Appearance colours.
* Files: includes/dash-styles.php, assets/ds/ (ds-base.css, one CSS per style, ds-fonts.css + fonts/
  self-hosted, img/ Higgsfield art: 3D icons for Azora, sunset for Savanna, haze for Night Glass,
  prev/ preview pictures). To fine-tune a style, edit assets/ds/<style>.css.
* Preview without saving: add ?ds=<style> (and ?menu=hamburger|dock|both) to any member page;
  ?ds=off ends the preview.
* Readability fixes for every design: notification dates/text, read-only form fields, "on hold"
  note on Withdraw, AI-Training wallet figures, captions on hotel photos.

== N5.6.1 — 5 more styles: glass + gradients + 3D ==
* New in Admin → Dashboard Styles (21 styles now): Aurora Glass, Peach Glass, Ocean Glass,
  Sunset Glow, Nebula 3D — frosted glass cards, colour gradients and glossy 3D icons
  (assets/ds/img/aurora_*, peach_gift, ocean_*, nebula_*, made with Higgsfield). Each has light + dark;
  same contrast checks (WCAG AA) pass.
* Fix: full-page backgrounds of every style now show (the Version 5 base forced a transparent page
  background) — Night Glass haze, Azora/Quest/Royale glows, Cyber grid, etc.
* Fix: 3D pictures on the balance card are no longer clipped to the Sunrise logo shape.

== N5.6.2 — Final light/dark check on every page ==
* Contrast audit (axe-core WCAG AA + pixel test for text on gradients/pictures) on all 21 styles ×
  light and dark × all 31 pages of the member menu (1,302 page checks), then every fixed page re-run
  (504 checks): 0 failures.
* Fixes for every style: price inside "Buy" buttons takes the button colour; Tournament #3 badge;
  Walk & Earn price in dark; Surveys "Unlock", Tournament #1/avatars/"You" and the active chat tab
  use a deeper accent behind white text; section titles on Pay for a client.
* Black Gold, Night Glass, Ocean, Terminal-style accents deepened where white text sits on them;
  Neo Brutal uses black-on-pink for those parts. Sunset Glow keeps its colour band on the dashboard
  only (other pages: plain background + gradient header).

== N5.6.3 — Teach Swahili header ==
* Teach Swahili header: an AI-generated student photo as a round profile picture (no label) in place of the
  cartoon; the header just says "Teach Swahili" (removed "Teach AI practice students…" and the
  "AI practice students" badge; student cards no longer carry the "AI practice student" tag).
  The note inside a lesson still says the student is an AI practice partner.

== N5.6.5 — Database self-repair on admin login ==
* Fix: "Import failed: Unknown column 'unlock_price'" (Map Reviews → import places). The step that
  adds unlock_price / commission columns to ai_tasks ran before the table was created, so on some
  sites those columns were never added. Order fixed.
* New: every admin login (and the first admin page after uploading a new version) checks the
  database against database/helawave.sql and every feature's own setup, then adds whatever is
  missing — tables, columns, indexes, default settings; widens columns where an upgrade needs it
  (never narrows). Never drops or changes existing data. Takes under a second.
  The admin sees a one-line notice when something was added ("Database updated: 3 tables created,
  4 columns added"). Admin → Database Check shows the last report and has "Check & repair now".
* Tested: an empty database is rebuilt to all 58 tables / 607 columns with 0 errors; a damaged
  database (missing columns + dropped tables) is repaired on login; a second run finds nothing.
* Host note: the database user needs CREATE and ALTER rights (normal on cPanel).

== N5.6.6 — Smooth scrolling on phones ==
* Fix: dashboards "shook" while scrolling with a finger. Cause: cards slid up 14px as they came into
  view, the press effect shrank a card the moment a finger landed on it, and the ripple started at
  the start of every scroll. On touch screens cards now stay put (no slide-in, no press/hover
  movement), the ripple only plays on a real tap, and glass styles skip per-card blur (header and
  tab bar keep it). Measured with real touch scrolling: card drift 15px → under 1px, 0 ripples.
  Computers keep all the animations.

== N5.6.7 — 5 new 3D dashboard styles + welcome-section designs ==
- New styles: Clay Pop 3D, Plum Velvet 3D, Mint Breeze 3D, Neon Night 3D, Candy Cloud 3D (26 styles total).
- 32 glossy 3D icons (assets/ds/i3d/*.webp, 580 KB) made with Higgsfield, used in the menu,
  page headers, wallets, stat cards and task tiles (assets/ds/ds-3d.css).
- Admin > Dashboard Styles: new "3D icons" option (style default / on for every style / off).
  Setting key: ds_3d. Preview links: ?i3d=1 or ?i3d=0.
- Welcome section ("Good afternoon" + "No new team members today") now has 7 designs:
  card, banner, strip, merge, bubble, float, center. Each style has its own default; admin can
  override under "Welcome section". The notice shows a 3D team icon.
- Page header pictures keep space so long titles never run behind them.
- Checked: 5 styles x 31 pages x light/dark = 310 contrast checks, 0 failures.

== N5.6.8 — Teach Swahili students locked one by one (like Hotels) ==
- Every student is now locked separately with its own unlock price (existing students start at KES 100,
  upline 20/10/5 %). Members always see every student (photo, country, level, payout) with a Locked
  tag and an "Unlock for KES …" button; payment uses the same M-Pesa sheet as hotels, or manual
  payment outside Kenya.
- On payment: the student opens for that member for good; uplines get L1/L2/L3 % into the
  Teach Swahili commission wallet. Payment type: swahili_unlock (target 'swahili:<id>').
- The server refuses to start or pay a session for a locked student.
- Admin > Chat Tasks: "Lock each student" card (one price + commission for all), per-student Edit
  (price + picture picker), a gallery of the 16 student pictures, unlock price on Add and on
  bulk Generate. Bulk Prices > Chat tasks now has the unlock price and L1/L2/L3 columns.
  Admin > Commission Rates has "Teach Swahili student unlocks".
- The old section-wide fee (Task Settings) still works if set; set it to 0 so members pay per student only.
- New table swahili_unlocks; chat_tasks gains unlock_price, commission_l1..3 (auto-added on admin login).

== N5.6.9 — Compact welcome · Unlock Modes for every task · real student photos ==
- Welcome section (all 26 styles): one-line greeting (no date or referral code) and a one-row
  team notice (3D icon · text · Invite · close). About 40% shorter. Each style keeps its colours.
- NEW Admin → Unlock Modes (admin/unlock-modes.php, includes/unlock-modes.php). For Hotels, Surveys,
  Apps Rating, AI Training, Map Reviews, App Testing, Website Testing, Teach Swahili, Chat & Earn
  profiles (and YouTube/TikTok videos where shown) choose:
    Each item (like Hotels) · Section (pay once, all items free) · Both (section, then each item).
  Section fee and item prices are set on the same page ("3 × reward", "All free", "Set all").
  0 = free everywhere. Settings: unlock_mode_<key>. Pages show a standard section card and grey
  out items until it is paid; every API checks the same rules (unlock_section_open / unlock_items_on).
- First page after upload (once, unlock_modes_init): section-fee rows for groups that had none
  (price 0 = free), AI / map / app / web tasks priced at 3 × their reward, videos likewise.
- AI admin "Lock" boxes now set the Unlock Mode (on = each task, off = section).
- Per-video unlocks built (payment type video_unlock, table video_unlocks) — dormant in this
  version, which shows Walk & Earn instead of videos.
- Teach Swahili: 8 more realistic Higgsfield photos (16 in total); cartoons removed. Students are
  matched once to a photo that fits their country and gender (setting swahili_photos_v2); new
  students get one automatically. Every photo keeps its small "AI" mark.

== N5.7.0 — Teach Swahili: bigger photos, no "AI" badge ==
- Student photos 52 → 68 px (lesson header 40 → 48 px); the small black "AI" badge is removed.
- One line under "Available students" ("Students are AI practice partners.") and the unlock sheet
  say it instead, so members know before they pay; the in-lesson note is unchanged.

== N5.7.1 — a different 3D team icon for every dashboard style ==
- 25 new Higgsfield 3D icons (assets/ds/i3d/team-<style>.webp, ~30 KB each); Clay Pop keeps team.webp.
  E.g. Savanna = lion, giraffe & elephant; Nebula = astronauts; Ocean = dolphins; Velvet = handshake;
  Gold = gold statues; Candy = gummy bears; Terminal = robots; Cloud = friends on a cloud.
- Shown in the "No new team members today" row (ds-base.css, per data-ds); icon slightly bigger (2.85rem)
  without making the row taller. "+N new members" still shows the trophy.

== N5.7.2 — simpler sign-up page ==
- Removed: subtitle, "At least 3 characters.", "Pick your country — its code is added automatically.",
  "(min 4 characters)", the "Invited by …" line and the "Have a referral code?" link.
- The invite link (?ref=) still credits the sponsor through a hidden field.
- The hint lines stay empty and only appear for "Available" / "already registered" / "taken".

== N5.7.3 — sign-up fields stacked; Kenya default; country hidden when only Kenya ==
- Username, Country, Phone, Password are now one below another (country is no longer beside the phone).
- Kenya is selected by default (or the first active country if Kenya is switched off).
- With only one active country the Country field is not shown; it is filled in automatically.
- Cameroon (added by an old update) is now added once only, so a country the admin deletes
  stays deleted even when the admin-login self-repair runs.

== N5.7.4 — "I agree" tick box can be switched off ==
- Admin → Website & Pages → Terms & Privacy: new switch '"I agree" tick box on sign-up' (setting
  site_pages.signup_agree, default on). Off = no tick box and none required; the Terms and Privacy
  pages stay online. Works on both sign-up pages (sr5 and classic) and in the server check.

== N5.7.5 — tighter welcome spacing; clear animated menu button ==
- Welcome area: no empty padding round a greeting without a card; gaps now ~12px above the greeting,
  8px to the team notice and 14px below it (was 32 / 22 / 24). All 26 styles.
- Hamburger menu button: brand-tinted rounded button with three brand-coloured lines; the lines play a
  short wave every 3 s with a soft glow pulse so members see where to tap. After a member opens the
  menu once the pulse stops (localStorage dsMenuSeen). No motion when the phone asks for reduced motion.
- If the site name cannot fit beside the menu button on a small phone, only the logo mark shows
  (instead of a cut-off name); the name is in the menu.

== N5.7.6 — Maintenance mode (new) ==
- Admin → Maintenance (admin/maintenance.php): on/off switch, optional message, optional "Back by" time
  (shown only; the site does not reopen by itself), "Preview the page members see".
- While ON (includes/maintenance.php, run from includes/functions.php on every request):
  members and visitors get a "We'll be back soon" page (HTTP 503 + Retry-After, auto-refresh every 60 s,
  light/dark); API / app calls get JSON {success:false, maintenance:true, message}.
  Still working: admin panel (+ red "Maintenance mode is ON" banner and ON badge in the menu), member
  pages for a logged-in admin, payment callbacks (/api/payment/webhook, /api/payment/gw), /pay/return,
  cron, CLI, /assets, /pwa. Balances and earnings are not touched.
- Settings: maintenance_mode, maintenance_message, maintenance_until.

== N5.7.7 — webhook addresses visible with a Copy button ==
- New admin_copy_box() (includes/admin-copy.php): full address shown (wraps on phones) + Copy button
  ("Copied!"), clipboard API with a select-and-copy fallback.
- Payment Settings: "Your M-Pesa webhook URL" at the top (the custom Daraja callback if set, else
  <site>/api/payment/webhook). Payment Accounts: "Webhook URL for every business" at the top.
- Payment Gateways: each gateway's callback address (<site>/api/payment/gw/<gateway>) is now shown on
  the card itself instead of hidden inside the collapsed "Settings & keys".
- If the address shows the wrong domain, set the Site URL in admin settings.

== N5.7.8 — Admin → Wallets: Save always on screen ==
- A Save bar floats at the bottom of the screen while the wallet list is on screen (the admin layout
  blocks CSS sticky, so it is a fixed bar placed over the list); it steps aside when the real Save
  button at the end comes into view. After any edit it turns amber: "You have unsaved changes", and the
  browser warns before leaving the page with unsaved changes.

== N5.7.9 — "Withdrawal fee via M-Pesa prompt" now applies to the combined balance ==
- Bug: in this version members withdraw from the combined "Available Balance"; that withdrawal was
  saved as wallet 'combined', so each wallet's prompt-fee switch was never checked.
- Fix: combined_plan() works out which wallets the money comes from (largest balances first, same as
  the debit); combined_prompt_fee() adds the fee of each of those wallets that has the switch on
  (fixed amount, or % of the part taken from it). If there is a fee, the withdrawal waits for the
  M-Pesa fee prompt like a single wallet (member receives the full amount once the fee is paid).
- The split is recorded, so cancelling (member) or rejecting (admin) returns each part to its wallet.
- Upline L1/L2/L3 commission on the paid fee uses the fee wallet the largest part came from.

== N5.8.0 — Dashboard Styles on every version; version choice survives updates ==
- New: Admin → Dashboard Styles → "Use my dashboard style on every version" (setting ds_all_versions,
  default on). With it on, Profiz 1, Profiz 3, Version 4, HELAHIVE and TrendGain show the member area
  with the Sunrise page set and the chosen Dashboard Style, while keeping that version's own rules
  (combined wallet for Profiz 3/TrendGain, Profiz 3 home page, wording). Off = the version's original
  design. HELAWAVE (classic) always keeps its own pages. (is_sr5() in includes/ui.php; dashboard/index.php
  checks it first.)
- Fix: uploading an update no longer switches the site back to Version 5. The package's version is applied
  only on a first install or when the package is built for a different version (ui_pkg_applied).
- Checked on Profiz 3 and TrendGain: dashboard + 93 member page loads, 0 layout / PHP / JS errors.

== N5.8.1 — new dashboard order, partner link, commission sources, side-menu order ==
- Dashboard (dashboard/sr5.php), all 26 styles:
  greeting → team notice (no button) → WALLETS (available balance, Today/Withdrawn/Lifetime, every bonus
  wallet) → WAYS TO EARN → YOUR PARTNER LINK → RECENT ACTIVITY.
  Withdraw and Invite are no longer at the top (Withdraw stays in the bottom bar).
- Partner link: full link + Copy, share to WhatsApp, Facebook, Telegram, X, SMS and "More" (phone share
  sheet). Optional custom share text: setting partner_share_text.
- Recent activity: commissions show where they came from — "Level 1 · from <member> · Account activation /
  Hotel unlock / Chat profile unlock / Product sale…" (from the transaction meta source_user + level).
- Side menu: "Earn" is now "Ways to earn" and comes right after Home.
- NEW Admin → Menu Order (admin/menu-order.php): drag or ↑/↓ whole groups and the items in each group;
  Home stays first; Reset to default. Setting nav_order; applied in pz1_nav() → every menu (side menu,
  drawer, tiles' lock state).

N5.8.2 — Link preview picture, faster pages, Profiz 3 dashboard styles
-----------------------------------------------------------------------
LINK SHARING / FAVICON
- Every page now carries a favicon (32/48/192 px) and share tags (Open Graph + Twitter card), so a link
  pasted in WhatsApp, Facebook, Telegram or X shows the app icon, name and a short line of text.
- /og-image.png (pwa/og.php): a 1200×630 share picture drawn from the app icon, name, colours and the
  share text; cached in storage/cache/og-*.png. /favicon.ico serves the icon (.htaccess rules).
- Admin → App settings → "Link sharing — picture, title & text": share_title, share_description,
  partner_share_text, with a live preview. share_head() in includes/ui.php (called by pwa_head()).

SPEED ON SLOW INTERNET
- Icon fonts trimmed to only the icons the app uses (Phosphor + Duotone 305 KB → 85 KB; Fluent icon
  script 89 KB → 52 KB gzipped). Originals kept as *.full.*; re-run tools/perf/build_icons.py after
  adding new icons in code.
- includes/asset-bundle.php: back-to-back stylesheets and scripts are joined into one file each
  (21 files → 6 per page), written once to assets/cache/b-<hash>.css/js and rebuilt automatically
  when a source file changes. CSS is lightly minified. Setting asset_bundling = 0 turns it off.
  assets/cache/ must be writable (it is created automatically); if not, pages load as before.
- Photos (hotels, surveys, AI tasks, chat profiles) use img_fit()/img_srcset(): 480 px on phones,
  900 px on wider screens, quality 60, AVIF/WebP.
- Slow-3G test (compressed like the live host): first paint 5.0 s → 3.6 s; dashboard 748 → 435 KB,
  hotel reviews 1,614 → 674 KB, withdraw 719 → 407 KB.

DASHBOARD STYLES — PROFIZ 3 (+2 finishes of the same design)
- profiz       "Profiz 3"          white greeting card, full-width green / blue / red / purple balance
                                   cards with outlined corner buttons and faint corner icons, pink brand,
                                   raised pink Withdraw in the tab bar.
- profizglow   "Profiz 3 Glow"     same layout, deeper 3-stop gradients, coloured glow, one glossy shine
                                   (off for "reduce motion").
- profiznight  "Profiz 3 Midnight" same layout on deep navy with neon-edged cards; opens in dark, has a
                                   full light version too.
- Skins are generated from tools/ds/pz3_skins.py → tools/ds/skins/*.css → tools/ds/gen.py.
  Corner icons: assets/ds/pz3/ghost-*.svg. Previews: assets/ds/prev/profiz*_{light,dark}.webp.
- Contrast audit 0 failures (light + dark); overflow check 141 pages, 0 problems.

N5.8.3 — Profiz 3 colour patterns (replace Glow / Midnight)
------------------------------------------------------------
- Removed "Profiz 3 Glow" and "Profiz 3 Midnight" (they looked too alike). Sites that had chosen them
  move automatically: profizglow → profizsunset, profiznight → profizneon (ds_current()).
- "Profiz 3" (original colours) stays. Five new styles of the same design, each with its own colours
  and its own icons behind the cards:
    profiztropic  Profiz 3 Tropical Pop  — teal / orange / pink / indigo, glossy 3D wallet, star, coins, trophy
    profizjewel   Profiz 3 Royal Jewel   — emerald / sapphire / ruby / amethyst, gold edges, gold outline icons
    profizpastel  Profiz 3 Pastel Cream  — mint / sky / rose / lilac with dark text, tinted icons;
                                           dark mode turns the pastels into tinted dark glass
    profizsunset  Profiz 3 Sunset Ramp   — orange → red → magenta → plum, frosted white 3D icons
    profizneon    Profiz 3 Neon Ocean    — dark glass cards with cyan / violet / amber / green glowing edges,
                                           matching amounts, neon icons (opens in dark)
  Wallet cards below cycle the same four colours.
- Source: tools/ds/pz3_patterns.py (colours + icon styles) → tools/ds/pz3_skins.py → tools/ds/gen.py.
  Previews: assets/ds/prev/profiz*_{light,dark}.webp.
- Checks: contrast audit 0 failures in light and dark for all six Profiz styles; overflow check 0 problems.

N5.8.4 — Withdrawable or not, per task
--------------------------------------
- New panel "Withdrawable — per task" at the top of Admin → Wallets: every task by the name members see
  (Hotels Evaluation, Teach Swahili, Chat With Asians/Europeans/Americans, Apps Rating, Paid Surveys,
  Walk & Earn, Lucky Spin, AI Training, Map Reviews, App Testing, Website Testing, TikTok & YouTube,
  Forex Trading, Y99, Site Products, Instant Loan, Team bonus, plus any custom feature) with a switch for
  its OWN EARNINGS wallet and for its TEAM COMMISSION (royalties) wallet: Withdrawable / Not withdrawable.
  Wallets shared by several tasks show "Also paid by …" and move together. Team Bonus has one switch
  (on the Team bonus row) because many tasks pay into it.
- The same switches (only that task's rows) now sit at the top of each task's admin page:
  hotel-reviews, chat-tasks, app-reviews, surveys, ai-training, video-tasks, task-settings, products,
  features. Saving there returns to the same page with a "Saved" note.
- Switch = wallet_config.withdrawal_enabled, so it applies everywhere.
- FIX: the combined balance (Profiz 3 / Sunrise "Available balance") used to include wallets set to
  "not withdrawable" — a locked task's money could still be withdrawn through it. Now only withdrawable
  wallets join the combined balance (combined_wallets()).
- FIX: the dashboard "Available balance" (sunrise5, profiz1, classic) no longer counts locked wallets
  (e.g. Agent Bonus, Lucky Spin) — wallet_withdraw_on().
- Code: includes/task-withdraw.php (task_withdraw_registry, task_withdraw_panel, task_withdraw_save,
  wallet_withdraw_on). New task? Add one line to task_withdraw_registry().

N5.8.5 — Lock one AI Training task type (e.g. only Image Labeling)
------------------------------------------------------------------
- Admin → Tasks → AI Training → "Categories & locks": the "Set one unlock price for" list now has
  "One task type only" options (Image Labeling, Image Annotation, AI Model Reviews, Text Tagging) next to
  the whole sections. Price > 0 locks every task of that type (members see "Unlock for KES …"); 0 = free.
  Works when the AI Training Lock box is ticked (lock each item); the save message warns if it is not.
- "Task types" box shows per type how many tasks are locked and from what price.

N5.8.6 — No more "Processing…" while the M-Pesa window is open
--------------------------------------------------------------
- Bug: on every unlock / pay button (Surveys, Hotels, Apps Rating, AI Training, Map Reviews, App &
  Website Testing, Teach Swahili, Chat With Asians/Europeans/Americans, Walk & Earn, Lucky Spin,
  Forex, Y99, TikTok & YouTube, …) the page marked the button "Processing…" BEFORE the M-Pesa number
  window opened, so it spun while the member had done nothing, and could stay that way.
- Fix (one place, assets/js/app.js → PhonePrompt.ask): when the window opens, those buttons return to
  normal; after "Pay" they show "Processing…" again until the prompt is sent; if the window is closed
  they stay normal. Safety net: a button tied to a request clears itself after 20 s at most.
- Tested on 17 task pages: open = normal, closed = normal, Pay = spinner, failed payment = normal.

N5.9.0 — Short Drama (Drama Pass / time pass)
---------------------------------------------
Member page: /tasks/short-drama  (menu: Ways to earn → Short Drama; dashboard tile; Task Visibility key
"short_drama"). Admin: Admin → Tasks → Short Drama (/admin/tasks/short-drama).
- Catalog: moving teaser banner (AI video, loads only on fast connections; a picture on Data Saver / 2G /
  reduced motion), Drama Pass card, Continue watching, genre chips, 9:16 series posters.
  With no series yet it shows "New dramas are coming soon" and sells nothing.
- Series page: story, episode grid (watched / next / locked), finish-and-review reward.
- Player: 9:16, resumes where the member stopped, saves progress, plays the next episode by itself.
  At the end of the last open episode: the CLIFFHANGER screen (blurred last frame) with
  "Watch it free today" or a one-tap "Unlock now · 7 days for KES 199".
- Drama Pass plans (admin-editable; seeded 1 day 49 · 7 days 199 · 30 days 599). One payment, never
  renews on its own; buying again adds days after the current pass. The plans sheet shows price per day
  and "Save %" against the shortest plan. Pays through the same M-Pesa window as every unlock
  (type drama_pass); outside Kenya via manual payment (purpose drama_pass).
- FREE EPISODE OF THE DAY (Admin setting, on by default): members without a pass can open one locked
  episode per day (Nairobi date), open until midnight. Brings members back daily.
- RATING = STARS ONLY (no text, no need to finish the series). The player counts real playing time
  (pauses, seeking and faster playback don't count); the member can rate a series once they have
  watched the admin's minimum (Admin → Short Drama → Settings → "Watch time before rating", default
  3 minutes; 0 = any time). The server checks the time with its own clock, so it can't be faked.
  Rating reward (default KES 20, paid automatically by default — untick to approve by hand) →
  "Short Drama Earnings" wallet. Upline commission on every pass (Commission Rates → Short Drama passes, default 20/10/5 %)
  → "Drama Royalties" wallet. Both wallets have the withdrawable switch at the top of the admin page.
- Videos: upload MP4/WEBM (up to 500 MB each, several at once, numbered by file name). Sent in 1.5 MB
  pieces, so it works with the host's 2 MB upload limit and slow internet. Stored in storage/drama
  (not reachable directly); they only play through /tasks/short-drama/stream/<id>, which checks the free
  episode / pass / free-of-the-day and supports seeking (HTTP Range). Or paste an https link
  (e.g. an AgentSasa episode link) — note a pasted link itself is public.
- Premium look: swiping banner (teaser + 3 slides, slow zoom, progress dots), glowing Drama Pass card
  with a 3D crown, "Pick a mood" genre tiles (10 genres, each with its own colours and art), poster rails
  (New this fortnight / Top rated — shown only with real data: 3+ ratings), series header on a blurred
  poster backdrop, ambient glow around the player, watch-time ring and progress bar, confetti on rating
  and on a bought pass. All animations stop for members who turn on "reduce motion".
- Artwork in assets/drama/ (AgentSasa, AI-made): teaser.mp4 (190 KB), hero, pass art and genre posters
  (romance, family, revenge, comedy, thriller, office, campus, mystery, love triangle, fantasy), 3 banner
  slides and crown.webp. A series without its own poster uses its genre's poster.
- FIX (all categories): a "one commission per category" rate could be saved as 0/0/0 if its table did not
  exist yet, and the sync then set every item to 0 %. It no longer saves when the read fails; a one-time
  repair puts Drama Pass plans back to 20/10/5 if no pass was sold.
- New tables: drama_series, drama_episodes, drama_plans, drama_passes, drama_progress, drama_reviews,
  drama_daily (drama_progress.watched_sec = real watch time). Balances: drama_earn_balance, drama_comm_balance. Created automatically.
- Code: includes/short-drama.php, site-tasks/short-drama/{index,stream}.php, api/tasks/short-drama.php,
  admin/tasks/short-drama.php, assets/css/short-drama(.admin).css.

N5.9.1 — Choose which members are paid automatically
----------------------------------------------------
Admin → Automatic Withdrawals → "Members paid automatically":
- Rule "All members" (default, same as before): everyone is paid automatically; untick a member to send
  their withdrawals to Withdrawals → Pending for you. New members are ticked.
- Rule "Only ticked members": nobody is paid automatically unless you tick them. New members are unticked.
- Search by username, phone (07… / 2547… / 7…), email, referral code or member ID. Tabs: All / Automatic /
  Manual with counts. Switch per member (saves at once), "Tick all shown" / "Untick all shown".
  Shows "inactive", "N pending" and "set by you" labels. "Clear my individual ticks" resets everyone to the rule.
- The wallet ticks, the maximum amount and the master switch still apply; the member tick is one more check.
  Your "Send via HashPay" button on a withdrawal still works for any member.
- Every change is written to the admin audit log. New column users.auto_withdraw (NULL = follow the rule).

N5.9.2 — FIX: "Something went wrong" on Short Drama (tables not created)
-----------------------------------------------------------------------
- On a site that never had Short Drama, the automatic setup first tried to add a column to
  drama_progress before that table existed; the error stopped the whole setup, so no drama table was
  created ("Table 'drama_plans' doesn't exist" in error_log) and /tasks/short-drama failed.
- Now the tables are created first and every setup step runs on its own (one failure never blocks the
  rest; failed steps retry on the next page load). Tested from an empty database: all 7 tables, both
  wallets, the 3 plans (20/10/5 % commission) appear on the first visit.
- Optional: database/short-drama-tables.sql creates the same tables by hand in phpMyAdmin.

N5.9.3 — Short Drama banner moves by itself
-------------------------------------------
- The top banner now slides to the right every 5 seconds and loops back to the first slide
  (before: the first slide waited 9 s, and on phones any touch stopped it for good).
- Touch pauses it only while the finger is on it (it carries on 2.5 s later); mouse hover pauses on
  desktop; it also pauses when the banner is scrolled off-screen or the tab is hidden, and never moves
  for members who turn on "reduce motion". The dot under each slide fills up to show the timing.
- Phones: the next slide peeks in from the right so members see they can swipe.
- Desktop: previous / next arrows appear on hover.

N5.9.4 — Hidden tasks hide their wallets · theme on sign-in pages · balance card · banner X
------------------------------------------------------------------------------------------
- Admin → Task Visibility now also hides the WALLET CARDS of switched-off tasks on member dashboards
  (Sunrise 5, Profiz 1/3/4/6, classic) and their lines on Financial → Commissions. A wallet stays visible
  while it still holds money (money is never hidden), and a wallet fed by several tasks stays while one of
  them is on (e.g. AI Royalties also collects Map Reviews unlocks). Code: includes/task-visibility.php
  (commission_source_visible, wallet_column_task_visible).
- Login, register, forgot-password and activation pages now use the same dashboard style as the member
  area (colours, fonts, background, light/dark default); the classic register page no longer forces light.
- Available balance card (Sunrise 5): same compact look as the Today card; on desktop the balance and the
  three stat cards sit in an even 2 × 2 grid (no tall, empty card). Works on every style.
- FIX: the X on "No new team members today" did nothing (a style rule kept it visible). It now closes the
  banner and it stays closed for the day (shows again when a new member joins or the next day).

N5.9.5 — Available balance card back to the compact Today-card look (extras removed); desktop 2 × 2 grid.

N5.9.6 — Short Drama banner slides smoothly
-------------------------------------------
- The banner no longer uses browser scroll-snapping (it jumped and stuttered on phones). The strip now
  moves with a GPU-accelerated slide (0.75 s ease), follows the finger while swiping and glides to the
  nearest slide; a quick flick also changes slide, a tiny nudge does not.
- Last slide → first slide now continues forward (a copy of the first slide is used) instead of
  rewinding back through every slide.
- Side slides on phones use a light shade instead of a colour filter (filters repaint every frame);
  the slow zoom on pictures is GPU-accelerated too.

N5.9.7 — Depth & glass for the 25 classic dashboard styles
-----------------------------------------------------------
- Every classic style (Material, Royale, Candy, Glass, Cyber, Gold, Ocean, Terminal, Azora, Quest, Loud,
  Clean, Blocks, Lavender, Brutal, Savanna, Aurora, Peach, Sunset, Nebula, Claypop, Velvet, Mint, Neon,
  Cloud) keeps its own layout, colours and fonts, and now has depth inside its containers (balance card,
  stat cards, wallet cards, team banner):
  · light cards: frosted inner light, a soft pool of the style's colour, a lit top edge, a soft colour glow;
  · colour cards: gloss, a glass bubble, a light streak and a deeper shade at the bottom;
  · one signature texture per style: Cyber grid, Terminal scanlines, Gold foil, Brutal halftone dots,
    real frosted glass on Glass, Savanna sunlight, Aurora ribbons, Nebula stars, Ocean wave glow,
    Claypop clay light, Neon inner glow, Cloud puffs, Velvet sheen …;
  · icon chips get a small glassy dome; the balance card has a slow light sweep (off for "reduce motion").
- Dark mode has its own, quieter version of every effect. Text contrast was re-checked (WCAG AA).
- Admin → Dashboard Styles → "Depth & glass" (on by default) turns it off for the flat original look.
- Files: assets/ds/ds-depth.css (generated by tools/ds/depth.py), loaded by ds_head() for classic styles
  only (Sunrise and the Profiz styles are unchanged). The style files themselves are unchanged.

N5.9.8 — Compact withdraw page (one phone screen)
-------------------------------------------------
- Financial → Withdraw (Sunrise 5 and Profiz) now fits on one phone screen; page height went from
  1230 px to about 880 px, and the "Withdraw to M-Pesa" button is visible without scrolling.
  · slim page header (title only); smaller wallet chips;
  · balance card: amount on the left, Min / Max on the right; the wallet breakdown is one swipeable row;
  · 25% · 50% · 75% · MAX in one row of small buttons;
  · "registered number" note sits beside the M-Pesa label (full text on the locked field's tooltip);
  · You receive · Fee · Deducted side by side in one strip instead of three rows.
- Same form fields, checks and fee maths as before (financial/withdraw-pz1.php).

N5.9.9 — Short Drama top section: 5 designs to choose from
-----------------------------------------------------------
- Admin → Tasks → Short Drama → "Top section design": Classic (current) or one of five designs for the
  poster slider and the earnings cards:
  1 Cinema (full-width poster, story bars, white Play button, frosted glass earnings bar overlapping the poster)
  2 Spotlight (centred card with coloured glow, side posters shrink and fade, ticket-stub earnings cards)
  3 Split (wide picture on top + dark info panel below, 01 / 04 counter, slim pill earnings)
  4 Neon (slowly turning rainbow frame, neon titles, dark neon earnings cards)
  5 Bento (shorter poster, big type, 01 / 04 counter, pastel earnings tile grid)
- Members' page previews any design with /tasks/short-drama?hv=1 … ?hv=5 (no setting changed).
- Slider fix: the slide step now uses the card's real width, so scaled side cards don't shift the slider.
- Files: assets/css/short-drama-hv.css (new), site-tasks/short-drama/index.php, admin/tasks/short-drama.php.

N5.10.0 — Compact sign-up page with sponsor
--------------------------------------------
- auth/register (Sunrise 5) redesigned to fit one phone screen: colour header band (logo, light/dark
  button, "Create account", "Join <app> in a minute and start earning."), then a white sheet with
  label-free fields (Username, Country, +254 | phone, Password with eye), Terms tick, a big
  "Create account" button and "Already have an account? Sign in".
- Sponsor line is back: "● Sponsor : <username>" shows when the visitor came through an invite link
  (?ref=, or the 30-day invite cookie). The sponsor is still credited automatically.
- The +code box follows the chosen country; the header uses the active dashboard style's colours;
  dark mode supported. All checks (availability, phone format, terms, errors) are unchanged.
- Files: includes/sr5/auth-register.php, includes/sr5/auth.php, assets/sunrise5/sr5-register.css (new).

N5.10.1 — Sign-in matches the compact sign-up; both made smaller
-----------------------------------------------------------------
- Sign-up made smaller to match the reference: shorter header (28 px title), 45 px fields, 47 px button,
  tighter gaps — the "Sign in" line now ends at about 556 px on a 390 × 844 phone.
- Sign-in page rebuilt the same way: colour header "Welcome back / Sign in and keep earning.",
  "Phone number or username", "Password" with eye, "Keep me signed in" + "Forgot password?" on one row,
  gold "Sign in" button, "New to <app>? Create account". Error message sits under the header.
- Shared header helper sr5_rg_hero() in includes/sr5/auth.php.
- Files: includes/sr5/auth.php, includes/sr5/auth-login.php, includes/sr5/auth-register.php, assets/sunrise5/sr5-register.css.

N5.10.2 — Sign-in / sign-up in a centred card on phones
--------------------------------------------------------
- On phones the compact form now sits in a rounded card centred on the screen (soft brand-coloured
  page background, shadow), instead of filling the whole screen. Same size, fields and checks.
- File: assets/sunrise5/sr5-register.css.

N5.10.3 — Fix: Task Visibility crashed on "Custom features"
------------------------------------------------------------
- Admin → Tasks → Task Visibility showed "Something went wrong · Call to undefined function" inside the
  Custom features card: the page used feature_slug() but never loaded includes/icon-library.php.
- Fixed in two places: the page loads it, and includes/functions.php now loads icon-library.php for
  every page, so menus and the commission/visibility checks can always use the feature helpers.
- Files: admin/tasks/visibility.php, includes/functions.php.

N5.10.4 — Home page, sign-in and sign-up share one theme
---------------------------------------------------------
- Sign-in and sign-up now take their colours from the same place as the public home page
  (site_brand(): Admin → Website & Pages / theme colours), so all three match:
  · page background = the home page's dark hero with the same pink/violet glows;
  · card header, buttons and the desktop side panel = the home page's pink → violet gradient;
  · sponsor name, +254, links and the country arrow = the same brand pink (lighter in dark mode).
- The gold/orange colours on the sign-in and sign-up pages are gone. Change the theme colour once
  and the home page, sign-in and sign-up change together.
- Files: includes/sr5/auth.php, assets/sunrise5/sr5-register.css.

N5.11.0 — Short Drama · Trailers: watch, rate & earn (the RateFlix flow)
------------------------------------------------------------------------
Members (Short Drama → "Trailers · earn", or /tasks/short-drama/trailers):
- Discover: banner with the Short Drama wallet + Withdraw, "x/10 rated today" bar with today's
  earnings, bonus hint, search, filters (All · To rate · Movies · Series · Rated), sort (For you ·
  Most rated · Top score · Newest), genre chips and big trailer cards (+KES reward badge, length,
  New / Featured / Rated chips, "Watch & rate · earn KES 20").
- Trailer page: blurred backdrop, 16:9 player (YouTube, youtube-nocookie), "earning live" ring that
  counts up to the reward, a progress button "Watching… 84s left · 30%". After the minimum watch %
  the stars unlock (1–5, mood and words optional, spoiler switch), "Post rating · earn KES 20",
  then a "Rating posted! +KES 20" dialog with Next trailer. Score panel (average + 5-bar chart),
  members' reviews with moods, "More like this".
- Short Drama home: a Series | Trailers switch and a "Rate trailers · earn" poster row.
Earning (checked on the server, like RateFlix):
- Play starts a server watch session; posting is refused until the minimum % of the trailer's real
  length has passed ("Play the trailer first", "Keep watching — N more seconds").
- One rating per trailer, a daily limit, a once-a-day bonus when the limit is reached.
- Reward → "Short Drama Earnings" (drama_earn_balance), ledger type drama_reward / drama_trailer.
Admin → Drama Trailers (side menu, or the button on Admin → Short Drama):
- Trailers: add one by YouTube link; edit title, genre, length, own reward, order; Live / Featured;
  bulk make live / hide / delete. "length guessed" until the real length is known.
- Import trailers (preview, fix titles/genres, tick, import live or hidden; duplicates skipped):
  · YouTube channel or playlist — no key; only titles with "trailer/teaser" unless "All videos";
  · pasted YouTube links — no key;
  · TMDB lists (in cinemas now, coming soon, popular, trending, top rated, series) and TMDB search —
    free TMDB key; brings real titles, genres, year, synopsis, posters and the official trailer;
  · YouTube search — optional YouTube Data API key.
  Videos are never downloaded: trailers play from YouTube; posters are TMDB / YouTube images (linked).
  Titles are tidied ("Official Trailer | Netflix" removed) and channel boilerplate is dropped from
  descriptions.
- Earning & settings: on/off, reward, ratings per day, minimum watch %, daily bonus, words required,
  TMDB key, YouTube key, daily auto-import (sources one per line, how many, go live) + "Run now".
  Daily cron: 15 6 * * * php /home/USER/site/cron/drama-trailers.php
- Real trailer length: read from YouTube when the host can reach it, else reported once by the
  player the first time a member plays it (30–1800 s), and always editable by the admin.
Also fixed: set_setting() now maps int/float/bool to the settings table's integer/decimal/boolean
(the Short Drama settings form could fail on a strict MySQL the first time it was saved).
Files: includes/drama-trailers.php (new), site-tasks/short-drama/trailers.php (new),
admin/tasks/drama-trailers.php (new), assets/css/drama-trailers.css (new), cron/drama-trailers.php (new),
database/drama-trailers.sql (new, optional — tables are created automatically), api/tasks/short-drama.php,
site-tasks/short-drama/index.php, admin/tasks/short-drama.php, includes/admin-header.php,
includes/functions.php, .htaccess (3 new routes), config/constants.php.

N5.11.1 — Trailers: RateFlix auto-sliding poster carousel + progress tiles
--------------------------------------------------------------------------
- Top of Short Drama → Trailers (like the RateFlix dashboard): pills (All · Movies · Series · To rate ·
  Top rated), a centred poster carousel with the neighbours peeking in (current poster bigger, brand
  glow border, "+KES 20" or "Rated" corner), the page background takes the current poster's colours,
  title + year | genre | ★ score (ratings), "Review & earn" / "Watch again" and "Earn KES 20" / "Details",
  dots and arrows (desktop). Slides by itself every 4.5 s, swipes by finger, loops endlessly, pauses
  while touched or hovered, off for "reduce motion". Tapping a side poster brings it to the middle.
- Progress tiles: Rated today (ring), Rating wallet (+today), Drama royalties, Rating streak (days in
  a row), then the bonus bar "Rate N more today to unlock a KES 30 bonus".
- Rows: Rate & earn today · Top 10 this week (big numbers) · New arrivals, then "All trailers" with
  search, filters and cards. While searching or filtering, the page goes straight to the list.
- Files: site-tasks/short-drama/trailers.php, assets/css/drama-trailers.css, config/constants.php.

N5.11.2 — Withdraw page hides the M-Pesa number
------------------------------------------------
- The member's number shows with the middle hidden: 0712345845 → 07*****845 (254… numbers are shown
  in 07… form). New helper mask_own_phone() in includes/functions.php.
- Locked number (default): the masked number is shown read-only; the real number is sent hidden and the
  server still pays only the registered number.
- Editable number (admin allows changing): masked number + a "Change" button that opens an empty field;
  in the older form an empty field means "use my registered number".
- Files: financial/withdraw-pz1.php, financial/withdraw.php, includes/functions.php.
