:root {
  --bg: #07070F;
  --surface: #10101C;
  --surface-2: #0B0B16;
  --raise: #1D1D33;
  --border: #23233A;
  --border-2: #34345A;
  --text: #F4F4F5;
  --soft: #D4D4D8;
  --muted: #9A9AA3;
  --dim: #71717A;
  --accent: #8B6CFF;
  --accent-ink: #07070F;
  --accent-glow: #8B6CFF66;
  --wallet-bg: #17132E;
  --wallet-border: #3A3170;
  --green: #6EE0B0;
  --green-bg: #10261D;
  --amber: #F2C66D;
  --red: #FF8A8A;
  --l1: #C9CDD6; --l1-bg: #1E2029;
  --l2: #6EE0B0; --l2-bg: #10261D;
  --l3: #8FD3FF; --l3-bg: #10223A;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Geist, system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand svg { flex-shrink: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.wallet { background: var(--wallet-bg); border-color: var(--wallet-border); }
.card-title { font-weight: 600; font-size: 16px; }
.label { font-size: 12px; color: var(--muted); }
.big { font-weight: 700; font-size: 24px; letter-spacing: -0.02em; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--soft); }
.input {
  min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; width: 100%;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
select.input { appearance: none; }
.hint { font-size: 12px; color: var(--muted); }

/* Buttons */
.btn {
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-2); font-weight: 600; }
.btn.subtle { background: var(--raise); color: var(--text); font-weight: 600; }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn.link { background: none; color: var(--accent); min-height: 40px; padding: 0; font-weight: 500; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #5A2A2A; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
}

/* Chips & bars */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; box-shadow: 0 0 8px currentColor; }
.lvl-1 { color: var(--l1); background: var(--l1-bg); }
.lvl-2 { color: var(--l2); background: var(--l2-bg); }
.lvl-3 { color: var(--l3); background: var(--l3-bg); }
.bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.segs { display: flex; gap: 4px; flex: 1; }
.segs span { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.segs span.on { background: var(--accent); }

.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg-toggle button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
.seg-toggle button[aria-pressed="true"] { background: var(--raise); color: var(--text); }

.banner { padding: 12px 14px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.banner.accent { background: var(--wallet-bg); border: 1px solid var(--wallet-border); }
.banner.amber { background: #2A2213; color: #F2D58A; }
.banner.green { background: var(--green-bg); color: var(--green); }

/* Lists */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #171727; }
.list-row:first-child { border-top: 0; }
.ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.ico.up { background: var(--green-bg); color: var(--green); }
.ico.down { background: #1C1838; color: var(--accent); }
.ico.neutral { background: var(--raise); color: var(--soft); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px;
  background: var(--raise); border: 1px solid var(--border-2); font-size: 14px; z-index: 50;
  box-shadow: 0 8px 30px #0008; display: none;
}
#toast.show { display: block; }
#toast.error { border-color: #5A2A2A; color: #FFC2C2; }

/* ---------- Customer app ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: calc(20px + env(safe-area-inset-top)) 20px 120px; display: flex; flex-direction: column; gap: 14px; }
.screen-head h1 { font-weight: 700; font-size: 30px; letter-spacing: -0.03em; }
.balance { font-weight: 800; font-size: 76px; line-height: 1; letter-spacing: -0.04em; margin-top: 4px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #07070FEE; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #171727; padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
}
.tabbar-inner { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar button {
  min-height: 52px; border: 0; background: none; color: var(--dim); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.tabbar button[aria-current="page"] { color: var(--text); }
.auth { max-width: 400px; margin: 0 auto; padding: calc(64px + env(safe-area-inset-top)) 24px 40px; display: flex; flex-direction: column; gap: 18px; min-height: 100vh; }
.auth h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.code-input { letter-spacing: 0.4em; font-size: 24px; text-align: center; font-weight: 700; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 24px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--raise); font-size: 22px; }
.stepper .amt { font-weight: 800; font-size: 60px; letter-spacing: -0.04em; min-width: 120px; text-align: center; }
.pick { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); width: 100%; text-align: left; }
.pick[aria-pressed="true"] { border-color: var(--accent); background: var(--wallet-bg); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40vh auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Business dashboard ---------- */
.biz { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 210px; max-width: 232px; padding: 24px 12px; border-right: 1px solid #171727; display: flex; flex-direction: column; gap: 2px; }
.side .brand { padding: 0 10px 26px; font-size: 15px; }
.logo-tile { width: 30px; height: 30px; border-radius: 9px; background: var(--raise); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.side nav button {
  width: 100%; min-height: 40px; padding: 0 10px; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; display: flex; align-items: center; gap: 10px;
}
.side nav button::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: transparent; }
.side nav button[aria-current="page"] { background: var(--raise); color: var(--text); }
.side nav button[aria-current="page"]::before { background: var(--accent); }
.side-foot { margin-top: auto; padding: 12px 10px; border-top: 1px solid #171727; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 15px; background: var(--raise); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.main { flex: 999 1 560px; min-width: 0; padding: 24px clamp(16px, 4vw, 44px) 60px; display: flex; flex-direction: column; gap: 18px; max-width: 1180px; }
.searchbar { flex: 1 1 320px; max-width: 460px; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 6px 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; outline: none; }
.cust-card { position: relative; overflow: hidden; padding: 24px 26px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.cust-card .moon { position: absolute; right: -70px; top: -90px; opacity: .07; pointer-events: none; }
.ring { width: 60px; height: 60px; border-radius: 30px; padding: 2px; flex-shrink: 0; }
.ring > div { width: 56px; height: 56px; border-radius: 28px; background: var(--raise); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; align-items: start; }
.panel { padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.amount-input { min-height: 64px; font-weight: 800; font-size: 32px; letter-spacing: -0.03em; border-color: var(--accent); background: var(--surface-2); }
.tag { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--raise); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.tag.dashed { border-style: dashed; background: transparent; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 8px; }
td { padding: 8px; border-top: 1px solid var(--border); vertical-align: middle; }
td .input { min-height: 40px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 40px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; border-right: 0; border-bottom: 1px solid #171727; }
  .side .brand { padding: 0 8px; }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
  .side nav button { width: auto; }
  .side-foot { display: none; }
}

/* Cards used as buttons */
button.card { width: 100%; display: block; color: var(--text); font: inherit; }
button.card:hover, .pick:hover { border-color: var(--border-2); }
