:root {
  --bg: #F8FAFC; --surface: #FFFFFF; --sunk: #F1F5F9;
  --border: #E2E8F0; --border-strong: #CBD5E1;
  --fg: #020617; --muted: #475569; --subtle: #94A3B8;
  --primary: #0F172A; --accent: #0369A1; --accent-hover: #075985; --accent-subtle: #E0F2FE;
  --success: #15803D; --success-subtle: #DCFCE7;
  --warning: #A16207; --warning-subtle: #FEF3C7;
  --danger: #DC2626; --danger-subtle: #FEE2E2;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-sm: 0 1px 2px rgba(2,6,23,.04);
  --shadow-md: 0 4px 12px -2px rgba(2,6,23,.08);
  --shadow-lg: 0 12px 28px -6px rgba(2,6,23,.14);
  --shadow-xl: 0 24px 48px -12px rgba(2,6,23,.22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--fg); font-family: 'Fira Sans', system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
.mono { font-family: 'Fira Code', monospace; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13.5px; }
a { color: inherit; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--primary); color: #CBD5E1; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.sidebar::-webkit-scrollbar { width: 6px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand b { color: #fff; font-size: 14px; font-weight: 600; }
.brand small { display: block; font-family: 'Fira Code', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: #64748B; }
.nav { flex: 1; padding: 10px; }
.nav-group { font-family: 'Fira Code', monospace; font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: .14em; color: #475569; padding: 14px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; font-size: 13px; color: #CBD5E1; cursor: pointer; transition: background .15s var(--ease); border: 0; background: none; width: 100%; text-align: left; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 500; }
.nav-item svg { flex-shrink: 0; opacity: .75; }
.nav-item.active svg { opacity: 1; }
.nav-badge { margin-left: auto; font-family: 'Fira Code', monospace; font-size: 9px; padding: 1px 6px; border-radius: 999px; background: rgba(220,38,38,.25); color: #FCA5A5; }
.nav-badge.info { background: rgba(255,255,255,.12); color: #CBD5E1; }
.nav-chip { margin-left: auto; font-family: 'Fira Code', monospace; font-size: 8.5px; padding: 1.5px 5px; border-radius: 4px; background: rgba(148,163,184,.15); color: #94A3B8; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 25; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-sub { font-family: 'Fira Code', monospace; font-size: 10px; color: var(--subtle); }
.content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* page transition */
.page { animation: pageIn .35s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- cards & panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 13.5px; font-weight: 600; }
.grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } .g23 { grid-template-columns: 2fr 1fr; } }
.stat { padding: 16px 18px; }
.stat .lbl { font-family: 'Fira Code', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--subtle); margin-bottom: 6px; }
.stat .val { font-size: 24px; font-weight: 300; font-family: 'Fira Code', monospace; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; border: 1px solid transparent; transition: all .15s var(--ease); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-dark { background: var(--primary); color: #fff; }
.btn-dark:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn:active { transform: translateY(0); }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.inp, select.inp, textarea.inp { width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--fg); transition: border-color .15s, box-shadow .15s; }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(3,105,161,.12); }
.inp.err { border-color: var(--danger); }
.hint { font-size: 11px; color: #64748B; margin-top: 4px; }
.hint.error { color: var(--danger); }

/* ---------- badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.b-green { background: var(--success-subtle); color: var(--success); }
.b-blue { background: var(--accent-subtle); color: var(--accent); }
.b-amber { background: var(--warning-subtle); color: #854D0E; }
.b-red { background: var(--danger-subtle); color: #991B1B; }
.b-gray { background: var(--sunk); color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- tables ---------- */
.tbl-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tbl-search { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.tbl-search input { width: 100%; padding: 7px 12px 7px 32px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 12.5px; }
.tbl-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-family: 'Fira Code', monospace; font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: #64748B; font-weight: 500; padding: 10px 16px; background: var(--sunk); white-space: nowrap; }
.tbl td { padding: 11px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); vertical-align: middle; }
.tbl td:first-child { color: var(--fg); font-weight: 500; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--sunk); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--subtle); }
.pager { display: flex; gap: 4px; }
.pager button { padding: 4px 10px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px; font-size: 12px; color: var(--muted); }
.pager button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: default; }
.empty { padding: 46px 20px; text-align: center; color: var(--subtle); }
.empty svg { margin: 0 auto 10px; display: block; opacity: .5; }

/* ---------- modal ---------- */
.m-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(2,6,23,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .22s var(--ease); overflow-y: auto; }
.m-overlay.open { opacity: 1; }
.m-panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-xl); width: 100%; max-width: 460px; max-height: calc(100vh - 60px); display: flex; flex-direction: column; transform: translateY(14px) scale(.965); opacity: 0; transition: transform .26s var(--ease), opacity .22s var(--ease); }
.m-overlay.open .m-panel { transform: none; opacity: 1; }
.m-panel.lg { max-width: 680px; } .m-panel.xl { max-width: 860px; }
.m-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.m-title { font-size: 15px; font-weight: 600; }
.m-x { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--sunk); color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background .15s; }
.m-x:hover { background: var(--border); }
.m-body { padding: 20px; overflow-y: auto; }
.m-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* result modals */
.result-icon { width: 74px; height: 74px; margin: 6px auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.result-icon.ok { background: var(--success-subtle); }
.result-icon.fail { background: var(--danger-subtle); }
.result-icon svg path, .result-icon svg polyline, .result-icon svg line { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .55s .15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.result-icon.fail { animation: shake .4s .1s var(--ease); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 60% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--primary); color: #E2E8F0; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 360px; transform: translateX(30px); opacity: 0; transition: all .3s var(--ease); }
.toast.in { transform: none; opacity: 1; }
.toast .t-ok { color: #4ADE80; } .toast .t-err { color: #F87171; } .toast .t-info { color: #38BDF8; }

/* ---------- misc ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tstep { position: relative; padding-bottom: 18px; }
.tstep:last-child { padding-bottom: 0; }
.tstep::before { content: ''; position: absolute; left: -24px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--border-strong); }
.tstep.done::before { background: var(--success); border-color: var(--success); }
.tstep.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(3,105,161,.18); }
.tstep .ts-t { font-size: 13px; font-weight: 500; }
.tstep .ts-s { font-size: 11.5px; color: var(--subtle); margin-top: 2px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--subtle); } .kv dd { color: var(--fg); font-weight: 500; }

.agent-brief { background: linear-gradient(135deg, #F0F9FF, #E0F2FE); border: 1px solid #BAE6FD; border-radius: 10px; padding: 14px 16px; }
.agent-brief .ab-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: #0C4A6E; text-transform: uppercase; letter-spacing: .08em; font-family: 'Fira Code', monospace; margin-bottom: 8px; }
.agent-brief p { font-size: 12.5px; color: #075985; line-height: 1.55; }
.agent-brief .ab-rec { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #0C4A6E; }

.copybox { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--sunk); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px 12px; font-family: 'Fira Code', monospace; font-size: 12px; }

.quote-ring { width: 46px; height: 46px; position: relative; flex-shrink: 0; }
.quote-ring svg { transform: rotate(-90deg); }
.quote-ring .qr-n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Fira Code', monospace; font-size: 13px; font-weight: 600; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); padding: 20px; }
.login-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-xl); width: 100%; max-width: 400px; padding: 32px; animation: pageIn .5s var(--ease); }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps .st { flex: 1; height: 4px; border-radius: 2px; background: var(--border); transition: background .3s; }
.steps .st.on { background: var(--accent); }

.notif-dot { position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

/* ---------- wise-style visual language ---------- */
.flagc { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--sunk); border: 1px solid var(--border); font-size: 19px; line-height: 1; flex-shrink: 0; }
.flagc.sm { width: 24px; height: 24px; font-size: 13px; }
.flagc.lg { width: 46px; height: 46px; font-size: 25px; }
.avc { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avc.sm { width: 26px; height: 26px; font-size: 10px; }
.txi { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; }
.txi.out { background: #E8ECF4; color: var(--primary); }
.txi.in { background: var(--success-subtle); color: var(--success); }
.txi.fx { background: var(--accent-subtle); color: var(--accent); }
.txi.gray { background: var(--sunk); color: var(--muted); }
.txi.warn { background: var(--warning-subtle); color: #854D0E; }
.txi.alert { background: var(--danger-subtle); color: #991B1B; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); text-decoration: none; cursor: pointer; transition: background .12s var(--ease); }
.lrow:first-of-type { border-top: 0; }
.lrow:hover { background: var(--sunk); }
.lrow .lr-main { flex: 1; min-width: 0; }
.lrow .lr-t { display: block; font-size: 13.5px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .lr-s { display: block; font-size: 11.5px; color: var(--subtle); margin-top: 2px; }
.lrow .lr-right { text-align: right; flex-shrink: 0; }
.lrow .lr-amt { display: block; font-family: 'Fira Code', monospace; font-size: 13px; font-weight: 600; color: var(--fg); }
.qa-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.qa-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qa-tile .txi { width: 46px; height: 46px; }
.qa-tile span:last-child { font-size: 12px; font-weight: 500; color: var(--fg); }
.ccy-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.ccy-scroll::-webkit-scrollbar { height: 5px; } .ccy-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.ccy-card { min-width: 155px; scroll-snap-align: start; }

/* fx calculator (wise-style) */
.fx-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.fx-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(3,105,161,.12); }
.fx-row label { display: block; font-size: 11px; font-weight: 500; color: var(--subtle); margin-bottom: 2px; }
.fx-amtin { border: 0; outline: none; background: transparent; font-family: 'Fira Code', monospace; font-size: 24px; font-weight: 600; width: 100%; color: var(--fg); padding: 0; }
.fx-amtin::placeholder { color: var(--border-strong); }
.fx-outval { font-family: 'Fira Code', monospace; font-size: 24px; font-weight: 600; color: var(--fg); min-height: 30px; }
.fx-ccy { display: flex; align-items: center; gap: 7px; background: var(--sunk); border: 1px solid var(--border); border-radius: 999px; padding: 5px 8px 5px 6px; flex-shrink: 0; position: relative; }
.fx-ccy select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-family: inherit; font-weight: 600; font-size: 14px; color: var(--fg); padding: 2px 18px 2px 2px; cursor: pointer; outline: none; }
.fx-ccy::after { content: ''; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--subtle); border-bottom: 2px solid var(--subtle); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.fx-swapline { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.fx-swapline::before, .fx-swapline::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.fx-swapbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent); display: flex; align-items: center; justify-content: center; transition: transform .25s var(--ease), border-color .15s; }
.fx-swapbtn:hover { transform: rotate(180deg); border-color: var(--accent); }
.fx-meta { display: grid; gap: 8px; margin: 16px 2px; }
.fx-meta .fm { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.fx-meta .fm .fm-i { width: 18px; text-align: center; font-family: 'Fira Code', monospace; color: var(--subtle); flex-shrink: 0; }
.fx-meta .fm b { margin-left: auto; font-family: 'Fira Code', monospace; color: var(--fg); font-weight: 600; }

/* bottom tab nav (customer portal, mobile) */
.bottomnav { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-xl); }
  .burger { display: flex !important; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .stat .val { font-size: 20px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(2,6,23,.06); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; font-size: 10px; font-weight: 500; color: var(--subtle); text-decoration: none; border-radius: 10px; }
  .bottomnav a.active { color: var(--accent); }
  body.has-bottomnav .content { padding-bottom: 92px; }
  body.has-bottomnav .burger { display: none !important; }
  /* bottom-sheet modals */
  .m-overlay { align-items: flex-end; padding: 0; }
  .m-panel { max-width: 100% !important; border-radius: 20px 20px 0 0; max-height: 92vh; transform: translateY(40px); }
  .btn { padding: 10px 16px; }
}
.burger { display: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); align-items: center; justify-content: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { *, .page, .m-panel, .toast { animation: none !important; transition: none !important; } }
