Banking — Send Money
A trust-first mobile send-money flow for a fintech app, walking from payee selection through amount entry to a verified confirmation. Pick a saved or brand-new payee, type an amount on a numeric keypad that validates against your real balance, choose a source account, add a note, then release the transfer behind a mocked two-factor code. Closes with a clearing receipt and an animated success check. Pure HTML, CSS and vanilla JavaScript.
MCP
Code
:root {
--navy: #0e1b3a;
--navy-2: #16264d;
--ink: #0e1726;
--ink-2: #3a4660;
--muted: #697089;
--accent: #3b6ef6;
--accent-d: #2a55cc;
--accent-50: #eaf0ff;
--teal: #0fb5a6;
--violet: #7c5cff;
--bg: #f5f7fb;
--surface: #ffffff;
--line: rgba(14, 27, 58, 0.10);
--line-2: rgba(14, 27, 58, 0.18);
--ok: #1f9d62;
--warn: #d9982b;
--danger: #d4493e;
--credit: #1f9d62;
--debit: #0e1726;
--r-sm: 8px;
--r-md: 14px;
--r-lg: 20px;
--sh-sm: 0 1px 2px rgba(14, 27, 58, .06), 0 1px 3px rgba(14, 27, 58, .08);
--sh-md: 0 6px 18px rgba(14, 27, 58, .08), 0 2px 6px rgba(14, 27, 58, .06);
--sh-lg: 0 24px 60px rgba(14, 27, 58, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
font-family: "Inter", system-ui, -apple-system, sans-serif;
background:
radial-gradient(1200px 600px at 20% -10%, #eaf0ff 0%, transparent 55%),
radial-gradient(900px 500px at 110% 10%, #e6fbf8 0%, transparent 50%),
var(--bg);
color: var(--ink);
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
min-height: 100vh;
}
.tabnum, .amt, .cur-dec, .big, .balance-line, .review-amount .big {
font-variant-numeric: tabular-nums;
}
button { font-family: inherit; }
.app {
display: grid;
place-items: center;
min-height: 100vh;
padding: 24px 16px;
}
/* Phone frame */
.phone {
position: relative;
width: 100%;
max-width: 412px;
min-height: 760px;
background: var(--surface);
border-radius: 30px;
box-shadow: var(--sh-lg);
border: 1px solid var(--line);
overflow: hidden;
display: flex;
flex-direction: column;
}
/* Topbar */
.topbar {
display: flex;
align-items: center;
gap: 10px;
padding: 18px 18px 8px;
}
.topbar-title {
font-weight: 700;
font-size: 17px;
letter-spacing: -.01em;
flex: 1;
}
.icon-btn {
display: inline-grid;
place-items: center;
width: 34px;
height: 34px;
border-radius: 50%;
border: 1px solid var(--line);
background: var(--surface);
color: var(--ink);
cursor: pointer;
transition: background .15s, transform .1s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[hidden] { display: none; }
.secure-badge {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 11.5px;
font-weight: 600;
color: var(--teal);
background: #e6fbf8;
padding: 5px 9px;
border-radius: 999px;
}
/* Progress dots */
.progress {
display: flex;
gap: 6px;
padding: 4px 18px 10px;
}
.dot {
height: 4px;
flex: 1;
border-radius: 999px;
background: var(--line);
transition: background .25s;
}
.dot.is-active { background: var(--accent); }
/* Steps */
.step {
display: none;
flex: 1;
flex-direction: column;
padding: 6px 18px 20px;
animation: slideIn .28s ease;
}
.step.is-active { display: flex; }
@keyframes slideIn {
from { opacity: 0; transform: translateX(14px); }
to { opacity: 1; transform: translateX(0); }
}
.scroll { flex: 1; overflow-y: auto; }
.section-h {
font-size: 12px;
text-transform: uppercase;
letter-spacing: .07em;
color: var(--muted);
font-weight: 700;
margin: 18px 0 10px;
}
.section-h small { text-transform: none; letter-spacing: 0; font-weight: 500; }
/* Search */
.search {
display: flex;
align-items: center;
gap: 9px;
background: var(--bg);
border: 1px solid var(--line);
border-radius: var(--r-md);
padding: 11px 13px;
color: var(--muted);
}
.search input {
border: 0;
background: transparent;
outline: none;
font-size: 14.5px;
width: 100%;
color: var(--ink);
}
/* Avatars row */
.avatars {
display: flex;
gap: 14px;
overflow-x: auto;
padding: 2px 0 4px;
scrollbar-width: none;
}
.avatars::-webkit-scrollbar { display: none; }
.ava-item {
display: grid;
justify-items: center;
gap: 6px;
min-width: 56px;
cursor: pointer;
border: 0;
background: transparent;
}
.ava-item .ava { width: 50px; height: 50px; font-size: 16px; }
.ava-item span.nm {
font-size: 11.5px;
color: var(--ink-2);
max-width: 56px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ava-item:active .ava { transform: scale(.93); }
.ava {
display: grid;
place-items: center;
width: 44px;
height: 44px;
border-radius: 50%;
font-weight: 700;
font-size: 14px;
color: #fff;
background: var(--accent);
transition: transform .12s;
flex-shrink: 0;
}
/* Payee list */
.payee-list { list-style: none; margin: 0; padding: 0; }
.payee-row {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
border: 0;
background: transparent;
padding: 11px 8px;
border-radius: var(--r-md);
cursor: pointer;
text-align: left;
transition: background .14s;
}
.payee-row:hover { background: var(--bg); }
.payee-row:active { background: var(--accent-50); }
.payee-meta { flex: 1; min-width: 0; }
.payee-meta strong { display: block; font-size: 14.5px; font-weight: 600; }
.payee-meta small { color: var(--muted); font-size: 12.5px; }
.payee-row .chev { color: var(--line-2); }
.verified {
display: inline-flex;
vertical-align: -2px;
color: var(--accent);
margin-left: 4px;
}
.ghost-row {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
border: 1px dashed var(--line-2);
background: var(--surface);
padding: 13px;
border-radius: var(--r-md);
cursor: pointer;
margin-top: 14px;
font-size: 14.5px;
font-weight: 600;
color: var(--accent);
transition: background .14s, border-color .14s;
}
.ghost-row:hover { background: var(--accent-50); border-color: var(--accent); }
.ghost-row .chev { margin-left: auto; color: var(--line-2); }
.plus-circle {
display: grid;
place-items: center;
width: 34px;
height: 34px;
border-radius: 50%;
background: var(--accent-50);
color: var(--accent);
font-size: 20px;
font-weight: 600;
line-height: 1;
}
/* Amount step */
.amount-head { display: flex; justify-content: center; padding: 4px 0 2px; }
.payee-chip {
display: inline-flex;
align-items: center;
gap: 9px;
background: var(--bg);
border: 1px solid var(--line);
padding: 6px 12px 6px 6px;
border-radius: 999px;
}
.payee-chip .ava { width: 32px; height: 32px; font-size: 12px; }
.chip-meta { display: grid; line-height: 1.2; }
.chip-meta strong { font-size: 13.5px; }
.chip-meta small { font-size: 11.5px; color: var(--muted); }
.amount-display {
display: flex;
align-items: baseline;
justify-content: center;
gap: 2px;
margin: 30px 0 4px;
color: var(--ink);
}
.amount-display .cur { font-size: 28px; font-weight: 600; color: var(--ink-2); }
.amount-display .amt {
font-size: 56px;
font-weight: 800;
letter-spacing: -.03em;
line-height: 1;
}
.amount-display .cur-dec { font-size: 28px; font-weight: 700; color: var(--ink-2); }
.amount-display.is-error .amt,
.amount-display.is-error .cur,
.amount-display.is-error .cur-dec { color: var(--danger); }
.balance-line {
text-align: center;
color: var(--muted);
font-size: 13px;
margin: 2px 0 0;
font-weight: 500;
}
.amount-error {
text-align: center;
color: var(--danger);
font-size: 12.5px;
font-weight: 600;
margin: 8px 0 0;
}
.quick-amts {
display: flex;
gap: 8px;
justify-content: center;
margin: 22px 0 6px;
flex-wrap: wrap;
}
.quick-amts button {
border: 1px solid var(--line);
background: var(--surface);
color: var(--ink-2);
font-weight: 600;
font-size: 13px;
padding: 8px 16px;
border-radius: 999px;
cursor: pointer;
transition: all .14s;
}
.quick-amts button:hover { border-color: var(--accent); color: var(--accent); }
.quick-amts button:active { background: var(--accent-50); }
/* Keypad */
.keypad {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 4px;
margin: auto 0 14px;
}
.keypad button {
border: 0;
background: transparent;
font-size: 23px;
font-weight: 600;
color: var(--ink);
padding: 15px 0;
border-radius: var(--r-md);
cursor: pointer;
transition: background .12s, transform .08s;
display: grid;
place-items: center;
}
.keypad button:hover { background: var(--bg); }
.keypad button:active { background: var(--accent-50); transform: scale(.96); }
/* CTA */
.cta {
width: 100%;
border: 0;
background: var(--accent);
color: #fff;
font-weight: 700;
font-size: 15.5px;
padding: 15px;
border-radius: var(--r-md);
cursor: pointer;
box-shadow: 0 8px 20px rgba(59, 110, 246, .28);
transition: background .15s, transform .1s, box-shadow .15s, opacity .15s;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 9px;
}
.cta:hover:not(:disabled) { background: var(--accent-d); }
.cta:active:not(:disabled) { transform: translateY(1px); }
.cta:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.cta.ghost {
background: var(--surface);
color: var(--ink-2);
border: 1px solid var(--line-2);
box-shadow: none;
}
.cta.ghost:hover:not(:disabled) { background: var(--bg); }
.cta.is-loading .label { opacity: .7; }
.cta .spin {
width: 16px; height: 16px;
border: 2px solid rgba(255, 255, 255, .4);
border-top-color: #fff;
border-radius: 50%;
display: none;
animation: spin .7s linear infinite;
}
.cta.is-loading .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Review step */
.review-amount {
text-align: center;
padding: 10px 0 4px;
}
.review-amount small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.review-amount .big {
font-size: 38px;
font-weight: 800;
letter-spacing: -.02em;
margin: 2px 0;
}
.review-amount .to-name { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.accounts { display: grid; gap: 9px; }
.account {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
border: 1.5px solid var(--line);
background: var(--surface);
padding: 13px;
border-radius: var(--r-md);
cursor: pointer;
text-align: left;
transition: border-color .14s, background .14s;
}
.account:hover { background: var(--bg); }
.account.is-selected { border-color: var(--accent); background: var(--accent-50); }
.account .card-ic {
display: grid;
place-items: center;
width: 42px; height: 30px;
border-radius: 6px;
color: #fff;
font-size: 10px;
font-weight: 700;
}
.account-meta { flex: 1; min-width: 0; }
.account-meta strong { display: block; font-size: 14px; }
.account-meta small { color: var(--muted); font-size: 12.5px; }
.account .bal { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.account .radio {
width: 20px; height: 20px;
border-radius: 50%;
border: 2px solid var(--line-2);
flex-shrink: 0;
position: relative;
transition: border-color .14s;
}
.account.is-selected .radio { border-color: var(--accent); }
.account.is-selected .radio::after {
content: "";
position: absolute;
inset: 3px;
border-radius: 50%;
background: var(--accent);
}
.note {
width: 100%;
border: 1px solid var(--line);
background: var(--bg);
border-radius: var(--r-md);
padding: 12px 13px;
font-size: 14.5px;
outline: none;
color: var(--ink);
transition: border-color .14s, background .14s;
}
.note:focus { border-color: var(--accent); background: var(--surface); }
.review-card {
margin-top: 18px;
border: 1px solid var(--line);
border-radius: var(--r-md);
padding: 4px 14px;
background: var(--surface);
box-shadow: var(--sh-sm);
}
.rrow {
display: flex;
justify-content: space-between;
align-items: center;
padding: 11px 0;
font-size: 13.5px;
border-bottom: 1px solid var(--line);
}
.rrow:last-child { border-bottom: 0; }
.rrow span { color: var(--muted); }
.rrow strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.rrow strong.credit { color: var(--credit); }
.fine {
display: flex;
align-items: center;
gap: 6px;
color: var(--muted);
font-size: 11.5px;
margin: 14px 2px 0;
}
/* 2FA */
.auth-wrap {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 18px 6px 0;
}
.auth-icon {
display: grid;
place-items: center;
width: 64px; height: 64px;
border-radius: 50%;
background: var(--accent-50);
color: var(--accent);
margin: 14px 0 16px;
}
.auth-wrap h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.auth-sub { color: var(--muted); font-size: 13.5px; max-width: 280px; margin: 0 0 22px; }
.auth-sub strong { color: var(--ink); }
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input {
width: 44px; height: 54px;
text-align: center;
font-size: 22px;
font-weight: 700;
border: 1.5px solid var(--line-2);
border-radius: var(--r-md);
outline: none;
background: var(--surface);
color: var(--ink);
font-variant-numeric: tabular-nums;
transition: border-color .14s, box-shadow .14s;
}
.otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.otp.is-error input { border-color: var(--danger); animation: shake .35s; }
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
75% { transform: translateX(5px); }
}
.auth-hint { font-size: 12.5px; color: var(--muted); margin: 16px 0 0; }
.otp-error { color: var(--danger); font-size: 12.5px; font-weight: 600; margin: 8px 0 0; }
.link {
border: 0;
background: transparent;
color: var(--accent);
font-weight: 600;
font-size: inherit;
cursor: pointer;
text-decoration: underline;
text-underline-offset: 2px;
padding: 0;
}
.link.center { display: block; margin: 12px auto 0; text-align: center; }
/* Pills */
.pill {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 11.5px;
font-weight: 700;
padding: 3px 9px;
border-radius: 999px;
}
.pill-ok { background: #e7f6ee; color: var(--ok); }
.pill::before {
content: "";
width: 6px; height: 6px;
border-radius: 50%;
background: currentColor;
}
/* Success overlay */
.success {
position: absolute;
inset: 0;
background: var(--surface);
z-index: 20;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 60px 24px 24px;
animation: fadeUp .35s ease;
}
.success[hidden] { display: none; }
@keyframes fadeUp {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
.success h2 { margin: 8px 0 2px; font-size: 24px; font-variant-numeric: tabular-nums; }
.success > p { color: var(--ink-2); margin: 0 0 20px; font-size: 14px; }
.success .cta { margin-top: auto; }
.check { width: 92px; height: 92px; }
.check svg { width: 92px; height: 92px; }
.ck-circle {
stroke: var(--ok);
stroke-width: 3;
stroke-dasharray: 151;
stroke-dashoffset: 151;
animation: ckCircle .5s ease forwards;
}
.ck-mark {
stroke: var(--ok);
stroke-width: 4;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 48;
stroke-dashoffset: 48;
animation: ckMark .35s .4s ease forwards;
}
@keyframes ckCircle { to { stroke-dashoffset: 0; } }
@keyframes ckMark { to { stroke-dashoffset: 0; } }
.receipt {
width: 100%;
border: 1px solid var(--line);
border-radius: var(--r-md);
padding: 4px 14px;
margin-bottom: 14px;
box-shadow: var(--sh-sm);
}
/* Bottom sheet */
.sheet-back {
position: fixed;
inset: 0;
background: rgba(14, 23, 38, .42);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 40;
animation: fade .2s ease;
}
.sheet-back[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
width: 100%;
max-width: 412px;
background: var(--surface);
border-radius: 22px 22px 0 0;
padding: 12px 20px 24px;
box-shadow: var(--sh-lg);
animation: sheetUp .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grab {
width: 40px; height: 4px;
background: var(--line-2);
border-radius: 999px;
margin: 0 auto 12px;
}
.sheet h3 { margin: 0 0 16px; font-size: 17px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input {
width: 100%;
border: 1px solid var(--line-2);
background: var(--bg);
border-radius: var(--r-md);
padding: 12px 13px;
font-size: 14.5px;
outline: none;
color: var(--ink);
transition: border-color .14s, background .14s;
}
.field input:focus { border-color: var(--accent); background: var(--surface); }
.field input.invalid { border-color: var(--danger); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 6px; }
/* Toast */
.toast {
position: fixed;
left: 50%;
bottom: 28px;
transform: translateX(-50%) translateY(20px);
background: var(--navy);
color: #fff;
font-size: 13.5px;
font-weight: 500;
padding: 11px 18px;
border-radius: 999px;
box-shadow: var(--sh-md);
opacity: 0;
pointer-events: none;
transition: opacity .25s, transform .25s;
z-index: 60;
max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Responsive */
@media (max-width: 520px) {
.app { padding: 0; }
.phone {
max-width: 100%;
min-height: 100vh;
border-radius: 0;
border: 0;
}
.amount-display .amt { font-size: 48px; }
.keypad button { padding: 13px 0; font-size: 21px; }
.otp input { width: 40px; height: 50px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}(function () {
"use strict";
// ---------- Data (fictional) ----------
var ACCOUNTS = [
{ id: "main", name: "Everyday Current", iban: "DE74 1001 0010 0000 4242 01", mask: "•••• 4242", balance: 8420.55, color: "var(--navy)" },
{ id: "save", name: "Savings Pot", iban: "DE21 1001 0010 0009 9817 06", mask: "•••• 9817", balance: 15280.00, color: "var(--teal)" },
{ id: "biz", name: "Business Spend", iban: "DE55 1001 0010 0005 0031 88", mask: "•••• 0031", balance: 3140.20, color: "var(--violet)" }
];
var PAYEES = [
{ id: "p1", name: "Mara Delgado", sub: "ES91 2100 0418 4502 0005 1332", handle: "@mara", recent: true, verified: true },
{ id: "p2", name: "Tomás Riedel", sub: "DE12 5001 0517 0648 4898 90", handle: "@tomr", recent: true, verified: false },
{ id: "p3", name: "Lena Whitfield",sub: "GB29 NWBK 6016 1331 9268 19", handle: "@lenaw", recent: true, verified: true },
{ id: "p4", name: "Kojo Mensah", sub: "FR14 2004 1010 0505 0001 3M02", handle: "@kojo", recent: false, verified: false },
{ id: "p5", name: "Aoife Brennan", sub: "IE29 AIBK 9311 5212 3456 78", handle: "@aoife", recent: false, verified: true },
{ id: "p6", name: "Bright Lights Co.", sub: "NL91 ABNA 0417 1643 00", handle: "@brightlights", recent: false, verified: true }
];
var DEMO_OTP = "428190";
// ---------- State ----------
var state = {
step: 1,
payee: null,
amount: "", // string of digits/dot
source: ACCOUNTS[0],
note: ""
};
// ---------- Helpers ----------
var $ = function (s, r) { return (r || document).querySelector(s); };
var $$ = function (s, r) { return Array.prototype.slice.call((r || document).querySelectorAll(s)); };
function initials(name) {
return name.split(/\s+/).map(function (w) { return w[0]; }).join("").slice(0, 2).toUpperCase();
}
function colorFor(id) {
var colors = ["#3b6ef6", "#0fb5a6", "#7c5cff", "#d9982b", "#1f9d62", "#2a55cc"];
var h = 0; for (var i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0;
return colors[h % colors.length];
}
function fmt(n) {
return n.toLocaleString("en-IE", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
function amountValue() {
var v = parseFloat(state.amount || "0");
return isNaN(v) ? 0 : v;
}
var toastTimer;
function toast(msg) {
var el = $("#toast");
el.textContent = msg;
el.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(function () { el.classList.remove("show"); }, 2400);
}
// ---------- Step navigation ----------
function goto(step) {
state.step = step;
$$(".step").forEach(function (s) {
s.classList.toggle("is-active", +s.dataset.step === step);
});
$$(".dot").forEach(function (d) {
d.classList.toggle("is-active", +d.dataset.dot <= step);
});
var titles = { 1: "Send money", 2: "Enter amount", 3: "Review transfer", 4: "Verify it's you" };
$("#stepTitle").textContent = titles[step];
$("#backBtn").hidden = step === 1;
if (step === 3) buildReview();
if (step === 4) { resetOtp(); setTimeout(function () { $("#otp input").focus(); }, 60); }
$(".phone").scrollTop = 0;
}
$("#backBtn").addEventListener("click", function () {
if (state.step > 1) goto(state.step - 1);
});
// ---------- Step 1: payees ----------
function payeeRow(p) {
var btn = document.createElement("button");
btn.className = "payee-row";
btn.type = "button";
var ava = '<span class="ava" style="background:' + colorFor(p.id) + '">' + initials(p.name) + '</span>';
var vsvg = p.verified
? '<span class="verified" title="Verified payee"><svg viewBox="0 0 24 24" width="13" height="13"><path d="M12 2l2.4 1.8 3 .2.9 2.9 2.3 1.9-.9 2.9.9 2.9-2.3 1.9-.9 2.9-3 .2L12 22l-2.4-1.8-3-.2-.9-2.9L3.4 15l.9-2.9-.9-2.9 2.3-1.9.9-2.9 3-.2L12 2z" fill="currentColor"/><path d="M9 12l2 2 4-4" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>'
: "";
btn.innerHTML =
ava +
'<span class="payee-meta"><strong>' + p.name + vsvg + '</strong><small>' + p.sub + '</small></span>' +
'<svg class="chev" viewBox="0 0 24 24" width="18" height="18"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
btn.addEventListener("click", function () { choosePayee(p); });
var li = document.createElement("li");
li.appendChild(btn);
return li;
}
function renderPayees(filter) {
var q = (filter || "").trim().toLowerCase();
var list = $("#payeeList");
list.innerHTML = "";
var matched = PAYEES.filter(function (p) {
if (!q) return true;
return p.name.toLowerCase().indexOf(q) > -1 ||
p.handle.toLowerCase().indexOf(q) > -1 ||
p.sub.toLowerCase().replace(/\s/g, "").indexOf(q.replace(/\s/g, "")) > -1;
});
if (!matched.length) {
var li = document.createElement("li");
li.innerHTML = '<p style="color:var(--muted);font-size:13.5px;padding:8px">No payees match “' + (filter || "") + '”.</p>';
list.appendChild(li);
} else {
matched.forEach(function (p) { list.appendChild(payeeRow(p)); });
}
var row = $("#recentRow");
row.innerHTML = "";
PAYEES.filter(function (p) { return p.recent; }).forEach(function (p) {
var b = document.createElement("button");
b.className = "ava-item";
b.type = "button";
b.innerHTML =
'<span class="ava" style="background:' + colorFor(p.id) + '">' + initials(p.name) + '</span>' +
'<span class="nm">' + p.name.split(" ")[0] + '</span>';
b.addEventListener("click", function () { choosePayee(p); });
row.appendChild(b);
});
}
$("#payeeSearch").addEventListener("input", function (e) { renderPayees(e.target.value); });
function choosePayee(p) {
state.payee = p;
state.amount = "";
$("#chipAva").textContent = initials(p.name);
$("#chipAva").style.background = colorFor(p.id);
$("#chipName").textContent = p.name;
$("#chipSub").textContent = p.sub.length > 24 ? p.sub.slice(0, 24) + "…" : p.sub;
updateAmount();
goto(2);
}
// ---------- Step 2: amount ----------
function updateAmount() {
var raw = state.amount;
var disp = raw === "" ? "0" : raw;
var dec = "";
if (disp.indexOf(".") > -1) {
var parts = disp.split(".");
disp = parts[0] === "" ? "0" : parts[0];
dec = "." + (parts[1] || "").slice(0, 2).padEnd(0, "");
}
// format integer part with thousands
var intNum = parseInt(disp, 10);
var intStr = isNaN(intNum) ? "0" : intNum.toLocaleString("en-IE");
$("#amountText").textContent = intStr;
$("#amountDec").textContent = raw.indexOf(".") > -1 ? dec : ".00";
var val = amountValue();
var over = val > state.source.balance;
$("#balanceLine").textContent = "Available · €" + fmt(state.source.balance);
$("#amountError").hidden = !over;
$(".amount-display").classList.toggle("is-error", over);
$("#toSourceBtn").disabled = !(val > 0 && !over);
}
function pressKey(k) {
var a = state.amount;
if (k === "del") {
a = a.slice(0, -1);
} else if (k === ".") {
if (a.indexOf(".") === -1) a = (a === "" ? "0" : a) + ".";
} else {
// limit 2 decimals
if (a.indexOf(".") > -1 && a.split(".")[1].length >= 2) return;
if (a === "0") a = k; // replace leading zero
else a = a + k;
if (a.replace(".", "").length > 9) return; // sanity cap
}
state.amount = a;
updateAmount();
}
$("#keypad").addEventListener("click", function (e) {
var b = e.target.closest("[data-k]");
if (b) pressKey(b.dataset.k);
});
$("#quickAmts").addEventListener("click", function (e) {
var b = e.target.closest("[data-q]");
if (!b) return;
if (b.dataset.q === "max") {
state.amount = String(state.source.balance);
} else {
state.amount = b.dataset.q;
}
updateAmount();
});
// keyboard support on amount step
document.addEventListener("keydown", function (e) {
if (state.step !== 2) return;
if (/^[0-9]$/.test(e.key)) { pressKey(e.key); }
else if (e.key === ".") { pressKey("."); }
else if (e.key === "Backspace") { pressKey("del"); }
else if (e.key === "Enter" && !$("#toSourceBtn").disabled) { goto(3); }
});
$("#toSourceBtn").addEventListener("click", function () {
if (!this.disabled) goto(3);
});
// ---------- Step 3: source + review ----------
function renderAccounts() {
var wrap = $("#accounts");
wrap.innerHTML = "";
ACCOUNTS.forEach(function (a) {
var btn = document.createElement("button");
btn.type = "button";
btn.className = "account" + (a.id === state.source.id ? " is-selected" : "");
btn.innerHTML =
'<span class="card-ic" style="background:' + a.color + '">' + a.id.toUpperCase().slice(0, 3) + '</span>' +
'<span class="account-meta"><strong>' + a.name + '</strong><small>' + a.mask + '</small></span>' +
'<span class="bal">€' + fmt(a.balance) + '</span>' +
'<span class="radio"></span>';
btn.addEventListener("click", function () {
state.source = a;
updateAmount();
renderAccounts();
buildReview();
});
wrap.appendChild(btn);
});
}
function buildReview() {
var p = state.payee, val = amountValue();
$("#reviewAmount").textContent = "€" + fmt(val);
$("#reviewTo").textContent = "to " + (p ? p.name : "—");
$("#rRecipient").textContent = p ? p.name : "—";
$("#rIban").textContent = p ? p.sub : "—";
$("#rAmount").textContent = "€" + fmt(val);
renderAccounts();
}
$("#noteInput").addEventListener("input", function (e) { state.note = e.target.value; });
$("#toAuthBtn").addEventListener("click", function () {
var val = amountValue();
if (val <= 0) { toast("Enter an amount first."); goto(2); return; }
if (val > state.source.balance) { toast("Not enough balance in " + state.source.name + "."); return; }
goto(4);
toast("Verification code sent to •••• ••82");
});
// ---------- Step 4: OTP ----------
var otpInputs = $$("#otp input");
function resetOtp() {
otpInputs.forEach(function (i) { i.value = ""; });
$("#otp").classList.remove("is-error");
$("#otpError").hidden = true;
$("#confirmBtn").disabled = true;
}
function otpValue() { return otpInputs.map(function (i) { return i.value; }).join(""); }
otpInputs.forEach(function (inp, idx) {
inp.addEventListener("input", function () {
inp.value = inp.value.replace(/\D/g, "").slice(0, 1);
if (inp.value && idx < otpInputs.length - 1) otpInputs[idx + 1].focus();
$("#otp").classList.remove("is-error");
$("#otpError").hidden = true;
$("#confirmBtn").disabled = otpValue().length !== 6;
});
inp.addEventListener("keydown", function (e) {
if (e.key === "Backspace" && !inp.value && idx > 0) otpInputs[idx - 1].focus();
});
inp.addEventListener("paste", function (e) {
e.preventDefault();
var d = (e.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, 6).split("");
d.forEach(function (ch, i) { if (otpInputs[i]) otpInputs[i].value = ch; });
var next = Math.min(d.length, otpInputs.length - 1);
otpInputs[next].focus();
$("#confirmBtn").disabled = otpValue().length !== 6;
});
});
$("#autofill").addEventListener("click", function () {
DEMO_OTP.split("").forEach(function (ch, i) { otpInputs[i].value = ch; });
$("#otp").classList.remove("is-error");
$("#otpError").hidden = true;
$("#confirmBtn").disabled = false;
otpInputs[5].focus();
});
$("#confirmBtn").addEventListener("click", function () {
var btn = this;
if (otpValue() !== DEMO_OTP) {
$("#otp").classList.add("is-error");
$("#otpError").hidden = false;
resetOtpValuesOnly();
otpInputs[0].focus();
return;
}
btn.classList.add("is-loading");
btn.disabled = true;
$(".label", btn).textContent = "Sending…";
setTimeout(showSuccess, 1300);
});
function resetOtpValuesOnly() {
otpInputs.forEach(function (i) { i.value = ""; });
$("#confirmBtn").disabled = true;
}
// ---------- Success ----------
function showSuccess() {
var p = state.payee, val = amountValue();
var ref = "TRX-" + Math.random().toString(36).slice(2, 7).toUpperCase() + "-" + Math.floor(100 + Math.random() * 900);
$("#successAmt").textContent = "€" + fmt(val) + " sent";
$("#successTo").textContent = "to " + (p ? p.name : "—") + (state.note ? " · " + state.note : "");
$("#successRef").textContent = ref;
$("#successFrom").textContent = state.source.name + " · " + state.source.mask;
// deduct from balance (visual)
state.source.balance = Math.max(0, state.source.balance - val);
var sc = $("#success");
sc.hidden = false;
// restart check animation
var mark = $(".ck-mark"), circ = $(".ck-circle");
[mark, circ].forEach(function (el) { el.style.animation = "none"; void el.offsetWidth; el.style.animation = ""; });
var btn = $("#confirmBtn");
btn.classList.remove("is-loading");
$(".label", btn).textContent = "Confirm & send";
}
$("#doneBtn").addEventListener("click", resetFlow);
$("#againBtn").addEventListener("click", resetFlow);
function resetFlow() {
$("#success").hidden = true;
state.payee = null;
state.amount = "";
state.note = "";
state.source = ACCOUNTS[0];
$("#noteInput").value = "";
$("#payeeSearch").value = "";
renderPayees("");
updateAmount();
goto(1);
}
// ---------- New payee sheet ----------
function openSheet() { $("#sheetBack").hidden = false; setTimeout(function () { $("#npName").focus(); }, 80); }
function closeSheet() { $("#sheetBack").hidden = true; $("#npName").value = ""; $("#npIban").value = ""; $("#npName").classList.remove("invalid"); $("#npIban").classList.remove("invalid"); }
$("#newPayeeBtn").addEventListener("click", openSheet);
$("#npCancel").addEventListener("click", closeSheet);
$("#sheetBack").addEventListener("click", function (e) { if (e.target === this) closeSheet(); });
$("#npSave").addEventListener("click", function () {
var name = $("#npName").value.trim();
var iban = $("#npIban").value.trim().toUpperCase();
var ok = true;
if (name.length < 2) { $("#npName").classList.add("invalid"); ok = false; }
else $("#npName").classList.remove("invalid");
if (iban.replace(/\s/g, "").length < 12) { $("#npIban").classList.add("invalid"); ok = false; }
else $("#npIban").classList.remove("invalid");
if (!ok) { toast("Check the name and IBAN."); return; }
var p = { id: "n" + Date.now(), name: name, sub: iban, handle: "@" + name.split(" ")[0].toLowerCase(), recent: false, verified: false };
PAYEES.unshift(p);
closeSheet();
toast("Payee added");
choosePayee(p);
});
document.addEventListener("keydown", function (e) {
if (e.key === "Escape" && !$("#sheetBack").hidden) closeSheet();
});
// ---------- Init ----------
renderPayees("");
updateAmount();
goto(1);
})();<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Banking — Send Money</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="app" role="main">
<div class="phone" aria-live="polite">
<!-- Top bar -->
<header class="topbar">
<button class="icon-btn" id="backBtn" type="button" aria-label="Go back" hidden>
<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path d="M15 18l-6-6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<div class="topbar-title" id="stepTitle">Send money</div>
<div class="secure-badge" title="End-to-end encrypted">
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M12 2l7 3v6c0 5-3.5 8.5-7 10-3.5-1.5-7-5-7-10V5l7-3z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M9 12l2 2 4-4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
<span>Secure</span>
</div>
</header>
<!-- Progress -->
<div class="progress" aria-hidden="true">
<span class="dot is-active" data-dot="1"></span>
<span class="dot" data-dot="2"></span>
<span class="dot" data-dot="3"></span>
<span class="dot" data-dot="4"></span>
</div>
<!-- ====== STEP 1: Payee ====== -->
<section class="step is-active" data-step="1" aria-label="Choose payee">
<div class="scroll">
<label class="search">
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><circle cx="11" cy="11" r="7" fill="none" stroke="currentColor" stroke-width="2"/><path d="M21 21l-4-4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
<input id="payeeSearch" type="search" placeholder="Search name, IBAN or @handle" aria-label="Search payees" autocomplete="off" />
</label>
<h2 class="section-h">Recent</h2>
<div class="avatars" id="recentRow"></div>
<h2 class="section-h">Saved payees</h2>
<ul class="payee-list" id="payeeList"></ul>
<button class="ghost-row" id="newPayeeBtn" type="button">
<span class="plus-circle" aria-hidden="true">+</span>
<span>Send to someone new</span>
<svg class="chev" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
</div>
</section>
<!-- ====== STEP 2: Amount ====== -->
<section class="step" data-step="2" aria-label="Enter amount">
<div class="amount-head">
<div class="payee-chip" id="payeeChip">
<span class="ava" id="chipAva">AB</span>
<span class="chip-meta">
<strong id="chipName">—</strong>
<small id="chipSub">—</small>
</span>
</div>
</div>
<div class="amount-display">
<span class="cur">€</span>
<span class="amt" id="amountText">0</span>
<span class="cur-dec" id="amountDec">.00</span>
</div>
<p class="balance-line" id="balanceLine">Available · €8,420.55</p>
<p class="amount-error" id="amountError" role="alert" hidden>Amount exceeds available balance.</p>
<div class="quick-amts" id="quickAmts">
<button type="button" data-q="20">€20</button>
<button type="button" data-q="50">€50</button>
<button type="button" data-q="100">€100</button>
<button type="button" data-q="max">Max</button>
</div>
<div class="keypad" id="keypad" role="group" aria-label="Amount keypad">
<button type="button" data-k="1">1</button>
<button type="button" data-k="2">2</button>
<button type="button" data-k="3">3</button>
<button type="button" data-k="4">4</button>
<button type="button" data-k="5">5</button>
<button type="button" data-k="6">6</button>
<button type="button" data-k="7">7</button>
<button type="button" data-k="8">8</button>
<button type="button" data-k="9">9</button>
<button type="button" data-k=".">.</button>
<button type="button" data-k="0">0</button>
<button type="button" data-k="del" aria-label="Delete">
<svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M9 6h11v12H9l-6-6 6-6z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M13 10l4 4M17 10l-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
</button>
</div>
<button class="cta" id="toSourceBtn" type="button" disabled>Continue</button>
</section>
<!-- ====== STEP 3: Source + note (review) ====== -->
<section class="step" data-step="3" aria-label="Review transfer">
<div class="scroll">
<div class="review-amount">
<small>Sending</small>
<div class="big" id="reviewAmount">€0.00</div>
<span class="to-name" id="reviewTo">to —</span>
</div>
<h2 class="section-h">Pay from</h2>
<div class="accounts" id="accounts"></div>
<h2 class="section-h">Note <small>(optional)</small></h2>
<input id="noteInput" class="note" type="text" maxlength="60" placeholder="e.g. Rent · June" />
<div class="review-card">
<div class="rrow"><span>Recipient</span><strong id="rRecipient">—</strong></div>
<div class="rrow"><span>Account</span><strong id="rIban">—</strong></div>
<div class="rrow"><span>Amount</span><strong id="rAmount" class="credit">—</strong></div>
<div class="rrow"><span>Fee</span><strong>€0.00</strong></div>
<div class="rrow"><span>Arrives</span><strong>Instantly · SEPA</strong></div>
</div>
<p class="fine"><svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><rect x="5" y="11" width="14" height="9" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8 11V8a4 4 0 018 0v3" fill="none" stroke="currentColor" stroke-width="1.8"/></svg> Protected by 256-bit encryption. You'll confirm with a code.</p>
</div>
<button class="cta" id="toAuthBtn" type="button">Review & confirm</button>
</section>
<!-- ====== STEP 4: 2FA ====== -->
<section class="step" data-step="4" aria-label="Two-factor verification">
<div class="auth-wrap">
<div class="auth-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" width="28" height="28"><rect x="5" y="11" width="14" height="9" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8 11V8a4 4 0 018 0v3" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="15.5" r="1.4" fill="currentColor"/></svg>
</div>
<h2>Verify it's you</h2>
<p class="auth-sub">We sent a 6-digit code to <strong>•••• ••82</strong>. Enter it to release the transfer.</p>
<div class="otp" id="otp">
<input inputmode="numeric" maxlength="1" aria-label="Digit 1" />
<input inputmode="numeric" maxlength="1" aria-label="Digit 2" />
<input inputmode="numeric" maxlength="1" aria-label="Digit 3" />
<input inputmode="numeric" maxlength="1" aria-label="Digit 4" />
<input inputmode="numeric" maxlength="1" aria-label="Digit 5" />
<input inputmode="numeric" maxlength="1" aria-label="Digit 6" />
</div>
<p class="auth-hint">Demo code: <button class="link" id="autofill" type="button">tap to autofill 4 2 8 1 9 0</button></p>
<p class="otp-error" id="otpError" role="alert" hidden>That code didn't match. Try again.</p>
</div>
<button class="cta" id="confirmBtn" type="button" disabled>
<span class="spin" aria-hidden="true"></span>
<span class="label">Confirm & send</span>
</button>
</section>
<!-- ====== SUCCESS overlay ====== -->
<div class="success" id="success" role="dialog" aria-modal="true" aria-label="Transfer sent" hidden>
<div class="check">
<svg viewBox="0 0 52 52" aria-hidden="true">
<circle class="ck-circle" cx="26" cy="26" r="24" fill="none"/>
<path class="ck-mark" fill="none" d="M14 27l8 8 16-17"/>
</svg>
</div>
<h2 id="successAmt">€0.00 sent</h2>
<p id="successTo">to —</p>
<div class="receipt">
<div class="rrow"><span>Reference</span><strong id="successRef">—</strong></div>
<div class="rrow"><span>From</span><strong id="successFrom">—</strong></div>
<div class="rrow"><span>Status</span><strong><span class="pill pill-ok">Cleared</span></strong></div>
</div>
<button class="cta" id="doneBtn" type="button">Done</button>
<button class="link center" id="againBtn" type="button">Send another</button>
</div>
</div>
</main>
<!-- New payee sheet -->
<div class="sheet-back" id="sheetBack" hidden>
<div class="sheet" role="dialog" aria-modal="true" aria-label="New payee">
<div class="sheet-grab" aria-hidden="true"></div>
<h3>Send to someone new</h3>
<label class="field"><span>Full name</span><input id="npName" type="text" placeholder="Jordan Avery" /></label>
<label class="field"><span>IBAN</span><input id="npIban" type="text" placeholder="DE89 3704 0044 0532 0130 00" autocomplete="off" /></label>
<div class="sheet-actions">
<button class="cta ghost" id="npCancel" type="button">Cancel</button>
<button class="cta" id="npSave" type="button">Add & continue</button>
</div>
</div>
</div>
<div class="toast" id="toast" role="status" aria-live="polite"></div>
<script src="script.js"></script>
</body>
</html>Send Money
A complete four-step transfer journey rendered inside a phone shell. Step one lists recent contacts as avatar chips plus a searchable roster of saved payees with verified badges and IBANs; a dashed row opens a bottom sheet to add someone new. Step two is a full numeric keypad with tabular-figure amounts, quick-fill pills (€20 / €50 / €100 / Max) and live validation that turns the display red and blocks Continue the moment you exceed the selected account’s balance.
Step three is the review screen: choose which of three funded accounts pays, attach an optional note, and scan a clean summary card showing recipient, masked account, amount, fee and SEPA arrival. Step four gates the money behind a six-box one-time-code input with paste support, a demo autofill helper, shake-on-error feedback and a sending spinner. A correct code triggers an animated success check, a clearing receipt with a generated reference, and a balance that visibly updates so you can send again.
Everything is self-contained vanilla JavaScript — step routing, amount math, keypad and keyboard input, account selection, 2FA handling and a small toast helper — with no frameworks, build step or network calls. Realistic but clearly fictional names, IBANs and masked card numbers keep it demo-safe, and the layout collapses cleanly to a full-bleed mobile screen down to 360px.
Illustrative UI only — not real banking software or financial advice.