:root {
  --bg: #050506;
  --card: #141417;
  --card2: #1E1E23;
  --line: #2A2A31;
  --nav: #0B0B0D;
  --navline: #1F1F25;
  --text: #F5F5F7;
  --muted: #9C9CA6;
  --muted2: #CACAD2;
  --navoff: #80808A;
  --accent: #2F54FF;
  --accent-text: #A9BCFF;
  --pearl: #EAF0FF;
  --danger: #FF8A80;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 16px 16px 108px; display: flex; flex-direction: column; gap: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.loading, .empty { color: var(--muted); text-align: center; padding: 48px 16px; font-size: 15px; line-height: 1.5; }

/* typography */
.h1 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0; }
.h2 { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.accent-text { color: var(--accent-text); }

/* layout */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; }
.logo { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; object-position: 62% 72%; display: block; flex-shrink: 0; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-weight: 700; flex-shrink: 0; }
.back { width: 44px; height: 44px; border-radius: 22px; background: var(--card); border: 0; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; }

/* cards */
.card { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tile { background: var(--card2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.tile .v { font-size: 15px; font-weight: 800; }
.stat { background: var(--card); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-family: var(--display); font-size: 20px; font-weight: 600; }
.note { background: var(--card2); color: #DCE4FF; border-radius: 16px; padding: 12px 14px; display: flex; gap: 10px;
  align-items: center; font-size: 13px; font-weight: 600; line-height: 1.35; }

.balance { background: var(--accent); color: #fff; border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.balance .big { font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.badge { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: rgba(0,0,0,.35); white-space: nowrap; }
.badge.soft { background: var(--card2); color: var(--accent-text); }
.progress { height: 8px; background: rgba(255,255,255,.28); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: #fff; border-radius: 4px; }

/* buttons */
.btn { min-height: 48px; border: 0; border-radius: 14px; background: var(--card2); color: var(--text); font-weight: 700;
  font-size: 15px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.btn.lg { min-height: 56px; border-radius: 16px; font-size: 16px; font-weight: 800; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.pearl { background: var(--pearl); color: var(--bg); font-weight: 800; }
.btn.ghost { background: transparent; color: var(--muted2); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { min-height: 44px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 14px; padding: 12px 0; }
.ico { width: 22px; height: 22px; flex-shrink: 0; }
.icobox { width: 44px; height: 44px; border-radius: 14px; background: var(--card2); color: var(--accent-text); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; }

/* list */
.list { background: var(--card); border-radius: 20px; padding: 0 16px; display: flex; flex-direction: column; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; color: inherit; }
.item:last-child { border-bottom: 0; }
.item .t { font-size: 15px; font-weight: 600; }
.amt { font-size: 16px; font-weight: 800; white-space: nowrap; }
.amt.plus { color: var(--accent-text); }
.amt.zero { color: var(--muted); }
.strike { text-decoration: line-through; opacity: .6; }

/* tabs (segmented) */
.seg { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 14px; }
.seg button { flex: 1 1 0; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted2);
  font-size: 13px; font-weight: 700; }
.seg button[aria-selected="true"] { background: var(--accent); color: #fff; }

/* choice chips */
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 60px; padding: 10px 12px;
  border-radius: 14px; background: var(--card); border: 2px solid var(--card); text-align: left; color: var(--text); }
.chip[aria-checked="true"] { border-color: var(--accent); }
.chip[hidden], [hidden] { display: none !important; }
.chip .t { font-size: 14px; font-weight: 700; }

/* switch */
.switch { width: 56px; height: 44px; border: 0; padding: 0; background: transparent; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.switch span { width: 52px; height: 30px; border-radius: 15px; background: #34343C; padding: 3px; display: flex; transition: background .15s; }
.switch span i { width: 24px; height: 24px; border-radius: 12px; background: #fff; display: block; transition: transform .15s; }
.switch[aria-checked="true"] span { background: var(--accent); }
.switch[aria-checked="true"] span i { transform: translateX(22px); }
.switch:disabled { opacity: .4; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input { width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2);
  color: var(--text); padding: 0 14px; font-size: 16px; outline: none; }
textarea.input { min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* QR */
.qrbox { background: #fff; border-radius: 20px; padding: 10px; position: relative; width: 236px; height: 236px; }
.qrbox svg { width: 100%; height: 100%; display: block; }
.qrbox .qrlogo { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; background: #fff; border-radius: 14px; padding: 4px; }
.qrbox .qrlogo img { width: 100%; height: 100%; border-radius: 10px; object-fit: cover; object-position: 62% 72%; display: block; }
.code { font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: 3px; }
.dot { width: 28px; height: 28px; border-radius: 14px; background: var(--card2); font-weight: 800; font-size: 13px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; }
.dot.on { background: var(--accent); color: #fff; }

/* summary */
.sum { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted2); gap: 12px; }
.sum b { color: var(--text); }
.sep { height: 1px; background: var(--line); }

/* nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--nav); border-top: 1px solid var(--navline);
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); z-index: 5; }
.nav button { border: 0; background: transparent; color: var(--navoff); display: flex; flex-direction: column; align-items: center;
  gap: 4px; font-size: 11px; font-weight: 700; min-height: 52px; justify-content: center; }
.nav button[aria-current="page"] { color: var(--accent-text); }
@media (min-width: 520px) { .nav { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--navline); border-right: 1px solid var(--navline); } }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); background: var(--pearl); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 10; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

.success { align-items: center; text-align: center; padding: 28px 16px; }
.success .big { font-family: var(--display); font-size: 40px; font-weight: 700; color: var(--accent-text); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
