/* Nimbus Bank brand: deep navy + gold */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #e1e6ef;
  --text: #0f1b2d;
  --muted: #5d6b80;
  --primary: #0b3270;
  --primary-600: #082655;
  --primary-soft: #e7eef9;
  --gold: #c99a2e;
  --gold-600: #b0861f;
  --gold-soft: #fbf3e0;
  --navy-900: #061833;
  --accent: #0f9d6b;
  --accent-soft: #e2f6ee;
  --warn: #d98a06;
  --warn-soft: #fff4e0;
  --danger: #d93838;
  --danger-soft: #fdecec;
  --info: #1c7fc4;
  --info-soft: #e4f1fa;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 18px rgba(15, 27, 45, .06);
  --radius: 12px;
  --sidebar-w: 264px;
  --hero: linear-gradient(120deg, #061833 0%, #0b3270 58%, #164a99 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111d; --surface: #111b2b; --surface-2: #162236; --border: #24324a;
    --text: #e8eef8; --muted: #93a2b9; --primary: #5b8fe0; --primary-600: #4a7dcc;
    --primary-soft: #1a2a45; --gold-soft: #2e2510; --accent-soft: #0e2e24; --warn-soft: #33270f;
    --danger-soft: #3a1a1f; --info-soft: #0f2b3a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #0a111d; --surface: #111b2b; --surface-2: #162236; --border: #24324a;
  --text: #e8eef8; --muted: #93a2b9; --primary: #5b8fe0; --primary-600: #4a7dcc;
  --primary-soft: #1a2a45; --gold-soft: #2e2510; --accent-soft: #0e2e24; --warn-soft: #33270f;
  --danger-soft: #3a1a1f; --info-soft: #0f2b3a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-600); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--accent); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; }
.field label .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; transition: .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
textarea.input { min-height: 110px; resize: vertical; }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .addon {
  display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--border); border-left: 0;
  background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--muted); font-weight: 600; font-size: 13px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15.5px; }
.section-head { background: var(--primary-soft); border-radius: var(--radius) var(--radius) 0 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat { display: flex; gap: 14px; align-items: center; padding: 18px; cursor: default; transition: .15s; }
.stat[data-href] { cursor: pointer; }
.stat[data-href]:hover { transform: translateY(-2px); border-color: var(--primary); }
.stat .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.stat .ico svg { width: 22px; height: 22px; }
.stat .val { font-size: 21px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.c-primary { background: var(--primary-soft); color: var(--primary); }
.c-green { background: var(--accent-soft); color: var(--accent); }
.c-warn { background: var(--warn-soft); color: var(--warn); }
.c-red { background: var(--danger-soft); color: var(--danger); }
.c-info { background: var(--info-soft); color: var(--info); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.badge.green { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.purple { background: var(--primary-soft); color: var(--primary); }
.badge.gray { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; margin-bottom: 8px; }
.amount-pos { color: var(--accent); font-weight: 700; }
.amount-neg { color: var(--danger); font-weight: 700; }

/* Mobile: tables become stacked label/value cards, like the reference */
@media (max-width: 760px) {
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border: 1px solid var(--border); border-radius: 12px; margin: 12px; width: auto; overflow: hidden; }
  .tbl.responsive td { display: flex; justify-content: space-between; gap: 16px; text-align: right; padding: 12px 14px; }
  .tbl.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
}

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .25s;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 18px; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--hero); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.side-search { margin: 4px 16px 10px; position: relative; }
.side-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.side-search input { padding-left: 34px; background: var(--surface-2); }
.nav { overflow-y: auto; padding: 4px 12px 20px; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text);
  font-weight: 500; margin-bottom: 2px; position: relative;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); }
.nav a .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.nav a.active .count { background: #fff; color: var(--primary); }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar .title { font-weight: 700; font-size: 17px; }
.top-btn { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--primary); cursor: pointer; }
.top-btn .dot { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 99px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.footer { text-align: center; padding: 18px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.backdrop { display: none; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 50; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button.item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; color: var(--text); width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button.item:hover { background: var(--surface-2); }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 8px; }
.notif-item:hover { background: var(--surface-2); }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 13, 26, .45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .topbar .title { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat .ico { width: 40px; height: 40px; }
  .stat .val { font-size: 18px; }
}

/* ---------- User dashboard ---------- */
.balance-card {
  background: var(--hero); color: #fff; border-radius: 22px; padding: 26px; position: relative; overflow: hidden;
  box-shadow: 0 20px 40px -14px rgba(6, 24, 51, .55);
}
.balance-card::before, .balance-card::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.balance-card::before { width: 280px; height: 280px; right: -80px; top: -120px; }
.balance-card::after { width: 180px; height: 180px; right: 80px; bottom: -110px; }
.balance-card .amt { font-size: 36px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 18px; }
.balance-card .acct { opacity: .85; font-size: 13px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; position: relative; z-index: 1; }
.quick a { background: rgba(255,255,255,.14); color: #fff; border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; transition: .15s; }
.quick a:hover { background: rgba(255,255,255,.24); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } }
.tx-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.tx-item:last-child { border-bottom: 0; }
.tx-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.vcard {
  aspect-ratio: 1.586; border-radius: 18px; padding: 20px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, #061833, #0b3270 60%, #1d5bb5); position: relative; overflow: hidden;
}
.vcard .num { font-size: 18px; letter-spacing: .12em; font-weight: 600; }
.chip { width: 40px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #fde68a, #d4a017); }

.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 12px; border: 1px solid var(--border); overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 14px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.plan-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.plan-card .rate { font-size: 30px; font-weight: 800; color: var(--primary); }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-card li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding-bottom: 8px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; font-weight: 600; }

/* Field builder card (like reference beneficiary config) */
.field-cfg { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; background: var(--surface-2); }
.field-cfg .meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }

/* ---------- Modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 13, 26, .5); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 60px rgba(0,0,0,.25); animation: pop .18s; }
.modal.lg { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); animation: pop .2s; max-width: 360px; }
.toast.ok svg { color: var(--accent); }
.toast.err svg { color: var(--danger); }

/* ---------- Public site ---------- */
.pill { display: inline-flex; gap: 8px; align-items: center; background: var(--primary-soft); color: var(--primary); padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.section { padding: 70px 5vw; max-width: 1280px; margin: 0 auto; }
.section h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; letter-spacing: -.02em; text-align: center; }
.section .sub { text-align: center; color: var(--muted); max-width: 560px; margin: 12px auto 40px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature { padding: 24px; }
.bank-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.bank-grid .kv > div { padding: 10px 18px; }
.bank-grid .kv > div > span:first-child { white-space: nowrap; }
.feature .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }
.feature h3 { font-size: 17px; margin-bottom: 6px; }
.demo-box { border: 1px dashed var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 18px; background: var(--surface-2); }
