<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WORKIFY</title>
<style>
:root{
--bg:#080a0e;--panel:#111720;--panel2:#171f2a;
--gold:#d6a843;--gold2:#f8d77b;--text:#f3f4f6;
--muted:#929baa;--green:#36c98a;--red:#ef6262;
--border:#27313e;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:Arial,sans-serif;min-height:100vh}
button,input,select{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
/* BRAND */
.brand-line{display:flex;align-items:center;gap:8px;min-width:0}
.brand-symbol{width:40px;height:38px;flex-shrink:0}
.logo{font-size:23px;font-weight:900;letter-spacing:1px;white-space:nowrap}
.logo span{color:var(--gold)}
/* LOGIN */
.auth-screen{min-height:100vh;display:flex;justify-content:center;align-items:center;padding:20px 14px;background:var(--bg)}
.auth-card{width:100%;max-width:430px;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:25px 20px;box-shadow:0 20px 60px #0008}
.auth-brand{display:flex;flex-direction:column;align-items:center;margin-bottom:22px}
.auth-brand .brand-symbol{width:65px;height:55px}
.auth-brand .logo{font-size:35px}
.auth-sub{text-align:center;color:var(--muted);margin-bottom:24px}
.tabs{display:flex;background:var(--bg);border:1px solid var(--border);border-radius:9px;padding:4px;margin-bottom:22px}
.tabs button{flex:1;border:0;background:transparent;color:var(--muted);padding:12px;border-radius:7px;font-weight:bold}
.tabs button.active{background:var(--gold);color:#111}
.field{margin-bottom:17px}
.field label{display:block;margin-bottom:8px;font-size:13px;font-weight:bold}
input,select{width:100%;padding:13px;border-radius:8px;border:1px solid var(--border);background:#090d13;color:white;outline:none}
input:focus,select:focus{border-color:var(--gold)}
.password-wrap{position:relative}
.password-wrap input{padding-right:48px}
.eye-toggle{position:absolute;right:7px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--muted);width:35px;height:35px}
.eye-toggle svg{width:20px;height:20px}
.primary{width:100%;border:0;border-radius:8px;padding:14px;background:linear-gradient(135deg,var(--gold2),var(--gold));color:#111;font-weight:900}
.primary:disabled{opacity:.6}
.auth-note{color:var(--muted);text-align:center;font-size:12px;margin-top:20px}
.message{margin-top:14px;font-size:13px;line-height:1.5}
.message.success{color:var(--green)}
.message.error{color:var(--red)}
.field-error{display:none;color:var(--red);font-size:12px;margin-top:6px}
.field-error.visible{display:block}
/* HEADER */
#app{min-height:100vh;background:var(--bg)}
.topbar{min-height:65px;background:var(--panel);border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;gap:12px;padding:0 22px;position:sticky;top:0;z-index:10}
.topbar>.brand-line{flex-shrink:0}
.top-right{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12px;min-width:0}
.country{color:var(--text);font-size:13px;white-space:nowrap;display:block}
.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--green);margin-right:6px}
#connectionStatus{white-space:nowrap}
/* DESKTOP LAYOUT */
.layout{display:flex;min-height:calc(100vh - 65px);background:var(--bg)}
.sidebar{width:220px;flex-shrink:0;background:var(--panel);border-right:1px solid var(--border);padding:20px 13px;display:flex;flex-direction:column}
.side-label{color:var(--muted);font-size:10px;font-weight:bold;letter-spacing:1.5px;padding:14px 12px 9px}
.nav{width:100%;text-align:left;background:transparent;border:0;color:#c3cad4;padding:13px 12px;border-radius:7px;margin-bottom:4px;font-size:13px}
.nav:hover,.nav.active{background:#252b34;color:var(--gold2)}
.sidebar-bottom{margin-top:auto;padding-top:20px}
/* MAIN CONTENT */
.main{flex:1;min-width:0;padding:25px;max-width:1400px;background:var(--bg)}
.page{display:none}
.page.active{display:block}
.page-heading{font-size:25px;margin:0 0 8px}
.page-sub{color:var(--muted);font-size:13px;margin-bottom:22px}
.panel,.stat{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:18px;margin-bottom:16px}
.panel-title{font-size:15px;font-weight:bold;margin-bottom:15px}
.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}
.stat small{display:block;color:var(--muted);font-size:10px;font-weight:bold;letter-spacing:1px;margin-bottom:10px}
.stat strong{font-size:21px;color:var(--gold2);overflow-wrap:anywhere}
.quick{display:flex;gap:10px;flex-wrap:wrap}
.notice{color:var(--muted);font-size:12px;line-height:1.6;margin-top:15px}
.form-box{max-width:600px}
.form-box .field{margin-bottom:18px}
.empty{color:var(--muted);font-size:13px;padding:12px 0}
table{width:100%;border-collapse:collapse;min-width:550px}
th,td{padding:13px 10px;text-align:left;border-bottom:1px solid var(--border);font-size:12px}
th{color:var(--gold2);font-size:10px}
td{color:#d6dce5}
.table-wrap{overflow-x:auto}
.profile-line{display:flex;justify-content:space-between;gap:15px;padding:15px 0;border-bottom:1px solid var(--border);font-size:13px}
.profile-line span{color:var(--muted)}
.profile-line strong{text-align:right;overflow-wrap:anywhere}
/* DEPOSIT PAGE */
.deposit-brand{display:flex;justify-content:flex-start;margin:5px 0 35px}
.deposit-brand .brand-symbol{width:40px;height:38px}
.deposit-brand .logo{font-size:23px}
.deposit-methods{
display:grid;
grid-template-columns:1fr;
gap:18px;
max-width:850px;
}
.deposit-method{
width:100%;
min-height:220px;
background:#080a0e;
border:1px solid #252525;
border-radius:22px;
padding:25px 28px;
color:var(--text);
text-align:left;
display:flex;
flex-direction:column;
justify-content:space-between;
gap:22px;
cursor:default;
}
.deposit-method-top{
display:flex;
align-items:center;
justify-content:space-between;
gap:15px;
}
.deposit-method-heading{
display:flex;
align-items:center;
gap:20px;
min-width:0;
}
.deposit-method-icon{
width:55px;
height:55px;
flex-shrink:0;
color:#fff;
}
.deposit-method-title{
font-size:23px;
font-weight:900;
line-height:1.35;
}
.deposit-available{
flex-shrink:0;
background:#06301d;
color:#20c76b;
border-radius:30px;
padding:10px 16px;
font-size:15px;
font-weight:bold;
white-space:nowrap;
}
.deposit-description{
font-size:19px;
line-height:1.5;
color:#f3f4f6;
}
.deposit-detail{
font-size:15px;
line-height:1.5;
color:#929292;
}
/* MOBILE DASHBOARD */
.mobile-dashboard{display:none}
.hero-banner{width:100%;aspect-ratio:2.33 / 1;min-height:190px;max-height:290px;border-radius:8px;overflow:hidden;display:flex;background:linear-gradient(110deg,#25202b,#40301b 55%,#171c25);border:1px solid #5c4827;margin:12px 0 9px}
.hero-left{width:50%;display:flex;flex-direction:column;justify-content:center;padding:17px;background:linear-gradient(145deg,#171c26,#30251b)}
.hero-left .hero-small{color:var(--gold2);font-size:11px;font-weight:bold;letter-spacing:2px;margin-bottom:12px}
.hero-left h2{font-size:22px;line-height:1.15;margin:0 0 9px}
.hero-left p{font-size:11px;line-height:1.5;color:#c6c6c6;margin:0}
.hero-right{width:50%;display:flex;align-items:center;justify-content:center;padding:12px;background:linear-gradient(135deg,#8e641e,#d6a843);color:#16120a;text-align:center}
.hero-right strong{font-size:25px;line-height:1.1}
.hero-right span{display:block;font-size:11px;margin-top:9px;font-weight:bold}
/* MOVING TICKER */
.announcement{height:68px;display:flex;align-items:center;overflow:hidden;background:var(--panel);border:1px solid var(--border);border-radius:10px;margin:9px 0 12px;padding:0 15px}
.announcement-icon{flex-shrink:0;font-size:25px;color:var(--gold2);margin-right:13px}
.announcement-window{flex:1;min-width:0;overflow:hidden;white-space:nowrap}
.announcement-track{display:inline-flex;width:max-content;animation:announcementMove 24s linear infinite}
.announcement-track span{padding-right:45px;color:var(--gold2);font-size:14px;font-weight:bold}
@keyframes announcementMove{from{transform:translateX(0)}to{transform:translateX(-50%)}}
/* QUICK ACTIONS */
.quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:10px 0 20px}
.quick-tile{min-height:92px;border:1px solid #9b7836;border-radius:9px;background:linear-gradient(135deg,#29231a,#171720);color:var(--text);display:flex;align-items:center;justify-content:space-between;padding:13px 18px;font-weight:bold;font-size:15px;text-align:left}
.quick-tile:active{transform:scale(.98)}
.quick-icon{font-size:29px;color:var(--gold2)}
.quick-label{text-align:right}
/* INVESTMENT LEVELS */
.investment-heading{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:bold;margin:20px 0 15px}
.investment-heading .heading-icon{color:var(--gold2);font-size:25px}
.level-card{background:linear-gradient(110deg,#111720,#1b2028);border:1px solid #59606a;border-radius:9px;margin-bottom:14px;overflow:hidden}
.level-label{display:inline-block;padding:9px 14px;background:#8c681f;color:#fff;font-size:13px;font-weight:bold;min-width:145px}
.level-placeholder{min-height:95px;display:flex;align-items:center;justify-content:center;text-align:center;padding:20px;color:var(--muted);font-size:13px;line-height:1.6}
/* PROFILE MENU */
.profile-menu-heading{font-size:24px;font-weight:bold;margin:0 0 8px}
.profile-menu-sub{color:var(--muted);font-size:13px;margin-bottom:20px}
.profile-menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%}
.profile-menu-button{min-height:82px;width:100%;border:1px solid #78602f;border-radius:8px;background:linear-gradient(135deg,#29231a,#171720);color:var(--text);display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 16px;text-align:left;font-weight:bold;font-size:14px}
.profile-menu-button:active{transform:scale(.985)}
.profile-menu-button:hover{border-color:var(--gold2);background:linear-gradient(135deg,#332b1d,#20202a)}
.profile-menu-icon{color:var(--gold2);font-size:27px;min-width:34px;text-align:center}
.profile-menu-text{flex:1;text-align:right;line-height:1.3}
.profile-menu-button.signout{border-color:#8a6331}
/* MOBILE NAVIGATION */
.mobile-nav{display:none}
/* RESPONSIVE */
@media(max-width:850px){
.sidebar{width:185px}
.main{padding:18px}
.grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
body{padding-bottom:78px}
.topbar{min-height:58px;padding:7px 8px;gap:8px}
.topbar>.brand-line{flex:0 1 auto;gap:5px;min-width:0}
.topbar .brand-symbol{width:clamp(25px,8vw,32px);height:clamp(25px,8vw,32px);flex-shrink:0}
.topbar .logo{font-size:clamp(13px,4.4vw,18px);letter-spacing:.4px;white-space:nowrap}
.top-right{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;gap:0;min-width:0;overflow:visible}
.country{display:block;color:var(--text);font-size:clamp(7px,2.5vw,10px);white-space:normal;text-align:right;line-height:1.3;flex:0 1 auto;min-width:0;max-width:42vw;overflow-wrap:normal}
#connectionStatus{display:none}
.layout{min-height:calc(100vh - 58px)}
.sidebar{display:none}
.main{padding:10px 12px 100px}
.mobile-dashboard{display:block}
.desktop-dashboard{display:none}
.hero-banner{aspect-ratio:2.33 / 1;min-height:0;max-height:none;margin:10px 0 9px}
.hero-left{padding:12px}
.hero-left .hero-small{font-size:9px;letter-spacing:1px;margin-bottom:9px}
.hero-left h2{font-size:clamp(16px,4.2vw,22px)}
.hero-left p{font-size:10px}
.hero-right{padding:8px}
.hero-right strong{font-size:clamp(18px,5vw,25px)}
.hero-right span{font-size:9px}
.announcement{height:62px;margin:8px 0 11px;padding:0 12px}
.announcement-icon{font-size:23px;margin-right:10px}
.announcement-track span{font-size:12px}
.quick-grid{gap:8px;margin:10px 0 19px}
.quick-tile{min-height:83px;padding:11px 13px;font-size:14px}
.quick-icon{font-size:25px}
.investment-heading{font-size:20px;margin:18px 0 13px}
.investment-heading .heading-icon{font-size:23px}
.level-placeholder{min-height:85px}
.grid{gap:9px}
.stat{padding:13px}
.stat strong{font-size:17px}
.page-heading{font-size:22px}
.profile-menu-heading{font-size:22px}
.profile-menu-grid{gap:9px}
.profile-menu-button{min-height:78px;padding:11px 10px;font-size:13px}
.profile-menu-icon{font-size:24px;min-width:29px}
.deposit-brand{margin:5px 0 28px}
.deposit-method{padding:20px 16px;min-height:205px;border-radius:18px;gap:18px}
.deposit-method-top{align-items:flex-start;gap:10px}
.deposit-method-heading{gap:12px}
.deposit-method-icon{width:43px;height:43px}
.deposit-method-title{font-size:17px}
.deposit-available{font-size:12px;padding:8px 11px}
.deposit-description{font-size:16px}
.deposit-detail{font-size:13px}
.mobile-nav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:30;background:var(--panel);border-top:1px solid var(--border);justify-content:space-around;padding:8px 2px calc(8px + env(safe-area-inset-bottom))}
.mobile-nav button{flex:1;border:0;background:transparent;color:var(--muted);font-size:10px;line-height:1.5;padding:4px 1px}
.mobile-nav button .nav-icon{display:block;font-size:22px;line-height:1.2;margin-bottom:3px}
.mobile-nav button.active{color:var(--gold2)}
.auth-card{padding:22px 18px}
}
</style>
</head>
<body>
<!-- LOGIN AND REGISTRATION -->
<section id="authScreen" class="auth-screen">
<div class="auth-card">
<div class="auth-brand">
<div class="brand-line">
<svg class="brand-symbol" viewBox="0 0 100 85" xmlns="http://www.w3.org/2000/svg">
<path d="M8 17 L29 67 L44 35 L57 66 L73 22" fill="none" stroke="#d6a843" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M38 61 C56 58 75 43 91 8" fill="none" stroke="#f8d77b" stroke-width="8" stroke-linecap="round"/>
<path d="M72 10 L94 4 L91 27" fill="none" stroke="#d6a843" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div class="logo">WORK<span>IFY</span></div>
</div>
</div>
<div class="auth-sub">Your account. Your workspace.</div>
<div class="tabs">
<button id="loginTab" class="active" onclick="showAuth('login')">LOGIN</button>
<button id="registerTab" onclick="showAuth('register')">REGISTER</button>
</div>
<form id="loginForm" onsubmit="login(event)" novalidate>
<div class="field">
<label for="loginMobile">Mobile number (10 digits)</label>
<input id="loginMobile" type="tel" inputmode="numeric" maxlength="10" placeholder="Enter 10-digit mobile number" autocomplete="tel" required>
<div id="loginMobileError" class="field-error"></div>
</div>
<div class="field">
<label for="loginPin">PIN (5 to 8 digits)</label>
<div class="password-wrap">
<input id="loginPin" type="password" inputmode="numeric" maxlength="8" placeholder="Enter your PIN" autocomplete="current-password" required>
<button class="eye-toggle" type="button" onclick="togglePin('loginPin',this)" aria-label="Show PIN">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
<div id="loginPinError" class="field-error"></div>
</div>
<button class="primary" id="loginButton" type="submit">LOGIN SECURELY</button>
</form>
<form id="registerForm" class="hidden" onsubmit="register(event)" novalidate>
<div class="field">
<label for="regName">Full name</label>
<input id="regName" type="text" maxlength="80" autocomplete="name" required>
<div id="regNameError" class="field-error"></div>
</div>
<div class="field">
<label for="regMobile">Mobile number (10 digits)</label>
<input id="regMobile" type="tel" inputmode="numeric" maxlength="10" placeholder="Enter 10-digit mobile number" required>
<div id="regMobileError" class="field-error"></div>
</div>
<div class="field">
<label for="regPin">Create PIN (5 to 8 digits)</label>
<div class="password-wrap">
<input id="regPin" type="password" inputmode="numeric" maxlength="8" placeholder="Create your PIN" required>
<button class="eye-toggle" type="button" onclick="togglePin('regPin',this)" aria-label="Show PIN">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
<div id="regPinError" class="field-error"></div>
</div>
<div class="field">
<label for="regConfirm">Confirm PIN</label>
<div class="password-wrap">
<input id="regConfirm" type="password" inputmode="numeric" maxlength="8" placeholder="Confirm your PIN" required>
<button class="eye-toggle" type="button" onclick="togglePin('regConfirm',this)" aria-label="Show PIN">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
<div id="regConfirmError" class="field-error"></div>
</div>
<div class="field">
<label for="regReferral">Referral code (optional)</label>
<input id="regReferral" type="text" maxlength="30">
</div>
<button class="primary" id="registerButton" type="submit">CREATE ACCOUNT</button>
</form>
<div id="authMessage" class="message"></div>
<div class="auth-note">Your PIN should never be shared with anyone.</div>
</div>
</section>
<!-- MAIN APPLICATION -->
<div id="app" class="hidden">
<header class="topbar">
<div class="brand-line">
<svg class="brand-symbol" viewBox="0 0 100 85" xmlns="http://www.w3.org/2000/svg">
<path d="M8 17 L29 67 L44 35 L57 66 L73 22" fill="none" stroke="#d6a843" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M38 61 C56 58 75 43 91 8" fill="none" stroke="#f8d77b" stroke-width="8" stroke-linecap="round"/>
<path d="M72 10 L94 4 L91 27" fill="none" stroke="#d6a843" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div class="logo">WORK<span>IFY</span></div>
</div>
<div class="top-right">
<span id="connectionStatus"><span class="status-dot"></span>ACCOUNT</span>
<span class="country">🇿🇦 South Africa | ZAR</span>
</div>
</header>
<div class="layout">
<aside class="sidebar">
<div class="side-label">WORKSPACE</div>
<button class="nav active" data-page="dashboard" onclick="navigate('dashboard')">▦ Investment</button>
<button class="nav" data-page="wallet" onclick="navigate('wallet')">◈ Earnings</button>
<button class="nav" data-page="transactions" onclick="navigate('transactions')">▤ Activity</button>
<button class="nav" data-page="information" onclick="navigate('information')">ⓘ Information</button>
<div class="side-label">ACCOUNT</div>
<button class="nav" data-page="profile" onclick="navigate('profile')">◉ Profile</button>
<button class="nav" data-page="deposit" onclick="navigate('deposit')">+ Deposit</button>
<button class="nav" data-page="withdraw" onclick="navigate('withdraw')">↗ Withdraw</button>
<button class="nav" data-page="referrals" onclick="navigate('referrals')">♧ Referrals</button>
<button class="nav hidden" id="adminNav" data-page="admin" onclick="navigate('admin')">⚙ Admin panel</button>
<div class="sidebar-bottom">
<button class="nav" onclick="logout()">⇥ Log out</button>
</div>
</aside>
<main class="main">
<!-- INVESTMENT PAGE -->
<section id="dashboard" class="page active">
<div class="mobile-dashboard">
<div class="hero-banner">
<div class="hero-left">
<div class="hero-small">WELCOME TO WORKIFY</div>
<h2>BUILD YOUR FUTURE</h2>
<p>Your WORKIFY account and workspace, all in one place.</p>
</div>
<div class="hero-right">
<div>
<strong>WORKIFY</strong>
<span>YOUR ACCOUNT. YOUR WORKSPACE.</span>
</div>
</div>
</div>
<div class="announcement">
<div class="announcement-icon">📢</div>
<div class="announcement-window">
<div class="announcement-track">
<span>WELCOME TO WORKIFY — MAKING SOUTH AFRICA GREAT AGAIN! 🇿🇦</span>
<span>WELCOME TO WORKIFY — MAKING SOUTH AFRICA GREAT AGAIN! 🇿🇦</span>
<span>WELCOME TO WORKIFY — MAKING SOUTH AFRICA GREAT AGAIN! 🇿🇦</span>
<span>WELCOME TO WORKIFY — MAKING SOUTH AFRICA GREAT AGAIN! 🇿🇦</span>
</div>
</div>
</div>
<div class="quick-grid">
<button class="quick-tile" onclick="navigate('deposit')">
<span class="quick-icon">▣</span><span class="quick-label">Deposit</span>
</button>
<button class="quick-tile" onclick="navigate('withdraw')">
<span class="quick-icon">▤</span><span class="quick-label">Withdraw</span>
</button>
<button class="quick-tile" onclick="navigate('information')">
<span class="quick-icon">♙</span><span class="quick-label">Rules</span>
</button>
<button class="quick-tile" onclick="navigate('information')">
<span class="quick-icon">▧</span><span class="quick-label">Introduction</span>
</button>
</div>
<div class="investment-heading">
<span class="heading-icon">☷</span>
<span>Investment Levels</span>
</div>
<div class="level-card">
<div class="level-label">Investment Levels</div>
<div class="level-placeholder">Investment plans will appear here once configured.</div>
</div>
</div>
<div class="desktop-dashboard">
<h1 class="page-heading">Investment</h1>
<div class="page-sub">Your WORKIFY account overview.</div>
<div class="grid">
<div class="stat"><small>WALLET BALANCE</small><strong id="dashBalance">—</strong></div>
<div class="stat"><small>ACCOUNT STATUS</small><strong id="dashStatus">—</strong></div>
<div class="stat"><small>ACCOUNT HOLDER</small><strong id="dashName" style="font-size:16px">—</strong></div>
<div class="stat"><small>TRANSACTIONS</small><strong id="dashTransactions">—</strong></div>
</div>
<div class="panel">
<div class="panel-title">Quick actions</div>
<div class="quick">
<button class="action" onclick="navigate('deposit')">Deposit</button>
<button class="action" onclick="navigate('withdraw')">Withdraw</button>
<button class="action" onclick="navigate('information')">Rules</button>
<button class="action" onclick="navigate('information')">Introduction</button>
</div>
</div>
<div class="panel">
<div class="panel-title">Investment Levels</div>
<div class="empty">Investment plans will appear here once configured.</div>
</div>
<div class="panel">
<div class="panel-title">Recent activity</div>
<div id="recentActivity" class="empty">No transactions available.</div>
</div>
</div>
</section>
<!-- EARNINGS -->
<section id="wallet" class="page">
<h1 class="page-heading">Earnings</h1>
<div class="page-sub">Your recorded wallet balance.</div>
<div class="panel">
<div class="stat"><small>AVAILABLE BALANCE</small><strong id="walletBalance">—</strong></div>
<p class="notice">Only completed and recorded transactions are reflected in your account balance.</p>
</div>
</section>
<!-- ACTIVITY -->
<section id="transactions" class="page">
<h1 class="page-heading">Activity</h1>
<div class="page-sub">Your recorded account activity.</div>
<div class="panel table-wrap">
<table>
<thead><tr><th>DATE</th><th>TYPE</th><th>AMOUNT</th><th>STATUS</th></tr></thead>
<tbody id="transactionRows">
<tr><td colspan="4" class="empty">No transactions available.</td></tr>
</tbody>
</table>
</div>
</section>
<!-- INFORMATION -->
<section id="information" class="page">
<h1 class="page-heading">Information</h1>
<div class="page-sub">WORKIFY information and account guidance.</div>
<div class="panel">
<div class="panel-title">Introduction</div>
<p class="notice">Welcome to WORKIFY. Use your registered account to access the available account features.</p>
</div>
<div class="panel">
<div class="panel-title">Account rules</div>
<p class="notice">Keep your login details private. Check your account information carefully before submitting a deposit or withdrawal request.</p>
</div>
<div class="panel">
<div class="panel-title">Referral information</div>
<p class="notice">Your referral code is available in your Profile and Referrals sections.</p>
<button class="action" onclick="navigate('referrals')">VIEW REFERRAL CODE</button>
</div>
</section>
<!-- DEPOSIT -->
<section id="deposit" class="page">
<div class="deposit-brand">
<div class="brand-line">
<svg class="brand-symbol" viewBox="0 0 100 85" xmlns="http://www.w3.org/2000/svg">
<path d="M8 17 L29 67 L44 35 L57 66 L73 22" fill="none" stroke="#d6a843" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M38 61 C56 58 75 43 91 8" fill="none" stroke="#f8d77b" stroke-width="8" stroke-linecap="round"/>
<path d="M72 10 L94 4 L91 27" fill="none" stroke="#d6a843" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div class="logo">WORK<span>IFY</span></div>
</div>
</div>
<h1 class="page-heading">Choose Deposit Method</h1>
<div class="page-sub">Select your preferred deposit method.</div>
<div class="deposit-methods">
<!-- EFT BANK TRANSFER -->
<button class="deposit-method" type="button">
<div class="deposit-method-top">
<div class="deposit-method-heading">
<svg class="deposit-method-icon" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Bank icon">
<path d="M6 23L32 7L58 23H6Z" stroke="currentColor" stroke-width="4" stroke-linejoin="round"/>
<path d="M10 56H54M14 25V49M26 25V49M38 25V49M50 25V49M8 56V51H56V56" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="deposit-method-title">EFT BANK TRANSFER</span>
</div>
<span class="deposit-available">Available option</span>
</div>
<div class="deposit-description">
Transfer directly from your banking app.
</div>
<div class="deposit-detail">
Unique payment reference generated for each deposit.
</div>
</button>
<!-- CARD PAYMENT -->
<button class="deposit-method" type="button">
<div class="deposit-method-top">
<div class="deposit-method-heading">
<svg class="deposit-method-icon" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Card payment icon">
<rect x="6" y="13" width="52" height="38" rx="7" stroke="currentColor" stroke-width="4"/>
<path d="M7 25H57" stroke="currentColor" stroke-width="4"/>
<path d="M15 41H29" stroke="currentColor" stroke-width="4" stroke-linecap="round"/>
</svg>
<span class="deposit-method-title">CARD PAYMENT</span>
</div>
<span class="deposit-available">Available option</span>
</div>
<div class="deposit-description">
Pay securely using Visa or Mastercard.
</div>
<div class="deposit-detail">
Payment processed through a payment gateway.
</div>
</button>
</div>
</section>
<!-- WITHDRAW -->
<section id="withdraw" class="page">
<h1 class="page-heading">Withdraw</h1>
<div class="page-sub">Submit a withdrawal request.</div>
<div class="panel form-box">
<form onsubmit="submitWithdrawal(event)">
<div class="field">
<label>Amount (ZAR)</label>
<input id="withdrawAmount" type="number" min="1" step="0.01" required>
</div>
<div class="field">
<label>Bank name</label>
<input id="withdrawBank" type="text" maxlength="80" required>
</div>
<div class="field">
<label>Account holder</label>
<input id="withdrawHolder" type="text" maxlength="80" required>
</div>
<div class="field">
<label>Account number</label>
<input id="withdrawAccount" type="text" inputmode="numeric" maxlength="30" required>
</div>
<button class="primary" type="submit">SUBMIT WITHDRAWAL REQUEST</button>
</form>
<div id="withdrawMessage" class="message"></div>
<p class="notice">A submitted request is not a completed bank transfer. Requests require review and processing.</p>
</div>
</section>
<!-- REFERRALS -->
<section id="referrals" class="page">
<h1 class="page-heading">Referrals</h1>
<div class="page-sub">Your personal referral details.</div>
<div class="panel">
<div class="panel-title">Your referral code</div>
<strong id="referralCode" style="color:var(--gold2)">—</strong>
<br><br>
<button class="action" onclick="copyReferral()">COPY REFERRAL CODE</button>
<div id="referralMessage" class="message"></div>
</div>
</section>
<!-- PROFILE MENU -->
<section id="profile" class="page">
<h1 class="profile-menu-heading">Profile</h1>
<div class="profile-menu-sub">Your account services and settings.</div>
<div class="profile-menu-grid">
<button class="profile-menu-button" onclick="profileAction('customer')"><span class="profile-menu-icon">♡</span><span class="profile-menu-text">Customer service</span></button>
<button class="profile-menu-button" onclick="profileAction('invite')"><span class="profile-menu-icon">✉</span><span class="profile-menu-text">Invite friends</span></button>
<button class="profile-menu-button" onclick="profileAction('team')"><span class="profile-menu-icon">♧</span><span class="profile-menu-text">My team</span></button>
<button class="profile-menu-button" onclick="profileAction('revenue')"><span class="profile-menu-icon">▤</span><span class="profile-menu-text">Revenue Details</span></button>
<button class="profile-menu-button" onclick="profileAction('data')"><span class="profile-menu-icon">▥</span><span class="profile-menu-text">Data flow</span></button>
<button class="profile-menu-button" onclick="profileAction('security')"><span class="profile-menu-icon">♙</span><span class="profile-menu-text">Security center</span></button>
<button class="profile-menu-button" onclick="profileAction('withdrawal')"><span class="profile-menu-icon">▧</span><span class="profile-menu-text">Withdrawal management</span></button>
<button class="profile-menu-button" onclick="profileAction('shipping')"><span class="profile-menu-icon">⌖</span><span class="profile-menu-text">Shipping address</span></button>
<button class="profile-menu-button" onclick="profileAction('country')"><span class="profile-menu-icon">◎</span><span class="profile-menu-text">Country switch</span></button>
<button class="profile-menu-button" onclick="profileAction('agreement')"><span class="profile-menu-icon">▣</span><span class="profile-menu-text">Service Agreement</span></button>
<button class="profile-menu-button signout" onclick="logout()"><span class="profile-menu-icon">⇥</span><span class="profile-menu-text">Sign out</span></button>
</div>
<div id="profileMessage" class="message"></div>
</section>
<!-- ADMIN -->
<section id="admin" class="page">
<h1 class="page-heading">Admin Panel</h1>
<div class="page-sub">Account requests requiring review.</div>
<div class="panel table-wrap">
<table>
<thead><tr><th>REFERENCE</th><th>TYPE</th><th>AMOUNT</th><th>STATUS</th><th>ACTION</th></tr></thead>
<tbody id="adminRows"><tr><td colspan="5" class="empty">No requests loaded.</td></tr></tbody>
</table>
</div>
<div id="adminMessage" class="message"></div>
<p class="notice">Only verified administrators can access this area. Requests must be checked against actual payment records before any approval or payment action.</p>
</section>
</main>
</div>
<!-- MOBILE NAVIGATION -->
<nav class="mobile-nav">
<button data-page="dashboard" class="active" onclick="navigate('dashboard')"><span class="nav-icon">▣</span>Investment</button>
<button data-page="wallet" onclick="navigate('wallet')"><span class="nav-icon">▤</span>Earnings</button>
<button data-page="transactions" onclick="navigate('transactions')"><span class="nav-icon">◷</span>Activity</button>
<button data-page="information" onclick="navigate('information')"><span class="nav-icon">▧</span>Information</button>
<button data-page="profile" onclick="navigate('profile')"><span class="nav-icon">♙</span>Profile</button>
</nav>
</div>
<script>
"use strict";
const API_BASE = "https://workify-backend-ijpv.onrender.com";
let currentUser = null;
let accountData = null;
function $(id){return document.getElementById(id)}
function setMessage(id,message,type=""){
const el = $(id);
if(!el)return;
el.textContent = message;
el.className = "message " + type;
}
function money(value){
const number = Number(value || 0);
return "R " + number.toLocaleString("en-ZA",{
minimumFractionDigits:2,
maximumFractionDigits:2
});
}
async function api(path,options={}){
const response = await fetch(API_BASE + path,{
...options,
credentials:"include",
headers:{
"Content-Type":"application/json",
...(options.headers || {})
}
});
let data={};
try{data=await response.json()}catch(error){data={}}
if(!response.ok){
throw new Error(data.message || data.error || "Request failed. Please try again.");
}
return data;
}
/* AUTH DISPLAY */
function showAuth(mode){
$("loginForm").classList.toggle("hidden",mode!=="login");
$("registerForm").classList.toggle("hidden",mode!=="register");
$("loginTab").classList.toggle("active",mode==="login");
$("registerTab").classList.toggle("active",mode==="register");
setMessage("authMessage","");
}
function togglePin(id,button){
const input=$(id);
if(!input)return;
input.type=input.type==="password"?"text":"password";
button.setAttribute("aria-label",input.type==="password"?"Show PIN":"Hide PIN");
}
function showFieldError(id,message){
const el=$(id);
if(!el)return;
el.textContent=message;
el.classList.toggle("visible",Boolean(message));
}
function clearErrors(){
document.querySelectorAll(".field-error").forEach(el=>{
el.textContent="";
el.classList.remove("visible");
});
}
function cleanMobile(value){
return String(value||"").replace(/\D/g,"");
}
function validPin(value){
return /^\d{5,8}$/.test(value);
}
/* LOGIN */
async function login(event){
event.preventDefault();
clearErrors();
setMessage("authMessage","");
const mobile=cleanMobile($("loginMobile").value);
const pin=$("loginPin").value;
let valid=true;
if(!/^\d{10}$/.test(mobile)){
showFieldError("loginMobileError","Enter a valid 10-digit mobile number.");
valid=false;
}
if(!validPin(pin)){
showFieldError("loginPinError","PIN must contain 5 to 8 digits.");
valid=false;
}
if(!valid)return;
const button=$("loginButton");
button.disabled=true;
button.textContent="LOGGING IN...";
try{
await api("/api/login",{
method:"POST",
body:JSON.stringify({mobile,pin})
});
await loadAccount();
$("loginForm").reset();
setMessage("authMessage","");
}catch(error){
setMessage("authMessage",error.message||"Login failed. Check your details.","error");
}finally{
button.disabled=false;
button.textContent="LOGIN SECURELY";
}
}
/* REGISTRATION */
async function register(event){
event.preventDefault();
clearErrors();
setMessage("authMessage","");
const fullName=$("regName").value.trim();
const mobile=cleanMobile($("regMobile").value);
const pin=$("regPin").value;
const confirmPin=$("regConfirm").value;
const referralCode=$("regReferral").value.trim();
let valid=true;
if(fullName.length<2){
showFieldError("regNameError","Enter your full name.");
valid=false;
}
if(!/^\d{10}$/.test(mobile)){
showFieldError("regMobileError","Enter a valid 10-digit mobile number.");
valid=false;
}
if(!validPin(pin)){
showFieldError("regPinError","PIN must contain 5 to 8 digits.");
valid=false;
}
if(pin!==confirmPin){
showFieldError("regConfirmError","The PINs do not match.");
valid=false;
}
if(!valid)return;
const button=$("registerButton");
button.disabled=true;
button.textContent="CREATING ACCOUNT...";
try{
await api("/api/register",{
method:"POST",
body:JSON.stringify({fullName,mobile,pin,confirmPin,referralCode})
});
$("registerForm").reset();
showAuth("login");
$("loginMobile").value=mobile;
setMessage("authMessage","Account created. Please log in using your mobile number and PIN.","success");
}catch(error){
setMessage("authMessage",error.message||"Registration failed.","error");
}finally{
button.disabled=false;
button.textContent="CREATE ACCOUNT";
}
}
/* LOAD ACCOUNT AFTER LOGIN */
async function loadAccount(){
const data=await api("/api/me",{method:"GET"});
accountData=data.account||data.user||data;
currentUser=accountData.user||accountData;
renderAccount();
$("authScreen").classList.add("hidden");
$("app").classList.remove("hidden");
navigate("dashboard");
}
/* ACCOUNT DISPLAY */
function renderAccount(){
const a=accountData||{};
const user=currentUser||{};
const name=user.fullName||user.full_name||a.fullName||a.full_name||"Account holder";
const status=user.status||a.status||"Active";
const balance=a.balance??a.walletBalance??a.wallet_balance??user.balance??0;
const referral=user.referralCode||user.referral_code||a.referralCode||a.referral_code||"—";
const transactions=a.transactions||user.transactions||[];
$("dashBalance").textContent=money(balance);
$("walletBalance").textContent=money(balance);
$("dashStatus").textContent=String(status);
$("dashName").textContent=name;
$("dashTransactions").textContent=Array.isArray(transactions)?transactions.length:"—";
$("referralCode").textContent=referral;
const isAdmin=
user.role==="admin"||a.role==="admin"||
user.isAdmin===true||a.isAdmin===true;
$("adminNav").classList.toggle("hidden",!isAdmin);
renderTransactions(transactions);
$("connectionStatus").innerHTML='<span class="status-dot"></span>CONNECTED';
}
/* TRANSACTIONS */
function renderTransactions(items){
const rows=$("transactionRows");
const recent=$("recentActivity");
if(!Array.isArray(items)||items.length===0){
rows.innerHTML='<tr><td colspan="4" class="empty">No transactions available.</td></tr>';
if(recent)recent.textContent="No transactions available.";
return;
}
rows.innerHTML="";
if(recent)recent.innerHTML="";
items.forEach(item=>{
const date=item.createdAt||item.created_at||item.date||"—";
const type=item.type||item.transactionType||item.transaction_type||"Transaction";
const amount=item.amount??0;
const status=item.status||"—";
const tr=document.createElement("tr");
[date,type,money(amount),status].forEach(value=>{
const td=document.createElement("td");
td.textContent=String(value);
tr.appendChild(td);
});
rows.appendChild(tr);
if(recent){
const line=document.createElement("div");
line.className="profile-line";
line.textContent=type+" — "+money(amount)+" — "+status;
recent.appendChild(line);
}
});
}
/* NAVIGATION */
function navigate(page){
const target=$(page);
if(!target)return;
if(page==="admin"&&$("adminNav").classList.contains("hidden"))return;
document.querySelectorAll(".page").forEach(el=>el.classList.remove("active"));
target.classList.add("active");
document.querySelectorAll(".nav,.mobile-nav button").forEach(button=>{
button.classList.toggle("active",button.dataset.page===page);
});
if(page==="admin")loadAdminRequests();
window.scrollTo({top:0,behavior:"smooth"});
}
/* PROFILE BUTTON ACTIONS */
function profileAction(action){
switch(action){
case "invite":navigate("referrals");break;
case "revenue":navigate("wallet");break;
case "data":navigate("transactions");break;
case "withdrawal":navigate("withdraw");break;
case "customer":setMessage("profileMessage","Customer service contact details have not been configured yet.","error");break;
case "team":setMessage("profileMessage","Your team section has not been configured yet.","error");break;
case "security":setMessage("profileMessage","Keep your PIN private. Never share your login details with anyone.","success");break;
case "shipping":setMessage("profileMessage","Shipping address settings have not been configured yet.","error");break;
case "country":setMessage("profileMessage","WORKIFY currently uses South Africa and ZAR.","success");break;
case "agreement":setMessage("profileMessage","The Service Agreement has not been added yet.","error");break;
}
}
/* LOG OUT */
async function logout(){
try{
await api("/api/logout",{
method:"POST",
body:JSON.stringify({})
});
}catch(error){}
currentUser=null;
accountData=null;
$("app").classList.add("hidden");
$("authScreen").classList.remove("hidden");
$("loginForm").reset();
$("registerForm").reset();
clearErrors();
$("connectionStatus").textContent="ACCOUNT";
showAuth("login");
setMessage("authMessage","You have been logged out.","success");
}
/* DEPOSIT REQUEST FUNCTION - RESERVED FOR FUTURE USE */
async function submitDeposit(event){
event.preventDefault();
const amount=Number($("depositAmount").value);
const method=$("depositMethod").value;
const reference=$("depositReference").value.trim();
if(!Number.isFinite(amount)||amount<=0){
setMessage("depositMessage","Enter a valid amount.","error");
return;
}
try{
await api("/api/deposit-requests",{
method:"POST",
body:JSON.stringify({amount,method,reference})
});
$("depositAmount").value="";
$("depositMethod").value="";
$("depositReference").value="";
setMessage("depositMessage","Deposit request submitted for review.","success");
}catch(error){
setMessage("depositMessage",error.message,"error");
}
}
/* WITHDRAWAL */
async function submitWithdrawal(event){
event.preventDefault();
const amount=Number($("withdrawAmount").value);
const bank=$("withdrawBank").value.trim();
const holder=$("withdrawHolder").value.trim();
const accountNumber=$("withdrawAccount").value.trim();
if(!Number.isFinite(amount)||amount<=0){
setMessage("withdrawMessage","Enter a valid amount.","error");
return;
}
try{
await api("/api/withdrawal-requests",{
method:"POST",
body:JSON.stringify({amount,bank,holder,accountNumber})
});
$("withdrawAmount").value="";
$("withdrawBank").value="";
$("withdrawHolder").value="";
$("withdrawAccount").value="";
setMessage("withdrawMessage","Withdrawal request submitted for review.","success");
}catch(error){
setMessage("withdrawMessage",error.message,"error");
}
}
/* REFERRAL CODE */
async function copyReferral(){
const code=$("referralCode").textContent;
if(!code||code==="—"){
setMessage("referralMessage","No referral code is available.","error");
return;
}
try{
await navigator.clipboard.writeText(code);
setMessage("referralMessage","Referral code copied.","success");
}catch(error){
setMessage("referralMessage","Copy is not available in this browser.","error");
}
}
/* ADMIN REQUESTS */
async function loadAdminRequests(){
const rows=$("adminRows");
rows.innerHTML='<tr><td colspan="5" class="empty">Loading requests...</td></tr>';
try{
const data=await api("/api/admin/requests",{method:"GET"});
const requests=data.requests||data;
if(!Array.isArray(requests)||requests.length===0){
rows.innerHTML='<tr><td colspan="5" class="empty">No requests available.</td></tr>';
return;
}
rows.innerHTML="";
requests.forEach(request=>{
const tr=document.createElement("tr");
const reference=request.reference||request.referenceCode||request.id||"";
const values=[reference,request.type||"—",money(request.amount),request.status||"—"];
values.forEach(value=>{
const td=document.createElement("td");
td.textContent=String(value);
tr.appendChild(td);
});
const actionCell=document.createElement("td");
const rejectButton=document.createElement("button");
rejectButton.className="action";
rejectButton.textContent="REJECT";
rejectButton.onclick=()=>rejectRequest(reference);
actionCell.appendChild(rejectButton);
tr.appendChild(actionCell);
rows.appendChild(tr);
});
}catch(error){
rows.innerHTML='<tr><td colspan="5" class="empty">Could not load requests.</td></tr>';
setMessage("adminMessage",error.message,"error");
}
}
async function rejectRequest(reference){
if(!reference)return;
if(!confirm("Are you sure you want to reject this request?"))return;
try{
await api("/api/admin/requests/"+encodeURIComponent(reference)+"/reject",{
method:"POST",
body:JSON.stringify({})
});
setMessage("adminMessage","Request rejected.","success");
loadAdminRequests();
}catch(error){
setMessage("adminMessage",error.message,"error");
}
}
/* ALWAYS START AT LOGIN - NO AUTOMATIC SESSION RESTORE */
$("authScreen").classList.remove("hidden");
$("app").classList.add("hidden");
showAuth("login");
</script>
</body>
</html>