/* ============================================================
   Crypto Kassa — UI
   Mobile-first dark fintech interface
   ============================================================ */

:root {
  --bg: #05070d;
  --bg-soft: #070b14;
  --surface: rgba(13, 21, 38, 0.72);
  --surface-solid: #0b1424;
  --surface-2: rgba(18, 29, 50, 0.6);
  --input: rgba(3, 8, 18, 0.7);

  --text: #f1f5f9;
  --muted: #94a3b8;
  --dim: #64748b;

  --accent: #22d3ee;
  --accent-2: #6366f1;
  --accent-3: #38bdf8;
  --accent-soft: rgba(34, 211, 238, 0.12);

  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(34, 211, 238, 0.36);

  --good: #34d399;
  --good-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --bad: #fb7185;
  --bad-bg: rgba(251, 113, 133, 0.12);
  --info: #7dd3fc;
  --info-bg: rgba(56, 189, 248, 0.12);

  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 8px 26px rgba(0, 0, 0, 0.28);

  --nav-h: 74px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
}

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--nav-h) + 34px + var(--safe-bottom));
}

img {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.hidden {
  display: none !important;
}

.tiny {
  font-size: 11px;
}

.small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.mt {
  margin-top: 10px;
}

.mt-lg {
  margin-top: 18px;
}

.mb {
  margin-bottom: 10px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Background ---------- */

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 50% -12%, rgba(34, 211, 238, 0.1), transparent 62%),
    radial-gradient(700px 420px at 108% 15%, rgba(99, 102, 241, 0.1), transparent 60%),
    linear-gradient(180deg, #060910 0%, #04060b 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}

.bg-glow-a {
  width: 460px;
  height: 460px;
  top: -220px;
  left: -140px;
  background: rgba(34, 211, 238, 0.16);
}

.bg-glow-b {
  width: 480px;
  height: 480px;
  top: 220px;
  right: -220px;
  background: rgba(99, 102, 241, 0.14);
}

.bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 85% 62% at 50% 0%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 62% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------- Shell ---------- */

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-top)) 16px 6px;
}

/* ---------- Header ---------- */

.app-header {
  margin-bottom: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-avatar-ring {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  border: 1px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.18), inset 0 0 10px rgba(34, 211, 238, 0.12);
}

.brand-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-meta {
  min-width: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.brand-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  max-width: 62vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.neon-accent {
  background: linear-gradient(120deg, #22d3ee 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  backdrop-filter: blur(14px);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  transition: transform 0.4s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.rotating svg {
  animation: spin 0.6s linear infinite;
}

/* ---------- Page ---------- */

.page {
  animation: pageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 2px 14px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 2px 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title h2 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.section-badge {
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

/* ---------- Stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 27, 47, 0.78), rgba(8, 14, 26, 0.78));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.045), transparent 45%);
}

.stat-icon-wrap {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.stat-icon-wrap svg {
  width: 19px;
  height: 19px;
}

.stat-icon-wrap.green {
  color: var(--good);
  background: var(--good-bg);
}

.stat-icon-wrap.amber {
  color: var(--warn);
  background: var(--warn-bg);
}

.stat-icon-wrap.blue {
  color: var(--accent-3);
  background: var(--info-bg);
}

.stat-info {
  min-width: 0;
}

.stat-info .label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.stat-info .value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-info .sub {
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 1px;
}

.stat-info .link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  margin-top: 2px;
}

.volume-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.volume-chip {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--info);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 26, 45, 0.72), rgba(8, 14, 26, 0.72));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.card-head-with-icon {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.card-head-with-icon h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-icon-badge {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(34, 211, 238, 0.16);
}

.card-icon-badge svg {
  width: 19px;
  height: 19px;
}

.card-icon-badge.green {
  color: var(--good);
  background: var(--good-bg);
  border-color: rgba(52, 211, 153, 0.2);
}

.card-icon-badge.cyan {
  color: var(--accent);
  background: var(--accent-soft);
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.1);
  font-size: 13px;
}

.kv:last-child {
  border-bottom: none;
}

.kv > span {
  color: var(--muted);
  flex: none;
}

.kv > b {
  font-weight: 600;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spacer {
  flex: 1;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn svg,
.btn-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn:hover {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(30, 41, 59, 0.7);
}

.btn:active {
  transform: scale(0.97);
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 100%);
  color: #04121a;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38e0f5 0%, #4f8ffa 100%);
}

.btn-danger {
  border-color: rgba(251, 113, 133, 0.28);
  background: var(--bad-bg);
  color: #fecdd3;
}

.btn-outline {
  background: transparent;
  border-color: rgba(34, 211, 238, 0.3);
  color: var(--accent);
}

.btn-sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 10px;
  gap: 6px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.link-btn:hover {
  color: var(--text);
}

.shop-nav-bar {
  margin: 0 2px 8px;
}

/* ---------- Lists ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 26, 45, 0.62), rgba(8, 14, 26, 0.62));
  transition: border-color 0.2s ease, background 0.2s ease;
}

.list-item:hover {
  border-color: rgba(34, 211, 238, 0.22);
  background: rgba(20, 32, 54, 0.7);
}

.item-icon-box {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--info);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.item-icon-box svg {
  width: 18px;
  height: 18px;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-main .title {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-main .sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.item-right {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.amount {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}

.curr {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.net-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 5px;
  vertical-align: 1px;
}

.net-tag.ton {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
}

.net-tag.tron {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.12);
}

/* ---------- Pills & statuses ---------- */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.pill svg {
  width: 12px;
  height: 12px;
}

.pill.ok {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.22);
  background: var(--good-bg);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.status.pending,
.status.gas_sent {
  color: var(--warn);
  background: var(--warn-bg);
}

.status.paid,
.status.confirmed,
.status.success,
.status.active {
  color: var(--good);
  background: var(--good-bg);
}

.status.sent {
  color: var(--info);
  background: var(--info-bg);
}

.status.expired,
.status.exhausted {
  color: var(--dim);
  background: rgba(100, 116, 139, 0.14);
}

.status.cancelled,
.status.failed,
.status.mismatch {
  color: var(--bad);
  background: var(--bad-bg);
}

/* ---------- Shops ---------- */

.shop-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 26, 45, 0.7), rgba(8, 14, 26, 0.7));
  box-shadow: var(--shadow-soft);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.shop-card:hover {
  border-color: rgba(34, 211, 238, 0.24);
}

.shop-card:active {
  transform: scale(0.99);
}

.shop-card-left {
  flex: 1;
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-card-arrow {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--dim);
}

.shop-card-arrow svg {
  width: 100%;
  height: 100%;
}

.shop-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.shop-title-large {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.shop-id-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

/* ---------- Wallets ---------- */

.wallets-grid {
  display: grid;
  gap: 10px;
}

.wallet-box {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(3, 8, 18, 0.45);
}

.wallet-box.connected {
  border-color: rgba(52, 211, 153, 0.22);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.055), rgba(3, 8, 18, 0.4));
}

.network-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.network-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
}

.network-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(2, 6, 16, 0.55);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.tabs button svg {
  width: 14px;
  height: 14px;
}

.tabs button.active {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(99, 102, 241, 0.12));
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.16);
}

/* ---------- Empty ---------- */

.empty {
  padding: 26px 16px;
  text-align: center;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(2, 6, 16, 0.3);
}

.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 9px;
  color: var(--dim);
  opacity: 0.9;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- Notices ---------- */

.notice {
  padding: 11px 13px;
  margin: 10px 0;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.06);
  color: #bae6fd;
  font-size: 12.5px;
  line-height: 1.55;
}

.notice.small {
  font-size: 11.5px;
  padding: 9px 11px;
}

.notice.tip {
  border-color: rgba(34, 211, 238, 0.22);
  background: rgba(34, 211, 238, 0.07);
  color: #a5f3fc;
}

.notice.warn {
  border-color: rgba(251, 191, 36, 0.24);
  background: var(--warn-bg);
  color: #fde68a;
}

.notice.danger {
  border-color: rgba(251, 113, 133, 0.3);
  background: var(--bad-bg);
  color: #fecdd3;
}

/* ---------- Spinner ---------- */

.spinner {
  width: 28px;
  height: 28px;
  margin: 18px auto;
  border-radius: 50%;
  border: 2.5px solid rgba(148, 163, 184, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner-box {
  display: grid;
  place-items: center;
  padding: 48px 16px;
  text-align: center;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 40;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 22px;
  background: rgba(8, 13, 24, 0.88);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px 6px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--dim);
  user-select: none;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.nav-btn:active {
  transform: scale(0.95);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-label {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1px;
}

.nav-btn.active {
  color: #e0f2fe;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(99, 102, 241, 0.1));
}

.nav-btn.active .nav-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 7px rgba(34, 211, 238, 0.5));
}

/* ---------- Gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  overflow-y: auto;
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(34, 211, 238, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(4, 7, 13, 0.96), rgba(4, 7, 13, 0.99));
  backdrop-filter: blur(10px);
}

.gate-card {
  width: 100%;
  max-width: 400px;
  padding: 26px 22px;
  text-align: center;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.92), rgba(7, 12, 23, 0.96));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(34, 211, 238, 0.05) inset;
  animation: pageIn 0.35s ease;
}

.gate-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  padding: 3px;
  border-radius: 20px;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  box-shadow: 0 12px 34px rgba(34, 211, 238, 0.25);
}

.gate-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px;
  display: block;
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  margin-bottom: 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.gate-badge svg {
  width: 12px;
  height: 12px;
}

.gate-card h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 8px;
}

.gate-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 18px;
}

.gate-btn {
  min-height: 48px;
  font-size: 14px;
}

.gate-btn svg {
  width: 18px;
  height: 18px;
}

.gate-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
  text-align: left;
}

.gate-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.45);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.gate-step b {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.14);
  color: var(--accent);
  font-size: 10.5px;
}

.gate-note {
  margin-top: 16px;
  font-size: 11px;
  color: var(--dim);
}

body.gated {
  overflow: hidden;
}

body.gated .app-shell,
body.gated .bottom-nav,
body.gated #modalRoot,
body.gated .toast-root {
  display: none !important;
}

/* ---------- Docs ---------- */

.doc-nav {
  display: flex;
  gap: 7px;
  margin: 0 0 12px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.doc-nav::-webkit-scrollbar {
  display: none;
}

.doc-nav a {
  flex: none;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(2, 6, 16, 0.45);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.doc-nav a:hover {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.3);
}

.api-hero {
  border-color: rgba(34, 211, 238, 0.18);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(34, 211, 238, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(16, 26, 45, 0.78), rgba(8, 14, 26, 0.78));
  scroll-margin-top: 14px;
}

.api-hero-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.api-hero-title {
  font-size: 15px;
  font-weight: 750;
}

.api-base-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.7);
}

.api-base {
  flex: 1;
  min-width: 170px;
  font-size: 12.5px;
  color: #67e8f9;
  word-break: break-all;
}

.api-hero-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.doc-h3 {
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: -0.2px;
  margin-bottom: 8px;
}

.doc-h4 {
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.doc-p {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.doc-list {
  display: grid;
  gap: 8px;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.doc-list li {
  position: relative;
  padding-left: 16px;
}

.doc-list li::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(34, 211, 238, 0.6);
}

.doc-foot {
  margin-top: 14px;
  font-size: 12px;
  color: var(--dim);
}

code {
  font-size: 0.93em;
  color: #a5f3fc;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 5px;
  padding: 1px 5px;
}

.code-block {
  margin: 10px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #040911;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.55);
  font-size: 11px;
  color: var(--muted);
}

.code-lang,
.code-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-copy {
  margin-left: auto;
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.code-copy:hover {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.3);
}

.code-block pre {
  padding: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-block pre code {
  display: block;
  padding: 0;
  background: none;
  color: #cbd5e1;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre;
}

.http-badge {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.4px;
}

.http-badge.post {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
}

.http-badge.get {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.14);
}

.endpoint-list {
  display: grid;
  gap: 7px;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.4);
}

.endpoint-main {
  min-width: 0;
}

.endpoint-main code {
  display: block;
  padding: 0;
  background: none;
  color: #e2e8f0;
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.endpoint-main span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--dim);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #0b1424, #070c18);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.65);
  animation: sheetIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal h3 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.modal-sub {
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions .btn {
  flex: 1;
}

/* ---------- Forms ---------- */

.form .field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(100, 116, 139, 0.7);
}

.field textarea {
  min-height: 82px;
  resize: vertical;
}

.field .seed-input {
  min-height: 106px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--dim);
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.5);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.check-chip svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.check-chip input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.secret-box {
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 6, 16, 0.55);
}

.secret-box .label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.secret-box .value {
  margin: 6px 0 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
  color: #e2e8f0;
}

/* ---------- QR ---------- */

.qr-wrapper {
  width: 220px;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
}

.qr-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px;
}

/* ---------- Toast ---------- */

.toast-root {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 28px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 13px;
  background: rgba(9, 16, 30, 0.94);
  color: #e2e8f0;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  animation: toastIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.3);
  color: #bbf7d0;
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.35);
  color: #fecdd3;
}

/* ---------- Payments page ---------- */

.pay-body {
  padding-bottom: 0;
}

.pay-shell {
  max-width: 600px;
  padding-bottom: 28px;
}

.pay-topbar {
  padding-bottom: 8px;
}

.secure-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 6px 9px;
  border: 1px solid rgba(52, 211, 153, 0.24);
  border-radius: var(--radius-pill);
  background: rgba(52, 211, 153, 0.08);
  color: #6ee7b7;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.secure-chip svg {
  width: 13px;
  height: 13px;
}

.pay-hero {
  position: relative;
  padding: 20px;
  margin: 8px 0 14px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(8, 14, 26, 0.92));
  box-shadow: var(--shadow);
}

.pay-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pay-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.pay-amount {
  margin-top: 4px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.currency-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  vertical-align: 6px;
}

.pay-timer {
  margin-top: 16px;
}

.pay-timer-track {
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.15);
}

.pay-timer-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #22d3ee, #6366f1);
  transition: width 1s linear;
}

.pay-timer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.pay-timer-label b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pay-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.07);
  color: #bae6fd;
  font-size: 12.5px;
  line-height: 1.55;
}

.pay-note-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.pay-note-icon svg {
  width: 100%;
  height: 100%;
}

.pay-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.pay-shell .card {
  margin-bottom: 12px;
}

.pay-qr-card {
  text-align: center;
}

.pay-qr-card .qr-wrapper {
  width: 210px;
  margin: 12px auto;
}

.addr-box {
  margin: 10px 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.65);
  font-size: 11.5px;
  line-height: 1.6;
  word-break: break-all;
  color: #e2e8f0;
}

.pay-result {
  padding: 24px 18px;
  text-align: center;
}

.pay-result-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.pay-result-icon svg {
  width: 26px;
  height: 26px;
}

.pay-result h3 {
  font-size: 16px;
  font-weight: 750;
  margin-bottom: 6px;
}

.pay-result p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.ok-result {
  border-color: rgba(52, 211, 153, 0.25);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.08), rgba(8, 14, 26, 0.8));
}

.ok-result .pay-result-icon {
  color: var(--good);
  background: var(--good-bg);
}

.warn-result {
  border-color: rgba(251, 191, 36, 0.25);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.07), rgba(8, 14, 26, 0.8));
}

.warn-result .pay-result-icon {
  color: var(--warn);
  background: var(--warn-bg);
}

.exp-result {
  border-color: rgba(148, 163, 184, 0.2);
}

.exp-result .pay-result-icon {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
}

.err-result {
  border-color: rgba(251, 113, 133, 0.25);
  background: linear-gradient(180deg, rgba(251, 113, 133, 0.07), rgba(8, 14, 26, 0.8));
}

.err-result .pay-result-icon {
  color: var(--bad);
  background: var(--bad-bg);
}

.pay-footnote {
  margin-top: 16px;
  padding: 0 8px;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--dim);
}

/* ---------- Responsive ---------- */

@media (min-width: 700px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }

  .wallets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pay-grid {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: stretch;
  }

  .modal-overlay {
    align-items: center;
    padding: 24px;
  }

  .modal {
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 24px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page-title {
    font-size: 20px;
  }

  .nav-label {
    font-size: 9px;
  }

  .pay-amount {
    font-size: 29px;
  }

  .stat-card {
    padding: 11px;
  }

  .stat-info .value {
    font-size: 19px;
  }
}

/* ---------- Animations ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
