/* ════════════════════════════════════════════════════════
   Wallet UI polish — premium dark, uniform CTAs (uifix_v1)
   ════════════════════════════════════════════════════════ */

#panelWallet .wallet-scroll {
  padding-bottom: 24px;
}

#panelWallet .wallet-balances {
  gap: 12px;
  margin-bottom: 14px;
}

#panelWallet .wallet-balance-card {
  background: #121214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: none;
}

#panelWallet .wallet-balance-card--grid {
  background: linear-gradient(160deg, #16161a 0%, #121214 100%);
  border-color: rgba(255, 122, 26, 0.28);
}

#panelWallet .wallet-balance-card--cryo {
  background: linear-gradient(160deg, #16161a 0%, #121214 100%);
  border-color: rgba(216, 132, 255, 0.22);
}

#panelWallet .wallet-balance-card__val {
  color: #f5f5f7;
}

#panelWallet .wallet-balance-card--grid .wallet-balance-card__val {
  color: #ff9a4a;
}

#panelWallet .wallet-balance-card--cryo .wallet-balance-card__val {
  color: #e0b0ff;
}

/* Primary action row */
.wallet-primary-actions {
  display: flex;
  gap: 12px;
  margin: 4px 0 10px;
}

#walletDepositHint {
  margin: 0 0 14px;
  color: rgba(245, 245, 247, 0.55);
  font-size: 13px;
  line-height: 1.4;
}

/* Unified button system */
.wallet-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a1e;
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.wallet-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.wallet-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.wallet-btn--primary {
  border-color: rgba(255, 122, 26, 0.55);
  background: linear-gradient(180deg, #1e1a16 0%, #161412 100%);
  color: #ff9a4a;
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.08), 0 0 18px rgba(255, 122, 26, 0.12);
}

.wallet-btn--primary:hover:not(:disabled),
.wallet-btn--primary:focus-visible {
  border-color: rgba(255, 154, 74, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.2), 0 0 22px rgba(255, 122, 26, 0.22);
}

.wallet-btn--secondary {
  border-color: rgba(255, 255, 255, 0.12);
  background: #151518;
  color: rgba(245, 245, 247, 0.88);
}

.wallet-btn--secondary:hover:not(:disabled),
.wallet-btn--secondary:focus-visible {
  border-color: rgba(255, 122, 26, 0.4);
  color: #ff9a4a;
}

.wallet-btn--ghost {
  min-height: 42px;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(245, 245, 247, 0.7);
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}

.wallet-primary-actions .wallet-btn {
  flex: 1 1 0;
  margin: 0;
}

/* Flow cards */
#panelWallet .wallet-card--flow,
#panelWallet .wallet-card--activity {
  background: #121214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
  box-shadow: none;
}

#panelWallet .wallet-card__title {
  margin: 0 0 10px;
  color: #f5f5f7;
  font-size: 15px;
  font-weight: 700;
}

#panelWallet .wallet-card__label {
  margin: 0 0 8px;
  color: rgba(245, 245, 247, 0.55);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Polymarket-style network dropdown ── */
.wallet-network-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.wallet-net-select {
  position: relative;
  margin: 0 0 14px;
  z-index: 5;
}

.wallet-net-select__trigger {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0e0e10;
  color: #f5f5f7;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wallet-net-select__trigger:hover,
.wallet-net-select[data-open="true"] .wallet-net-select__trigger {
  border-color: rgba(255, 122, 26, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.12);
}

.wallet-net-select__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: #121214;
  color: #a78bfa;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.wallet-net-select__icon.is-polygon {
  color: #a78bfa;
  background: #16121f;
  box-shadow: inset 0 0 0 1px rgba(130, 71, 229, 0.35);
}
.wallet-net-select__icon.is-tron {
  color: #ff6b6b;
  background: #1a1214;
  box-shadow: inset 0 0 0 1px rgba(239, 51, 64, 0.35);
}
.wallet-net-select__icon.is-solana {
  color: #14f195;
  background: #101816;
  box-shadow: inset 0 0 0 1px rgba(20, 241, 149, 0.28);
}

.wallet-net-select__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-net-select__name {
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-net-select__min {
  font-size: 12px;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.5);
}

.wallet-net-select__chev {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(245, 245, 247, 0.45);
  border-bottom: 2px solid rgba(245, 245, 247, 0.45);
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform 0.15s ease;
}

.wallet-net-select[data-open="true"] .wallet-net-select__chev {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.wallet-net-select__menu {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #16161a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.wallet-net-select__menu[hidden] {
  display: none !important;
}

.wallet-net-select__menu li {
  margin: 0;
  padding: 0;
}

.wallet-net-select__option {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f5f5f7;
  cursor: pointer;
  text-align: left;
}

.wallet-net-select__option:hover,
.wallet-net-select__option.is-active {
  background: rgba(255, 122, 26, 0.1);
}

.wallet-net-select__option-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: #121214;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.wallet-net-select__option-icon--polygon {
  color: #a78bfa;
  background: #16121f;
  box-shadow: inset 0 0 0 1px rgba(130, 71, 229, 0.35);
}
.wallet-net-select__option-icon--tron {
  color: #ff6b6b;
  background: #1a1214;
  box-shadow: inset 0 0 0 1px rgba(239, 51, 64, 0.35);
}
.wallet-net-select__option-icon--solana {
  color: #14f195;
  background: #101816;
  box-shadow: inset 0 0 0 1px rgba(20, 241, 149, 0.28);
}

.wallet-net-icon-svg {
  display: block;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}

.wallet-net-select__option-icon .wallet-net-icon-svg {
  width: 23px;
  height: 23px;
}

.wallet-net-select--withdraw {
  margin-bottom: 2px;
  z-index: 7;
}

.wallet-net-select--withdraw .wallet-net-select__menu {
  z-index: 30;
}

/* Always dark icon tiles — never flip to white via OS/Telegram light preference. */
.wallet-net-select__icon,
.wallet-net-select__option-icon,
.wallet-net-select__icon.is-polygon,
.wallet-net-select__icon.is-tron,
.wallet-net-select__icon.is-solana,
.wallet-net-select__option-icon--polygon,
.wallet-net-select__option-icon--tron,
.wallet-net-select__option-icon--solana {
  background-image: none !important;
}

.wallet-net-select__option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wallet-net-select__option-name {
  font-size: 14px;
  font-weight: 700;
}

.wallet-net-select__option-meta {
  font-size: 12px;
  color: rgba(245, 245, 247, 0.5);
}

.wallet-flow-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-deposit-setup {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#custodialDepositSetup.wallet-state--hidden,
#custodialDepositSetup[hidden] {
  display: none !important;
}

.wallet-card--deposit-active .wallet-card__title {
  color: #ff9a4a;
}

.wallet-invoice__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(245, 245, 247, 0.72);
}

.wallet-invoice__meta-sep {
  opacity: 0.45;
}

.wallet-invoice__countdown {
  text-align: center;
  min-height: 18px;
}

.wallet-btn--cancel-deposit {
  width: 100%;
  margin-top: 4px;
}

#panelWallet .wallet-input {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0e0e10;
  color: #f5f5f7;
  box-sizing: border-box;
}

#panelWallet .wallet-input:focus {
  outline: none;
  border-color: rgba(255, 122, 26, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.15), 0 0 14px rgba(255, 122, 26, 0.12);
}

.wallet-link__hint {
  margin: 0;
  color: rgba(245, 245, 247, 0.55);
  font-size: 13px;
  line-height: 1.45;
}

.wallet-link__hint--inline {
  min-height: 18px;
}

.wallet-link__hint--exact {
  text-align: center;
}

.wallet-invoice {
  margin-top: 0;
  padding: 14px 0 4px;
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-card--deposit-active .wallet-invoice {
  padding-top: 0;
}

/* Specificity must beat .wallet-invoice { display:flex } — hide until Generate */
#custodialInvoiceDetails.wallet-state--hidden,
#custodialInvoiceDetails[hidden],
.wallet-invoice.wallet-state--hidden,
.wallet-invoice[hidden] {
  display: none !important;
}

.wallet-net-icon-svg {
  display: block;
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}

.wallet-net-select__icon,
.wallet-net-select__option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: 0;
  color: inherit;
}

/* Horizontal invoice banner — never vertical letter stack */
.wallet-invoice__banner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.12), rgba(14, 14, 16, 0.9));
  overflow: hidden;
}

.wallet-invoice__banner-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(94, 234, 212, 0.75);
}

.wallet-invoice__serial-code {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #5eead4;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  word-break: normal;
  overflow-wrap: normal;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wallet-invoice__serial-code::-webkit-scrollbar {
  display: none;
}

.wallet-invoice__banner-copy {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: rgba(14, 14, 16, 0.7);
  color: #5eead4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

.wallet-await {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 154, 74, 0.28);
  background: linear-gradient(180deg, rgba(255, 122, 26, 0.12), rgba(14, 14, 16, 0.9));
}

.wallet-await__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 154, 74, 0.25);
  border-top-color: #ff9a4a;
  animation: walletAwaitSpin 0.85s linear infinite;
  flex: 0 0 auto;
}

.wallet-await__text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffb06a;
  animation: walletAwaitPulse 1.8s ease-in-out infinite;
}

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

@keyframes walletAwaitPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

.wallet-await--success {
  border-color: rgba(52, 211, 153, 0.48);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.14), rgba(10, 20, 16, 0.92));
  animation: walletDepositSuccess 0.65s ease-out;
}

.wallet-await--success .wallet-await__text {
  color: #6ee7b7;
  animation: none;
}

.wallet-await__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #34d399;
  color: #04130d;
  font-size: 14px;
  font-weight: 900;
  animation: walletDepositCheck 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-await--expired,
.wallet-await--failed {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.12);
}

.wallet-await--expired .wallet-await__text,
.wallet-await--failed .wallet-await__text {
  color: #fca5a5;
  animation: none;
}

.wallet-await__state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 800;
}

.wallet-invoice--completed .wallet-invoice__banner {
  border-color: rgba(52, 211, 153, 0.42);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.11), rgba(10, 18, 14, 0.92));
}

@keyframes walletDepositCheck {
  0% { opacity: 0; transform: scale(0.35) rotate(-18deg); }
  70% { opacity: 1; transform: scale(1.14) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes walletDepositSuccess {
  0% { transform: scale(0.98); opacity: 0.55; }
  100% { transform: scale(1); opacity: 1; }
}

/* QR block — only visible after active invoice generation */
.wallet-deposit-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #ffffff;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
}

.wallet-deposit-qr.wallet-state--hidden,
.wallet-deposit-qr[hidden] {
  display: none !important;
}

.wallet-deposit-qr__canvas {
  display: block;
  width: 180px;
  height: 180px;
  max-width: 100%;
  border-radius: 4px;
}

/* Address bar: wrap address beside copy — no native scrollbar */
.wallet-address-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(255, 122, 26, 0.32);
  background: #0e0e10;
  overflow: hidden;
  box-shadow: 0 0 16px rgba(255, 122, 26, 0.08);
}

.wallet-invoice__address {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  box-sizing: border-box;
  padding: 12px;
  border: 0;
  background: transparent;
  color: #ff9a4a;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 11px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.wallet-address-bar__copy {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 72px;
  padding: 8px 10px;
  border: 0;
  border-left: 1px solid rgba(255, 122, 26, 0.28);
  background: linear-gradient(180deg, #1e1a16 0%, #161412 100%);
  color: #ff9a4a;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wallet-address-bar__copy-icon {
  width: 16px;
  height: 16px;
  display: block;
  background:
    linear-gradient(currentColor, currentColor) 3px 5px / 10px 10px no-repeat,
    linear-gradient(transparent, transparent);
  border: 1.5px solid currentColor;
  border-radius: 3px;
  box-shadow: 3px -3px 0 -1px #161412, 3px -3px 0 0 currentColor;
  opacity: 0.95;
}

.wallet-address-bar__copy-text {
  max-width: 64px;
  text-align: center;
  line-height: 1.15;
}

#custodialCopyDepositBtn.is-copied,
.wallet-address-bar__copy.is-copied {
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
}

#custodialDepositBlock.wallet-card--flow {
  max-height: none;
  overflow: visible;
  -webkit-overflow-scrolling: auto;
  overflow-x: hidden;
}

.wallet-input--select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(245,245,247,0.55) 50%),
    linear-gradient(135deg, rgba(245,245,247,0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.wallet-withdraw-quote {
  margin: 4px 0 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 18, 22, 0.92);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-withdraw-quote__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: rgba(245, 245, 247, 0.62);
}

.wallet-withdraw-quote__row strong {
  color: #f5f5f7;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
}

.wallet-withdraw-quote__row--receive strong {
  color: #6ee7b7;
  font-size: 14px;
}

#walletActivityWrap {
  margin-top: 16px;
}

#panelWallet .wallet-activity__toggle {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #151518;
  color: rgba(245, 245, 247, 0.75);
}

/* Soften legacy orange CTA overrides inside wallet */
#panelWallet .wallet-card__cta {
  border-radius: 14px;
  min-height: 48px;
}

.wallet-btn--support {
  margin-top: 4px;
  border-radius: 12px;
  border-color: rgba(255, 154, 74, 0.45);
  background: #161412;
  color: #ff9a4a;
  text-decoration: none;
  box-shadow: 0 0 14px rgba(255, 122, 26, 0.1);
}

.wallet-btn--support:hover,
.wallet-btn--support:focus-visible {
  border-color: rgba(255, 154, 74, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.18), 0 0 20px rgba(255, 122, 26, 0.2);
  color: #ffb06a;
}

/* Legacy network button styles (unused, kept harmless) */
.wallet-btn--network,
.wallet-network-picker,
.wallet-network-selected {
  display: none;
}

