:root {
  --upa-primary: #000000;
  --upa-accent: #F5C518;
  --upa-accent-2: #F5C518;
  --upa-input: #2c2c2e;
  --upa-green: #2ebd85;
  --upa-on-accent: #111111;
  --upa-red: #ef454a;
  --upa-muted: #8e8e93;
  --upa-nav-inactive: #8e8e93;
  --upa-nav-inactive-strong: #636366;
  --upa-nav-active: #1c1c1e;
  --mc-bg: #1c1c1e;
  --mc-surface: #2c2c2e;
  --mc-surface-2: #3a3a3c;
  --mc-border: #48484a;
  --mc-text: #e5e5ea;
  --mc-text-secondary: #ebebf0;
  --mc-text-muted: #a0a0a0;
  --mc-page-frame: #e8e8e8;
  --max-mobile: 430px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--mc-page-frame);
  color: #111;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

.mobile-shell {
  max-width: var(--max-mobile);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--mc-bg);
  color: var(--mc-text);
  position: relative;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.18);
}

/* Light mode (default) — dark via explicit user toggle */
html:not([data-theme="dark"]) {
  color-scheme: light;
}

html:not([data-theme="dark"]) body {
  background: #f0f0f0;
  color: #111;
}

html:not([data-theme="dark"]) .mobile-shell {
  background: #fff;
  color: #111;
  box-shadow: 0 0 24px rgba(0, 0, 0, .08);
}

html:not([data-theme="dark"]) a {
  color: var(--upa-accent);
}

/* Accent filled controls need dark ink — link color must not override */
html:not([data-theme="dark"]) a.upa-btn,
html:not([data-theme="dark"]) a.fund-submit,
html:not([data-theme="dark"]) a.fund-support-btn,
html:not([data-theme="dark"]) a.home-assets__deposit,
html:not([data-theme="dark"]) a.assets-actions__btn--primary,
html:not([data-theme="dark"]) a.app-menu-btn,
html:not([data-theme="dark"]) a.kyc-card__cta--primary,
html:not([data-theme="dark"]) a.kyc-card__cta,
html:not([data-theme="dark"]) a.fi-btn,
html:not([data-theme="dark"]) a.fi-header__back,
a.upa-btn,
a.fund-submit,
a.home-assets__deposit,
a.assets-actions__btn--primary,
a.app-menu-btn,
a.kyc-card__cta--primary,
a.kyc-card__cta,
a.fi-btn,
a.fi-header__back {
  color: var(--upa-on-accent) !important;
}
html:not([data-theme="dark"]) a.pc-logout,
a.pc-logout {
  color: #666 !important;
}
html:not([data-theme="dark"]) a.kyc-card__cta--done {
  color: #1f8a4c !important;
}
html:not([data-theme="dark"]) a.kyc-card__cta--pending {
  color: #b45309 !important;
}

/* Light-mode chrome: keep sophisticated gray — never brand yellow */
html:not([data-theme="dark"]) .tabbar a,
html:not([data-theme="dark"]) .tabbar-icon-wrap {
  color: var(--upa-nav-inactive) !important;
}
html:not([data-theme="dark"]) .tabbar a.active,
html:not([data-theme="dark"]) .tabbar a.active .tabbar-icon-wrap {
  color: var(--upa-nav-active) !important;
}
html:not([data-theme="dark"]) .market-category-tabs a,
html:not([data-theme="dark"]) .market-category-tabs span {
  color: #8a8a94 !important;
}
html:not([data-theme="dark"]) .market-category-tabs .active,
html:not([data-theme="dark"]) .market-category-tabs a.active {
  color: #1a1a1a !important;
}
html:not([data-theme="dark"]) .trade-timeframes a,
html:not([data-theme="dark"]) .trade-timeframes button,
html:not([data-theme="dark"]) .trade-drawer__filter {
  color: var(--upa-nav-inactive) !important;
}
html:not([data-theme="dark"]) .trade-timeframes a.active,
html:not([data-theme="dark"]) .trade-timeframes button.active {
  color: var(--upa-nav-active) !important;
}
html:not([data-theme="dark"]) .header-back,
html:not([data-theme="dark"]) .pc-top__back,
html:not([data-theme="dark"]) .auth-page__back,
html:not([data-theme="dark"]) .kyc-form-top__back {
  color: #111 !important;
}

.mobile-shell.has-tabbar { padding-bottom: 56px; }

.page-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  padding: 0 16px;
}

.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.page-header--logo {
  background: var(--upa-primary);
  border-bottom-color: var(--upa-primary);
}

.page-header--logo img {
  height: 28px;
  width: auto;
  display: block;
}

.page-header--logo .header-right a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.page-header--logo .header-right img {
  width: 22px;
  height: 22px;
}

.page-header .header-right {
  position: absolute;
  right: 16px;
}

.page-header .header-back {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  color: #111 !important;
  text-decoration: none;
  line-height: 1;
  -webkit-text-stroke: 0.6px #111;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  transition: background-color 0.08s ease, opacity 0.08s ease;
}

.page-header .header-back:active,
.page-header .header-back.is-pending,
a.auth-page__back:active,
a.auth-page__back.is-pending,
a.support-page__back:active,
a.support-page__back.is-pending {
  background: rgba(0, 0, 0, 0.06);
  opacity: 0.72;
}

.page-body {
  padding: 0 0 16px;
  overflow-y: auto;
}

.upa-input-wrap {
  display: flex;
  align-items: center;
  background: var(--upa-input);
  border-radius: 8px;
  height: 46px;
  padding: 0 32px;
  position: relative;
  margin-bottom: 12px;
}

.upa-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  color: #333;
  font-size: 14px;
  outline: none;
}

.upa-input-wrap input::placeholder { color: #aaa; }

.upa-input-wrap .icon-left {
  position: absolute;
  left: 12px;
  color: #fff;
  opacity: .9;
}

.upa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--upa-accent);
  color: var(--upa-on-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.upa-btn:disabled { opacity: .6; cursor: not-allowed; }

.upa-btn-outline {
  background: transparent;
  border: 1px solid var(--upa-accent);
  color: var(--upa-accent);
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-mobile);
  /* Never use fixed height + safe-area padding with border-box — that
     crushed icons into ~22px on iPhone and hid the bar under the home indicator. */
  height: auto;
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: stretch;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 300;
  padding-top: 6px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
  min-height: 50px;
  font-size: 10px;
  line-height: 1.15;
  color: var(--upa-nav-inactive);
  gap: 3px;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 0.08s ease, opacity 0.08s ease;
}

.tabbar a.active {
  color: var(--upa-nav-active);
  font-weight: 700;
}

/* Instant press feedback so taps feel registered during full-page navigations */
.tabbar a:active,
.tabbar a.is-pending {
  color: var(--upa-nav-active);
  opacity: 0.88;
}

.tabbar-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--upa-nav-inactive);
  transition: color 0.08s ease, transform 0.08s ease;
}

.tabbar a.active .tabbar-icon-wrap,
.tabbar a:active .tabbar-icon-wrap,
.tabbar a.is-pending .tabbar-icon-wrap {
  color: var(--upa-nav-active);
}

.tabbar a:active .tabbar-icon-wrap,
.tabbar a.is-pending .tabbar-icon-wrap {
  transform: scale(0.9);
}

.tabbar-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.tabbar img { width: 24px; height: 24px; }

.exchange-page { padding: 16px; }

.exchange-pair-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 24px;
}

.exchange-currency-col { flex: 1; min-width: 0; }
.exchange-currency-col-right { text-align: right; }

.exchange-currency-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  color: #111;
  cursor: pointer;
}

.exchange-chevron { font-size: 12px; color: #999; }

.exchange-balance-label {
  font-size: 12px;
  color: var(--upa-muted);
  margin-top: 8px;
}

.exchange-balance-val {
  font-size: 14px;
  color: #333;
  margin-top: 2px;
}

.exchange-swap-btn {
  flex-shrink: 0;
  margin-top: 4px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--upa-primary);
  cursor: pointer;
}

.exchange-amount-wrap {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.exchange-amount-input {
  flex: 1;
  border: none;
  font-size: 15px;
  outline: none;
  min-width: 0;
}

.exchange-amount-input::placeholder { color: #ccc; }

.exchange-all-btn {
  border: none;
  background: none;
  color: var(--upa-primary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0 4px 12px;
}

.exchange-meta { margin-bottom: 24px; }

.exchange-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  padding: 6px 0;
}

.exchange-estimate-row { color: #333; font-weight: 500; }

.exchange-submit { margin-top: 8px; }

.exchange-picker { position: fixed; inset: 0; z-index: 100; }
.exchange-picker[hidden] { display: none; }

.exchange-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}

.exchange-picker-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: var(--max-mobile);
  margin: 0 auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  max-height: 50vh;
  overflow-y: auto;
}

.exchange-picker-title {
  margin: 0 0 12px;
  font-weight: 600;
  text-align: center;
}

.exchange-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 16px;
  cursor: pointer;
}

.deposit-page { padding: 0 0 24px; }

.deposit-page--categories .deposit-method-list {
  border-top: 1px solid #f0f0f0;
}

.deposit-category-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deposit-category-icon--bank {
  background: var(--upa-accent);
  border-radius: 8px;
}

.deposit-category-icon--crypto {
  background: var(--upa-accent);
  border-radius: 50%;
}

.deposit-page--categories .deposit-method-item {
  padding: 18px 16px;
}

.deposit-page--categories .deposit-method-label {
  font-weight: 400;
}

.deposit-bank-details {
  margin-bottom: 8px;
}

.deposit-notice {
  margin: 12px 16px;
  padding: 12px 16px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: #666;
  text-align: center;
}

.deposit-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 16px 8px;
}

.deposit-method-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deposit-method-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}

.deposit-method-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.deposit-method-icon-lg { width: 32px; height: 32px; }

.deposit-method-label { flex: 1; font-size: 15px; font-weight: 500; }

.deposit-method-arrow { color: #ccc; font-size: 20px; }

.deposit-empty { text-align: center; color: #999; padding: 32px 16px; }

.deposit-detail { padding: 16px; }

.deposit-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.deposit-detail-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.deposit-qr-wrap { text-align: center; margin: 8px 0 24px; }

.deposit-qr { border-radius: 8px; }

.deposit-field { margin-bottom: 20px; }

.deposit-field-label {
  font-size: 13px;
  color: var(--upa-muted);
  margin-bottom: 8px;
}

.deposit-address-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.deposit-address {
  flex: 1;
  font-size: 14px;
  word-break: break-all;
  background: none;
  padding: 0;
}

.deposit-copy-btn {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.deposit-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e5e5e5;
  padding: 8px 0;
  font-size: 15px;
  outline: none;
}

.deposit-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border: 2px dashed #bebdfd;
  border-radius: 8px;
  background: #f9f9ff;
  cursor: pointer;
}

.deposit-upload-icon { font-size: 32px; }

.deposit-form .upa-btn { margin-top: 8px; }

/* ── Fund pages (deposit / withdraw) ── */
.fund-page {
  background: #f5f5f5;
  min-height: calc(100dvh - 44px);
  padding: 12px 16px 28px;
}
.fund-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.fund-card--tips { padding: 14px 16px; }
.fund-card--amount { padding: 0 16px 16px; overflow: hidden; }
.fund-card--select { padding: 0; }
.fund-card__title {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}
.fund-card__accent-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 14px;
}
.fund-card__accent-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--upa-accent);
}
.fund-card__banner {
  margin: 0 -16px 14px;
  padding: 10px 16px;
  min-height: 36px;
  background: rgba(245, 197, 24, 0.12);
  font-size: 13px;
  font-weight: 600;
  color: #333;
  box-sizing: border-box;
}
.fund-card__banner:empty {
  padding: 0;
  min-height: 12px;
}
.fund-card__head-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.fund-tips {
  margin: 0;
  padding-left: 18px;
  color: #777;
  font-size: 13px;
  line-height: 1.55;
}
.fund-tips li + li { margin-top: 8px; }
.fund-currency-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fund-currency-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}
.fund-currency-list li:last-child .fund-currency-item { border-bottom: none; }
.fund-crypto-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #f7f7f7;
}
.fund-currency-item__label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: #111;
}
.fund-currency-item__chevron {
  color: #c8c8c8;
  font-size: 20px;
  line-height: 1;
}
.fund-network-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fff3bf;
  color: #333;
  font-size: 11px;
  font-weight: 600;
}
.fund-network-pill {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff3bf;
  font-size: 11px;
  font-weight: 600;
}
.fund-copy-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f3f3;
}
.fund-copy-row:last-child { border-bottom: none; }
.fund-copy-row__meta { flex: 1; min-width: 0; }
.fund-copy-row__label {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}
.fund-copy-row__value {
  font-size: 15px;
  color: #111;
  font-weight: 500;
  word-break: break-all;
}
.fund-copy-row__value--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}
.fund-copy-btn {
  flex-shrink: 0;
  border: 1px solid #e8e8e8;
  background: #fff;
  color: #333;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.fund-copy-btn.is-copied {
  border-color: var(--upa-accent);
  background: #fff8dd;
}
.fund-field-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}
.fund-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e6e6e6;
  padding: 10px 0;
  font-size: 16px;
  outline: none;
  background: transparent;
  color: #111;
}
.fund-input--password {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #f7f7f8 !important;
  background-color: #f7f7f8 !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  caret-color: #111;
  font-size: 15px;
  box-sizing: border-box;
  color-scheme: light only;
  -webkit-appearance: none;
  appearance: none;
}
.fund-input--password::placeholder {
  color: #9a9aa3;
  -webkit-text-fill-color: #9a9aa3;
  opacity: 1;
}
.fund-input--password:-webkit-autofill,
.fund-input--password:-webkit-autofill:hover,
.fund-input--password:-webkit-autofill:focus {
  -webkit-text-fill-color: #111 !important;
  caret-color: #111;
  box-shadow: 0 0 0 1000px #f7f7f8 inset !important;
  -webkit-box-shadow: 0 0 0 1000px #f7f7f8 inset !important;
  transition: background-color 99999s ease-out;
}
.fund-input--amount {
  border: none;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 0;
}
.fund-amount-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.fund-amount-min {
  font-size: 12px;
  color: #999;
}
.fund-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e6e6e6;
}
.fund-amount-prefix {
  font-size: 20px;
  font-weight: 700;
  color: #111;
}
.fund-all-btn {
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.fund-all-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fund-qr-wrap { text-align: center; margin: 8px 0 16px; }
.fund-qr { border-radius: 10px; background: #fff; }
.fund-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border: 2px dashed #c5c4f5;
  border-radius: 12px;
  background: #f8f7ff;
  cursor: pointer;
}
.fund-upload__icon { font-size: 30px; }
.fund-upload__icon.has-file { color: var(--upa-green); font-size: 22px; font-weight: 700; }
.fund-hint {
  margin: 8px 4px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #888;
  text-align: center;
}
.fund-support-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 16px;
  font-size: 13px;
  color: #555;
}
.fund-support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--upa-accent);
  color: var(--upa-on-accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.fund-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  background: var(--upa-accent);
  color: var(--upa-on-accent);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.fund-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.fund-empty {
  text-align: center;
  color: #999;
  padding: 24px 8px;
  margin: 0;
}
.fund-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  width: 100%;
  box-sizing: border-box;
}
.fund-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #111;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.fund-select-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  color: #999;
  text-decoration: none;
  font-size: 14px;
}
.fund-warn-link {
  margin: 0 4px 12px;
  font-size: 13px;
}
.fund-warn-link a { color: var(--upa-accent); font-weight: 600; }
.withdraw-add-wallet {
  margin: 2px 4px 14px;
  font-size: 13px;
}
.withdraw-add-wallet a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--upa-accent);
  font-weight: 700;
  text-decoration: none;
}
.withdraw-add-wallet__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--upa-accent);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.withdraw-wallet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 4px;
}

.withdraw-wallet-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #2c2c2e;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.withdraw-wallet-option input[type="radio"] {
  position: absolute;
  left: 14px;
  top: 16px;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}

.withdraw-wallet-option__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #555;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  box-sizing: border-box;
}

.withdraw-wallet-option.is-selected,
.withdraw-wallet-option:has(input[type="radio"]:checked) {
  border-color: var(--upa-accent);
  background: rgba(245, 197, 24, 0.08);
}

.withdraw-wallet-option.is-selected .withdraw-wallet-option__check,
.withdraw-wallet-option:has(input[type="radio"]:checked) .withdraw-wallet-option__check {
  border-color: var(--upa-accent);
  background: var(--upa-accent);
}

.withdraw-wallet-option.is-selected .withdraw-wallet-option__check::after,
.withdraw-wallet-option:has(input[type="radio"]:checked) .withdraw-wallet-option__check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #111;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.withdraw-wallet-option__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.withdraw-wallet-option__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.withdraw-wallet-option__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 197, 24, 0.18);
  color: var(--upa-accent);
}

.withdraw-wallet-option__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #9a9aa3;
}

.withdraw-wallet-option__addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  color: #c8c8d0;
}

.fund-card--warn {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

html:not([data-theme="dark"]) .withdraw-wallet-option {
  background: #fff;
  border-color: #e8e8e8;
  color: #111;
}

html:not([data-theme="dark"]) .withdraw-wallet-option__title {
  color: #111;
}

html:not([data-theme="dark"]) .withdraw-wallet-option__addr {
  color: #555;
}

html:not([data-theme="dark"]) .withdraw-wallet-option.is-selected,
html:not([data-theme="dark"]) .withdraw-wallet-option:has(input[type="radio"]:checked) {
  background: rgba(245, 197, 24, 0.06);
}
.fund-fee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: #333;
}
.fund-fee-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #999;
}

.position-page { padding-bottom: 24px; }

.position-asset-tabs {
  display: flex;
  justify-content: center;
  gap: 32px;
  border-bottom: 1px solid #f0f0f0;
}

.position-asset-tabs a {
  padding: 12px 8px;
  font-size: 15px;
  color: #666;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.position-asset-tabs a.active {
  color: var(--upa-primary);
  font-weight: 600;
  border-bottom-color: var(--upa-primary);
}

.position-segment {
  display: flex;
  margin: 16px;
  border: 1px solid var(--upa-primary);
  border-radius: 999px;
  overflow: hidden;
}

.position-segment a {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  text-decoration: none;
  color: var(--upa-primary);
  background: #fff;
}

.position-segment a.active {
  background: var(--upa-primary);
  color: #fff;
}

.position-list { padding: 0 16px; }

.position-card {
  border-bottom: 1px solid #f0f0f0;
  padding: 16px 0;
}

.position-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.position-pair { font-size: 16px; font-weight: 700; color: #111; }

.position-code { font-size: 12px; color: #999; margin-top: 2px; }

.position-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.position-badge-long { background: #e8f8f0; color: var(--upa-green); }

.position-badge-short { background: #fde8eb; color: var(--upa-red); }

.position-prices {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.position-price-col { display: flex; flex-direction: column; gap: 4px; }

.position-price-col-right { text-align: right; align-items: flex-end; }

.position-label { font-size: 12px; color: var(--upa-muted); }

.position-value { font-size: 14px; color: #333; }

.position-duration { font-size: 12px; color: #666; margin-top: 2px; }

.position-amounts {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.position-amounts-right { text-align: right; }

.position-amount { font-size: 14px; color: #999; display: block; margin-top: 4px; }

.position-revenue { font-size: 14px; font-weight: 600; display: block; margin-top: 4px; }

.position-revenue-pending { color: #ccc; font-weight: 400; }

.position-time { font-size: 11px; color: #999; }

.position-empty { text-align: center; color: #999; padding: 32px 16px; }

.position-loaded { text-align: center; color: #ccc; font-size: 13px; padding: 24px 0; }

.notify-page { padding: 0 0 24px; min-height: 200px; }

.notify-list { list-style: none; margin: 0; padding: 0; }

.notify-item {
  display: block;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}

.notify-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.notify-item-title { font-size: 15px; font-weight: 600; flex: 1; }

.notify-time { font-size: 11px; color: var(--upa-muted); white-space: nowrap; }

.notify-item-preview {
  margin: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.notify-empty { text-align: center; padding: 48px 24px; color: #999; }

.notify-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }

.notify-loaded { text-align: center; color: #ccc; font-size: 13px; padding: 24px; }

.notify-detail { padding: 16px; }

.notify-detail-title { font-size: 18px; font-weight: 700; margin: 0 0 8px; }

.notify-detail-body { font-size: 14px; line-height: 1.6; color: #333; margin-top: 16px; }

.notify-back-link {
  display: block;
  text-align: center;
  padding: 16px;
  font-size: 14px;
}

.static-page { padding: 16px 16px 32px; }

.static-body { font-size: 14px; line-height: 1.65; color: #333; }

.static-body h3 { font-size: 15px; font-weight: 700; margin: 20px 0 8px; color: #111; }

.static-body p { margin: 0 0 12px; }

.static-body ul, .static-body ol { margin: 0 0 12px; padding-left: 20px; }

.static-body li { margin-bottom: 6px; }

.static-body a { color: var(--upa-primary); }

.static-muted { font-size: 12px; color: var(--upa-muted); }

.service-card {
  background: #f8f9fc;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.service-card h3 { margin: 0 0 8px; font-size: 15px; }

/* ── Support Center ── */
.support-page {
  min-height: 100dvh;
  margin: -0px;
  background: var(--mc-bg);
  padding-bottom: 40px;
}
.mobile-shell:has(.support-page),
.mobile-shell:has(.support-page) .page-body {
  background: var(--mc-bg);
}
.mobile-shell:has(.support-page) .page-body {
  padding: 0;
}
.support-page__top {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 0 8px;
  border-bottom: 1px solid var(--mc-border);
}
.support-page__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
}
.support-page__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.support-page__card {
  margin: 18px 16px 0;
  background: var(--mc-surface-2);
  border: 1px solid var(--mc-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
}
.support-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid var(--mc-border);
}
.support-row:last-child { border-bottom: none; }
.support-row:active { background: rgba(255, 255, 255, 0.04); }
.support-row__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--upa-accent);
}
.support-row__icon svg { display: block; }
.support-row__label {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
}
.support-row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.support-row__handle {
  font-size: 13px;
  font-weight: 500;
  color: var(--upa-accent);
}
.support-row__chevron {
  color: #666;
  font-size: 22px;
  line-height: 1;
}


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

.faq-item {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-answer {
  padding: 0 16px 14px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.banner-slide img {
  width: 100%;
  height: auto;
  min-height: 140px;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
}

.announce-bar {
  margin: 12px 16px;
  padding: 8px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  font-size: 12px;
  color: #666;
  display: flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
}

.announce-bar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.announce-bar-chevron { color: #ccc; font-size: 14px; }

.announce-bar-track {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent);
}

.announce-bar-marquee {
  display: inline-flex;
  width: max-content;
  white-space: nowrap;
  animation: announce-marquee 18s linear infinite;
}

.announce-bar-marquee.is-static {
  animation: none;
  width: 100%;
}

.announce-bar-marquee.is-static .announce-bar-text:last-child {
  display: none;
}

.announce-bar-text {
  padding-right: 48px;
}

@keyframes announce-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .announce-bar-marquee { animation: none; }
}

.hot-scroll {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 16px 8px;
}

.hot-card {
  min-width: 130px;
  padding: 10px;
  border-radius: 10px;
  background: #f8f9fb;
  border: 1px solid #eef0f4;
}

.hot-card .sym { font-weight: 700; font-size: 14px; }
.hot-card .price { font-size: 16px; font-weight: 700; }
.hot-card .chg { font-size: 12px; }

.price-up { color: var(--upa-green); }
.price-down { color: var(--upa-red); }

@keyframes mc-tick-up {
  0% { background-color: rgba(46, 189, 133, 0.28); }
  100% { background-color: transparent; }
}
@keyframes mc-tick-down {
  0% { background-color: rgba(239, 69, 74, 0.28); }
  100% { background-color: transparent; }
}
.tick-up {
  border-radius: 4px;
  animation: mc-tick-up 0.38s ease-out forwards;
}
.tick-down {
  border-radius: 4px;
  animation: mc-tick-down 0.38s ease-out forwards;
}

.market-table .row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f5;
  align-items: center;
  font-size: 13px;
}

.market-table .head {
  color: #999;
  font-size: 11px;
}

.market-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--icon-size, 28px);
  height: var(--icon-size, 28px);
  border-radius: 50%;
  overflow: hidden;
  background: #f3f4f6;
}

.market-icon {
  display: block;
  object-fit: contain;
}

.market-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.market-name-text {
  font-weight: 700;
  font-size: 14px;
  color: #1c1c1e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.admin-stat-card .val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-stat-card .lbl {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.admin-stat-card .val.is-up { color: #059669; }
.admin-stat-card .val.is-down { color: #dc2626; }

.admin-stat-grid--trades {
  margin-bottom: 8px;
}

.admin-trades-stats__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.admin-trades-stats__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.admin-trades-stats__range {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.admin-trades-stats__hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: #666;
}

.admin-trades-stats__subtitle {
  margin: 18px 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.admin-trades-stats__empty {
  margin: 0;
  font-size: 13px;
  color: #888;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table--compact th,
.admin-table--compact td {
  padding: 8px 10px;
  font-size: 13px;
}

.admin-stat-card a {
  font-size: 11px;
  color: var(--upa-primary, #2563eb);
  text-decoration: none;
}

.admin-dash-section {
  margin-top: 24px;
}

.admin-dash-section h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.badge-up, .badge-down {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  min-width: 58px;
  text-align: center;
}
.badge-up { background: var(--upa-green); color: #fff; }
.badge-down { background: #c62828; color: #fff; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px;
  text-align: center;
  font-size: 11px;
}

.quick-grid .icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 197, 24, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
}

.quick-grid .icon img {
  width: 22px;
  height: 22px;
  display: block;
}

.assets-card {
  margin: 0 16px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 100%);
  color: #fff;
  border: 1px solid rgba(245, 197, 24, 0.2);
}

.assets-card .balance { font-size: 28px; font-weight: 700; margin: 8px 0; }

.list-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  color: #111;
  font-size: 14px;
}

.list-cell:last-child { border-bottom: none; }

.card-block {
  margin: 12px 16px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #f0f0f0;
}

.wallet-bind-form {
  padding: 16px;
}

.wallet-page {
  padding: 8px 0 24px;
  background: #fff;
  min-height: calc(100dvh - 44px);
}

.wallet-page__banner {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8d9;
  border: 1px solid #f5e6a3;
  color: #6b5a12;
  font-size: 13px;
  line-height: 1.4;
}

.wallet-bind-form {
  padding-bottom: 24px;
}

.wallet-bind-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 16px 18px;
  padding: 14px;
  border-radius: 12px;
  background: #f7f7f7;
}

.wallet-bind-hero__title {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}

.wallet-bind-hero__hint {
  margin-top: 4px;
  font-size: 12px;
  color: #888;
}

.wallet-bind-default {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0 16px 16px;
  padding: 0;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: 0;
  height: auto;
}

.wallet-bind-default input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  max-width: 18px;
  margin: 0;
  padding: 0 !important;
  flex: 0 0 18px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  background: #fff;
  accent-color: var(--upa-accent);
  cursor: pointer;
  box-sizing: border-box;
}

.wallet-bind-default span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.wallet-section {
  margin: 0 0 8px;
}

.wallet-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 4px;
  font-size: 13px;
  color: #888;
}

.wallet-section__head strong {
  color: #111;
  font-size: 14px;
}

.wallet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  color: inherit;
  text-decoration: none;
  background: #fff;
  position: relative;
}

.wallet-row__select {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.wallet-row__delete {
  flex-shrink: 0;
  margin: 0;
}

.wallet-row__delete button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f3f3f3;
  color: #666;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.wallet-row__delete button:hover {
  background: #ffe8e8;
  color: #c0392b;
}

.wallet-row--add:active {
  background: #fafafa;
}

.wallet-row__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  line-height: 1.05;
}

.wallet-row__glyph {
  font-size: 15px;
  font-weight: 700;
}

.wallet-row__net {
  font-size: 8px;
  font-weight: 600;
  opacity: .92;
  letter-spacing: .02em;
}

.wallet-row__icon--usdt { background: #26a17b; }
.wallet-row__icon--usdc { background: #2775ca; }
.wallet-row__icon--btc { background: #f7931a; }
.wallet-row__icon--eth { background: #627eea; }

.wallet-row__main {
  flex: 1;
  min-width: 0;
}

.wallet-row__title {
  font-size: 15px;
  font-weight: 600;
  color: #111;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-row__badge {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fff7ed;
  border-radius: 999px;
  padding: 2px 8px;
}

.wallet-row__address {
  margin-top: 4px;
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

.wallet-row__label {
  margin-top: 2px;
  font-size: 12px;
  color: #999;
}

.wallet-row__plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--upa-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--upa-accent);
  flex-shrink: 0;
}

.wallet-row--selectable {
  text-decoration: none;
  color: inherit;
}

.wallet-row__use {
  color: #888;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  padding-left: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-theme="dark"] .wallet-row {
  background: #1c1c1e;
  border-bottom-color: #222222;
}

html[data-theme="dark"] .wallet-row__title {
  color: #f2f2f2;
}

html[data-theme="dark"] .wallet-row__plus {
  border-color: #2a2a2a;
  color: #f2f2f2;
}

.user-banner {
  margin: 12px 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #434459, #2d2e3d);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  color: #fff;
  font-size: 11px;
  border: 1px solid rgba(245, 197, 24, 0.2);
}

/* ── Personal Center ── */
.pc-page {
  background: #fff;
  min-height: calc(100dvh - 56px);
  padding-bottom: 24px;
}
.pc-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 48px;
  padding: 0 8px;
}
.pc-top__back,
.pc-top__action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #111;
  text-decoration: none;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  -webkit-text-stroke: 0.4px currentColor;
}
.pc-row__icon {
  color: #2b2b2b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.pc-row__icon svg {
  width: 26px;
  height: 26px;
  display: block;
}
.pc-top__title {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}
.pc-profile {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 8px 20px 22px;
  text-decoration: none;
  color: inherit;
}
.pc-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
}
.pc-avatar__svg { width: 56px; height: 56px; display: block; }
.pc-avatar-upload.app-avatar-btn {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.pc-profile__avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pc-profile__avatar-hint {
  font-size: 10px;
  color: #999;
  text-align: center;
  max-width: 64px;
  line-height: 1.2;
}
html[data-theme="dark"] .pc-profile__avatar-hint {
  color: #8e8e93;
}
.pc-avatar-upload .app-avatar-btn__img,
.pc-avatar-upload .app-avatar-btn__placeholder {
  width: 56px;
  height: 56px;
}
.pc-avatar-upload .app-avatar-btn__placeholder svg {
  width: 32px;
  height: 32px;
}
.pc-avatar-upload .app-avatar-btn__camera {
  width: 18px;
  height: 18px;
  right: 0;
  bottom: 0;
}
.pc-avatar-upload .app-avatar-btn__camera svg {
  width: 10px;
  height: 10px;
}
.pc-profile__name {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  word-break: break-all;
}
.pc-profile__uid {
  margin-top: 4px;
  font-size: 12px;
  color: #9a9a9a;
}
.pc-credit {
  text-align: right;
  min-width: 72px;
}
.pc-credit__label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: #9a9a9a;
}
.pc-credit__icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}
.pc-credit__icon svg { width: 14px; height: 14px; }
.pc-credit__value {
  margin-top: 2px;
  font-size: 28px;
  font-weight: 700;
  color: #111;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pc-group {
  padding: 0 8px;
}
.pc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 12px;
  border: none;
  background: transparent;
  text-decoration: none;
  color: #111;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pc-row:active { background: #fafafa; }
.pc-row__icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-row__icon svg { width: 36px; height: 36px; display: block; }
.pc-row__label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
}
.pc-row__chevron {
  color: #c8c8c8;
  font-size: 20px;
  line-height: 1;
  padding-left: 4px;
}
.pc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8f8ef;
  color: #1f9d57;
  font-size: 11px;
  font-weight: 600;
}
.pc-divider {
  height: 1px;
  margin: 8px 20px;
  background: #efefef;
}
.pc-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 28px 20px 8px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid #ececec;
  color: #666 !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.pc-logout:active { background: #fafafa; }

.flash {
  margin: 8px 16px;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
}
.flash.error { background: #fee; color: #c00; }
.flash.success { background: #efe; color: #060; }

.form-group { margin-bottom: 14px; padding: 0 16px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  height: 44px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  color: #111;
  outline: none;
}
.kyc-page { padding: 8px 0 24px; }
.kyc-page__status { font-size: 13px; margin: 0 16px 12px; color: #666; }
.kyc-page__hint { font-size: 13px; color: #888; margin: 12px 16px; }
.kyc-page .form-group { padding: 0 16px; }
.file-field__label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 600;
}
.file-field__control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.file-field__input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 0 !important;
}
.file-field__btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.file-field__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-field__name.is-selected {
  color: #111;
  font-weight: 600;
}

.sub-tabs {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: #f5f5f5;
}
.sub-tabs a, .sub-tabs button {
  border: none;
  background: none;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  padding: 0;
}
.sub-tabs .active { color: #000; font-weight: 700; }

.trade-modes {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
  align-items: center;
}
.trade-modes .mode {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  background: #f0f0f0;
  color: #666;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.trade-modes .mode.active { background: var(--upa-accent); color: var(--upa-on-accent); font-weight: 600; }
.trade-orders-icon {
  margin-left: auto;
  font-size: 18px;
  text-decoration: none;
  padding: 4px 8px;
}

.chart-box {
  margin: 8px 16px;
  height: 180px;
  background: linear-gradient(180deg, #fff8ee, #fff);
  border-radius: 8px;
  overflow: hidden;
}

.login-page { padding: 60px 40px 40px; background: linear-gradient(180deg, #434459 0%, #2d2e3d 45%, #fff 45%); min-height: 100dvh; }
.login-page .logo { display: block; margin: 0 auto 40px; width: 120px; border-radius: 24px; }
.login-page a { color: var(--upa-accent); }
.login-page label { color: #ccc !important; }

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: #1e293b;
  color: #fff;
  padding: 20px 0;
}
.admin-sidebar a {
  display: block;
  padding: 10px 20px;
  color: #cbd5e1 !important;
  font-size: 14px;
}
.admin-sidebar a:hover, .admin-sidebar a.active { background: #334155; color: #fff !important; }
.admin-main { padding: 24px; background: #f8fafc; }
.admin-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; }
.status-pending { color: #d97706; }
.status-approved, .status-won { color: #059669; }
.status-rejected, .status-lost { color: #dc2626; }

@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .admin-sidebar a { padding: 8px 12px; border-radius: 6px; }
}

.panel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.panel-filters input,
.panel-filters select {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.panel-filters button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--upa-primary);
  color: #fff;
  cursor: pointer;
}

.agent-sidebar { background: #0f3d6e; }
.agent-sidebar .panel-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 6px;
}

.app-top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.app-top-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: block;
  overflow: hidden;
  flex-shrink: 0;
  background: #4A4A4A;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.app-header-avatar__img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}
.app-header-avatar__placeholder {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-header-avatar__placeholder svg {
  width: 20px;
  height: 20px;
}

.app-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--upa-accent);
  color: #111 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.app-menu-btn .ui-icon--menu-bars {
  display: block;
  color: #111;
  fill: #111;
}

.app-avatar-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
  overflow: visible;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.app-avatar-btn__img,
.app-avatar-btn__placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  background: #4A4A4A;
  color: #fff;
}
.app-avatar-btn__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-avatar-btn__placeholder svg {
  width: 22px;
  height: 22px;
}
.app-avatar-btn__camera {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--upa-accent);
  color: var(--upa-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  pointer-events: none;
}
.app-avatar-btn__camera svg {
  width: 8px;
  height: 8px;
  display: block;
}
.app-avatar-btn input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
html[data-theme="dark"] .app-avatar-btn__camera {
  border-color: #000;
}
html[data-theme="dark"] .app-avatar-btn__placeholder {
  background: #3a3a3a;
}

.app-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f3f3;
  border-radius: 999px;
  padding: 0 14px;
  height: 38px;
  min-width: 0;
}

.app-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.app-search-icon {
  color: #999;
  font-size: 16px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.app-search-icon:focus-visible {
  outline: 2px solid var(--upa-accent, var(--upa-accent));
  outline-offset: 2px;
  border-radius: 4px;
}

.app-top-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.app-top-actions a {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #333;
}

.market-category-tabs {
  display: flex;
  gap: 16px;
  padding: 12px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.market-category-tabs a,
.market-category-tabs span {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 400;
  color: #8a8a94;
  text-decoration: none;
  padding-bottom: 8px;
  border-bottom: 2px solid transparent;
}

.market-category-tabs .active {
  color: #1a1a1a;
  font-weight: 500;
  border-bottom-color: var(--upa-accent);
}

.sub-tabs--pills {
  background: transparent;
  gap: 10px;
  padding: 12px 16px;
}

.sub-tabs--pills a {
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid #e5e5e5;
  color: #666;
}

.sub-tabs--pills .active {
  background: var(--upa-accent);
  border-color: var(--upa-accent);
  color: var(--upa-on-accent);
  font-weight: 600;
}

.sub-tabs .active {
  color: #111;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--upa-accent);
}

.tabbar a.active { color: var(--upa-nav-active); font-weight: 700; }
.tabbar a.active .tabbar-icon-wrap { color: var(--upa-nav-active); }

/* ── Reference UI (user frontend) ── */

.mobile-shell.has-tabbar {
  padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
}
.mobile-shell.has-trade-actions { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
.mobile-shell.has-tabbar.has-trade-actions {
  /* Tabbar (~56) + compact Buy bar (~49); keep time axis flush with sticky actions. */
  padding-bottom: calc(105px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.mobile-shell.has-tabbar.has-trade-actions .page-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}
.mobile-shell.has-tabbar.has-trade-actions .trade-top-bar,
.mobile-shell.has-tabbar.has-trade-actions .trade-summary,
.mobile-shell.has-tabbar.has-trade-actions .trade-timeframes,
.mobile-shell.has-tabbar.has-trade-actions .trade-inline-countdown {
  flex-shrink: 0;
}
.mobile-shell.has-tabbar.has-trade-actions .chart-box--candles {
  flex: 1 1 auto;
  min-height: clamp(340px, 52vh, calc(100dvh - 240px));
  max-height: none;
}
.mobile-shell.has-tabbar.has-trade-actions .trade-market-panels {
  flex: 0 1 42%;
  min-height: 160px;
  max-height: 46%;
}

.market-table .row {
  grid-template-columns: 1.4fr 1fr 0.9fr;
}
.market-table .row > span:nth-child(2) { text-align: center; font-weight: 600; }
.market-table .row > span:nth-child(3) { text-align: right; }
.market-table .row.head > span:nth-child(2) { text-align: center; }
.market-table .row.head > span:nth-child(3) { text-align: right; }

.home-guest-cta {
  padding: 18px 16px 4px;
}
.home-guest-cta__title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}
.home-guest-cta__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.home-guest-cta__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--upa-accent, #F5C518);
  color: #1a1a1a !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
}
.home-guest-cta__btn:active {
  opacity: 0.88;
}
html[data-theme="dark"] .home-guest-cta__title {
  color: #f2f2f2;
}
html[data-theme="dark"] .home-guest-cta__btn {
  color: #111 !important;
}

.home-assets { padding: 14px 16px 0; }
.home-assets__head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
.home-assets__label-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.home-assets__label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #6b6b75; font-weight: 400; }
.home-assets__funds-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 0;
  border-radius: 0;
  background: transparent;
  color: #6b6b75;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
.home-assets__funds-btn:active {
  opacity: 0.7;
}
.home-assets__funds-label {
  color: #6b6b75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-assets__caret { font-size: 11px; color: #9a9aa3; font-weight: 400; }
.home-assets__eye {
  border: none;
  background: none;
  padding: 6px;
  margin: -4px 0 -4px -2px;
  cursor: pointer;
  color: #8a8a94;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.home-assets__eye:hover { color: #444; }
.home-assets__eye.is-hidden-balance .ui-icon--eye { display: none; }
.home-assets__eye:not(.is-hidden-balance) .ui-icon--eye-off { display: none; }
.home-assets__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 8px; }
.home-assets__amounts { min-width: 0; flex: 1; }
.home-assets__balance {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  line-height: 1.15;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.home-assets__aed {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  color: #8a8a94;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.home-assets__balance.is-balance-masked,
.home-assets__aed.is-balance-masked {
  user-select: none;
  letter-spacing: 0.08em;
}
.home-assets__deposit {
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--upa-accent);
  color: var(--upa-on-accent) !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 2px;
  flex-shrink: 0;
}
html:not([data-theme="dark"]) a.home-assets__deposit,
html[data-theme="dark"] a.home-assets__deposit {
  color: var(--upa-on-accent) !important;
}
.home-quick-grid {
  gap: 18px 8px;
  padding: 18px 16px 12px;
}

.home-quick-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #222;
  transition: transform 0.15s ease;
}

.home-quick-grid__item:active {
  transform: scale(0.96);
}

.home-quick-grid .icon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  background: transparent !important;
  margin: 0;
  color: #5A5A5A;
}

.home-quick-grid .home-quick-icon {
  width: 48px;
  height: 48px;
  display: block;
  color: #5A5A5A;
  --home-quick-icon: #5A5A5A;
}

.home-quick-grid__item span {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  color: #3a3a42;
  max-width: 76px;
  letter-spacing: 0.01em;
}

.home-promo-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 16px 16px;
  padding: 12px 14px;
  border: 1px solid #ebebeb;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-promo-card:hover {
  border-color: #ddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.home-promo-card__art {
  flex-shrink: 0;
  width: 72px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-promo-card__svg {
  width: 72px;
  height: 58px;
  display: block;
}

.home-promo-card__copy {
  flex: 1;
  min-width: 0;
}

.home-promo-card__copy strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 4px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.home-promo-card__copy span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #8a8a94;
  line-height: 1.35;
}

.home-promo-card__arrow {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-promo-card__arrow svg {
  width: 16px;
  height: 16px;
}
.home-carousel { padding: 0 16px 8px; }
.home-carousel__viewport { overflow: hidden; width: 100%; }
.home-carousel__track {
  display: flex;
  width: 100%;
  transition: transform 0.4s ease;
  will-change: transform;
  touch-action: pan-y;
}
.home-carousel__slide {
  flex: 0 0 100%;
  display: flex;
  gap: 10px;
  min-width: 0;
  box-sizing: border-box;
}
.home-carousel__card {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 12px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.home-carousel__sym { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #6b6b75; margin-bottom: 6px; gap: 6px; font-weight: 400; }
.home-carousel__sym span:last-child { font-weight: 500; font-size: 12px; }
.home-carousel__price { font-size: 18px; font-weight: 500; margin-bottom: 8px; letter-spacing: -0.02em; }
.home-carousel__chart { height: 52px; margin: 0 -2px; }
.home-carousel__dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.home-carousel__dot {
  appearance: none; border: none; padding: 0; cursor: pointer;
  width: 18px; height: 4px; border-radius: 999px; background: #ddd;
}
.home-carousel__dot.is-active { background: #111; width: 22px; }
.sparkline { width: 100%; height: 100%; display: block; }
.sparkline--placeholder { opacity: 0.55; }
.home-banner { padding: 8px 16px 0; }
.home-banner__viewport {
  overflow: hidden;
  border-radius: 12px;
  height: 160px;
  background: #111;
}
.home-banner__track {
  display: flex;
  height: 100%;
  transition: transform 0.45s ease;
}
.home-banner__slide {
  flex: 0 0 100%;
  height: 100%;
}
.home-banner__slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.home-banner__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.home-banner__dots button {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: #ddd;
  border: none;
  padding: 0;
  cursor: pointer;
}
.home-banner__dots .is-active {
  background: #111;
  width: 22px;
}
.home-banner-fallback {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 16px 0;
  padding: 22px 20px;
  min-height: 148px;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 90% at 85% 50%, rgba(45, 212, 191, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 80% at 95% 80%, rgba(236, 72, 153, 0.2), transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #111827 45%, #0b1220 100%);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.28);
}
.home-banner-fallback__copy {
  position: relative;
  z-index: 1;
  max-width: 62%;
}
.home-banner-fallback__brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.home-banner-fallback__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.home-banner-fallback__brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.home-banner-fallback__slogan {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}
.home-banner-fallback__mark {
  position: absolute;
  right: -8px;
  bottom: -18px;
  width: 132px;
  height: 132px;
  object-fit: contain;
  opacity: 0.92;
  pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}
.home-market-table { margin-top: 8px; padding-bottom: 8px; }
.home-market-table .row {
  padding-top: 11px;
  padding-bottom: 11px;
  font-size: 14px;
}
.home-market-table .market-name-text {
  color: #1c1c1e;
  font-weight: 500;
  font-size: 14px;
}
.home-market-table .row > span:nth-child(2) {
  font-weight: 500;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #1c1c1e;
}
.home-market-table .row > span:nth-child(2).price-up { color: var(--upa-green); }
.home-market-table .row > span:nth-child(2).price-down { color: var(--upa-red); }
.home-market-table .badge-up,
.home-market-table .badge-down {
  color: #fff;
}
.market-empty { padding: 24px; text-align: center; color: #999; }

.trade-top-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #f0f0f0; background: #fff;
}
.trade-top-bar__back, .trade-top-bar__menu, .trade-top-bar__star {
  border: none; background: none; font-size: 22px; color: #999; text-decoration: none; padding: 0; line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.trade-top-bar__back, .trade-top-bar__menu { color: #333; }
.trade-top-bar__star {
  width: 32px;
  height: 32px;
  color: #b0b0b0;
  transition: color 0.15s ease, transform 0.15s ease;
}
.trade-top-bar__star .ui-icon { display: block; }
.trade-top-bar__star.is-active {
  color: var(--upa-accent);
  transform: scale(1.06);
}
.trade-top-bar__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.trade-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: var(--max-mobile);
  transform: translateX(-50%);
  z-index: 220;
  pointer-events: none;
}
.trade-drawer[hidden] { display: none !important; }
.trade-drawer.is-open {
  pointer-events: auto;
}
.trade-drawer__scrim {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.28s ease;
  cursor: pointer;
}
.trade-drawer.is-open .trade-drawer__scrim {
  opacity: 1;
}
.trade-drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(78%, 320px);
  max-width: 320px;
  background: #fff;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.trade-drawer.is-open .trade-drawer__panel {
  transform: translateX(0);
}
.trade-drawer__tabs {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  padding: 12px 8px 0;
  border-bottom: 1px solid #f0f0f0;
  overflow-x: auto;
  scrollbar-width: none;
}
.trade-drawer__tabs::-webkit-scrollbar { display: none; }
.trade-drawer__tab {
  flex: 0 0 auto;
  appearance: none;
  background: none;
  border: none;
  padding: 8px 10px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #999;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.trade-drawer__tab.is-active {
  color: #111;
  border-bottom-color: var(--upa-accent);
}
.trade-drawer__filters {
  display: flex;
  gap: 8px;
  padding: 12px 12px 8px;
  flex-shrink: 0;
}
.trade-drawer__filter {
  appearance: none;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #666;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.trade-drawer__filter.is-active {
  background: var(--upa-accent);
  border-color: var(--upa-accent);
  color: var(--upa-on-accent);
}
.trade-drawer__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 24px;
}
.trade-drawer__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid #f7f7f7;
}
.trade-drawer__link {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px 12px 16px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.trade-drawer__row.is-active {
  background: #fffbeb;
}
.trade-drawer__row[hidden] {
  display: none !important;
}
.trade-drawer__fav,
.market-row__fav {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: #c8c8c8;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.trade-drawer__fav:hover,
.market-row__fav:hover {
  color: var(--upa-accent);
  background: rgba(245, 197, 24, 0.1);
}
.trade-drawer__fav:focus-visible,
.market-row__fav:focus-visible {
  outline: 2px solid var(--upa-accent, var(--upa-accent));
  outline-offset: 2px;
}
.trade-drawer__fav .ui-icon,
.market-row__fav .ui-icon { display: block; }
.trade-drawer__fav.is-active,
.market-row__fav.is-active {
  color: var(--upa-accent);
}
.trade-drawer__fav.is-active:active,
.market-row__fav.is-active:active,
.trade-drawer__fav:active,
.market-row__fav:active {
  transform: scale(0.92);
}

/* Shared column template: product (icon+meta) | price | fav — head + rows must match */
.market-page-table {
  margin-top: 0;
  --market-fav-col: 44px;
  --market-price-col: 108px;
  --market-icon-size: 32px;
  --market-icon-gap: 10px;
}

/* Must beat .market-table .row { grid-template-columns: 1.4fr 1fr 0.9fr } */
.market-page-table .row.market-page-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--market-fav-col) !important;
  gap: 0;
  align-items: center;
  padding: 8px 6px 8px 16px !important;
  color: #8a8a94;
  font-size: 12px;
  font-weight: 500;
}

.market-page-head__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--market-price-col);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding-right: 4px;
}

/* Mirror .market-row__product so "Products" sits over pair name + % badge */
.market-page-head__product {
  display: flex;
  align-items: center;
  gap: var(--market-icon-gap);
  min-width: 0;
  text-align: left;
}

.market-page-head__icon-spacer {
  width: var(--market-icon-size);
  height: 1px;
  flex-shrink: 0;
  visibility: hidden;
  pointer-events: none;
}

.market-page-head__product-label {
  min-width: 0;
  line-height: 1.2;
}

.market-page-head__price {
  display: block;
  width: 100%;
  text-align: right !important;
  justify-self: stretch;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.market-page-head__fav {
  width: var(--market-fav-col);
  height: 1px;
  justify-self: stretch;
}

.market-page-table .market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--market-fav-col);
  gap: 0;
  align-items: center;
  padding: 0 6px 0 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f5f5f5;
}

.market-page-table .market-row[hidden] {
  display: none !important;
}

.market-page-table .market-row__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--market-price-col);
  gap: 8px;
  align-items: center;
  padding: 12px 4px 12px 16px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.market-row__product {
  display: flex;
  align-items: center;
  gap: var(--market-icon-gap);
  min-width: 0;
}

.market-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.market-row__pair {
  font-size: 14px;
  font-weight: 700;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-row__price {
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c1c1e;
}
.market-row__price.price-up { color: var(--upa-green); }
.market-row__price.price-down { color: var(--upa-red); }

.market-page-table .market-row__fav {
  margin-right: 0;
}

.market-page-table .badge-up,
.market-page-table .badge-down {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  color: #fff;
  min-width: 58px;
  text-align: center;
}

.market-page-table .badge-up {
  background: var(--upa-green);
  color: #fff;
}

.market-page-table .badge-down {
  background: #c62828;
  color: #fff;
}

html[data-theme="dark"] .market-row__pair {
  color: var(--mc-text);
}

html[data-theme="dark"] .market-page-table .market-row {
  border-bottom-color: #222222;
}

html[data-theme="dark"] .market-row__fav {
  color: #6b6b75;
}

html[data-theme="dark"] .market-row__fav.is-active {
  color: var(--upa-accent);
}

.trade-drawer__name {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}
.trade-drawer__price {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.trade-drawer__empty {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 32px 16px;
  margin: 0;
}

.trade-top-bar__divider { width: 1px; height: 18px; background: #e5e5e5; }
.trade-top-bar__pair { flex: 1; margin: 0; font-size: 16px; font-weight: 700; text-align: left; }
.trade-summary { display: flex; gap: 12px; padding: 12px 16px; }
.trade-summary__left { min-width: 120px; }
.trade-summary__price {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.trade-summary__stats {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 10px; color: #999;
  /* Nudge stats block slightly right for balance vs large last-price */
  margin-left: 20px;
  padding-left: 4px;
}
.trade-summary__stats strong { display: block; color: #333; font-size: 11px; margin-top: 2px; }
.trade-timeframes {
  display: flex; gap: 12px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; align-items: center;
}
.trade-timeframes::-webkit-scrollbar { display: none; }
.trade-timeframes a,
.trade-timeframes button {
  flex-shrink: 0; font-size: 12px; color: var(--upa-nav-inactive); text-decoration: none; padding-bottom: 6px;
  border-bottom: 2px solid transparent; font-weight: 500; letter-spacing: 0.01em;
  background: none; border-top: none; border-left: none; border-right: none; cursor: pointer;
  font-family: inherit; appearance: none; -webkit-appearance: none;
}
.trade-timeframes a.active,
.trade-timeframes button.active {
  color: var(--upa-nav-active); font-weight: 700; border-bottom-color: var(--upa-nav-active);
}
.trade-ma-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  min-height: 0;
  line-height: 1.25;
  background: transparent;
  /* Soft halo + micro edge so pastel legend text reads on white without neon. */
  text-shadow:
    0 0 2px var(--tv-chart-bg, #ffffff),
    0 0.5px 0 rgba(0, 0, 0, 0.18);
}
/* Overlay inside .chart-box--tv — does not consume layout above the widget. */
.chart-box--tv > .trade-ma-legend {
  position: absolute;
  top: 8px;
  left: 10px;
  right: auto;
  /* Cap width so flex-wrap can break MA lines instead of overlapping. */
  max-width: calc(100% - 72px);
  z-index: 3;
  padding: 0;
  margin: 0;
  min-height: 0;
  pointer-events: none;
  box-sizing: border-box;
}
.trade-ma-legend__item { white-space: nowrap; }
/* Pane-local VOL / MACD legends — top set by JS from chart.panes() heights. */
.trade-pane-legend {
  position: absolute;
  left: 10px;
  right: auto;
  max-width: calc(100% - 64px);
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  margin: 0;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #5C5F6A;
  pointer-events: none;
  user-select: none;
  box-sizing: border-box;
  text-shadow:
    0 0 2px var(--tv-chart-bg, #ffffff),
    0 0.5px 0 rgba(0, 0, 0, 0.18);
}
.trade-pane-legend__item { white-space: nowrap; }
.trade-pane-legend.is-hidden { display: none; }
.trade-hl-label {
  position: absolute;
  z-index: 4;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: #5C5F6A;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.trade-hl-label.is-right::before,
.trade-hl-label.is-left::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  opacity: 0.85;
}
.trade-hl-label.is-right::before { margin-right: 4px; }
.trade-hl-label.is-left::after { margin-left: 4px; }
.trade-hl-label--high { color: #5C5F6A; }
.trade-hl-label--low { color: #5C5F6A; }
html[data-theme="dark"] .trade-ma-legend {
  text-shadow:
    0 0 2px var(--tv-chart-bg, #0F0F0F),
    0 0.5px 0 rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .trade-pane-legend,
html[data-theme="dark"] .trade-hl-label {
  color: #a8a8b0;
  text-shadow:
    0 0 2px var(--tv-chart-bg, #0F0F0F),
    0 0.5px 0 rgba(255, 255, 255, 0.12);
}
.chart-box--candles {
  margin: 0;
  border-radius: 0;
  background: #ffffff;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 300px;
  max-height: none;
  position: relative;
  touch-action: none;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
/* Trade LC chart: same viewport budget as prior TV box; legend overlays top-left. */
.chart-box--candles.chart-box--tv-lc {
  --tv-chart-bg: #ffffff;
  min-height: 72vh;
  overflow: hidden;
}
/* Hide LC canvas until first history load + realtime viewport (avoids fitContent squeeze flash). */
.chart-box--candles.chart-box--tv-lc.is-chart-loading .trade-chart-host,
.chart-box--candles.chart-box--tv-lc.is-chart-loading > .trade-ma-legend {
  opacity: 0;
  visibility: hidden;
}
.chart-box--candles.chart-box--tv-lc.is-chart-loading {
  background-image: linear-gradient(
    90deg,
    rgba(42, 46, 57, 0.04) 0%,
    rgba(42, 46, 57, 0.08) 50%,
    rgba(42, 46, 57, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: trade-chart-loading-shimmer 1.2s ease-in-out infinite;
}
html[data-theme="dark"] .chart-box--candles.chart-box--tv-lc.is-chart-loading {
  background-image: linear-gradient(
    90deg,
    rgba(242, 242, 242, 0.03) 0%,
    rgba(242, 242, 242, 0.07) 50%,
    rgba(242, 242, 242, 0.03) 100%
  );
}
@keyframes trade-chart-loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.mobile-shell.has-tabbar.has-trade-actions .chart-box--candles.chart-box--tv-lc {
  flex: 1 1 auto;
  min-height: clamp(420px, 62vh, calc(100dvh - 200px));
  max-height: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.chart-box--candles.chart-box--tv-lc > .trade-ma-legend {
  position: absolute;
  top: 8px;
  left: 10px;
  right: auto;
  max-width: calc(100% - 72px);
  z-index: 3;
  padding: 0;
  margin: 0;
  min-height: 0;
  pointer-events: none;
  box-sizing: border-box;
}
.chart-box--candles.chart-box--tv-lc.is-chart-loading > .trade-pane-legend,
.chart-box--candles.chart-box--tv-lc.is-chart-loading > .trade-hl-label {
  opacity: 0;
  visibility: hidden;
}
html[data-theme="dark"] .chart-box--candles.chart-box--tv-lc {
  --tv-chart-bg: #0F0F0F;
  background: #0F0F0F;
}
.chart-box--candles.is-panning {
  cursor: grabbing;
}
.chart-box--candles.is-y-hover,
.chart-box--candles.is-y-zooming {
  cursor: ns-resize;
}
/* Lightweight Charts owns canvas width/height/position — do NOT force
   absolute inset + 100% size (legacy custom-canvas rule). That collapses the
   bitmap to ~300×150 and makes thin forex candles look empty/flat. */
.trade-chart-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.trade-chart-host canvas {
  touch-action: none;
}
.trade-chart-host table {
  font-family: inherit !important;
}

.trade-inline-countdown {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
  margin: 0;
  padding: 10px 16px;
  background: linear-gradient(90deg, #fffdf2 0%, #fff 55%);
  border-top: 1px solid #f0e6b8;
  border-bottom: 1px solid #f0f0f0;
}
.trade-inline-countdown[hidden] { display: none !important; }
.trade-inline-countdown__timer {
  display: flex; align-items: baseline; gap: 4px; grid-row: 1 / span 2;
}
.trade-inline-countdown__label {
  display: none; font-size: 10px; color: #999; text-transform: uppercase; letter-spacing: .04em;
}
.trade-inline-countdown__value {
  font-size: 28px; font-weight: 800; color: #111; line-height: 1; min-width: 1.4em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.trade-inline-countdown__unit { font-size: 12px; color: #999; font-weight: 600; }
.trade-inline-countdown__meta {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; color: #666;
}
.trade-inline-countdown__meta span:first-child { font-weight: 700; color: #111; font-size: 13px; }
.trade-inline-countdown__bar {
  grid-column: 1 / -1; height: 3px; background: #f0f0f0; border-radius: 999px; overflow: hidden; margin-top: 2px;
}
.trade-inline-countdown__bar span {
  display: block; height: 100%; background: var(--upa-accent); transition: width .4s linear;
}

.trade-market-panels {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  overflow: hidden;
}
.trade-market-panels__tabs {
  display: flex; gap: 0; flex-shrink: 0; border-bottom: 1px solid #f0f0f0; padding: 0 8px;
}
.trade-market-panels__tab {
  flex: 1; appearance: none; background: none; border: none; padding: 10px 4px;
  font-size: 12px; font-weight: 600; color: var(--upa-nav-inactive); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.trade-market-panels__tab.is-active {
  color: var(--upa-nav-active); border-bottom-color: var(--upa-nav-active);
}
.trade-market-panels__pane {
  flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
}
.trade-market-panels__pane[hidden] { display: none !important; }
.trade-market-panels__pane.is-active { display: block; }

.trade-book__head,
.trade-tape__head {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 8px;
  padding: 8px 16px 4px; font-size: 10px; color: #bbb; position: sticky; top: 0; background: #fff; z-index: 1;
}
.trade-book__head span:nth-child(2),
.trade-book__head span:nth-child(3),
.trade-tape__head span:nth-child(2),
.trade-tape__head span:nth-child(3) { text-align: right; }

.trade-book__row,
.trade-tape__row {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 8px;
  padding: 3px 16px; font-size: 11px; font-variant-numeric: tabular-nums; position: relative;
}
.trade-book__row span:nth-child(2),
.trade-book__row span:nth-child(3),
.trade-tape__row span:nth-child(2),
.trade-tape__row span:nth-child(3) { text-align: right; color: #666; }
.trade-book__row::before {
  content: ""; position: absolute; top: 1px; bottom: 1px; right: 0;
  width: var(--depth, 0%); max-width: 70%; pointer-events: none;
}
.trade-book__row.is-ask::before { background: rgba(246, 70, 93, 0.1); }
.trade-book__row.is-bid::before { background: rgba(46, 189, 133, 0.12); }
.trade-book__mid {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 8px 16px; border-top: 1px solid #f5f5f5; border-bottom: 1px solid #f5f5f5; background: #fafafa;
}
.trade-book__mid strong { font-size: 16px; font-weight: 800; }
.trade-book__mid span { font-size: 10px; color: #999; }

.trade-positions-panel { padding: 0 16px 12px; }
.trade-positions-panel__empty { text-align: center; color: #bbb; font-size: 12px; padding: 28px 8px; margin: 0; }
.trade-positions-panel__all {
  display: block; text-align: center; font-size: 12px; font-weight: 600; padding: 10px 0 4px; color: var(--upa-accent);
}

@media (min-width: 900px) {
  .mobile-shell.trade-shell.has-tabbar.has-trade-actions .chart-box--candles {
    flex: 1 1 auto;
    max-height: none;
    min-height: 360px;
  }
  .trade-inline-countdown__label { display: inline; margin-right: 6px; }
}

/* Narrow phones: denser MA / pane legends so labels wrap instead of collide. */
@media (max-width: 400px) {
  .trade-ma-legend {
    font-size: 10px;
    column-gap: 8px;
    row-gap: 1px;
  }
  .chart-box--tv > .trade-ma-legend,
  .chart-box--candles.chart-box--tv-lc > .trade-ma-legend {
    max-width: calc(100% - 58px);
  }
  .trade-pane-legend {
    font-size: 9px;
    column-gap: 6px;
    max-width: calc(100% - 52px);
  }
}

/*
 * Short viewports (iPhone Mini / SE / ~667–800px): scroll-first trade layout.
 * Flex the LC host into the shell leftover above sticky Buy + tabbar so 701–800px
 * phones do not keep a solid 440px host (that left a white dead strip under the
 * time axis). min-height keeps VOL/MACD readable; shell scrolls when content is taller.
 * Buy Up/Down stay position:fixed above the tabbar (see .trade-bottom-actions).
 */
@media (max-height: 800px) {
  .mobile-shell.has-tabbar.has-trade-actions {
    /* Stay viewport-tall and scroll internally (don't expand the document). */
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    /*
     * Pad ≈ tabbar + Buy so content ends at the sticky actions (not under them).
     * Prior 120px pad overscrolled; solid 440px host under-filled 701–800px.
     */
    padding-bottom: calc(105px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }
  .mobile-shell.has-tabbar.has-trade-actions .page-body {
    overflow: visible;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    /*
     * Fill to the pad line (Buy top). Fixed page-body height was not required —
     * min-height lets market panels extend and scroll when present.
     */
    min-height: calc(100dvh - 105px - env(safe-area-inset-bottom, 0px));
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary {
    padding: 6px 12px 6px 14px;
    gap: 8px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__left {
    min-width: 96px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__price {
    font-size: 22px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__stats {
    gap: 2px 8px;
    margin-left: 8px;
    padding-left: 0;
    font-size: 9px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__stats strong {
    font-size: 10px;
    margin-top: 0;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes {
    padding: 0 12px 4px;
    gap: 10px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes a,
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes button {
    font-size: 11px;
    padding-bottom: 4px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .chart-box--candles {
    min-height: 400px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .chart-box--candles.chart-box--tv-lc {
    flex: 1 1 auto;
    /*
     * Grow into leftover height (closes 701–800px dead strip). Floor keeps
     * candles + VOL/MACD readable; shell scrolls when min-height exceeds leftover.
     */
    min-height: 420px;
    height: auto;
    max-height: none;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-market-panels {
    flex: 0 0 auto;
    min-height: 140px;
    max-height: none;
  }
}

/* Extra-short (SE / Mini ~667px): denser header; same flex-fill chart (readable floor). */
@media (max-height: 700px) {
  .mobile-shell.has-tabbar.has-trade-actions .trade-top-bar__pair {
    font-size: 15px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary {
    padding: 4px 12px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__price {
    font-size: 20px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .chart-box--candles.chart-box--tv-lc {
    /* Floor only — do not re-pin solid height (regresses flush on short phones). */
    min-height: 400px;
    height: auto;
  }
}

/*
 * Landscape phones (wide + short): chart fills height beside sticky Buy + tabbar.
 * Portrait short rules also flex-fill, but landscape still needs full-width shell,
 * page-body to tabbar (Buy overlays axis), and soft pane floors.
 * Keep shell scroll when pane floors need more than the short viewport.
 */
@media (orientation: landscape) and (max-height: 500px),
       (max-height: 500px) and (min-width: 600px) {
  .mobile-shell.has-tabbar.has-trade-actions {
    /* Use full landscape width — portrait --max-mobile:430 leaves side letterbox. */
    max-width: none;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    /* Same pad as portrait short — do not reintroduce a large Buy gap. */
    padding-bottom: calc(105px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }
  .mobile-shell.has-tabbar.has-trade-actions .tabbar,
  .mobile-shell.has-tabbar.has-trade-actions ~ .tabbar,
  .tabbar {
    max-width: none;
  }
  .trade-bottom-actions {
    max-width: none;
  }
  .mobile-shell.has-tabbar.has-trade-actions .page-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    /*
     * Extend under sticky Buy to the tabbar — Buy overlays the time axis /
     * lower MACD. Stopping at pad-105 left a white dead strip under the chart.
     */
    min-height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px));
    max-height: none;
    overflow: visible;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-top-bar {
    min-height: 40px;
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary {
    padding: 2px 12px;
    gap: 4px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-summary__price {
    font-size: 18px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes {
    padding: 0 12px 2px;
    gap: 10px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes a,
  .mobile-shell.has-tabbar.has-trade-actions .trade-timeframes button {
    font-size: 11px;
    padding-bottom: 2px;
  }
  .mobile-shell.has-tabbar.has-trade-actions .chart-box--candles,
  .mobile-shell.has-tabbar.has-trade-actions .chart-box--candles.chart-box--tv-lc {
    flex: 1 1 auto;
    /* Override portrait solid 420/440 — flex into page-body leftover (no dead strip). */
    min-height: 0;
    height: auto;
    max-height: none;
  }
  .mobile-shell.has-tabbar.has-trade-actions .trade-market-panels {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
  }
}

.orders-empty, .orders-end {
  text-align: center; color: #ccc; font-size: 13px; padding: 20px 0;
}

.trade-bottom-actions {
  /* Sticky above tabbar on all heights (preferred over scrolling with content). */
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  width: 100%; max-width: var(--max-mobile); display: grid; grid-template-columns: 1fr 1fr;
  /* No top pad — sits flush under chart time axis (gap was empty strip on Mini). */
  gap: 10px; padding: 0 16px 4px; background: #fff; border-top: 1px solid #f0f0f0; z-index: 90;
}
.trade-bottom-actions button,
.trade-bottom-actions a.trade-bottom-actions__up,
.trade-bottom-actions a.trade-bottom-actions__down {
  height: 44px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.trade-bottom-actions__up { background: var(--upa-green); color: #fff; }
.trade-bottom-actions__down { background: var(--upa-red); color: #fff; }

/* Short phones: pull Buy into LC time-axis whitespace under tick labels. */
@media (max-height: 800px) {
  .trade-bottom-actions {
    /*
     * Chart flex-fills to the pad line; extra padding-bottom grows the bar
     * upward so green/red sit under the tick glyphs (not under a dead strip).
     */
    border-top: none;
    background: transparent;
    padding: 0 16px 14px;
  }
}

/* TradingView advanced chart page (/tv-chart) */
.tv-chart-trade-link {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--upa-accent);
  text-decoration: none;
  padding: 4px 6px;
}
.trade-timeframes__tv {
  margin-left: auto;
  color: var(--upa-accent) !important;
  font-weight: 600;
  white-space: nowrap;
}
.trade-timeframes--tv {
  gap: 10px;
  padding-top: 2px;
}
.trade-timeframes--tv button {
  min-height: 28px;
}
.trade-summary__stats--tv {
  align-content: center;
  justify-content: end;
  display: flex;
  flex: 1;
  grid-template-columns: none;
}
.chart-box--tv {
  /*
   * Logo clip without white right gutter:
   * - Box stays width:100% + overflow:hidden (visible viewport = phone width).
   * - Inner host only: width calc(100% + clip) + translateX(-clip).
   * Never set left:-clip on the absolutely positioned container (that broke
   * left/right:0 and left a blank column). No right-clip / scaleX / white patch.
   * Bottom clip MUST stay 0 — prior 34px ate the time-scale labels (LA times).
   * TV logo is left-clipped; copyright node is visually hidden separately.
   * rightOffset: soft future-bar gap.
   */
  --tv-logo-clip: 56px;
  --tv-bottom-clip: 0px;
  --tv-chart-bg: #ffffff;
  margin: 0;
  border-radius: 0;
  background: var(--tv-chart-bg);
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 65vh;
  max-height: none;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
}
.mobile-shell.has-tabbar.has-trade-actions .chart-box--tv {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.mobile-shell.has-tabbar:not(.has-trade-actions) .chart-box--tv {
  flex: 0 0 auto;
  min-height: 240px;
  height: 36vh;
  max-height: 420px;
}
.chart-box--tv .trade-chart-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Outer container stays full box width — Y-axis stays at visible right edge. */
.chart-box--tv .tradingview-widget-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--tv-bottom-clip));
  height: calc(100% + var(--tv-bottom-clip)) !important;
  width: 100% !important;
  max-width: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: auto;
}
/* Widen + shift host only: left ~48px (TV logo) clips outside the box. */
.chart-box--tv .tradingview-widget-container__widget {
  height: 100% !important;
  width: calc(100% + var(--tv-logo-clip)) !important;
  max-width: none !important;
  transform: translateX(calc(-1 * var(--tv-logo-clip)));
  will-change: transform;
}
.chart-box--tv .tradingview-widget-container iframe {
  display: block;
  width: 100% !important;
  max-width: none;
  height: 100% !important;
  border: 0;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}
/* Free-embed ToS copyright node: keep in DOM, visually hidden (no header attribution). */
.chart-box--tv .tradingview-widget-copyright {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
html:not([data-theme="dark"]) .chart-box.chart-box--tv {
  --tv-chart-bg: #ffffff;
  background: #ffffff;
}
html[data-theme="dark"] .chart-box.chart-box--tv {
  --tv-chart-bg: #0F0F0F;
  background: #0F0F0F;
}

.order-trade-card { padding: 14px 0; border-bottom: 1px solid #f5f5f5; }
.order-trade-card__head {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 10px;
}
.order-trade-card__pair { font-size: 15px; font-weight: 700; }
.order-trade-card__dir { font-size: 12px; font-weight: 600; }
.order-trade-card__dir.is-up { color: var(--upa-green); }
.order-trade-card__dir.is-down { color: var(--upa-red); }
.order-trade-card__pl { font-size: 13px; font-weight: 700; text-align: right; }
.order-trade-card__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px;
}
.order-trade-card__label { display: block; font-size: 10px; color: #999; margin-bottom: 4px; }
.order-trade-card__value { display: block; font-size: 12px; font-weight: 600; color: #333; }
.order-trade-card__foot {
  display: flex; justify-content: space-between; font-size: 10px; color: #bbb;
}
.order-trade-card__status { color: #999; }
.order-trade-card__progress { height: 3px; background: #f0f0f0; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.order-trade-card__progress span { display: block; height: 100%; background: var(--upa-accent); }

.orders-page { padding-bottom: 16px; }
.orders-tabs {
  display: flex; justify-content: center; gap: 28px; border-bottom: 1px solid #f0f0f0;
}
.orders-tabs a {
  padding: 12px 4px; font-size: 15px; color: #999; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.orders-tabs a.active { color: #111; font-weight: 700; border-bottom-color: var(--upa-accent); }
.orders-list { padding: 0 16px; }

.assets-hero { padding: 20px 16px 0; background: #fff; }
.assets-hero__head { display: flex; justify-content: flex-start; align-items: center; font-size: 14px; color: #666; }
.assets-hero__label-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.assets-hero__eye {
  border: none; background: none; padding: 4px; cursor: pointer;
  color: #666; display: inline-flex; align-items: center; justify-content: center; line-height: 0;
}
.assets-hero__eye:hover { color: #111; }
.assets-hero__eye.is-hidden-balance .ui-icon--eye { display: none; }
.assets-hero__eye:not(.is-hidden-balance) .ui-icon--eye-off { display: none; }
.assets-hero__balance {
  font-size: 34px;
  font-weight: 500;
  margin: 8px 0;
  color: #111;
  letter-spacing: -0.02em;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.assets-hero__balance.is-balance-masked { user-select: none; letter-spacing: 0.08em; }
.assets-hero__balance.is-hidden, .is-hidden { filter: blur(6px); user-select: none; }
.assets-hero__sub {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #999; margin-bottom: 16px;
}
.assets-hero__sub strong { color: #333; font-weight: 600; }
.assets-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.assets-actions__btn {
  height: 38px; border-radius: 8px; border: 1px solid #e5e5e5; background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
  color: #333; text-decoration: none;
}
.assets-actions__btn--primary {
  background: var(--upa-accent);
  border-color: var(--upa-accent);
  color: var(--upa-on-accent) !important;
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 700;
}
.assets-stats {
  display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
}
.assets-stats > div { padding: 14px 16px; }
.assets-stats > div:first-child { border-right: 1px solid #f0f0f0; }
.assets-stats__label { font-size: 12px; color: #999; margin-bottom: 6px; }
.assets-stats__value { font-size: 18px; font-weight: 700; color: #111; }
.assets-help-btn {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid #ccc; background: #fff;
  font-size: 10px; line-height: 1; color: #999; padding: 0; cursor: pointer; vertical-align: middle;
}
.assets-positions { padding: 16px; }
.assets-positions h2 { margin: 0 0 8px; font-size: 15px; }
.assets-positions__empty { text-align: center; color: #999; padding: 24px 0; }
.assets-instruction-title { text-align: center; margin: 0 0 12px; font-size: 17px; }
.assets-instruction-list { margin: 0 0 16px; padding-left: 18px; color: #666; font-size: 13px; line-height: 1.5; }

.trade-modal[hidden] { display: none !important; }
.trade-modal { position: fixed; inset: 0; z-index: 360; pointer-events: auto; }
.trade-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.trade-modal__sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: var(--max-mobile); margin: 0 auto;
  background: #fff; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 90vh; overflow-y: auto;
}
.trade-modal__sheet--compact { border-radius: 14px; left: 16px; right: 16px; bottom: auto; top: 50%; transform: translateY(-50%); padding: 22px 20px 18px; }
.trade-modal__head { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 12px; }
.trade-modal__head h2 { margin: 0; font-size: 17px; font-weight: 700; color: #111; }
.trade-modal__close {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: none; background: none; font-size: 24px; color: #999; cursor: pointer; line-height: 1;
}
.trade-modal__primary {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}
.trade-modal__secondary {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  margin-top: 10px;
  background: #f5f5f5 !important;
  color: #333 !important;
  font-size: 15px;
  font-weight: 600;
}
.trade-countdown { position: relative; width: 148px; height: 148px; margin: 18px auto 22px; }
.trade-countdown__value {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 48px; font-weight: 700; color: #111; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  z-index: 1;
  pointer-events: none;
}
.trade-countdown__ring { width: 148px; height: 148px; transform: rotate(-90deg); }
.trade-countdown__ring-track { stroke: #ececec; }
.trade-countdown__meta {
  text-align: center; color: #666; font-size: 13px; margin: 0 0 4px;
}
.trade-result { text-align: center; }
.trade-result__pnl-label {
  margin: 8px 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #111;
}
.trade-result__amount {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}
.trade-result.is-won .trade-result__amount { color: #16a34a; }
.trade-result.is-lost .trade-result__amount { color: #ef4444; }
.trade-result__rows {
  text-align: left; font-size: 14px; color: #666; margin-bottom: 18px;
  border-top: 1px solid #f0f0f0; padding-top: 12px;
}
.trade-result__rows div {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px;
}
.trade-result__rows div:last-child { margin-bottom: 0; }
.trade-result__rows strong { color: #111; font-weight: 600; font-size: 14px; }

.trade-modal__meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 12px; color: #666; margin-bottom: 16px;
}
.trade-modal__meta strong { display: block; color: #111; font-size: 13px; margin-top: 2px; }
.trade-modal__section { margin-bottom: 14px; position: relative; z-index: 2; overflow: visible; }
.trade-modal__section-title { font-size: 13px; color: #666; margin-bottom: 8px; }
.duration-cards-wrap {
  position: relative;
  overflow: visible;
  z-index: 2;
  pointer-events: auto;
}
.duration-cards-track {
  position: relative;
  display: block;
  width: 100%;
}
.duration-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  overflow: visible;
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.duration-cards.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.duration-cards::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.duration-card {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 76px;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  pointer-events: auto;
  isolation: isolate;
}
.duration-cards-scroll {
  display: none;
}
.duration-cards-scroll__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: #111;
  transform: translateX(0);
  will-change: transform, width;
}
html[data-theme="dark"] .duration-cards-scroll {
  background: #3a3a3c;
}
html[data-theme="dark"] .duration-cards-scroll__thumb {
  background: #f2f2f7;
}
.trade-market-closed {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: #b45309;
  background: #fff7ed;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.trade-bottom-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.duration-card {
  position: relative;
  z-index: 2;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 12px 8px 10px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  pointer-events: auto;
}
.duration-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
  z-index: 4;
  -webkit-tap-highlight-color: transparent;
}
.duration-card > span {
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.duration-card.is-selected { border-color: var(--upa-accent); background: rgba(245, 197, 24, 0.08); }
.duration-card__ribbon {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  display: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.duration-card__ribbon::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 24px 24px 0 0;
  border-color: var(--upa-accent) transparent transparent transparent;
}
.duration-card__ribbon::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}
.duration-card.is-selected .duration-card__ribbon { display: block; }
.duration-card__label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #888;
  margin-bottom: 4px;
}
.duration-card__time {
  display: block;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #111;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.duration-card__dur { display: block; font-size: 11px; color: #666; }
.duration-card__income {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--upa-green);
}
.trade-modal__amount-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.trade-modal__min { color: #999; font-size: 11px; }
.trade-amount-input {
  display: flex; align-items: center; gap: 8px; border: 1px solid #e5e5e5; border-radius: 8px; padding: 0 12px; height: 44px;
}
.trade-amount-input input { flex: 1; border: none; outline: none; font-size: 15px; min-width: 0; }
.trade-amount-clear { border: none; background: none; color: #ccc; font-size: 18px; cursor: pointer; }
.trade-amount-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.trade-amount-quick button {
  height: 34px; border: 1px solid #eee; border-radius: 6px; background: #fafafa; font-size: 12px; cursor: pointer;
}
.trade-modal__summary { font-size: 12px; color: #666; margin: 12px 0; }
.trade-modal__summary div { display: flex; justify-content: space-between; margin-bottom: 6px; }
.trade-modal__summary strong { color: #111; }
.trade-modal__submit { margin-top: 4px; }

.security-page {
  background: #fff;
  min-height: calc(100dvh - 44px);
  padding: 0 0 28px;
}
.security-card {
  background: #fff;
}
.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  color: inherit;
  text-decoration: none;
  min-height: 52px;
  box-sizing: border-box;
}
.security-row--link:active { background: #fafafa; }
.security-row__label {
  font-size: 15px;
  color: #111;
  font-weight: 500;
}
.security-row__value {
  font-size: 14px;
  color: #999;
  text-align: right;
  word-break: break-all;
}
.security-row__trail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.security-row__status.is-unbound {
  color: #ef4444;
  font-size: 14px;
}
.security-row__chevron {
  color: #c8c8c8;
  font-size: 20px;
  line-height: 1;
}
.security-section-label {
  padding: 14px 16px 8px;
  font-size: 13px;
  color: #999;
  background: #f7f7f7;
}
.security-form {
  padding: 16px;
}
.security-hint {
  margin: 0 0 16px;
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

.method-list-page { padding-top: 4px; }
.method-list-item {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid #f0f0f0;
  text-decoration: none; color: inherit;
}
.method-list-item__icon {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #fff8dd; color: #c9a100; font-size: 18px;
}
.method-list-item__label { flex: 1; font-size: 15px; font-weight: 500; }
.method-list-item__arrow { color: #ccc; font-size: 20px; }

.fund-tabs {
  display: flex; justify-content: center; gap: 20px; border-bottom: 1px solid #f0f0f0;
}
.fund-tabs a {
  padding: 12px 6px; font-size: 14px; color: #999; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.fund-tabs a.active { color: #111; font-weight: 700; border-bottom-color: var(--upa-accent); }
.fund-list { padding: 0; }
.fund-item { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; }
.fund-item__row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.fund-item__sub, .fund-item__meta { margin-top: 6px; font-size: 11px; color: #999; }
.fund-empty { text-align: center; color: #999; padding: 32px 16px; }

.auth-page {
  min-height: 100dvh;
  background: linear-gradient(180deg, #fffdf5 0%, #ffffff 42%, #ffffff 100%);
  padding: 12px 22px 40px;
}
.auth-page__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  min-height: 40px;
}
.auth-page__back {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: #111; text-decoration: none; line-height: 1; border-radius: 50%;
}
.auth-page__link {
  color: #333; font-size: 18px; font-weight: 600; text-decoration: none;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
}
.auth-page__heading {
  flex: 1; text-align: center; font-size: 17px; font-weight: 700; margin: 0; color: #111;
}
.auth-page__top-spacer { width: 36px; }
.auth-page__brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 18px;
}
.auth-page__brand img {
  width: 56px; height: 56px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 8px 20px rgba(245, 197, 24, 0.25);
}
.auth-page__brand--compact { margin-bottom: 12px; }
.auth-page__brand--compact img { width: 48px; height: 48px; border-radius: 12px; }
.auth-page__brand-name {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: #111;
}
.auth-page__title { font-size: 22px; font-weight: 700; margin: 0 0 18px; color: #111; line-height: 1.35; }
.auth-page__intro {
  margin: 0 0 18px; font-size: 13px; color: #666; line-height: 1.5;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 20px;
  padding: 5px;
  background: #f3f3f3;
  border-radius: 12px;
}
.auth-tabs__tab {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; border-radius: 9px;
  height: 40px; font-size: 14px; font-weight: 600; color: #888;
  cursor: pointer; font-family: inherit;
}
.auth-tabs__tab.is-active {
  color: #111; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.auth-tabs--underline {
  display: flex;
  gap: 28px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border-bottom: 1px solid #ececec;
  margin-bottom: 22px;
}
.auth-tabs--underline .auth-tabs__tab {
  flex: 0 0 auto;
  height: auto;
  padding: 0 2px 12px;
  border-radius: 0;
  color: #999;
  font-size: 16px;
  font-weight: 600;
  box-shadow: none;
  background: transparent;
  position: relative;
}
.auth-tabs--underline .auth-tabs__tab.is-active {
  color: #111;
  background: transparent;
  box-shadow: none;
}
.auth-tabs--underline .auth-tabs__tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--upa-accent);
}
.auth-phone-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.auth-phone-dial {
  flex: 0 0 56px;
  height: 48px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #111;
  background: #fff;
}
.auth-phone-row input {
  flex: 1;
  min-width: 0;
}
.auth-country-trigger {
  width: 100%;
  height: 48px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.auth-country-trigger__flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.auth-country-trigger__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-country-trigger__chevron {
  color: #aaa;
  font-size: 12px;
}
.auth-send-code--link {
  min-width: auto;
  border: none;
  background: transparent;
  color: var(--upa-accent);
  font-weight: 700;
  padding: 0 4px;
}
.auth-send-code--link:disabled {
  background: transparent;
  border: none;
  color: #aaa;
}
.auth-country-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: center;
}
.auth-country-sheet[hidden] { display: none !important; }
.auth-country-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.auth-country-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-mobile, 480px);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.auth-country-sheet__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid #eee;
}
.auth-country-sheet__search-icon {
  color: #999;
  font-size: 18px;
  line-height: 1;
}
.auth-country-sheet__search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: #f7f7f7;
}
.auth-country-sheet__cancel {
  border: none;
  background: none;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 4px;
}
.auth-country-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.auth-country-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid #f2f2f2;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.auth-country-item__flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.auth-country-item__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-country-item__dial {
  font-size: 13px;
  color: #888;
  flex-shrink: 0;
}
body.auth-country-open {
  overflow: hidden;
}
.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  background: #f3f3f3;
  border-radius: 12px;
}
.auth-mode-tabs__tab {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; border-radius: 9px;
  height: 40px; font-size: 13px; font-weight: 600; color: #888;
  cursor: pointer; font-family: inherit; padding: 0 8px;
}
.auth-mode-tabs__tab.is-active {
  color: #111; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.auth-field { margin-bottom: 16px; }
.auth-field[hidden],
.auth-otp-hint[hidden] { display: none !important; }
.auth-field label { display: block; font-size: 13px; color: #333; margin-bottom: 8px; font-weight: 600; }
.auth-field input {
  width: 100%; height: 48px; border: 1px solid #e6e6e6; border-radius: 12px;
  padding: 0 14px; font-size: 14px; background: #fff; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-field input:focus {
  border-color: var(--upa-accent);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.2);
}
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 46px; }
.auth-password-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; padding: 6px;
  color: #888; display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
}
.auth-password-toggle:hover { color: #333; }
.ui-eye-swap { display: inline-flex; align-items: center; justify-content: center; }
.ui-eye-swap__hide { display: none; }
.ui-eye-swap[data-eye-state="visible"] .ui-eye-swap__show { display: none; }
.ui-eye-swap[data-eye-state="visible"] .ui-eye-swap__hide { display: inline-flex; }
.ui-icon { display: block; }
.auth-otp-row {
  display: flex; align-items: stretch; gap: 10px;
}
.auth-otp-row input {
  flex: 1; min-width: 0;
}
.auth-send-code {
  flex: 0 0 auto;
  min-width: 108px;
  height: 48px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 12px;
  font-family: inherit;
}
.auth-send-code:disabled {
  background: #ddd; border-color: #ddd; color: #888; cursor: not-allowed;
}
.auth-otp-hint {
  margin: 10px 0 0; font-size: 13px; color: #1a1a1a; line-height: 1.45;
  background: #fff8d9; border: 1px solid #f5e6a3; border-radius: 10px; padding: 10px 12px;
}
.auth-otp-hint[hidden] { display: none !important; }
.auth-submit { margin-top: 8px; height: 50px; border-radius: 28px; font-size: 16px; font-weight: 700; }
.auth-register-btn { margin-top: 12px; text-decoration: none; height: 46px; border-radius: 30px; }
.auth-forgot-wrap { text-align: right; margin-top: 14px; }
.auth-forgot-wrap--split { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  user-select: none;
}
.auth-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #111;
  cursor: pointer;
}
.auth-forgot {
  color: #888; font-size: 13px; text-decoration: none;
  border: none; background: none; cursor: pointer; padding: 0; font-family: inherit;
}
.auth-forgot:hover { color: #111; }
.auth-switch { margin-top: 22px; font-size: 13px; color: #666; }
.auth-switch a { color: #111; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth-switch--center { text-align: center; }

/* legacy absolute OTP layout fallback */
.auth-otp-wrap { position: relative; }
.auth-otp-wrap input { padding-right: 100px; }
.auth-otp-wrap .auth-send-code {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  min-width: auto; height: auto; border: none; background: none; color: var(--upa-accent);
  padding: 0; border-radius: 0;
}

body.modal-open { overflow: hidden; }
/* Keep % change as solid green/red pills with white text (do not dilute to tinted text) */
.badge-up, .badge-down {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  color: #fff;
}
.badge-up { background: var(--upa-green); color: #fff; }
.badge-down { background: #c62828; color: #fff; }

.app-top-actions a {
  border: 1px solid #e8e8e8; border-radius: 50%; font-size: 16px;
}

.app-top-actions .theme-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
  background: transparent;
  color: #333;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   RTL support (Arabic). Practical flips only — flex/grid layouts mostly
   mirror automatically once `dir="rtl"` is set on <html>; the rules below
   handle the remaining hardcoded left/right values.
   ========================================================================== */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .page-body,
html[dir="rtl"] .mobile-shell,
html[dir="rtl"] .auth-page {
  text-align: right;
}

html[dir="rtl"] .tabbar {
  direction: rtl;
}

html[dir="rtl"] .tabbar a.active .tabbar-icon-wrap {
  /* keep icon centering symmetric under RTL */
  margin-inline: auto;
}

html[dir="rtl"] .app-top-bar {
  direction: rtl;
}

html[dir="rtl"] .app-top-bar .app-top-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] ul,
html[dir="rtl"] ol {
  padding-right: 1.25em;
  padding-left: 0;
}

html[dir="rtl"] .trade-top-bar {
  direction: rtl;
}

html[dir="rtl"] .trade-top-bar__pair {
  text-align: right;
}

html[dir="rtl"] .trade-top-bar__back,
html[dir="rtl"] .trade-top-bar__menu,
html[dir="rtl"] .trade-top-bar__star {
  transform: scaleX(-1);
}

html[dir="rtl"] .auth-page__top {
  direction: rtl;
}

html[dir="rtl"] .auth-page__back {
  transform: scaleX(-1);
}

html[dir="rtl"] .auth-forgot-wrap {
  text-align: left;
}

html[dir="rtl"] .auth-switch {
  text-align: center;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea {
  text-align: right;
}

html[dir="rtl"] .admin-layout {
  direction: rtl;
}

/* ==========================================================================
   Language picker (dark list + circular flags — matches product reference)
   ========================================================================== */
body.lang-page-body {
  background: #2b2c36;
}

.mobile-shell--dark {
  background: #2b2c36;
  min-height: 100dvh;
  box-shadow: none;
}

.page-header--dark {
  background: #2b2c36;
  border-bottom: none;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 16px;
  height: 52px;
}

.page-header--dark h1 {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  position: static;
  transform: none;
  text-align: left;
}

/* Force-dark pages (e.g. Investment Order) keep a light chevron even when
   the user theme is light — base/light rules use #111 !important otherwise. */
html:not([data-theme="dark"]) .page-header--dark .header-back,
html[data-theme="dark"] .page-header--dark .header-back,
.page-header--dark .header-back {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  color: #fff !important;
  -webkit-text-stroke: 0 !important;
  font-size: 28px;
  line-height: 1;
  margin: 0 0 0 -8px;
  padding: 0;
  text-decoration: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 3;
  pointer-events: auto;
  box-sizing: border-box;
}
.page-header--dark .header-back svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.page-body--dark {
  background: #2b2c36;
  padding: 8px 0 32px;
  min-height: calc(100dvh - 52px);
}

.mobile-shell--dark .flash {
  margin: 8px 12px;
  border-radius: 8px;
}

.lang-picker {
  padding: 4px 12px 28px;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
}

.lang-picker__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.lang-picker__item {
  margin: 0;
  width: 100%;
}

.lang-picker__form {
  margin: 0;
  display: block;
  width: 100%;
}

.lang-picker__btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
  box-sizing: border-box;
}

.lang-picker__btn:hover,
.lang-picker__btn:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.lang-picker__btn.is-active {
  background: linear-gradient(90deg, var(--upa-accent) 0%, rgba(245, 197, 24, 0.55) 42%, rgba(245, 197, 24, 0.08) 100%);
  color: #fff;
  font-weight: 700;
}

.lang-picker__flag {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  background: #1a1a22;
}

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

.lang-picker__name {
  flex: 1;
  line-height: 1.3;
}

html[dir="rtl"] .lang-picker__btn {
  text-align: right;
  flex-direction: row-reverse;
}

/* ==========================================================================
   Night mode (data-theme="dark")
   ========================================================================== */
.theme-toggle {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
}

.theme-toggle__icon {
  display: none;
  line-height: 0;
}

html:not([data-theme="dark"]) .theme-toggle__icon--moon,
html[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

.pc-top__action.theme-toggle {
  border: none;
  background: transparent;
  color: #222;
  cursor: pointer;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

/* Night mode applies to the exchange shell; on desktop, keep a light page frame around it */
html[data-theme="dark"] body {
  background: #1c1c1e;
  color: #111;
}

html[data-theme="dark"] .mobile-shell {
  background: #1c1c1e;
  box-shadow: none;
  color: var(--mc-text);
}

@media (min-width: 480px) {
  html[data-theme="dark"] body {
    background: var(--mc-page-frame);
  }

  html[data-theme="dark"] .mobile-shell {
    box-shadow: 0 0 28px rgba(0, 0, 0, 0.22);
  }
}

html[data-theme="dark"] .app-top-bar,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .pc-top {
  background: #1c1c1e;
  border-bottom-color: #1f1f1f;
}

html[data-theme="dark"] .app-header-avatar {
  background: #3a3a3c;
  color: #e8e8e8;
}

html[data-theme="dark"] .page-header h1,
html[data-theme="dark"] .pc-top__title {
  color: var(--mc-text-secondary);
}

html[data-theme="dark"] .pc-top__back,
html[data-theme="dark"] .pc-top__action,
html[data-theme="dark"] .pc-top__action.theme-toggle,
html[data-theme="dark"] .header-back {
  color: #f2f2f2;
}

html[data-theme="dark"] .app-search {
  background: #2c2c2e;
}

html[data-theme="dark"] .app-search input {
  color: #f2f2f2;
  background: transparent;
}

html[data-theme="dark"] .app-search input::placeholder {
  color: #8b8b96;
}

html[data-theme="dark"] .app-search-icon {
  color: #8b8b96;
}

html[data-theme="dark"] .app-top-actions a,
html[data-theme="dark"] .app-top-actions .theme-toggle {
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .page-body,
html[data-theme="dark"] .pc-page,
html[data-theme="dark"] .deposit-page,
html[data-theme="dark"] .fund-page,
html[data-theme="dark"] .orders-page,
html[data-theme="dark"] .position-page,
html[data-theme="dark"] .assets-page {
  background: #1c1c1e;
  color: #e8e8e8;
}

html[data-theme="dark"] .fund-page {
  background: #1c1c1e;
}

html[data-theme="dark"] .deposit-page--categories .deposit-method-list {
  background: #2c2c2e;
  border-top-color: #1a1a1a;
  border-radius: 12px;
  margin: 12px 16px;
  overflow: hidden;
}

/* —— Home —— */
html[data-theme="dark"] .home-assets__label,
html[data-theme="dark"] .home-assets__caret,
html[data-theme="dark"] .home-assets__aed {
  color: #9a9aa8;
}

html[data-theme="dark"] .home-assets__funds-btn,
html[data-theme="dark"] .home-assets__funds-label {
  color: #a8a8b4;
  background: transparent;
}

html[data-theme="dark"] .home-assets__funds-btn:active {
  opacity: 0.7;
  background: transparent;
}

html[data-theme="dark"] .home-assets__eye {
  color: #9a9aa8;
}

html[data-theme="dark"] .home-assets__eye:hover {
  color: #e0e0e8;
}

html[data-theme="dark"] .home-assets__balance {
  color: #f0f0f4;
  font-weight: 500;
}

html[data-theme="dark"] .home-quick-grid__item {
  color: #e8e8e8;
}

html[data-theme="dark"] .home-quick-grid .icon,
html[data-theme="dark"] .home-quick-grid .home-quick-icon {
  color: #9A9A9A;
  --home-quick-icon: #9A9A9A;
}

html[data-theme="dark"] .home-quick-grid__item span {
  color: #e8e8e8;
}

html[data-theme="dark"] .home-promo-card,
html[data-theme="dark"] .home-carousel__card,
html[data-theme="dark"] .home-banner-fallback {
  background: #2c2c2e;
  border-color: #222222;
  color: #e8e8e8;
  box-shadow: none;
}

html[data-theme="dark"] .home-promo-card__copy strong,
html[data-theme="dark"] .home-banner-fallback__brand {
  color: #f2f2f2;
}

html[data-theme="dark"] .home-promo-card__copy span,
html[data-theme="dark"] .home-banner-fallback__slogan {
  color: #a0a0aa;
}

html[data-theme="dark"] .home-carousel__sym {
  color: #a0a0aa;
}

html[data-theme="dark"] .home-carousel__dot {
  background: #333333;
}

html[data-theme="dark"] .home-carousel__dot.is-active {
  background: var(--upa-accent);
}

html[data-theme="dark"] .market-table .head,
html[data-theme="dark"] .market-page-head,
html[data-theme="dark"] .home-market-table .head {
  color: #9a9aa3;
}

html[data-theme="dark"] .market-table .row,
html[data-theme="dark"] .market-name-text,
html[data-theme="dark"] .section-title {
  color: var(--mc-text);
}

html[data-theme="dark"] .market-table .row {
  border-bottom-color: #1a1a1a;
}

html[data-theme="dark"] .market-category-tabs a,
html[data-theme="dark"] .market-category-tabs span,
html[data-theme="dark"] .market-filter-tabs a {
  color: #9a9aa3;
}

html[data-theme="dark"] .market-category-tabs .active,
html[data-theme="dark"] .market-category-tabs a.active,
html[data-theme="dark"] .market-filter-tabs a.active {
  color: #f2f2f2;
}

html[data-theme="dark"] .market-empty {
  color: #9a9aa3;
}

/* —— Personal center / lists —— */
html[data-theme="dark"] .pc-profile__name,
html[data-theme="dark"] .pc-profile__uid,
html[data-theme="dark"] .pc-credit,
html[data-theme="dark"] .pc-row__label {
  color: #e8e8e8;
}

html[data-theme="dark"] .pc-group,
html[data-theme="dark"] .pc-row,
html[data-theme="dark"] .home-card,
html[data-theme="dark"] .home-banner,
html[data-theme="dark"] .carousel-card,
html[data-theme="dark"] .market-row,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-block,
html[data-theme="dark"] .list-cell,
html[data-theme="dark"] .assets-card {
  background: #2c2c2e;
  border-color: #222222;
  color: #e8e8e8;
}

html[data-theme="dark"] .pc-row {
  border-bottom-color: #222222;
}

html[data-theme="dark"] .pc-row__chevron,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .upa-muted {
  color: #9a9aa3;
}

html[data-theme="dark"] .tabbar {
  /* Distinct from page bg so the bar is visible on iPhone dark mode */
  background: rgba(44, 44, 46, 0.96);
  border-top-color: #3a3a3c;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .tabbar a {
  color: var(--upa-nav-inactive);
}

html[data-theme="dark"] .tabbar a.active {
  color: #f2f2f2;
}

html[data-theme="dark"] .tabbar a:active,
html[data-theme="dark"] .tabbar a.is-pending {
  color: #f2f2f2;
}

html[data-theme="dark"] .tabbar-icon-wrap {
  color: var(--upa-nav-inactive);
}

html[data-theme="dark"] .tabbar a.active .tabbar-icon-wrap,
html[data-theme="dark"] .tabbar a:active .tabbar-icon-wrap,
html[data-theme="dark"] .tabbar a.is-pending .tabbar-icon-wrap {
  color: #f2f2f2;
}

html[data-theme="dark"] .tabbar a:not(.active) img,
html[data-theme="dark"] .tabbar a:not(.active) svg {
  opacity: 0.85;
  filter: brightness(1.55);
}

/* —— Forms / inputs —— */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #2c2c2e;
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #8b8b96;
}

html[data-theme="dark"] .upa-input-wrap {
  background: #2c2c2e;
}

html[data-theme="dark"] .upa-input-wrap input {
  color: #f2f2f2;
  background: transparent;
}

html[data-theme="dark"] .flash {
  background: #2c2c2e;
  color: #e8e8e8;
}

html[data-theme="dark"] .market-icon-wrap {
  background: #2a2a2a;
}

/* —— Deposit / fund —— */
html[data-theme="dark"] .deposit-method-list,
html[data-theme="dark"] .fund-card,
html[data-theme="dark"] .fund-currency-list {
  background: #2c2c2e;
  border-color: #222222;
}

html[data-theme="dark"] .deposit-method-item,
html[data-theme="dark"] .fund-currency-item,
html[data-theme="dark"] .fund-copy-row,
html[data-theme="dark"] .fund-select-row {
  border-bottom-color: #222222;
  color: #e8e8e8;
}

html[data-theme="dark"] .deposit-method-label,
html[data-theme="dark"] .fund-currency-item__label,
html[data-theme="dark"] .fund-card__title,
html[data-theme="dark"] .fund-card__accent-title,
html[data-theme="dark"] .deposit-section-title,
html[data-theme="dark"] .deposit-detail-title,
html[data-theme="dark"] .fund-copy-row__value,
html[data-theme="dark"] .fund-amount-prefix {
  color: #f2f2f2;
}

html[data-theme="dark"] .deposit-method-arrow,
html[data-theme="dark"] .fund-currency-item__chevron,
html[data-theme="dark"] .fund-tips,
html[data-theme="dark"] .fund-copy-row__label,
html[data-theme="dark"] .fund-field-label,
html[data-theme="dark"] .fund-amount-min,
html[data-theme="dark"] .fund-hint,
html[data-theme="dark"] .fund-fee-note,
html[data-theme="dark"] .deposit-field-label,
html[data-theme="dark"] .deposit-empty,
html[data-theme="dark"] .deposit-notice {
  color: #9a9aa3;
}

html[data-theme="dark"] .fund-input,
html[data-theme="dark"] .deposit-input,
html[data-theme="dark"] .fund-select {
  background: #2c2c2e;
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .fund-input--password {
  background: #f7f7f8 !important;
  background-color: #f7f7f8 !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  border: 1px solid #e5e5e5;
  color-scheme: light only;
}

html[data-theme="dark"] .fund-copy-btn,
html[data-theme="dark"] .fund-all-btn,
html[data-theme="dark"] .deposit-copy-btn {
  background: #2c2c2e;
  color: #e8e8e8;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .fund-card__banner {
  background: #222222;
  color: #e8e8e8;
}

html[data-theme="dark"] .fund-upload,
html[data-theme="dark"] .deposit-upload {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #9a9aa3;
}

/* —— Assets —— */
html[data-theme="dark"] .assets-hero {
  background: #1c1c1e;
  color: #e8e8e8;
}

html[data-theme="dark"] .assets-hero__head,
html[data-theme="dark"] .assets-hero__eye,
html[data-theme="dark"] .assets-hero__sub,
html[data-theme="dark"] .assets-stats__label {
  color: #9a9aa3;
}

html[data-theme="dark"] .assets-hero__balance,
html[data-theme="dark"] .assets-hero__sub strong,
html[data-theme="dark"] .assets-stats__value,
html[data-theme="dark"] .assets-positions h2 {
  color: #f2f2f2;
}

html[data-theme="dark"] .assets-actions__btn {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #e8e8e8;
}

html[data-theme="dark"] .assets-actions__btn--primary {
  background: var(--upa-accent);
  border-color: var(--upa-accent);
  color: var(--upa-on-accent);
}

html[data-theme="dark"] .assets-stats {
  border-color: #1a1a1a;
}

html[data-theme="dark"] .assets-stats > div:first-child {
  border-right-color: #1a1a1a;
}

html[data-theme="dark"] .assets-help-btn {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #9a9aa3;
}

html[data-theme="dark"] .assets-positions__empty,
html[data-theme="dark"] .assets-instruction-list {
  color: #9a9aa3;
}

/* —— Orders / positions —— */
html[data-theme="dark"] .orders-tabs a,
html[data-theme="dark"] .position-asset-tabs a,
html[data-theme="dark"] .position-segment a {
  color: #9a9aa3;
}

html[data-theme="dark"] .orders-tabs a.active,
html[data-theme="dark"] .position-asset-tabs a.active,
html[data-theme="dark"] .position-segment a.active {
  color: #f2f2f2;
  background: transparent;
  border-bottom-color: var(--upa-accent);
}

html[data-theme="dark"] .position-segment a.active {
  background: var(--upa-primary);
  color: #fff;
  border-color: var(--upa-primary);
}

html[data-theme="dark"] .orders-empty,
html[data-theme="dark"] .orders-end,
html[data-theme="dark"] .position-empty,
html[data-theme="dark"] .position-loaded,
html[data-theme="dark"] .assets-positions__empty,
html[data-theme="dark"] .trade-positions-panel__empty,
html[data-theme="dark"] .market-empty,
html[data-theme="dark"] .fund-empty,
html[data-theme="dark"] .deposit-empty {
  color: #b8b8c0;
}

html[data-theme="dark"] .position-card {
  background: #2c2c2e;
  border-color: #222222;
}

html[data-theme="dark"] .position-pair,
html[data-theme="dark"] .position-value {
  color: #f2f2f2;
}

html[data-theme="dark"] .position-code,
html[data-theme="dark"] .position-label,
html[data-theme="dark"] .position-duration,
html[data-theme="dark"] .position-amount,
html[data-theme="dark"] .position-time {
  color: #9a9aa3;
}

html[data-theme="dark"] .position-badge-long {
  background: rgba(46, 189, 133, 0.18);
}

html[data-theme="dark"] .position-badge-short {
  background: rgba(246, 70, 93, 0.18);
}

/* —— Trade —— */
html[data-theme="dark"] .trade-top-bar,
html[data-theme="dark"] .trade-summary,
html[data-theme="dark"] .trade-timeframes,
html[data-theme="dark"] .trade-inline-countdown,
html[data-theme="dark"] .trade-market-panels,
html[data-theme="dark"] .trade-bottom-actions {
  background: #1c1c1e;
  color: #e8e8e8;
}
/* Legend overlays chart — keep transparent (no solid strip). */
html[data-theme="dark"] .trade-ma-legend {
  background: transparent;
  color: #e8e8e8;
}

html[data-theme="dark"] .trade-top-bar__back,
html[data-theme="dark"] .trade-top-bar__menu,
html[data-theme="dark"] .trade-top-bar__pair {
  color: #f2f2f2;
}

html[data-theme="dark"] .trade-top-bar__star {
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-top-bar__star.is-active {
  color: var(--upa-accent);
}

html[data-theme="dark"] .trade-top-bar__divider {
  background: #2a2a2a;
}

html[data-theme="dark"] .trade-summary__stats,
html[data-theme="dark"] .trade-summary__stats span {
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-summary__stats strong {
  color: #e8e8e8;
}

html[data-theme="dark"] .trade-timeframes a,
html[data-theme="dark"] .trade-timeframes button,
html[data-theme="dark"] .trade-market-panels__tab {
  color: var(--upa-nav-inactive);
}

html[data-theme="dark"] .trade-timeframes a.active,
html[data-theme="dark"] .trade-timeframes button.active,
html[data-theme="dark"] .trade-market-panels__tab.is-active {
  color: #f2f2f2;
  border-bottom-color: #f2f2f2;
}

html[data-theme="dark"] .chart-box,
html[data-theme="dark"] .chart-box--candles {
  background: #2c2c2e;
  border-color: #3a3a3c;
}

html[data-theme="dark"] .trade-book__head,
html[data-theme="dark"] .trade-tape__head,
html[data-theme="dark"] .trade-book__row span:nth-child(2),
html[data-theme="dark"] .trade-book__row span:nth-child(3),
html[data-theme="dark"] .trade-tape__row span:nth-child(2),
html[data-theme="dark"] .trade-tape__row span:nth-child(3),
html[data-theme="dark"] .trade-book__mid span,
html[data-theme="dark"] .trade-positions-panel__empty {
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-book__head,
html[data-theme="dark"] .trade-tape__head {
  background: #1c1c1e;
}

html[data-theme="dark"] .trade-book__mid {
  background: #2c2c2e;
  border-color: #2c2c2e;
}

html[data-theme="dark"] .trade-book__mid strong {
  color: var(--mc-text-secondary);
}

html[data-theme="dark"] .trade-inline-countdown__meta span:first-child,
html[data-theme="dark"] .trade-inline-countdown__value {
  color: #f2f2f2;
}

html[data-theme="dark"] .trade-inline-countdown__unit,
html[data-theme="dark"] .trade-inline-countdown__label {
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-modes .mode {
  background: #2c2c2e;
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-modes .mode.active {
  background: var(--upa-accent);
  color: var(--upa-on-accent);
}

/* —— Drawers / modals —— */
html[data-theme="dark"] .trade-drawer__panel,
html[data-theme="dark"] .modal-sheet,
html[data-theme="dark"] .trade-modal__sheet {
  background: #1c1c1e;
  color: var(--mc-text);
}

html[data-theme="dark"] .trade-drawer__tabs {
  border-bottom-color: #2c2c2e;
}

html[data-theme="dark"] .trade-drawer__tab {
  color: #8e8e93;
}

html[data-theme="dark"] .trade-drawer__tab.is-active {
  color: var(--mc-text-secondary);
  border-bottom-color: var(--upa-accent);
}

/* Inactive chips (e.g. Favorites) — charcoal fill, not flashy white */
html[data-theme="dark"] .trade-drawer__filter {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #c7c7cc;
}

/* Active All chip keeps brand yellow */
html[data-theme="dark"] .trade-drawer__filter.is-active {
  background: var(--upa-accent);
  border-color: var(--upa-accent);
  color: var(--upa-on-accent);
}

html[data-theme="dark"] .trade-drawer__row {
  border-bottom-color: #2c2c2e;
}

/* Selected / hover row — subtle elevated grey, not cream/white */
html[data-theme="dark"] .trade-drawer__row.is-active {
  background: #2c2c2e;
}

html[data-theme="dark"] .trade-drawer__row:hover {
  background: #3a3a3c;
}

html[data-theme="dark"] .trade-drawer__row.is-active:hover {
  background: #3a3a3c;
}

html[data-theme="dark"] .trade-drawer__link,
html[data-theme="dark"] .trade-drawer__name {
  color: var(--mc-text);
}

html[data-theme="dark"] .trade-drawer__price.price-up {
  color: var(--upa-green);
}

html[data-theme="dark"] .trade-drawer__price.price-down {
  color: var(--upa-red);
}

html[data-theme="dark"] .trade-drawer__fav {
  color: #636366;
}

html[data-theme="dark"] .trade-drawer__fav.is-active {
  color: var(--upa-accent);
}

html[data-theme="dark"] .trade-drawer__empty {
  color: #8e8e93;
}

html[data-theme="dark"] .trade-modal__head h2,
html[data-theme="dark"] .trade-modal__meta strong,
html[data-theme="dark"] .trade-modal__summary strong,
html[data-theme="dark"] .trade-result__rows strong,
html[data-theme="dark"] .assets-instruction-title {
  color: #f2f2f2;
}

html[data-theme="dark"] .trade-countdown__value {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  opacity: 1;
}

html[data-theme="dark"] .trade-countdown__ring-track {
  stroke: #3a3a3c;
}

html[data-theme="dark"] .trade-result__pnl-label {
  color: #f2f2f2;
}

html[data-theme="dark"] .trade-modal__close,
html[data-theme="dark"] .trade-modal__section-title,
html[data-theme="dark"] .trade-modal__summary,
html[data-theme="dark"] .trade-modal__min,
html[data-theme="dark"] .duration-card__label,
html[data-theme="dark"] .duration-card__dur {
  color: #9a9aa3;
}

html[data-theme="dark"] .trade-modal__secondary {
  background: #2c2c2e !important;
  color: #e8e8e8 !important;
}

html[data-theme="dark"] .duration-card {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e8e8e8;
}

html[data-theme="dark"] .duration-card.is-selected {
  background: #2c2c2e;
  border-color: #3a3a3c;
}

html[data-theme="dark"] .duration-card__time {
  color: #ffffff;
}

html[data-theme="dark"] .duration-card__income {
  color: #2ebd85;
}

html[data-theme="dark"] .trade-amount-input {
  background: #2c2c2e;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .trade-amount-input input {
  background: transparent;
  color: #f2f2f2;
}

html[data-theme="dark"] .trade-amount-input input::placeholder {
  color: #8b8b96;
}

html[data-theme="dark"] .trade-amount-clear {
  color: #8b8b96;
}

html[data-theme="dark"] .trade-amount-quick button {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #e8e8e8;
}

html[data-theme="dark"] .exchange-amount-input,
html[data-theme="dark"] .exchange-card {
  background: #2c2c2e;
  color: #e8e8e8;
  border-color: #222222;
}

html[data-theme="dark"] .wallet-row {
  background: #2c2c2e;
  border-color: #222222;
}

html[data-theme="dark"] .wallet-row__title {
  color: #f2f2f2;
}

html[data-theme="dark"] .wallet-row__plus {
  color: var(--upa-accent);
}

html[data-theme="dark"] .market-row__pair {
  color: var(--mc-text);
}

html[data-theme="dark"] .market-page-table .market-row {
  border-bottom-color: #1a1a1a;
}

html[data-theme="dark"] .market-row__fav {
  color: #6a6b75;
}

html[data-theme="dark"] .market-row__fav.is-active {
  color: var(--upa-accent);
}

/* —— Auth (login / register / forgot) —— */
html[data-theme="dark"] .auth-page {
  background: #1c1c1e;
  color: #e8e8e8;
}

html[data-theme="dark"] .auth-page__back,
html[data-theme="dark"] .auth-page__link,
html[data-theme="dark"] .auth-page__heading,
html[data-theme="dark"] .auth-page__brand-name,
html[data-theme="dark"] .auth-page__title {
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-page__intro,
html[data-theme="dark"] .auth-forgot,
html[data-theme="dark"] .auth-switch {
  color: #9a9aa3;
}

html[data-theme="dark"] .auth-tabs,
html[data-theme="dark"] .auth-mode-tabs {
  background: #2c2c2e;
}

html[data-theme="dark"] .auth-tabs__tab,
html[data-theme="dark"] .auth-mode-tabs__tab {
  color: #9a9aa3;
}

html[data-theme="dark"] .auth-tabs__tab.is-active,
html[data-theme="dark"] .auth-mode-tabs__tab.is-active {
  color: var(--upa-on-accent);
  background: var(--upa-accent);
  box-shadow: none;
}

html[data-theme="dark"] .auth-tabs--underline {
  background: transparent;
  border-bottom-color: #2a2a2a;
}

html[data-theme="dark"] .auth-tabs--underline .auth-tabs__tab {
  color: #9a9aa3;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .auth-tabs--underline .auth-tabs__tab.is-active {
  color: #f2f2f2;
  background: transparent;
}

html[data-theme="dark"] .auth-phone-dial,
html[data-theme="dark"] .auth-country-trigger {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-country-trigger__name,
html[data-theme="dark"] .auth-phone-dial {
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-send-code--link {
  background: transparent;
  border: none;
  color: var(--upa-accent);
}

html[data-theme="dark"] .auth-send-code--link:disabled {
  background: transparent;
  border: none;
  color: #8b8b96;
}

html[data-theme="dark"] .auth-country-sheet__panel {
  background: #2c2c2e;
}

html[data-theme="dark"] .auth-country-sheet__search {
  border-bottom-color: #2a2a2a;
}

html[data-theme="dark"] .auth-country-sheet__search input {
  background: #2c2c2e;
  border-color: #2a2a2a;
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-country-sheet__cancel {
  color: #c8c8d0;
}

html[data-theme="dark"] .auth-country-item {
  background: #2c2c2e;
  border-bottom-color: #1a1a1a;
}

html[data-theme="dark"] .auth-country-item__name {
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-country-item__dial {
  color: #9a9aa3;
}

html[data-theme="dark"] .auth-field label {
  color: #c8c8d0;
}

html[data-theme="dark"] .auth-field input,
html[data-theme="dark"] .auth-otp-row input {
  background: #2c2c2e;
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .auth-field input::placeholder,
html[data-theme="dark"] .auth-otp-row input::placeholder {
  color: #8b8b96;
}

html[data-theme="dark"] .auth-password-toggle {
  color: #9a9aa3;
}

html[data-theme="dark"] .auth-password-toggle:hover {
  color: #f2f2f2;
}

html[data-theme="dark"] .auth-send-code {
  background: var(--upa-accent);
  color: #111;
  border-color: var(--upa-accent);
}

html[data-theme="dark"] .auth-send-code:disabled {
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: #8b8b96;
}

html[data-theme="dark"] .auth-otp-hint {
  color: #e8e8e8;
  background: #2f2a18;
  border-color: #5a4e20;
}

html[data-theme="dark"] .auth-forgot {
  color: #b0b0ba;
}

html[data-theme="dark"] .auth-switch a {
  color: var(--upa-accent);
}

html[data-theme="dark"] .login-page {
  background: linear-gradient(180deg, #434459 0%, #2d2e3d 45%, #000000 45%);
  color: #e8e8e8;
}

html[data-theme="dark"] .wallet-page {
  background: #1c1c1e;
  color: #e8e8e8;
}

html[data-theme="dark"] .wallet-page__banner {
  background: #2f2a18;
  border-color: #5a4e20;
  color: #e8d48a;
}

html[data-theme="dark"] .wallet-row {
  background: #1c1c1e;
  border-bottom-color: #1a1a1a;
}

html[data-theme="dark"] .wallet-row--add:active {
  background: #2c2c2e;
}

html[data-theme="dark"] .wallet-row__title {
  color: #f2f2f2;
}

html[data-theme="dark"] .wallet-row__address,
html[data-theme="dark"] .wallet-row__label {
  color: #9a9aa3;
}

html[data-theme="dark"] .wallet-row__plus {
  border-color: #333333;
  color: #f2f2f2;
}

html[data-theme="dark"] .wallet-row__badge {
  background: rgba(245, 197, 24, 0.16);
  color: var(--upa-accent);
}

html[data-theme="dark"] .wallet-bind-hero {
  background: #2c2c2e;
}

html[data-theme="dark"] .wallet-bind-hero__title {
  color: #f2f2f2;
}

html[data-theme="dark"] .wallet-bind-hero__hint,
html[data-theme="dark"] .wallet-bind-default {
  color: #9a9aa3;
}

html[data-theme="dark"] .withdraw-add-wallet a {
  color: var(--upa-accent);
}

html[data-theme="dark"] .withdraw-add-wallet__plus {
  border-color: var(--upa-accent);
  color: var(--upa-accent);
}

/* —— Security Center —— */
html[data-theme="dark"] .security-page {
  background: #1c1c1e;
  color: #e8e8e8;
}

html[data-theme="dark"] .security-card {
  background: #1c1c1e;
}

html[data-theme="dark"] .security-row {
  border-bottom-color: #1a1a1a;
  color: #e8e8e8;
}

html[data-theme="dark"] .security-row--link:active {
  background: #2c2c2e;
}

html[data-theme="dark"] .security-row__label {
  color: #f2f2f2;
}

html[data-theme="dark"] .security-row__value {
  color: #9a9aa3;
}

html[data-theme="dark"] .security-row__chevron {
  color: #6a6b75;
}

html[data-theme="dark"] .security-section-label {
  background: #16171d;
  color: #9a9aa3;
}

html[data-theme="dark"] .security-hint {
  color: #9a9aa3;
}

html[data-theme="dark"] .form-group label {
  color: #c8c8d0;
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea {
  background: #2c2c2e;
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .form-group input::placeholder,
html[data-theme="dark"] .form-group textarea::placeholder {
  color: #8b8b96;
}

html[data-theme="dark"] .kyc-page {
  background: #1c1c1e;
}
html[data-theme="dark"] .kyc-hub__intro,
html[data-theme="dark"] .kyc-form__intro,
html[data-theme="dark"] .kyc-pending__text {
  color: #b0b0b8;
}
html[data-theme="dark"] .kyc-hub__help,
html[data-theme="dark"] .kyc-form__hint,
html[data-theme="dark"] .file-field__drop-hint {
  color: #8b8b96;
}
html[data-theme="dark"] .kyc-steps,
html[data-theme="dark"] .kyc-card,
html[data-theme="dark"] .kyc-form__section,
html[data-theme="dark"] .kyc-status-row {
  background: #2c2c2e;
  border-color: #3a3a3c;
}
html[data-theme="dark"] .kyc-steps__label { color: #8b8b96; }
html[data-theme="dark"] .kyc-steps__item.is-done .kyc-steps__label,
html[data-theme="dark"] .kyc-steps__item.is-current .kyc-steps__label,
html[data-theme="dark"] .kyc-card__title,
html[data-theme="dark"] .kyc-form__section-title,
html[data-theme="dark"] .file-field__drop-title,
html[data-theme="dark"] .kyc-pending__link,
html[data-theme="dark"] .kyc-form-top__back {
  color: #f2f2f2;
}
html[data-theme="dark"] .kyc-steps__line { background: #3a3a3c; }
html[data-theme="dark"] .kyc-card__desc,
html[data-theme="dark"] .kyc-card__reqs li,
html[data-theme="dark"] .kyc-status-row__label,
html[data-theme="dark"] .kyc-field label,
html[data-theme="dark"] .file-field__label {
  color: #c8c8d0;
}
html[data-theme="dark"] .kyc-card__icon {
  background: #3a3a3c;
  color: #e8e8e8;
}
html[data-theme="dark"] .kyc-card__icon--basic {
  background: #3a3420;
  color: #F5C518;
}
html[data-theme="dark"] .kyc-card__icon--id {
  background: #1f2e24;
  color: #4ade80;
}
html[data-theme="dark"] .kyc-badge--verified { background: #1f2e24; color: #4ade80; }
html[data-theme="dark"] .kyc-badge--pending { background: #3a3018; color: #fbbf24; }
html[data-theme="dark"] .kyc-badge--unverified { background: #3a3a3c; color: #a1a1aa; }
html[data-theme="dark"] .kyc-badge--rejected { background: #3a1f1f; color: #f87171; }
html[data-theme="dark"] .kyc-card__cta--done { background: #1f2e24; color: #4ade80; }
html[data-theme="dark"] .kyc-card__cta--pending { background: #3a3018; color: #fbbf24; }
html[data-theme="dark"] .kyc-card__cta--primary {
  background: #F5C518;
  color: #1c1c1e;
}
html[data-theme="dark"] .kyc-field input {
  background: #1c1c1e;
  color: #f2f2f2;
  border-color: #3a3a3c;
}
html[data-theme="dark"] .kyc-field input:focus {
  border-color: #F5C518;
  background: #2c2c2e;
}
html[data-theme="dark"] .file-field__control,
html[data-theme="dark"] .file-field--dropzone .file-field__drop {
  background: #1c1c1e;
  border-color: #3a3a3c;
}
html[data-theme="dark"] .file-field--dropzone .file-field__drop:hover,
html[data-theme="dark"] .file-field--dropzone.is-selected .file-field__drop {
  border-color: #F5C518;
  background: #2f2a18;
}
html[data-theme="dark"] .file-field__btn {
  background: var(--upa-accent);
  color: var(--upa-on-accent);
}
html[data-theme="dark"] .file-field__name,
html[data-theme="dark"] .file-field--dropzone .file-field__icon {
  color: #9a9aa3;
}
html[data-theme="dark"] .file-field__name.is-selected,
html[data-theme="dark"] .file-field--dropzone.is-selected .file-field__icon {
  color: #f2f2f2;
}
html[data-theme="dark"] .kyc-pending__icon {
  background: #3a3018;
  color: #fbbf24;
}
html[data-theme="dark"] .kyc-pending--ok .kyc-pending__icon {
  background: #1f2e24;
  color: #4ade80;
}

html[data-theme="dark"] .method-list-item {
  border-bottom-color: #1a1a1a;
  color: #e8e8e8;
}

html[data-theme="dark"] .method-list-item__label {
  color: #f2f2f2;
}

html[data-theme="dark"] .method-list-item__icon {
  background: #2f2a18;
  color: var(--upa-accent);
}

html[data-theme="dark"] .method-list-item__arrow {
  color: #6a6b75;
}

html[data-theme="dark"] .fund-tabs {
  border-bottom-color: #1a1a1a;
}

html[data-theme="dark"] .fund-tabs a {
  color: #9a9aa3;
}


/* ── KYC hub + dropzone (light base) ── */
.kyc-hub { padding: 8px 16px 24px; }
.kyc-hub__intro { margin: 0 0 16px; font-size: 13px; color: #666; line-height: 1.5; }
.kyc-hub__help { margin: 16px 0 0; font-size: 12px; color: #999; line-height: 1.45; }
.kyc-hub__note { margin: 12px 0 0; font-size: 13px; color: #b45309; }
.kyc-steps {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border: 1px solid #ebebeb; border-radius: 12px;
  background: #fafafa; margin-bottom: 14px;
}
.kyc-steps--compact { margin-bottom: 12px; }
.kyc-steps__item { display: flex; align-items: center; gap: 6px; }
.kyc-steps__dot {
  width: 8px; height: 8px; border-radius: 50%; background: #d0d0d6;
}
.kyc-steps__item.is-done .kyc-steps__dot,
.kyc-steps__item.is-current .kyc-steps__dot { background: var(--upa-accent); }
.kyc-steps__label { font-size: 12px; color: #999; font-weight: 500; }
.kyc-steps__item.is-done .kyc-steps__label,
.kyc-steps__item.is-current .kyc-steps__label { color: #222; }
.kyc-steps__line { flex: 1; height: 2px; background: #e5e5e5; border-radius: 2px; }
.kyc-steps__line.is-active { background: var(--upa-accent); }
.kyc-card {
  border: 1px solid #ebebeb; border-radius: 14px; padding: 14px;
  background: #fff; margin-bottom: 12px;
}
.kyc-card__head { display: flex; align-items: flex-start; gap: 12px; }
.kyc-card__icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; background: #f3f3f5; color: #333; flex-shrink: 0;
}
.kyc-card__icon--basic { background: #fff8e1; color: #b8860b; }
.kyc-card__icon--id { background: #eaf7ef; color: #1f8a4c; }
.kyc-card__titles { flex: 1; min-width: 0; }
.kyc-card__title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: #111; }
.kyc-card__desc { margin: 0; font-size: 12px; color: #777; line-height: 1.4; }
.kyc-card__reqs { margin: 10px 0 0; padding-left: 18px; color: #666; font-size: 12px; }
.kyc-card__actions { margin-top: 12px; }
.kyc-card__cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.kyc-card__cta--primary {
  background: var(--upa-accent);
  color: #111 !important;
  min-width: 88px;
}
.kyc-card__cta--done { background: #eaf7ef; color: #1f8a4c; }
.kyc-card__cta--pending { background: #fff7ed; color: #b45309; }
.kyc-badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.kyc-badge--verified { background: #eaf7ef; color: #1f8a4c; }
.kyc-badge--pending { background: #fff7ed; color: #b45309; }
.kyc-badge--unverified { background: #f1f1f3; color: #777; }
.kyc-badge--rejected { background: #fdecec; color: #c0392b; }
.kyc-form-top { padding: 0 16px 8px; }
.kyc-form-top__back {
  display: inline-flex; align-items: center; min-height: 36px;
  font-size: 13px; font-weight: 600; color: #111; text-decoration: none; margin-bottom: 8px;
}
.kyc-form__intro { margin: 0 16px 14px; font-size: 13px; color: #666; line-height: 1.5; }
.kyc-form__section {
  margin: 0 16px 16px; padding: 14px; border: 1px solid #ebebeb; border-radius: 12px; background: #fff;
}
.kyc-form__section-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: #111; }
.kyc-form__hint { margin: 0 0 12px; font-size: 12px; color: #888; }
.kyc-field { padding: 0 !important; margin-bottom: 12px; }
.kyc-field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 600; }
.kyc-field input {
  width: 100%; height: 44px; border: 1px solid #e6e6e6; border-radius: 10px;
  padding: 0 12px; font-size: 14px; background: #fff; color: #111; outline: none;
}
.kyc-field--submit { margin-top: 8px; }
.kyc-status-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 16px 12px; padding: 10px 12px; border-radius: 10px; background: #fafafa; border: 1px solid #eee;
}
.kyc-status-row__label { font-size: 13px; color: #666; }
.kyc-pending { padding: 24px 16px; text-align: center; }
.kyc-pending__text { color: #666; font-size: 14px; line-height: 1.5; }
.kyc-pending__link { color: #111; font-weight: 600; }

.file-field--dropzone { margin-bottom: 14px; }
.file-field--dropzone .file-field__label { margin-bottom: 8px; }
.file-field--dropzone .file-field__drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 118px;
  padding: 18px 14px;
  border: 1.5px dashed #d5d5da;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}
.file-field--dropzone .file-field__drop:hover {
  border-color: #c0c0c6;
  background: #f5f5f7;
}
.file-field--dropzone.is-selected .file-field__drop {
  border-color: var(--upa-accent);
  background: rgba(245, 197, 24, 0.08);
}
.file-field--dropzone .file-field__input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  font-size: 0 !important;
  cursor: pointer;
  z-index: 2;
}
.file-field--dropzone .file-field__icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: #efefef; color: #444; pointer-events: none; z-index: 1;
}
.file-field--dropzone.is-selected .file-field__icon {
  background: rgba(245, 197, 24, 0.2); color: #111;
}
.file-field--dropzone .file-field__drop-title {
  display: block; font-size: 14px; font-weight: 700; color: #222;
  pointer-events: none; z-index: 1; line-height: 1.3;
}
.file-field--dropzone .file-field__drop-hint {
  display: block; font-size: 12px; color: #888; max-width: 240px;
  pointer-events: none; z-index: 1; line-height: 1.35;
}
.file-field--dropzone .file-field__name {
  display: block; font-size: 12px; color: #999; max-width: 90%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none; z-index: 1;
}
.file-field--dropzone .file-field__name.is-selected {
  color: #333; font-weight: 600;
}
.file-field__req { color: #ef454a; }

/* ── General Settings ── */
.settings-page { padding: 12px 16px 28px; }
.settings-card {
  background: #fff; border: 1px solid #eee; border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
}
.settings-card__title {
  margin: 0 0 14px; font-size: 14px; font-weight: 700; color: #111;
}
.settings-avatar-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.settings-avatar-row__copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.settings-avatar-row__copy strong { font-size: 14px; color: #111; }
.settings-avatar-row__copy span { font-size: 12px; color: #888; line-height: 1.35; }
.settings-avatar-upload.app-avatar-btn { width: 64px; height: 64px; }
.settings-avatar-upload .app-avatar-btn__img,
.settings-avatar-upload .app-avatar-btn__placeholder { width: 64px; height: 64px; }
.settings-form .form-group { margin-bottom: 12px; }
.settings-form label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 600; }
.settings-form input {
  width: 100%; height: 44px; border: 1px solid #e6e6e6; border-radius: 10px;
  padding: 0 12px; font-size: 14px; background: #fff; color: #111;
}
.settings-row--toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.settings-row__copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.settings-row__copy strong { font-size: 14px; color: #111; }
.settings-row__copy span { font-size: 12px; color: #888; }
.settings-link-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; color: #222; text-decoration: none; font-size: 14px; font-weight: 500;
}
.settings-link-row__chevron { color: #bbb; font-size: 20px; }

/* Auth pages: standard system UI sans (no decorative IBM Plex quirks) */
.auth-page,
.auth-page * {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
.auth-page__brand-name {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}
.auth-page__title {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 23px;
}
.auth-page__back {
  font-size: 30px; font-weight: 700; color: #111;
  -webkit-text-stroke: 0.4px currentColor;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Dark: softer text, back = light grey not flash white */
html[data-theme="dark"] .pc-top__back,
html[data-theme="dark"] .pc-top__action,
html[data-theme="dark"] .pc-top__action.theme-toggle,
html[data-theme="dark"] .header-back,
html[data-theme="dark"] .auth-page__back,
html[data-theme="dark"] .kyc-form-top__back {
  color: #c7c7cc !important;
}
html[data-theme="dark"] .pc-row__icon { color: #e5e5ea; }
html[data-theme="dark"] .tabbar a.active,
html[data-theme="dark"] .tabbar a.active .tabbar-icon-wrap,
html[data-theme="dark"] .tabbar a:active,
html[data-theme="dark"] .tabbar a:active .tabbar-icon-wrap,
html[data-theme="dark"] .tabbar a.is-pending,
html[data-theme="dark"] .tabbar a.is-pending .tabbar-icon-wrap {
  color: #e5e5ea;
}
html[data-theme="dark"] .settings-card {
  background: #2c2c2e; border-color: #3a3a3c;
}
html[data-theme="dark"] .settings-card__title,
html[data-theme="dark"] .settings-avatar-row__copy strong,
html[data-theme="dark"] .settings-row__copy strong,
html[data-theme="dark"] .settings-link-row {
  color: #e5e5ea;
}
html[data-theme="dark"] .settings-avatar-row__copy span,
html[data-theme="dark"] .settings-row__copy span {
  color: #8e8e93;
}
html[data-theme="dark"] .settings-form input {
  background: #1c1c1e; color: #e5e5ea; border-color: #3a3a3c;
}
html[data-theme="dark"] .trade-drawer__filter {
  background: #2c2c2e !important;
  color: #a1a1aa !important;
}
html[data-theme="dark"] .trade-drawer__filter.is-active,
html[data-theme="dark"] .trade-drawer__filter.active {
  background: #3a3a3c !important;
  color: #e5e5ea !important;
}

/* ── Fixed Investment / lock mining ── */
.mobile-shell:has(.fi-page),
.mobile-shell:has(.fi-page) .page-body {
  background: #1c1c1e;
  padding: 0;
}
.fi-page {
  min-height: calc(100dvh - 0px);
  background: #1c1c1e;
  color: #fff;
  box-sizing: border-box;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}
.fi-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 48px;
  background: #F5C518;
  color: #111;
  padding: 0 44px;
}
.fi-header__back {
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  color: #111 !important;
  text-decoration: none;
  font-weight: 400;
  z-index: 2;
}
.fi-header__back svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: #111;
}
.fi-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.fi-hub-top {
  background: #F5C518;
  padding: 8px 16px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.fi-hub-funds__label {
  font-size: 12px;
  color: #222;
  margin-bottom: 4px;
}
.fi-hub-funds__value {
  font-size: 26px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.fi-hub-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.fi-hub-checkin-form {
  margin: 0;
}
.fi-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  color: #222;
}
.fi-chip svg {
  flex-shrink: 0;
}
.fi-chip--muted {
  background: rgba(80, 80, 80, 0.22);
  color: #2a2a2a;
}
.fi-chip--muted:disabled {
  opacity: 0.65;
  cursor: default;
}
.fi-chip--light {
  background: #f8e9a0;
  color: #222;
}

.fi-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f3e6b0;
  padding: 12px 12px 14px;
  text-align: center;
}
.fi-stats strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
}
.fi-stats span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: #444;
  line-height: 1.25;
}
.fi-help {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #666;
  background: transparent;
  color: #555;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fi-product-list {
  background: #1c1c1e;
}
.fi-product {
  padding: 16px;
  border-bottom: 1px solid #2c2c2e;
}
.fi-product__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.fi-product__name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.fi-product__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fi-product__grid span {
  display: block;
  font-size: 11px;
  color: #8e8e93;
  margin-bottom: 4px;
}
.fi-product__grid strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.fi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #F5C518;
  color: #111 !important;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  min-height: 36px;
  padding: 0 14px;
}
.fi-btn--sm {
  min-height: 32px;
  min-width: 64px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 6px;
  white-space: nowrap;
  color: #111 !important;
}

.fi-subscribe-hero {
  background: #F5C518;
  color: #111;
}
.fi-subscribe-hero__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 16px 14px;
  gap: 12px;
}
.fi-subscribe-hero__currency {
  font-size: 12px;
  color: #333;
  margin-bottom: 2px;
}
.fi-subscribe-hero__name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}
.fi-subscribe-hero__roi-wrap {
  text-align: right;
}
.fi-subscribe-hero__roi-label {
  font-size: 12px;
  color: #333;
  margin-bottom: 2px;
}
.fi-subscribe-hero__roi {
  font-size: 20px;
  font-weight: 700;
}
.fi-subscribe-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f3e6b0;
  padding: 12px 10px;
  text-align: center;
}
.fi-subscribe-metrics strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
}
.fi-subscribe-metrics span {
  font-size: 11px;
  color: #555;
}
.fi-subscribe-body {
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fi-card {
  background: #252528;
  border: 1px solid #333338;
  border-radius: 12px;
  padding: 16px 14px;
}
.fi-card--terms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.fi-card--balances {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fi-card__right {
  text-align: right;
}
.fi-card__label {
  display: block;
  font-size: 12px;
  color: #8e8e93;
  margin-bottom: 8px;
}
.fi-card__value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}
.fi-amount-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}
.fi-amount-field {
  position: relative;
  display: flex;
  align-items: center;
}
.fi-amount-field input {
  width: 100%;
  height: 46px;
  border: 1px solid #3a3a3c;
  border-radius: 8px;
  background: #1c1c1e;
  color: #fff;
  font-size: 15px;
  padding: 0 96px 0 12px;
  box-sizing: border-box;
}
.fi-amount-field input::placeholder {
  color: #8e8e93;
}
.fi-amount-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #c7c7cc;
  font-weight: 600;
}
.fi-amount-sep {
  color: #666;
}
.fi-amount-all {
  background: none;
  border: none;
  color: #F5C518;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}
.fi-cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(28, 28, 30, 0) 0%, #1c1c1e 28%);
  max-width: var(--max-mobile);
  margin: 0 auto;
  box-sizing: border-box;
}
.fi-cta-bar .fi-btn {
  width: 100%;
  height: 48px;
  font-size: 16px;
  border-radius: 10px;
}

.fi-orders {
  padding: 0 0 24px;
  background: #1c1c1e;
}
.fi-order {
  padding: 16px;
  border-bottom: 1px solid #2c2c2e;
}
.fi-order__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.fi-order__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.fi-order__status {
  font-size: 13px;
  color: #8e8e93;
  flex-shrink: 0;
}
.fi-order__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
  margin-bottom: 14px;
}
.fi-order__label {
  display: block;
  font-size: 11px;
  color: #8e8e93;
  margin-bottom: 4px;
}
.fi-order__grid strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.fi-order__col-right {
  text-align: right;
}
.fi-order__actions {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}
.fi-no-more {
  text-align: center;
  color: #8e8e93;
  font-size: 13px;
  padding: 18px 0 8px;
  margin: 0;
}
.fi-empty {
  text-align: center;
  color: #8e8e93;
  padding: 40px 16px;
  margin: 0;
}

.fi-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fi-modal[hidden] {
  display: none !important;
}
.fi-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.fi-modal__sheet {
  position: relative;
  width: min(340px, 100%);
  background: #2c2c2e;
  border-radius: 14px;
  padding: 22px 18px 18px;
  box-sizing: border-box;
  color: #fff;
}
.fi-modal__title {
  margin: 0 0 16px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}
.fi-modal__list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fi-modal__list li {
  font-size: 13px;
  line-height: 1.55;
  color: #d1d1d6;
}
.fi-modal__list li span {
  color: #fff;
  font-weight: 700;
  margin-right: 4px;
}
.fi-modal__sheet .fi-btn {
  width: 100%;
  height: 44px;
}

/* Light theme readability (hub still uses yellow brand blocks) */
html:not([data-theme="dark"]) .fi-page {
  background: #f2f2f7;
  color: #111;
}
html:not([data-theme="dark"]) .fi-product-list,
html:not([data-theme="dark"]) .fi-orders {
  background: #f2f2f7;
}
html:not([data-theme="dark"]) .fi-product,
html:not([data-theme="dark"]) .fi-order {
  border-bottom-color: #e5e5ea;
}
html:not([data-theme="dark"]) .fi-product__name,
html:not([data-theme="dark"]) .fi-product__grid strong,
html:not([data-theme="dark"]) .fi-order__title,
html:not([data-theme="dark"]) .fi-order__grid strong,
html:not([data-theme="dark"]) .fi-card__value,
html:not([data-theme="dark"]) .fi-amount-label {
  color: #111;
}
html:not([data-theme="dark"]) .fi-product__grid span,
html:not([data-theme="dark"]) .fi-order__label,
html:not([data-theme="dark"]) .fi-order__status,
html:not([data-theme="dark"]) .fi-card__label,
html:not([data-theme="dark"]) .fi-no-more,
html:not([data-theme="dark"]) .fi-empty {
  color: #6c6c70;
}
html:not([data-theme="dark"]) .fi-card {
  background: #fff;
  border-color: #e5e5ea;
}
html:not([data-theme="dark"]) .fi-amount-field input {
  background: #fff;
  border-color: #d1d1d6;
  color: #111;
}
html:not([data-theme="dark"]) .fi-amount-suffix {
  color: #555;
}
html:not([data-theme="dark"]) .fi-cta-bar {
  background: linear-gradient(180deg, rgba(242, 242, 247, 0) 0%, #f2f2f7 28%);
}
html:not([data-theme="dark"]) .fi-modal__sheet {
  background: #fff;
  color: #111;
}
html:not([data-theme="dark"]) .fi-modal__list li {
  color: #444;
}
html:not([data-theme="dark"]) .fi-modal__list li span {
  color: #111;
}

html[data-theme="dark"] .page-body:has(.fi-page),
html[data-theme="dark"] .mobile-shell:has(.fi-page) {
  background: #1c1c1e;
}

/* Legacy mining marketing styles (unused by new flow; kept for safety) */
.mining-page {
  padding: 12px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - 44px);
  background: #f5f5f7;
  box-sizing: border-box;
}
.mining-cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: var(--max-mobile);
  margin: 0 auto;
  box-sizing: border-box;
}

/* —— Instant nav progress (MPA tab/back taps) —— */
.midchains-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  background: transparent;
  overflow: hidden;
}
.midchains-nav-progress__bar {
  display: block;
  height: 100%;
  width: 28%;
  border-radius: 0 1px 1px 0;
  background: var(--upa-nav-active, #1a73e8);
  transform: translateX(-120%);
}
html.midchains-nav-pending .midchains-nav-progress {
  opacity: 1;
}
html.midchains-nav-pending .midchains-nav-progress__bar {
  animation: midchains-nav-progress-slide 0.9s ease-in-out infinite;
}
@keyframes midchains-nav-progress-slide {
  0% { transform: translateX(-120%); width: 28%; }
  50% { width: 42%; }
  100% { transform: translateX(360%); width: 28%; }
}
html[data-theme="dark"] .midchains-nav-progress__bar {
  background: #4da3ff;
}

/* —— Site-entry welcome splash —— */
.midchains-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  transition: opacity 0.36s ease, visibility 0.36s ease;
}
.midchains-splash[hidden] {
  display: none !important;
}
.midchains-splash.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
html.midchains-splash-active,
html.midchains-splash-active body {
  overflow: hidden;
}
.midchains-splash__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: -8vh;
}
.midchains-splash__logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
}
.midchains-splash__loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: #9a9aa3;
  letter-spacing: 0.02em;
}
.midchains-splash__spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid #d0d0d4;
  border-top-color: #8e8e93;
  border-radius: 50%;
  animation: midchains-splash-spin 0.75s linear infinite;
}
.midchains-splash__brand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #3a3a3c;
  letter-spacing: 0.01em;
}
@keyframes midchains-splash-spin {
  to { transform: rotate(360deg); }
}

/* —— Trade chart timed cache-refresh loader —— */
.trade-chart-cache-refresh {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.chart-box--candles.chart-box--tv-lc:not(.is-chart-loading) .trade-chart-cache-refresh,
.trade-chart-cache-refresh.is-done {
  opacity: 0;
  visibility: hidden;
}
.trade-chart-cache-refresh__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(245, 197, 24, 0.25);
  border-top-color: #F5C518;
  border-radius: 50%;
  animation: midchains-splash-spin 0.8s linear infinite;
}
.trade-chart-cache-refresh__status {
  margin: 0;
  font-size: 13px;
  color: #787B86;
  text-align: center;
  max-width: 240px;
  line-height: 1.35;
}
html[data-theme="dark"] .trade-chart-cache-refresh__status {
  color: #9a9aa3;
}
.trade-chart-cache-refresh__bar {
  width: min(200px, 55%);
  height: 3px;
  border-radius: 2px;
  background: rgba(42, 46, 57, 0.08);
  overflow: hidden;
}
html[data-theme="dark"] .trade-chart-cache-refresh__bar {
  background: rgba(242, 242, 242, 0.08);
}
.trade-chart-cache-refresh__bar > span {
  display: block;
  height: 100%;
  width: 28%;
  border-radius: 2px;
  background: #F5C518;
  animation: trade-cache-refresh-bar 1.1s ease-in-out infinite;
}
.trade-chart-cache-refresh[data-step="2"] .trade-chart-cache-refresh__bar > span { width: 48%; }
.trade-chart-cache-refresh[data-step="3"] .trade-chart-cache-refresh__bar > span { width: 72%; }
.trade-chart-cache-refresh[data-step="4"] .trade-chart-cache-refresh__bar > span { width: 92%; animation: none; }
@keyframes trade-cache-refresh-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.chart-box--candles.chart-box--tv-lc.is-chart-loading .trade-chart-cache-refresh {
  opacity: 1;
  visibility: visible;
}

/* Shell-first deferred widgets (Trends / Orders / Assets) */
.shell-skel {
  display: block;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shell-skel-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}
.shell-skel--icon { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; }
.shell-skel--text { width: 72px; height: 14px; margin-bottom: 6px; }
.shell-skel--badge { width: 48px; height: 12px; }
.shell-skel--price { width: 64px; height: 16px; margin-left: auto; }
.shell-skel--line { height: 12px; width: 100%; margin: 8px 0; }
.shell-skel--short { width: 55%; }
@keyframes shell-skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.market-row--skeleton {
  pointer-events: none;
  opacity: 0.9;
}
.market-row__link--skeleton {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 12px 0;
  text-decoration: none;
}
.order-trade-card--skeleton {
  pointer-events: none;
  padding: 14px 0;
  opacity: 0.85;
}
html[data-theme="dark"] .shell-skel {
  background: linear-gradient(90deg, #2a2a2e 25%, #333338 37%, #2a2a2e 63%);
  background-size: 400% 100%;
}

