/* FastWallet — базовая дизайн-система */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../../assets/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../../assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../../assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f2f3f7;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --surface-3: #eceef5;
  --ink: #111326;
  --ink-2: #2c2f43;
  --muted: #7c8194;
  --muted-2: #9ba0b0;
  --line: rgba(17, 19, 38, 0.075);
  --navy: #15182a;
  --navy-2: #232746;
  --accent: #6c5ce7;
  --accent-2: #5b8def;
  --accent-soft: #eeecff;
  --violet: #7b6cf6;
  --blue: #4e8df5;
  --grad: linear-gradient(135deg, #7b6cf6 0%, #5b8def 100%);
  --grad-deep: linear-gradient(145deg, #211f4a 0%, #3b2d76 48%, #4b3fa8 100%);
  --ok: #1f9d72;
  --ok-soft: #e6f7f1;
  --warn: #c77a12;
  --warn-soft: #fff4e2;
  --bad: #d8444b;
  --bad-soft: #ffecee;
  --info: #2f6fdc;
  --info-soft: #eaf1ff;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 0 10px 30px rgba(24, 26, 51, 0.07);
  --shadow-lg: 0 18px 50px rgba(24, 26, 51, 0.16);
  --tabbar: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
svg.ic { display: block; flex: 0 0 auto; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.danger { color: var(--bad); }
.success { color: var(--ok); }
.link { color: var(--accent); font-weight: 600; background: none; border: 0; cursor: pointer; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: clip;
}
.screen { min-height: 100vh; padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px); }
.app-detail .screen { padding-bottom: 28px; }
.app-auth .screen { padding-bottom: 0; }

/* ---------- Splash ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(80% 60% at 50% 30%, #322b70 0%, #171a2d 62%, #101223 100%);
  color: #fff;
  transition: opacity 0.3s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 20px 60px rgba(89, 75, 233, 0.45);
  animation: splash-pulse 1.6s ease-in-out infinite;
}
.splash-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 20px; }
.splash-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.splash-sub { font-size: 13px; color: rgba(255, 255, 255, 0.62); }
@keyframes splash-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.1px;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { color: #fff; background: var(--grad); box-shadow: 0 8px 22px rgba(97, 92, 231, 0.28); }
.btn-dark { color: #fff; background: var(--ink); }
.btn-ghost { color: var(--ink); background: var(--surface-3); }
.btn-soft { color: var(--accent); background: var(--accent-soft); }
.btn-white { color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.btn-danger { color: #fff; background: var(--bad); }
.btn-outline { color: var(--ink); background: transparent; border: 1.5px solid var(--line); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn-xs { min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 48px; padding: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-2);
  transition: background 0.15s, transform 0.12s;
  flex: 0 0 auto;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.glass { color: #fff; background: rgba(255, 255, 255, 0.09); }
.icon-btn.bare { background: transparent; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  padding-left: 4px;
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  transition: border 0.15s, background 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08); }
.input-wrap .ic { color: var(--muted); }
.input-wrap input, .input-wrap select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 550;
  padding: 13px 0;
}
.input-wrap input::placeholder { color: var(--muted-2); font-weight: 450; }
.input-wrap .suffix { color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
textarea.input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1.5px solid transparent;
  outline: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 14px 15px;
  font-size: 15px;
}
textarea.input:focus { border-color: var(--accent); background: #fff; }
.input {
  width: 100%;
  min-height: 52px;
  border: 1.5px solid transparent;
  outline: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0 15px;
  font-size: 16px;
  font-weight: 550;
}
.input:focus { border-color: var(--accent); background: #fff; }
.input::placeholder { color: var(--muted-2); font-weight: 450; }
select.input { appearance: none; background-image: none; cursor: pointer; }
.form-error { color: var(--bad); font-size: 12.5px; padding-left: 4px; }
.form-hint { color: var(--muted); font-size: 12px; line-height: 1.45; padding-left: 4px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.switch { position: relative; width: 46px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--surface-3); transition: 0.2s; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.16); transition: 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(17, 19, 38, 0.02);
}
.card-soft { background: var(--surface-2); }
.card-grad { background: var(--grad); color: #fff; }
.card-dark { background: var(--grad-deep); color: #fff; }
.card-title { font-size: 17px; font-weight: 750; letter-spacing: -0.2px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  width: 100%;
  text-align: left;
  position: relative;
  background: var(--surface);
}
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 68px;
  right: 16px;
  height: 1px;
  background: var(--line);
}
.row.no-line + .row::before { display: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.15px; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex: 0 0 auto; }
.row-amount { font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-amount.in { color: var(--ok); }
.row-amount.out { color: var(--ink); }
.row-amount.neutral { color: var(--accent); }
.row-time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.row .chev { color: var(--muted-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 4px 12px; }
.section-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }
.section-head .link { font-size: 13px; }
.section-label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; padding: 0 6px; margin: 20px 0 8px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.pane { padding: 0 16px; }
.pane-top { padding-top: 12px; }

.asset-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.34), transparent 55%),
    var(--ac, #6c5ce7);
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.14), 0 4px 10px rgba(24,26,51,.12);
  flex: 0 0 auto;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 750;
  background: var(--grad);
  flex: 0 0 auto;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-muted { color: var(--muted); background: var(--surface-2); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}
.tag-soon { color: var(--accent); background: var(--accent-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); display: inline-block; }

/* ---------- Header / hero ---------- */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 14px) 16px 12px;
  background: var(--bg);
  position: relative;
  z-index: 2;
}
.page-head h1 { flex: 1; font-size: 26px; font-weight: 800; letter-spacing: -0.9px; }
.page-head .head-space { width: 42px; flex: 0 0 auto; }
.page-head .icon-btn { background: var(--surface); box-shadow: 0 2px 10px rgba(24,26,51,.05); }
.page-head .icon-btn.bare { box-shadow: none; background: transparent; }
.page-head .head-actions { display: flex; gap: 8px; }
.page-sub { padding: 0 18px 14px; color: var(--muted); font-size: 13px; margin-top: -4px; }

.hero {
  position: relative;
  color: #fff;
  padding: calc(var(--safe-top) + 16px) 18px 36px;
  border-radius: 0 0 30px 30px;
  background:
    radial-gradient(110% 85% at 88% -6%, rgba(123, 108, 246, 0.95) 0%, rgba(80, 65, 200, 0.35) 40%, transparent 66%),
    radial-gradient(90% 60% at 0% 100%, rgba(48, 43, 102, 0.65), transparent 65%),
    linear-gradient(160deg, #191c31 0%, #232743 55%, #2c2856 100%);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -100px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(148, 132, 255, 0.28), transparent 65%);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.hero-top .spacer { flex: 1; }
.hello { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hello-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.hello-sub { font-size: 11.5px; color: rgba(255,255,255,.55); margin-top: 2px; }
.cashback-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 750;
  background: linear-gradient(135deg, rgba(139,126,255,.95), rgba(84,139,239,.95));
  box-shadow: 0 8px 22px rgba(88, 80, 220, 0.3);
}
.cashback-pill .ic { opacity: .9; }
.hero-balance { margin-top: 26px; position: relative; z-index: 1; }
.balance-label { font-size: 12px; color: rgba(255,255,255,.58); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.balance-line { display: flex; align-items: center; gap: 12px; margin-top: 5px; }
.balance-value { font-size: 38px; font-weight: 800; letter-spacing: -1.6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.balance-value .cur { font-size: 26px; font-weight: 650; margin-left: 2px; letter-spacing: -0.5px; }
.balance-eye { color: rgba(255,255,255,.6); }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; position: relative; z-index: 1; }
.hero-actions .btn { min-height: 46px; border-radius: 14px; font-size: 14px; }
.btn-hero-primary { color: #171a2e; background: #fff; box-shadow: 0 10px 26px rgba(8, 8, 30, 0.22); }
.btn-hero-ghost { color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1); }
.balance-hidden { letter-spacing: 2px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; position: relative; z-index: 1; }
.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 4px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.055);
  color: #fff;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.25;
  text-align: center;
}
.quick:active { background: rgba(255,255,255,.14); }
.quick-ic {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, rgba(139,126,255,.9), rgba(84,139,239,.8));
  box-shadow: 0 6px 16px rgba(70, 60, 190, 0.28);
}
.quick:nth-child(2) .quick-ic { background: linear-gradient(140deg, #4ec7a2, #2f9c7b); }
.quick:nth-child(3) .quick-ic { background: linear-gradient(140deg, #f0a754, #e77c3c); }
.quick:nth-child(4) .quick-ic { background: linear-gradient(140deg, #5b8def, #3f6fd1); }

.promo-scroll { display: flex; gap: 10px; overflow-x: auto; margin: 18px -18px 0; padding: 0 18px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; position: relative; z-index: 1; }
.promo-scroll::-webkit-scrollbar { display: none; }
.promo {
  position: relative;
  flex: 0 0 84%;
  min-height: 116px;
  border-radius: 20px;
  padding: 17px 16px;
  color: #fff;
  overflow: hidden;
  scroll-snap-align: start;
  background: linear-gradient(130deg, #6b5df0, #8d7bff);
}
.promo.blue { background: linear-gradient(130deg, #3f7ee8, #63a4ff); }
.promo.teal { background: linear-gradient(130deg, #1c8f78, #35bfa0); }
.promo h3 { font-size: 16px; font-weight: 750; letter-spacing: -0.3px; max-width: 75%; }
.promo p { font-size: 12px; color: rgba(255,255,255,.72); margin-top: 4px; max-width: 75%; }
.promo .promo-ic { position: absolute; right: 12px; bottom: 10px; width: 62px; height: 62px; border-radius: 20px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; transform: rotate(-8deg); }
.promo .promo-ic .ic { width: 34px; height: 34px; }
.promo-dots { display: flex; gap: 5px; justify-content: center; margin-top: 12px; }
.promo-dots i { width: 5px; height: 5px; border-radius: 4px; background: rgba(255,255,255,.28); }
.promo-dots i.on { width: 16px; background: #fff; }

/* ---------- White sheet content ---------- */
.sheet-content {
  position: relative;
  margin-top: -24px;
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  padding: 22px 16px 8px;
  z-index: 2;
}
.sheet-content-flat { margin-top: 0; border-radius: 0; }
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: rgba(17,19,38,.12); margin: 0 auto 14px; }
.money-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 12px; }
.money-head h2 { flex: 1; font-size: 21px; font-weight: 800; letter-spacing: -0.5px; }
.money-head .muted-total { font-size: 13px; font-weight: 650; color: var(--muted); }
.money-ic { width: 34px; height: 34px; border-radius: 11px; background: var(--surface-2); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.asset-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 4px 8px; margin: 0 -4px; scrollbar-width: none; }
.asset-scroll::-webkit-scrollbar { display: none; }
.asset-card {
  flex: 0 0 158px;
  background: var(--surface);
  border-radius: 20px;
  padding: 14px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 rgba(17,19,38,.03);
  text-align: left;
}
.asset-card-top { display: flex; align-items: center; gap: 8px; }
.asset-card-top .ticker { font-size: 12.5px; font-weight: 750; }
.asset-card .amount { font-size: 19px; font-weight: 800; letter-spacing: -0.6px; margin-top: auto; font-variant-numeric: tabular-nums; }
.asset-card .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.rate-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 4px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}
.rate-strip .rate-item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.rate-strip .rate-item b { color: var(--ink); font-weight: 650; }
.rate-strip .sep { width: 1px; height: 14px; background: var(--line); }
.rate-strip .refresh { margin-left: auto; color: var(--muted-2); }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed;
  z-index: 40;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: start;
  padding: 8px 4px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(17,19,38,.06);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.8px;
  font-weight: 550;
  color: var(--muted);
  padding: 2px 0;
  letter-spacing: -0.1px;
}
.tab-ic { position: relative; display: flex; padding: 5px 12px; border-radius: 13px; transition: background .15s; }
.tab.active { color: var(--accent); font-weight: 700; }
.tab.active .tab-ic { background: var(--accent-soft); }
.tab-dot { position: absolute; top: 1px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #ff3b4e; border: 1.5px solid #fff; }

/* ---------- Tabs / chips / segmented ---------- */
.seg {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 14px;
}
.seg button {
  flex: 1;
  min-height: 38px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(24,26,51,.08); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.chip.on { color: #fff; background: var(--ink); }
.chip.chip-soft.on { color: var(--accent); background: var(--accent-soft); }
.header-tabs { display: flex; gap: 8px; padding: 4px 16px 12px; }
.header-tabs button {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface);
}
.header-tabs button.on { color: #fff; background: var(--ink); }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 42px 22px; color: var(--muted); }
.empty-ic { width: 62px; height: 62px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--accent); margin: 0 auto 14px; box-shadow: var(--shadow); }
.empty h3 { color: var(--ink); font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 300px; margin: 0 auto 18px; }
.skeleton-wrap { padding: 18px; }
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.sk { background: linear-gradient(90deg, #e9ebf1 25%, #f3f4f8 37%, #e9ebf1 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 7px; }
.sk-circle { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk-line { height: 10px; }
.w60 { width: 60%; } .w35 { width: 35%; } .w20 { width: 20%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 34px; color: var(--muted); font-size: 13px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.detail-skeleton { padding-top: 20px; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  width: min(92vw, 440px);
  pointer-events: none;
}
.app-detail ~ #toast-root, .app-auth ~ #toast-root { bottom: calc(24px + var(--safe-bottom)); }
.toast {
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(20, 22, 41, 0.94);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #9e2f36; }
.toast-success { background: #157a5a; }

/* ---------- Sheet ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 13, 28, 0.46);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .2s;
}
#sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 102%);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  transition: transform .26s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -20px 60px rgba(10,12,30,.24);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}
#sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet-grab { width: 38px; height: 4px; border-radius: 4px; background: rgba(17,19,38,.14); margin: 10px auto 0; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 8px; }
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.sheet-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-x { background: var(--surface); width: 36px; height: 36px; border-radius: 12px; color: var(--muted); }
.sheet-body { padding: 8px 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 18px calc(16px + var(--safe-bottom)); background: var(--bg); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.sheet .field + .field { margin-top: 12px; }
.sheet-full { height: 92vh; }
.sheet-full .sheet-body { flex: 1; }

/* ---------- Modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 110; pointer-events: none; }
#modal-root:not(:empty) { pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(12,13,28,.5); backdrop-filter: blur(3px); }
.modal-card { width: min(100%, 380px); background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--shadow-lg); animation: modal-in .2s ease; }
.modal-card h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.modal-card p { color: var(--muted); font-size: 13.5px; margin-top: 8px; line-height: 1.5; }
.modal-actions { display: flex; gap: 9px; margin-top: 20px; }
.modal-actions .btn { flex: 1; min-height: 44px; font-size: 14px; }
@keyframes modal-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

/* ---------- QR ---------- */
.qr { width: 100%; margin: 0 auto; background: #fff; border-radius: 16px; padding: 10px; }
.qr svg { width: 100%; height: auto; display: block; }

/* ---------- Offline ---------- */
.offline-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #2a2d44;
  color: #fff;
  font-size: 11.5px;
  position: sticky;
  top: 0;
  z-index: 55;
}
.offline-bar.show { display: flex; }
.offline-bar span { flex: 1; }
.offline-bar button { color: #cfc8ff; font-size: 11.5px; font-weight: 700; }

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh;
  background:
    radial-gradient(90% 70% at 82% 0%, rgba(120, 104, 246, 0.55) 0%, transparent 58%),
    radial-gradient(80% 50% at 0% 100%, rgba(64, 53, 148, 0.5), transparent 65%),
    linear-gradient(165deg, #1a1d32 0%, #171a2c 60%, #111322 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.auth-top { padding: calc(var(--safe-top) + 36px) 26px 24px; }
.auth-logo {
  width: 68px;
  height: 68px;
  border-radius: 21px;
  background: #fff;
  padding: 7px;
  box-shadow: 0 16px 38px rgba(6, 7, 22, 0.35);
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 15px; }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 30px; }
.auth-brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.auth-brand-sub { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 1px; }
.auth-title { font-size: 31px; font-weight: 800; letter-spacing: -1.2px; line-height: 1.12; max-width: 330px; }
.auth-sub { font-size: 13.5px; color: rgba(255,255,255,.62); margin-top: 12px; max-width: 320px; line-height: 1.5; }
.auth-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.auth-chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.06); font-size: 11px; color: rgba(255,255,255,.72); }
.auth-panel {
  margin-top: auto;
  background: #fff;
  color: var(--ink);
  border-radius: 30px 30px 0 0;
  padding: 22px 22px calc(24px + var(--safe-bottom));
  box-shadow: 0 -18px 50px rgba(5, 6, 20, 0.24);
}
.auth-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 15px; background: var(--surface-2); margin-bottom: 18px; }
.auth-tabs button { flex: 1; min-height: 42px; border-radius: 12px; font-size: 14px; font-weight: 650; color: var(--muted); }
.auth-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(24,26,51,.08); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .btn { margin-top: 6px; }
.auth-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 16px; line-height: 1.5; }
.auth-foot a { font-weight: 650; }
.auth-note { display: flex; gap: 8px; padding: 11px 12px; border-radius: 13px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.auth-note .ic { color: var(--accent); margin-top: 1px; }

/* ---------- Desktop frame ---------- */
@media (min-width: 760px) {
  body {
    background:
      radial-gradient(60% 50% at 20% 0%, #2d2963 0%, transparent 60%),
      radial-gradient(50% 40% at 90% 100%, #243a63 0%, transparent 60%),
      #0c0e1a;
    padding: 22px 0;
  }
  .app { min-height: calc(100vh - 44px); border-radius: 30px; box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45); overflow: clip; }
  .screen { min-height: calc(100vh - 44px); }
  .tabbar { bottom: 22px; border-radius: 0 0 30px 30px; }
  #toast-root { bottom: 110px; }
  .sheet { border-radius: 28px 28px 0 0; bottom: 0; }
  .auth-screen { min-height: calc(100vh - 44px); }
}
@media (max-width: 380px) {
  .balance-value { font-size: 33px; }
  .quick { font-size: 10.5px; }
  .tab { font-size: 9px; }
  .tab-ic { padding: 5px 9px; }
}
