:root {
  color-scheme: light;
  --page-bg: #f3f5f8;
  --surface: #ffffff;
  --primary: #3478f6;
  --primary-pressed: #2465d8;
  --usdt: #4fa77c;
  --usdt-soft: #e6f4ed;
  --text: #171a1f;
  --muted: #77808d;
  --field: #f0f2f5;
  --border: #e2e6eb;
  --error: #cf3f45;
  --warning: #a56b00;
  --success: #27845c;
  --shadow: 0 2px 10px rgba(20, 31, 46, 0.06);
  --accent: var(--primary);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page-bg: #11151b;
    --surface: #1b2129;
    --text: #f4f7fb;
    --muted: #aab3bf;
    --field: #252c35;
    --border: #343d48;
    --usdt-soft: #203b31;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

/* Page views are switched with the native hidden attribute. Keep it stronger
   than later display declarations from the shared Mini App layouts. */
[hidden] { display: none !important; }

html, body {
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; letter-spacing: 0; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 48px;
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
}

.topbar-spacer { width: 44px; height: 44px; }

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover { background: var(--field); }
.icon-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(52, 120, 246, 0.28); outline-offset: 2px; }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.deposit-surface {
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.deposit-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.deposit-heading h2 { margin: 0 0 2px; font-size: 20px; line-height: 1.25; }
.deposit-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.usdt-mark { flex: 0 0 40px; width: 40px; height: 40px; }
.usdt-mark svg { display: block; width: 40px; height: 40px; }
.usdt-mark circle { fill: var(--usdt); }
.usdt-mark path { fill: #ffffff; }

.balance-row {
  display: flex;
  min-height: 46px;
  margin-bottom: 16px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 13px;
}

.balance-row strong { color: var(--text); font-size: 14px; }
.currency { color: var(--usdt); }

.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }

.amount-field {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-field input {
  width: 100%;
  height: 50px;
  padding: 0 126px 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font-size: 22px;
  font-weight: 650;
  appearance: none;
}

.amount-field input::placeholder { color: var(--muted); opacity: 0.72; }
.amount-field input:focus,
.amount-field input:not(:placeholder-shown) { color: var(--primary); }
.field-currency { position: absolute; right: 14px; color: var(--usdt); font-size: 13px; font-weight: 700; }
.amount-all {
  position: absolute;
  top: 50%;
  right: 58px;
  min-width: 42px;
  height: 30px;
  padding: 0 7px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.amount-all:active { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.amount-all:disabled { color: var(--muted); cursor: default; }

.field-meta {
  display: flex;
  min-height: 36px;
  padding: 7px 1px 0;
  flex-direction: column;
  color: var(--muted);
  font-size: 11px;
}

.field-error { color: var(--error); font-size: 12px; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 11px;
}

.preset-grid button {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font-weight: 650;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

/* The painted shell is smaller than the tap target without shrinking it. */
.preset-grid button::before {
  position: absolute;
  z-index: -1;
  inset: 3px 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #e2ebfa;
  content: "";
  pointer-events: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}

@media (prefers-color-scheme: dark) { .preset-grid button::before { background: #25354d; } }
.preset-grid button.is-selected { color: #ffffff; }
.preset-grid button.is-selected::before { border-color: var(--primary); background: var(--primary); }

.primary-button, .secondary-button {
  display: inline-flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button { border: 1px solid var(--primary); background: var(--primary); color: #ffffff; }
.primary-button:hover { background: var(--primary-pressed); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.62; }
.secondary-button { border: 1px solid var(--border); background: var(--field); color: var(--text); }

.button-spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; }
.primary-button.is-loading .button-spinner { display: block; animation: spin .7s linear infinite; }

.order-view { display: grid; gap: 16px; }
.order-view[hidden], #depositForm[hidden] { display: none; }
#paymentDetails { display: grid; min-width: 0; gap: 16px; }

.status-band {
  display: flex;
  min-height: 44px;
  padding: 10px 12px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
}

.status-band svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status-pending { border-color: rgba(165,107,0,.22); background: rgba(165,107,0,.10); color: var(--warning); }
.status-chain-pending { border-color: rgba(39,132,92,.34); background: rgba(39,132,92,.10); color: var(--success); }
.status-confirmed { border-color: rgba(39,132,92,.22); background: rgba(39,132,92,.10); color: var(--success); }
.status-expired, .status-failed { border-color: rgba(207,63,69,.22); background: rgba(207,63,69,.10); color: var(--error); }
.status-cancelled { border-color: rgba(119,128,141,.28); background: var(--field); color: var(--muted); }

.success-state {
  display: grid;
  padding: 18px 8px 10px;
  justify-items: center;
  gap: 6px;
  text-align: center;
  animation: success-enter 220ms ease-out both;
}

.success-state[hidden], #paymentDetails[hidden] { display: none; }
.success-seal {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: var(--usdt-soft);
  color: var(--success);
}
.success-seal svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.success-state h3 { margin: 5px 0 0; color: var(--text); font-size: 21px; line-height: 1.25; }
.success-state p { margin: 0; color: var(--muted); font-size: 14px; }
.success-state p strong { color: var(--success); font-size: 18px; }
.success-state > span { color: var(--text); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.success-state small { color: var(--muted); font-size: 12px; }

@keyframes success-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.qr-wrap {
  width: 196px;
  height: 196px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
}

.qr-wrap img { display: block; width: 180px; height: 180px; object-fit: contain; }

.order-amount { display: grid; justify-items: center; gap: 2px; }
.order-amount > span { color: var(--muted); font-size: 13px; }
.order-amount strong { font-size: 24px; line-height: 1.2; }
.order-amount small { color: var(--usdt); font-size: 13px; }

.address-field { padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); }
.address-field .field-label { margin-bottom: 5px; }
.address-value { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.address-value code { overflow-wrap: anywhere; word-break: break-all; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; font-weight: 700; line-height: 1.5; }
.copy-button { color: var(--primary); }

.address-input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
  font-weight: 650;
}

.address-input::placeholder { color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 400; }
.input-error { display: block; min-height: 24px; padding: 5px 1px 0; }
.amount-label { margin-top: 4px; }

.withdraw-summary {
  display: grid;
  gap: 0;
  margin: 4px 0 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
}

.withdraw-summary[hidden] { display: none; }

.withdraw-summary > div {
  display: flex;
  min-height: 42px;
  padding: 9px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.withdraw-summary > div:first-child { border-top: 0; }
.withdraw-summary strong { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.withdraw-summary .summary-total { color: var(--text); font-weight: 700; }
.withdraw-summary .summary-total strong { color: var(--primary); font-size: 15px; }
.withdraw-summary .summary-address { display: grid; align-items: start; }
.summary-address code { overflow-wrap: anywhere; word-break: break-all; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 650; line-height: 1.45; text-align: right; }

.withdraw-confirmation { display: grid; gap: 16px; }
.withdraw-confirmation[hidden], .withdrawal-view[hidden], #withdrawForm[hidden] { display: none; }
.confirmation-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.confirmation-summary { margin: 0; }
.withdrawal-view { gap: 16px; }
.withdrawal-details { margin: 0; }
.withdrawal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.withdrawal-actions .secondary-button { min-width: 0; }
.withdrawal-actions .secondary-button:only-child { grid-column: 1 / -1; }
.status-unknown { border-color: rgba(165,107,0,.22); background: rgba(165,107,0,.10); color: var(--warning); }
.status-refunded { border-color: rgba(207,63,69,.22); background: rgba(207,63,69,.10); color: var(--error); }

.countdown-block { display: grid; gap: 6px; }
.countdown-row { display: flex; min-height: 20px; align-items: center; justify-content: space-between; color: var(--success); font-size: 13px; }
.countdown-row strong { color: var(--success); font-variant-numeric: tabular-nums; }
.progress-track { overflow: hidden; height: 4px; margin: 0; border-radius: 2px; background: var(--field); }
.progress-track span { display: block; width: 100%; height: 100%; background: var(--success); transition: width 1s linear; }
.order-note { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.order-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.order-actions .secondary-button { min-width: 0; }
.danger-button { border-color: rgba(207,63,69,.28); color: var(--error); }
.danger-button:disabled { cursor: not-allowed; opacity: .58; }

.page-status { min-height: 22px; margin: 12px 4px 0; color: var(--muted); font-size: 12px; text-align: center; }
.page-status.is-error { color: var(--error); }
.page-status.is-emphasis { font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 5;
  max-width: calc(100vw - 32px);
  padding: 9px 14px;
  transform: translate(-50%, 12px);
  border-radius: 6px;
  background: #171a1f;
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* C2C hands users to this USD-only page from a separate Mini App route.
   Keep the first paint visible while the new document and Telegram bridge settle. */
.c2c-deposit-loading {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: var(--page-bg);
  color: var(--muted);
  font-size: 13px;
  opacity: 1;
  transition: opacity 180ms ease;
}

.c2c-deposit-loading.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.c2c-deposit-loading span {
  width: 25px;
  height: 25px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.c2c-deposit-loading p { margin: 0; }

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

@media (max-width: 350px) {
  .app-shell { padding-inline: 8px; }
  .deposit-surface { padding: 12px; }
  .preset-grid { gap: 6px; }
  .field-meta { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.success-state { animation: none; }
  .c2c-deposit-loading { transition-duration: 1ms; }
  .c2c-deposit-loading span { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Shared multi-asset mini app surfaces. */
.asset-app main { display: grid; gap: 14px; }
.swap-surface { display: flex; min-height: 0; padding: 8px 12px 12px; flex-direction: column; border: 0; background: transparent; box-shadow: none; }
#swapFormView[hidden], #quoteView[hidden] { display: none; }
.swap-market { display: flex; min-height: 28px; margin: 0 0 15px; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.swap-market strong { min-width: 0; color: var(--text); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.swap-leg { padding: 0 0 16px; }
.swap-leg-heading { display: flex; min-height: 26px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 14px; }
.swap-max { min-width: 44px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.swap-max:disabled { cursor: not-allowed; opacity: .48; }
.swap-leg-content { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; }
.swap-asset-control { position: relative; display: inline-flex; min-width: 0; min-height: 44px; align-items: center; gap: 8px; color: var(--text); }
.swap-token-icon, .swap-token-fallback { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; }
.swap-token-icon { object-fit: contain; }
.swap-token-fallback { display: grid; place-items: center; background: var(--field); color: var(--primary); font-size: 11px; font-weight: 750; }
.swap-token-fallback[hidden], .asset-hero-fallback[hidden] { display: none; }
.swap-asset-control strong { font-size: 22px; font-weight: 750; }
.swap-chevron { color: var(--muted); font-size: 20px; line-height: 1; transform: translateY(-2px); }
.swap-asset-control select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.swap-amount-wrap { display: grid; min-width: 0; justify-items: end; }
.swap-amount-wrap input { width: min(148px, 43vw); height: 50px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 28px; font-weight: 750; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.swap-amount-wrap input::placeholder { color: var(--muted); opacity: .34; }
.swap-amount-wrap input:focus, .swap-amount-wrap input:not(:placeholder-shown) { color: var(--primary); }
.swap-unit { margin-top: -8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.swap-balance { min-height: 18px; margin: -7px 0 0; color: var(--muted); font-size: 12px; }
.swap-divider { display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); align-items: center; margin: -8px 0 8px; }
.swap-divider > span { height: 1px; background: var(--border); }
.swap-flip { display: grid; width: 44px; height: 44px; margin: 0 auto; place-items: center; border: 1px solid var(--primary); border-radius: 8px; background: var(--primary); color: #ffffff; font: inherit; font-size: 25px; line-height: 1; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease; }
.swap-flip:hover { border-color: var(--primary-pressed); background: var(--primary-pressed); color: #ffffff; }
@media (prefers-color-scheme: light) {
  .swap-flip { width: 44px; height: 44px; border: 0; border-radius: 0; background: transparent; color: #171a1f; }
  .swap-flip:hover { border-color: transparent; background: transparent; color: #171a1f; opacity: .72; }
}
.swap-output-wrap { display: grid; min-width: 0; justify-items: end; gap: 3px; }
.swap-output-wrap > span { color: var(--muted); font-size: 12px; }
.swap-output { min-width: 0; color: var(--muted); font-size: 28px; font-weight: 750; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; opacity: .68; }
.swap-preview-button { min-height: 50px; margin-top: 12px; }
.swap-complete-page {
  display: grid;
  min-height: calc(100dvh - 28px);
  place-items: center;
  padding: 24px;
  text-align: center;
}
.swap-complete-page[hidden] { display: none; }
.swap-complete-content { width: min(100%, 300px); }
.swap-complete-mark {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  place-items: center;
  border: 2px solid var(--success);
  border-radius: 50%;
}
.swap-complete-mark span {
  width: 24px;
  height: 14px;
  border-bottom: 3px solid var(--success);
  border-left: 3px solid var(--success);
  transform: rotate(-45deg) translate(1px, -2px);
}
.swap-complete-eyebrow, .swap-complete-label, .swap-complete-countdown {
  margin: 0;
  color: var(--muted);
}
.swap-complete-eyebrow { font-size: 13px; font-weight: 700; }
.swap-complete-content h1 { margin: 6px 0 30px; color: var(--text); font-size: 26px; line-height: 1.25; }
.swap-complete-label { font-size: 13px; }
.swap-complete-output {
  display: block;
  margin-top: 5px;
  color: var(--success);
  font-size: 30px;
  font-weight: 750;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.swap-complete-countdown { margin-top: 30px; font-size: 13px; }
body.swap-is-complete .asset-app { width: 100%; min-height: 100dvh; padding: 0; }
body.swap-is-complete .asset-app main { display: block; min-height: 100dvh; }
body.swap-is-complete .swap-complete-page {
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}
body.swap-is-complete .page-status { display: none; }
@media (max-width: 350px) { .swap-surface { padding-inline: 8px; } .swap-market strong { font-size: 14px; } .swap-asset-control { gap: 6px; } .swap-token-icon, .swap-token-fallback { flex-basis: 38px; width: 38px; height: 38px; } .swap-asset-control strong { font-size: 21px; } .swap-amount-wrap input, .swap-output { font-size: 27px; } }
.asset-hero { display: flex; min-height: 48px; margin: 1px 0 16px; align-items: center; gap: 10px; }
.asset-hero-icon, .asset-hero-fallback { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; }
.asset-hero-icon { object-fit: contain; }
.asset-hero-fallback { display: grid; place-items: center; background: var(--field); color: var(--primary); font-size: 13px; font-weight: 750; }
.asset-hero-copy { min-width: 0; }
.asset-hero-copy h1 { margin: 0; color: var(--text); font-size: 20px; font-weight: 700; line-height: 1.2; }
.asset-hero-copy p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.section-title, .order-asset-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title { margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 14px; }
.section-title span { color: var(--muted); font-size: 11px; }
.section-meta { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 7px; }
.network-badge { padding: 3px 5px; border-radius: 4px; background: var(--field); font-variant-numeric: tabular-nums; }
.asset-available { color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.asset-segment { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.asset-choice, .asset-select { min-height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--field); color: var(--text); font: inherit; font-size: 12px; }
.asset-choice { position: relative; isolation: isolate; display: inline-flex; padding: 6px 4px; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; font-weight: 750; }
.asset-choice::before { position: absolute; z-index: -1; inset: 3px 0; border: 1px solid var(--border); border-radius: 7px; background: var(--field); content: ""; pointer-events: none; }
.asset-choice > * { position: relative; z-index: 1; }
.asset-icon { flex: 0 0 17px; width: 17px; height: 17px; border-radius: 50%; object-fit: contain; }
.asset-choice.is-active { color: var(--accent); font-weight: 750; }
.asset-choice.is-active::before { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--field)); }
.asset-select { width: 100%; padding: 0 12px; margin-bottom: 12px; }
.text-field { box-sizing: border-box; display: block; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--field); color: var(--text); font: inherit; outline: none; }
.text-field:focus { border-color: var(--accent); }
.text-field.is-error { border-color: var(--error); box-shadow: 0 0 0 2px color-mix(in srgb, var(--error) 18%, transparent); }
.amount-field.is-error { border-color: var(--error); box-shadow: 0 0 0 2px color-mix(in srgb, var(--error) 18%, transparent); }
.amount-field.is-error input { color: var(--error); }
.asset-app #formView .amount-field input, .asset-app #formView .primary-button { border-radius: 8px; }
.sandbox-label { margin: -4px 0 12px; padding: 9px 10px; border: 1px solid #c88b20; border-radius: 6px; color: #9a6200; font-size: 12px; line-height: 1.45; }
@media (prefers-color-scheme: dark) { .sandbox-label { color: #e7b85d; border-color: #8b641f; } }
.order-asset-line { margin: 16px 0 8px; }
.order-asset-line strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.order-asset-line span { padding: 4px 7px; border-radius: 4px; background: var(--field); color: var(--muted); font-size: 11px; }
.order-address { overflow-wrap: anywhere; margin: 0 0 12px; color: var(--text); font-weight: 700; text-align: center; }
.qr-image { display: block; width: min(200px, 62vw); height: auto; margin: 10px auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.copy-row code { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--field); color: var(--text); font-size: 20px; }
.order-timing { display: flex; justify-content: space-between; margin: 18px 0 7px; color: var(--success); font-size: 12px; }
.order-timing strong { font-variant-numeric: tabular-nums; }
.quote-result { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 15px 0; }
.quote-result span { color: var(--muted); font-size: 13px; }
.quote-result strong { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 330px) { .asset-choice { font-size: 12px; } .section-meta { gap: 5px; } .network-badge { display: none; } }

/* Deposit order details: optimized for Telegram Mini App mobile viewports. */
.payment-order {
  gap: 10px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.payment-asset-head {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
}

.payment-asset-icon {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: contain;
}

.payment-asset-head > div { min-width: 0; }
.payment-asset-head h1 { margin: 0; color: var(--text); font-size: 23px; font-weight: 750; line-height: 1.2; }
.payment-asset-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

.payment-balance {
  display: flex;
  min-height: 50px;
  padding: 7px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 14px;
}

.payment-balance strong { min-width: 0; color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payment-balance strong b { font: inherit; }
.payment-balance strong em { color: var(--usdt); font-size: 14px; font-style: normal; font-weight: 750; }

.payment-order .status-band { min-height: 48px; font-size: 14px; }
.status-clock { position: relative; flex: 0 0 21px; width: 21px; height: 21px; border: 2px solid currentColor; border-radius: 50%; }
.status-clock::before, .status-clock::after { position: absolute; left: 50%; top: 50%; width: 2px; border-radius: 2px; background: currentColor; content: ""; transform-origin: 50% 100%; }
.status-clock::before { height: 7px; transform: translate(-50%, -100%); }
.status-clock::after { height: 6px; transform: translate(-50%, -100%) rotate(122deg); }
.status-confirmed .status-clock::before { top: 46%; height: 8px; transform: translate(-50%, -50%) rotate(-45deg); }
.status-confirmed .status-clock::after { top: 43%; left: 63%; height: 12px; transform: translate(-50%, -50%) rotate(45deg); }

.payment-qr-wrap {
  display: grid;
  width: min(204px, 57vw);
  aspect-ratio: 1;
  margin: 4px auto 0;
  padding: 8px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
}

.payment-qr-wrap .qr-image { display: block; width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; object-fit: contain; }

.payment-amount { display: grid; justify-items: center; gap: 3px; margin-top: -2px; }
.payment-amount span { color: var(--muted); font-size: 14px; }
.payment-amount strong { color: var(--text); font-size: 31px; font-weight: 750; line-height: 1.18; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.payment-address {
  display: grid;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
}

.payment-address > span { color: var(--muted); font-size: 13px; }
.payment-address > span b { color: inherit; font-weight: 650; }
.payment-address > div { display: grid; grid-template-columns: minmax(0, 1fr) 44px; min-height: 44px; align-items: center; gap: 8px; }
.payment-address code { overflow-wrap: anywhere; word-break: break-all; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; font-weight: 750; line-height: 1.45; }

.copy-address-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.copy-address-button:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.copy-address-button i, .copy-address-button i::after { display: block; width: 15px; height: 17px; border: 2px solid currentColor; border-radius: 3px; content: ""; }
.copy-address-button i { position: relative; transform: translate(-2px, 2px); }
.copy-address-button i::after { position: absolute; left: 4px; top: -6px; background: var(--field); }

.payment-timing { display: grid; gap: 6px; margin-top: 0; }
.payment-timing > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--success); font-size: 14px; }
.payment-timing strong { color: var(--success); font-size: 16px; font-variant-numeric: tabular-nums; }
.payment-order .progress-track { height: 5px; border-radius: 3px; }
.payment-order .order-note { min-height: 36px; margin: -1px 0 0; font-size: 13px; line-height: 1.55; text-align: left; }
.payment-order .order-actions { gap: 10px; margin-top: 2px; }
.payment-order .order-actions .secondary-button:only-child { grid-column: 1 / -1; }
.payment-order .secondary-button { min-height: 52px; font-size: 16px; }

@media (max-width: 360px) {
  .payment-order { gap: 10px; padding: 13px 12px 14px; }
  .payment-asset-head h1 { font-size: 21px; }
  .payment-asset-icon { flex-basis: 46px; width: 46px; height: 46px; }
  .payment-balance { min-height: 48px; }
  .payment-order .status-band { min-height: 46px; }
  .payment-qr-wrap { width: min(188px, 56vw); }
  .payment-amount strong { font-size: 28px; }
  .payment-address { padding: 10px 12px; }
  .payment-address code { font-size: 13px; }
  .payment-order .secondary-button { min-height: 48px; font-size: 15px; }
}

/* Shared Mini App shell. */
.miniapp-ready .app-shell { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.mini-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  width: min(100%, 480px);
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  transform: translateX(-50%);
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -1px 0 rgba(20, 31, 46, .04);
}
.mini-nav-item {
  display: grid;
  min-width: 0;
  min-height: 48px;
  padding: 0 2px;
  align-content: center;
  justify-items: center;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.mini-nav-icon {
  display: block;
  width: 21px;
  height: 21px;
  overflow: visible;
}
.mini-nav-label { line-height: 15px; }
.mini-nav-item.is-active { color: var(--primary); font-weight: 700; }
.mini-nav-item.is-active .mini-nav-icon { stroke-width: 2.1; }
.mini-nav-item:active { background: var(--field); transform: translateY(1px); }
.mini-nav.is-busy .mini-nav-item { pointer-events: none; }
.mini-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 10px;
  background: var(--page-bg);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  opacity: 1;
  transition: opacity 180ms ease;
}
.mini-loading.is-hidden { opacity: 0; pointer-events: none; }
.mini-loading-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .72s linear infinite;
}
.mini-toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 9px 13px;
  transform: translate(-50%, 10px);
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.mini-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
body.swap-is-complete .mini-nav { display: none; }
.miniapp-ready .swap-surface { min-height: 0; }

/* Personal center. */
.profile-app main, .merchant-app main { display: grid; gap: 12px; }
.profile-header {
  display: grid;
  min-height: 80px;
  padding: 13px;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-avatar, .merchant-logo {
  display: grid;
  width: 54px;
  height: 54px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: color-mix(in srgb, var(--primary) 12%, var(--field));
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
}
.profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-avatar span { display: grid; width: 100%; height: 100%; place-items: center; }
.profile-identity { min-width: 0; }
.profile-identity h1, .compact-page-head h1 { margin: 0; color: var(--text); font-size: 18px; font-weight: 650; line-height: 1.3; }
.profile-identity p, .compact-page-head p { overflow: hidden; margin: 2px 0 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-id { padding: 5px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--field); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.profile-section, .merchant-card, .merchant-subsection, .merchant-admin, .compact-form, .credential-controls {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-section { overflow: hidden; }
.profile-section-head {
  display: flex;
  min-height: 44px;
  padding: 0 13px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profile-section-head h2, .merchant-subsection h2, .credential-controls h2 { margin: 0; color: var(--text); font-size: 14px; font-weight: 650; }
.text-action, .back-text, .danger-text-button {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.asset-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.asset-balance { display: grid; min-height: 82px; padding: 11px 12px; grid-template-columns: 21px minmax(0, 1fr); grid-template-rows: 20px 24px; align-items: center; column-gap: 7px; border-bottom: 1px solid var(--border); }
.asset-balance:nth-child(odd) { border-right: 1px solid var(--border); }
.asset-balance img, .asset-fallback { width: 20px; height: 20px; border-radius: 50%; object-fit: contain; }
.asset-fallback { display: grid; place-items: center; background: var(--field); color: var(--primary); font-size: 12px; font-weight: 700; }
.asset-fallback-cny { background: #e7f0ff; color: #2d70c9; }
.asset-fallback-lxb { background: #e9f5ef; color: #2d8962; }
.asset-balance:last-child { min-height: 54px; grid-template-columns: 21px minmax(0, 1fr) minmax(0, auto); grid-template-rows: 1fr; }
.asset-balance:last-child strong { grid-column: auto; grid-row: 1; text-align: right; }
@media (prefers-color-scheme: dark) {
  .asset-fallback-cny { background: #1f3658; color: #8cbcff; }
  .asset-fallback-lxb { background: #1d3a2d; color: #80cda7; }
}
.asset-balance > span { min-width: 0; color: var(--muted); font-size: 12px; }
.asset-balance strong { grid-column: 1 / -1; overflow: hidden; color: var(--text); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.merchant-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.merchant-summary-grid div { display: grid; min-height: 68px; place-content: center; gap: 3px; text-align: center; }
.merchant-summary-grid div + div { border-left: 1px solid var(--border); }
.merchant-summary-grid strong { color: var(--text); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.merchant-summary-grid span { color: var(--muted); font-size: 11px; }
.ledger-list { border-top: 1px solid var(--border); }
.ledger-row, .compact-row { display: flex; min-height: 55px; padding: 8px 13px; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); }
.ledger-row:first-child { border-top: 0; }
.ledger-row > div, .compact-row > span { display: grid; min-width: 0; gap: 2px; }
.ledger-row strong, .compact-row strong { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row span, .compact-row small { color: var(--muted); font-size: 11px; }
.ledger-row b, .compact-row b { flex: 0 0 auto; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-row b.is-in { color: var(--success); }
.ledger-row b.is-out { color: var(--text); }
.compact-empty { min-height: 54px; margin: 0; padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.profile-error { display: grid; gap: 10px; margin: 4px 0; }
.profile-error p { margin: 0; color: var(--error); font-size: 13px; text-align: center; }

/* Merchant workspace. */
.compact-page-head { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 10px; }
.compact-page-head > div { min-width: 0; }
.primary-small { min-width: 58px; min-height: 40px; padding: 0 12px; border: 1px solid var(--primary); border-radius: 6px; background: var(--primary); color: #fff; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.merchant-list { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.merchant-row { display: grid; width: 100%; min-height: 74px; padding: 10px 12px; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.merchant-row:first-child { border-top: 0; }
.merchant-row > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.merchant-row strong { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.merchant-row small { color: var(--muted); font-size: 11px; }
.merchant-state { padding: 4px 6px; border-radius: 4px; background: var(--field); color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.merchant-state.is-active { color: var(--success); }
.merchant-state.is-closed { color: var(--muted); }
.merchant-entry-arrow { color: var(--muted); font-size: 22px; font-weight: 400; line-height: 1; }
.merchant-pending-entry { display: grid; width: 100%; min-height: 62px; margin-bottom: 10px; padding: 9px 12px; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-align: left; cursor: pointer; }
.merchant-pending-entry > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.merchant-pending-entry strong { font-size: 14px; font-weight: 650; }
.merchant-pending-entry small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.merchant-entry-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 7px; background: var(--field); color: var(--primary); font-size: 19px; }
.merchant-admin { overflow: hidden; }
.admin-block { border-top: 1px solid var(--border); }
.admin-block h3 { margin: 0; padding: 10px 13px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.admin-row { display: flex; min-height: 54px; padding: 8px 13px; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); }
.admin-row > span:first-child { display: grid; min-width: 0; gap: 2px; }
.admin-row strong { color: var(--text); font-size: 13px; font-weight: 600; }
.admin-row small { color: var(--muted); font-size: 11px; }
.admin-row button { min-width: 42px; min-height: 32px; margin-left: 4px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--field); color: var(--text); font: inherit; font-size: 11px; cursor: pointer; }
.merchant-detail-view, .merchant-form-view, .merchant-work-view { display: grid; gap: 12px; }
.merchant-card { padding: 13px; }
.merchant-card-top { display: flex; align-items: center; gap: 10px; }
.merchant-card-top > div { display: grid; gap: 3px; }
.merchant-card-top strong { color: var(--text); font-size: 14px; font-weight: 650; }
.merchant-card-top p { margin: 0; color: var(--muted); font-size: 11px; }
.merchant-detail-meta { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 7px 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border); }
.merchant-detail-meta span { color: var(--muted); font-size: 12px; }
.merchant-detail-meta code { overflow: hidden; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.merchant-meta-value { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; }
.merchant-meta-value code { min-width: 0; }
.copy-icon-button { min-width: 38px; min-height: 30px; padding: 0 5px; border: 0; border-radius: 5px; background: var(--field); color: var(--primary); font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
.reveal-icon-button { display: grid; width: 30px; min-width: 30px; min-height: 30px; padding: 0; place-items: center; border: 0; border-radius: 5px; background: var(--field); color: var(--muted); cursor: pointer; }
.reveal-icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.reveal-icon-button.is-revealed { color: var(--primary); }
.reveal-icon-button:focus-visible, .copy-icon-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.reveal-icon-button:disabled, .copy-icon-button:disabled { cursor: default; opacity: .55; }
.merchant-actions, .merchant-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.merchant-actions .secondary-button, .merchant-action-grid .secondary-button { min-height: 46px; }
.danger-text-button { width: 100%; color: var(--error); }
.merchant-subsection, .merchant-section { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.compact-list { border-top: 1px solid var(--border); }
.compact-list .compact-row:first-child { border-top: 0; }
.merchant-section > .compact-list:first-child { border-top: 0; }
.merchant-data-row { width: 100%; border-right: 0; border-left: 0; border-bottom: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.merchant-data-row:hover, .merchant-row:hover, .merchant-pending-entry:hover { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.merchant-data-row b { color: var(--text); }
.merchant-data-row b.is-in { color: var(--success); }
.merchant-load-more { width: 100%; }
.merchant-setting-hint { margin: -2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.integration-section { display: grid; overflow: hidden; }
.integration-block { display: grid; gap: 6px; padding: 12px 13px; border-top: 1px solid var(--border); }
.integration-block:first-child { border-top: 0; }
.integration-block span { color: var(--muted); font-size: 12px; font-weight: 600; }
.integration-block code { overflow-wrap: anywhere; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.integration-note { margin: 0; padding: 12px 13px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.55; }
.compact-form { display: grid; gap: 12px; padding: 13px; }
.compact-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.compact-form input, .compact-form textarea, .compact-form select { width: 100%; min-height: 44px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 6px; outline: 0; background: var(--field); color: var(--text); font: inherit; font-size: 13px; font-weight: 400; resize: vertical; }
.compact-form input:focus, .compact-form textarea:focus, .compact-form select:focus { border-color: var(--primary); }
.compact-form .checkbox-label { display: flex; min-height: 44px; align-items: center; gap: 9px; }
.compact-form .checkbox-label input { width: 18px; min-height: 18px; }
.form-message { min-height: 18px; margin: -2px 0 0; color: var(--error); font-size: 12px; }
.credential-controls { display: grid; gap: 7px; padding: 13px; }
.credential-controls p { margin: 0; color: var(--muted); font-size: 12px; }
.credential-sheet { position: fixed; inset: 0; z-index: 70; display: flex; min-width: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); align-items: flex-end; justify-content: center; background: rgba(13, 17, 23, .48); }
.credential-sheet-card { display: grid; box-sizing: border-box; width: min(100%, 380px); max-width: 100%; gap: 12px; padding: 16px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.credential-sheet-card h2 { margin: 0; font-size: 16px; font-weight: 650; }
.credential-sheet-card > p { margin: -5px 0 2px; color: var(--muted); font-size: 12px; }
.credential-sheet-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) 44px; min-height: 44px; align-items: center; gap: 6px; padding: 0 0 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); }
.copy-field code { overflow: hidden; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.copy-field button { width: 44px; height: 44px; border: 0; border-radius: 0 6px 6px 0; background: transparent; color: var(--primary); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.payment-password-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.payment-password-actions button { width: 100%; }
.payment-password-sheet .form-message { margin: 0; }
@media (max-width: 360px) {
  .credential-sheet { padding-inline: 12px; }
  .credential-sheet-card { padding: 14px; }
}
@media (max-width: 350px) {
  .mini-nav { padding-inline: 4px; }
  .mini-nav-item { font-size: 11px; }
  .profile-id { display: none; }
  .asset-balance { padding-inline: 9px; }
}

/* Deposit payment state: intentionally quiet, focused, and single-purpose. */
.deposit-order-open .mini-nav { display: none; }
.deposit-order-open.miniapp-ready .app-shell { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.payment-order {
  position: relative;
  display: flex;
  padding: 22px 20px 20px;
  flex-direction: column;
  gap: 0;
  border-color: color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 30, 44, 0.05);
}

.payment-asset-head {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
}
.payment-asset-icon { flex-basis: 26px; width: 26px; height: 26px; }
.payment-asset-head h1 { margin: 0; font-size: 13px; font-weight: 650; line-height: 1; }
.payment-asset-head p { display: none; }
.payment-balance { display: none; }

.payment-order .status-band {
  order: 1;
  align-self: flex-start;
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 16px;
  background: rgba(174, 116, 18, 0.12);
  color: #a86e0b;
  font-size: 13px;
  font-weight: 650;
}
.payment-order .status-band .status-clock { display: none; }
.payment-order .status-chain-pending,
.payment-order .status-detected { background: rgba(39, 132, 92, 0.12); color: var(--success); }
.payment-order .status-confirmed { background: rgba(39, 132, 92, 0.12); color: var(--success); }
.payment-order .status-failed, .payment-order .status-expired { background: rgba(207, 63, 69, 0.10); color: var(--error); }
.payment-order .status-cancelled { background: var(--field); color: var(--muted); }

.payment-amount {
  order: 2;
  margin-top: 28px;
}
.payment-amount > span { display: none; }
.payment-amount strong {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}
.payment-amount strong::before {
  display: inline-block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: center / contain no-repeat url("/assets/asset-usd.png");
  content: "";
}
.payment-amount strong::after {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 20px;
  font-weight: 650;
  content: "USD";
}
.payment-order[data-asset="TRX"] .payment-amount strong::before { background-image: url("/assets/asset-trx.png"); }
.payment-order[data-asset="TRX"] .payment-amount strong::after { content: "TRX"; }
.payment-order[data-asset="TON"] .payment-amount strong::before { background-image: url("/assets/asset-ton.png"); }
.payment-order[data-asset="TON"] .payment-amount strong::after { content: "TON"; }

.payment-timing {
  order: 3;
  margin-top: 13px;
}
.payment-timing > div:first-child { justify-content: center; color: var(--muted); font-size: 16px; }
.payment-timing strong { margin-left: 8px; color: var(--error); font-size: 18px; font-weight: 700; }
.payment-order .progress-track { display: none; }

.payment-qr-wrap {
  order: 4;
  width: min(244px, 66vw);
  margin: 32px auto 28px;
  padding: 8px;
  border-color: color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(24, 31, 43, 0.03);
}
.payment-address {
  order: 5;
  gap: 8px;
  padding: 13px 14px;
  border: 0;
  border-radius: 8px;
  background: #f0eff5;
}
.payment-address > span { color: #84838d; font-size: 14px; }
.payment-address > div { grid-template-columns: minmax(0, 1fr) 52px; min-height: 32px; gap: 8px; }
.payment-address code { color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.45; }
.copy-address-button { width: 52px; height: 40px; color: var(--primary); font-size: 15px; font-weight: 650; }
.copy-address-button i { display: none; }
.copy-address-button::after { content: "复制"; }
.copy-address-button.is-copied { color: var(--success); }
.copy-address-button.is-copied::after { content: "已复制"; }

.payment-order .order-note {
  order: 6;
  min-height: 0;
  margin: 20px 0 22px;
  color: #af771a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
}
.payment-order .order-actions { order: 7; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 0; }
.payment-order #returnHome { display: none; }
.payment-order .danger-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: rgba(221, 74, 74, 0.13);
  color: #d94242;
  font-size: 16px;
  font-weight: 700;
}
.payment-order .danger-button:active { transform: scale(0.99); }

.deposit-cancel-dialog {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(16, 20, 28, 0.40);
  backdrop-filter: blur(8px);
  animation: dialog-fade-in 160ms ease-out both;
}
.deposit-cancel-card {
  overflow: hidden;
  width: min(100%, 304px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(12, 17, 26, 0.20);
  text-align: center;
  animation: dialog-card-in 180ms ease-out both;
}
.deposit-cancel-card h2 { margin: 0; padding: 17px 16px 4px; color: var(--text); font-size: 17px; font-weight: 650; }
.deposit-cancel-card p { margin: 0; padding: 0 18px 17px; color: var(--text); font-size: 13px; line-height: 1.5; }
.deposit-cancel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.deposit-cancel-actions button { min-height: 50px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--primary); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; }
.deposit-cancel-actions button:last-child { border-right: 0; color: var(--error); }
.deposit-cancel-actions button:active { background: var(--field); }
@keyframes dialog-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-card-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (prefers-color-scheme: dark) {
  .payment-order { box-shadow: none; }
  .payment-address { background: #252734; }
  .payment-address > span { color: var(--muted); }
  .payment-order .status-band { background: rgba(192, 137, 42, 0.18); color: #e3ad56; }
  .payment-order .status-chain-pending,
  .payment-order .status-detected { background: rgba(74, 170, 117, 0.18); color: #74c998; }
  .payment-order .order-note { color: #e1ad5a; }
  .deposit-cancel-dialog { background: rgba(0, 0, 0, 0.58); }
}

@media (max-width: 360px) {
  .payment-order { padding: 18px 14px 14px; }
  .payment-asset-head { top: 16px; right: 14px; }
  .payment-amount { margin-top: 26px; }
  .payment-amount strong { gap: 6px; font-size: 34px; }
  .payment-amount strong::before { width: 28px; height: 28px; flex-basis: 28px; }
  .payment-amount strong::after { font-size: 18px; }
  .payment-qr-wrap { width: min(220px, 66vw); margin-block: 26px 22px; }
  .payment-order .order-note { margin-block: 17px 19px; font-size: 12px; }
}
