/* ================================================================
   Earth API - 钱包样式 (wallet.css) v1.0
   双强调色：青色 #0EA5E9（操作）+ amber #F59E0B（余额专用）
   15px 基准字号 · ring 风格 · tabular-nums 数值
   与控制台 ec- 前缀平行，独立 ew- 命名空间
   ================================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 背景 */
  --ew-bg: #f8fafc;
  --ew-bg-elevated: #ffffff;
  --ew-bg-hover: #f1f5f9;
  --ew-bg-subtle: #fafbfc;
  --ew-bg-active: rgba(14, 165, 233, 0.08);

  /* 主色 - 青色（DESIGN.md 规定，与控制台一致） */
  --ew-primary: #0ea5e9;
  --ew-primary-hover: #0284c7;
  --ew-primary-soft: rgba(14, 165, 233, 0.10);
  --ew-primary-border: rgba(14, 165, 233, 0.25);
  --ew-primary-text: #0369a1;
  --ew-secondary: #06b6d4;
  --ew-secondary-soft: rgba(6, 182, 212, 0.10);

  /* amber 强调色 - 钱包/余额专用 */
  --ew-amber: #f59e0b;
  --ew-amber-hover: #d97706;
  --ew-amber-deep: #b45309;
  --ew-amber-soft: rgba(245, 158, 11, 0.10);
  --ew-amber-border: rgba(245, 158, 11, 0.25);
  --ew-amber-grad-from: #fffbeb;
  --ew-amber-grad-to: #fef3c7;

  /* 语义色 */
  --ew-success: #10b981;
  --ew-success-soft: rgba(16, 185, 129, 0.10);
  --ew-success-text: #047857;
  --ew-warning: #f59e0b;
  --ew-warning-soft: rgba(245, 158, 11, 0.10);
  --ew-warning-text: #b45309;
  --ew-error: #ef4444;
  --ew-error-soft: rgba(239, 68, 68, 0.10);
  --ew-error-text: #b91c1c;
  --ew-pending: #6366f1;
  --ew-pending-soft: rgba(99, 102, 241, 0.10);
  --ew-pending-text: #4338ca;

  /* 文字 */
  --ew-text-primary: #0f172a;
  --ew-text-secondary: #475569;
  --ew-text-tertiary: #64748b;
  --ew-text-muted: #94a3b8;
  --ew-text-placeholder: #94a3b8;
  --ew-text-on-dark: #f8fafc;

  /* 边框 / ring */
  --ew-border: #e2e8f0;
  --ew-border-strong: #cbd5e1;
  --ew-border-subtle: #f1f5f9;
  --ew-ring: 0 0 0 1px rgba(15, 23, 42, 0.06);
  --ew-ring-hover: 0 0 0 1px rgba(14, 165, 233, 0.18), 0 4px 12px rgba(15, 23, 42, 0.05);
  --ew-ring-amber: 0 0 0 1px rgba(245, 158, 11, 0.22);
  --ew-ring-amber-hover: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 4px 12px rgba(245, 158, 11, 0.10);
  --ew-input-border: #cbd5e1;
  --ew-input-focus: #0ea5e9;

  /* 圆角 - 同心圆角 */
  --ew-radius-xs: 5px;
  --ew-radius-sm: 7px;
  --ew-radius-md: 10px;
  --ew-radius-lg: 12px;
  --ew-radius-xl: 14px;
  --ew-radius-2xl: 18px;

  /* 阴影 - 克制 */
  --ew-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --ew-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --ew-shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --ew-shadow-lg: 0 8px 16px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -4px rgba(15, 23, 42, 0.04);
  --ew-shadow-xl: 0 16px 24px -6px rgba(15, 23, 42, 0.10), 0 8px 16px -8px rgba(15, 23, 42, 0.05);
  --ew-shadow-amber: 0 4px 12px rgba(245, 158, 11, 0.18);
  --ew-shadow-focus: 0 0 0 3px rgba(14, 165, 233, 0.15);
  --ew-shadow-focus-amber: 0 0 0 3px rgba(245, 158, 11, 0.18);

  /* 尺寸 */
  --ew-site-header-height: 68px;
  --ew-content-max: 1200px;

  /* 字体 - DESIGN.md 规定 */
  --ew-font-base: 'Outfit', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  --ew-font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;

  /* 过渡 */
  --ew-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ew-ease-fast: cubic-bezier(0.4, 0, 0.2, 1);
  --ew-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--ew-font-base);
  background: var(--ew-bg);
  color: var(--ew-text-primary);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 14px;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--ew-primary);
  text-decoration: none;
  transition: color 0.15s var(--ew-ease-fast);
}
a:hover {
  color: var(--ew-primary-hover);
}

/* 滚动条 - 纤细 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--ew-border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ew-text-muted);
}

::selection {
  background: rgba(14, 165, 233, 0.18);
  color: var(--ew-text-primary);
}

/* ---------- 整体布局 ---------- */
.ew-app {
  min-height: calc(100vh - var(--ew-site-header-height));
  margin-top: var(--ew-site-header-height);
  background: var(--ew-bg);
  padding: 24px 24px 48px;
}

.ew-container {
  max-width: var(--ew-content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- 页面标题 ---------- */
.ew-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.ew-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ew-text-primary);
  margin: 0 0 4px;
  line-height: 1.2;
}

.ew-page-sub {
  font-size: 0.85rem;
  color: var(--ew-text-tertiary);
  margin: 0;
}

.ew-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 余额 Hero ---------- */
.ew-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
}

/* 主余额卡 - amber 渐变 + 径向光晕 */
.ew-balance-main {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ew-amber-grad-from) 0%, var(--ew-amber-grad-to) 100%);
  border-radius: var(--ew-radius-xl);
  padding: 22px 24px;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18), var(--ew-shadow-sm);
  transition: box-shadow 0.25s var(--ew-ease);
}
.ew-balance-main::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 180%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.18) 0%, transparent 70%);
  pointer-events: none;
}
.ew-balance-main:hover {
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), var(--ew-shadow-md);
}

.ew-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.ew-balance-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ew-amber-deep);
  letter-spacing: 0.01em;
}

.ew-balance-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
  font-size: 0.72rem;
  font-weight: 600;
}
.ew-balance-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.ew-balance-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.ew-balance-symbol {
  font-family: var(--ew-font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ew-amber-hover);
  line-height: 1;
}

.ew-balance-num {
  font-family: var(--ew-font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--ew-amber-hover);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ew-balance-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(245, 158, 11, 0.18);
  position: relative;
  z-index: 1;
}

.ew-balance-foot-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ew-balance-foot-label {
  font-size: 0.72rem;
  color: var(--ew-amber-deep);
  opacity: 0.75;
  font-weight: 500;
}

.ew-balance-foot-val {
  font-family: var(--ew-font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ew-amber-hover);
  font-variant-numeric: tabular-nums;
}

/* 侧边卡片（累计消费 / 消费占比） */
.ew-balance-side {
  position: relative;
  background: var(--ew-bg-elevated);
  border-radius: var(--ew-radius-xl);
  padding: 22px 24px;
  box-shadow: var(--ew-ring), var(--ew-shadow-xs);
  transition: box-shadow 0.25s var(--ew-ease), transform 0.25s var(--ew-ease);
  display: flex;
  flex-direction: column;
}
.ew-balance-side:hover {
  box-shadow: var(--ew-ring-hover);
  transform: translateY(-1px);
}
.ew-balance-side[data-tone="amber"] {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.ew-balance-side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ew-balance-side-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--ew-radius-md);
  background: var(--ew-primary-soft);
  color: var(--ew-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ew-balance-side-icon svg {
  width: 17px;
  height: 17px;
}
.ew-balance-side[data-tone="amber"] .ew-balance-side-icon {
  background: var(--ew-amber-soft);
  color: var(--ew-amber-hover);
}

.ew-balance-side-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ew-text-secondary);
  letter-spacing: 0.01em;
}

.ew-balance-side-num {
  font-family: var(--ew-font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ew-text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.ew-balance-side[data-tone="amber"] .ew-balance-side-num {
  color: var(--ew-amber-hover);
}

.ew-balance-side-sub {
  font-size: 0.74rem;
  color: var(--ew-text-muted);
  margin-top: auto;
}

/* 进度条 */
.ew-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
  margin-top: auto;
}

.ew-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ew-primary) 0%, var(--ew-amber) 100%);
  position: relative;
  overflow: hidden;
  transition: width 0.6s var(--ew-ease);
}
.ew-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: ewProgressShimmer 1.8s ease-in-out infinite;
}

@keyframes ewProgressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---------- 卡片 ---------- */
.ew-card {
  background: var(--ew-bg-elevated);
  border-radius: var(--ew-radius-xl);
  box-shadow: var(--ew-ring), var(--ew-shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.25s var(--ew-ease);
}
.ew-card:hover {
  box-shadow: var(--ew-ring-hover);
}

.ew-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ew-border-subtle);
}

.ew-card-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ew-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--ew-radius-md);
  background: var(--ew-primary-soft);
  color: var(--ew-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ew-icon-badge svg {
  width: 20px;
  height: 20px;
}
.ew-icon-badge[data-tone="amber"] {
  background: var(--ew-amber-soft);
  color: var(--ew-amber-hover);
}
.ew-icon-badge[data-tone="cyan"] {
  background: var(--ew-secondary-soft);
  color: var(--ew-secondary);
}

.ew-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ew-text-primary);
  letter-spacing: -0.01em;
}

.ew-card-header p {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--ew-text-tertiary);
}

.ew-card-body {
  padding: 22px;
}

.ew-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ew-text-secondary);
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}

/* ---------- 按钮 ---------- */
.ew-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--ew-radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.18s var(--ew-ease);
  white-space: nowrap;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}
.ew-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ew-btn:focus-visible {
  outline: none;
  box-shadow: var(--ew-shadow-focus);
}
.ew-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.ew-btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: var(--ew-radius-sm);
}
.ew-btn-sm svg {
  width: 14px;
  height: 14px;
}
.ew-btn-lg {
  height: 44px;
  padding: 0 22px;
  font-size: 0.95rem;
  border-radius: var(--ew-radius-lg);
}
.ew-btn-lg svg {
  width: 18px;
  height: 18px;
}
.ew-btn-block {
  width: 100%;
}

/* 主色按钮 - shimmer 扫光 */
.ew-btn-primary {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border-color: #0284c7;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.ew-btn-primary::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -100%;
  width: 50%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s var(--ew-ease);
  pointer-events: none;
}
.ew-btn-primary:hover {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #0369a1;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.ew-btn-primary:hover::after {
  left: 140%;
}
.ew-btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* amber 按钮 - 钱包充值专用，shimmer 扫光 */
.ew-btn-amber {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.ew-btn-amber::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -100%;
  width: 50%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.30), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s var(--ew-ease);
  pointer-events: none;
}
.ew-btn-amber:hover {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  border-color: #b45309;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.ew-btn-amber:hover::after {
  left: 140%;
}
.ew-btn-amber:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 次级按钮 */
.ew-btn-secondary {
  background: var(--ew-bg-elevated);
  color: var(--ew-text-secondary);
  border-color: var(--ew-border);
  box-shadow: var(--ew-shadow-xs);
}
.ew-btn-secondary:hover {
  border-color: var(--ew-primary-border);
  color: var(--ew-primary);
  background: var(--ew-bg-elevated);
  box-shadow: var(--ew-shadow-sm);
  transform: translateY(-1px);
}
.ew-btn-secondary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--ew-shadow-xs);
}

/* ---------- 表单 ---------- */
.ew-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ew-field-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ew-text-secondary);
}

.ew-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--ew-radius-md);
  border: 1px solid var(--ew-input-border);
  background: var(--ew-bg-elevated);
  color: var(--ew-text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s var(--ew-ease-fast), box-shadow 0.15s var(--ew-ease-fast);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ew-input::placeholder {
  color: var(--ew-text-placeholder);
}
.ew-input:focus {
  border-color: var(--ew-input-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* ---------- 充值区 ---------- */
.ew-recharge-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  align-items: start;
}

/* 计算器 - 暗色显示屏 */
.ew-calc {
  background: var(--ew-bg-subtle);
  border-radius: var(--ew-radius-lg);
  padding: 14px;
  box-shadow: var(--ew-ring);
}

.ew-calc-display {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-radius: var(--ew-radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}
.ew-calc-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.3), transparent);
}

.ew-calc-display-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ew-calc-display-value {
  font-family: var(--ew-font-mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ew-text-on-dark);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  min-height: 2.1rem;
}

.ew-calc-display-currency {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--ew-font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(14, 165, 233, 0.8);
  letter-spacing: 0.05em;
}

.ew-calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ew-calc-key {
  height: 44px;
  border-radius: var(--ew-radius-sm);
  font-family: var(--ew-font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ew-text-primary);
  background: var(--ew-bg-elevated);
  border: 1px solid var(--ew-border);
  box-shadow: var(--ew-shadow-xs);
  transition: all 0.12s var(--ew-ease-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ew-calc-key:hover {
  background: var(--ew-bg-hover);
  border-color: var(--ew-border-strong);
  transform: translateY(-1px);
}
.ew-calc-key:active {
  transform: translateY(0) scale(0.95);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.ew-calc-key.num {
  color: var(--ew-text-primary);
}
.ew-calc-key.op {
  background: rgba(14, 165, 233, 0.08);
  color: var(--ew-primary);
  border-color: rgba(14, 165, 233, 0.2);
}
.ew-calc-key.op:hover {
  background: rgba(14, 165, 233, 0.14);
}
.ew-calc-key.fn {
  background: rgba(239, 68, 68, 0.06);
  color: var(--ew-error);
  border-color: rgba(239, 68, 68, 0.18);
}
.ew-calc-key.fn:hover {
  background: rgba(239, 68, 68, 0.12);
}
.ew-calc-key.eq {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border-color: #0284c7;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.25);
}
.ew-calc-key.eq:hover {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
}
.ew-calc-key.zero {
  grid-column: span 2;
}

/* 右侧面板 */
.ew-recharge-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ew-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ew-amount-option {
  height: 44px;
  border-radius: var(--ew-radius-md);
  background: var(--ew-bg-elevated);
  border: 1px solid var(--ew-border);
  color: var(--ew-text-primary);
  font-family: var(--ew-font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.15s var(--ew-ease);
  box-shadow: var(--ew-shadow-xs);
}
.ew-amount-option:hover {
  border-color: var(--ew-amber-border);
  color: var(--ew-amber-hover);
  background: var(--ew-amber-soft);
  transform: translateY(-1px);
}
.ew-amount-option.active {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

/* 兑换码 */
.ew-redeem {
  background: var(--ew-bg-subtle);
  border-radius: var(--ew-radius-md);
  padding: 14px;
  box-shadow: var(--ew-ring);
}

.ew-redeem-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ew-redeem-head svg {
  width: 16px;
  height: 16px;
  color: var(--ew-primary);
}
.ew-redeem-head-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ew-text-secondary);
}

.ew-redeem-row {
  display: flex;
  gap: 8px;
}
.ew-redeem-row + .ew-redeem-row {
  margin-top: 8px;
}
.ew-redeem-row .ew-input {
  flex: 1;
}
.ew-redeem-row .ew-btn {
  flex-shrink: 0;
}
.ew-redeem-row--pwd .ew-input {
  width: 100%;
}
.ew-redeem-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--ew-text-muted);
  line-height: 1.4;
}

/* ---------- 交易记录 ---------- */
.ew-tx-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ew-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--ew-bg-subtle);
  border: 1px solid var(--ew-border);
  border-radius: var(--ew-radius-md);
}

.ew-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--ew-radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ew-text-secondary);
  transition: all 0.15s var(--ew-ease);
}
.ew-tab:hover {
  color: var(--ew-text-primary);
  background: rgba(255, 255, 255, 0.6);
}
.ew-tab.active {
  background: var(--ew-bg-elevated);
  color: var(--ew-primary);
  font-weight: 600;
  box-shadow: var(--ew-shadow-xs);
}

.ew-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--ew-text-tertiary);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--ew-font-mono);
  font-variant-numeric: tabular-nums;
}
.ew-tab.active .ew-tab-count {
  background: var(--ew-primary-soft);
  color: var(--ew-primary);
}

.ew-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 260px;
  max-width: 100%;
}
.ew-search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--ew-text-muted);
  pointer-events: none;
}
.ew-search .ew-input {
  padding-left: 32px;
  height: 34px;
  font-size: 0.85rem;
}

/* 表格 */
.ew-table-wrap {
  overflow-x: auto;
  border-radius: var(--ew-radius-md);
  border: 1px solid var(--ew-border);
}

.ew-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.ew-table thead {
  background: var(--ew-bg-subtle);
}

.ew-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--ew-text-secondary);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ew-border);
  white-space: nowrap;
}

.ew-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ew-border-subtle);
  color: var(--ew-text-primary);
  vertical-align: middle;
}

.ew-table tbody tr:last-child td {
  border-bottom: none;
}

.ew-table tbody tr {
  animation: ewTableRowEnter 0.35s var(--ew-ease) both;
  transition: background 0.15s var(--ew-ease-fast);
}
.ew-table tbody tr:hover {
  background: rgba(14, 165, 233, 0.03);
}

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

/* 行入场动画的逐级延迟（前 15 行） */
.ew-table tbody tr:nth-child(1) { animation-delay: 0ms; }
.ew-table tbody tr:nth-child(2) { animation-delay: 25ms; }
.ew-table tbody tr:nth-child(3) { animation-delay: 50ms; }
.ew-table tbody tr:nth-child(4) { animation-delay: 75ms; }
.ew-table tbody tr:nth-child(5) { animation-delay: 100ms; }
.ew-table tbody tr:nth-child(6) { animation-delay: 125ms; }
.ew-table tbody tr:nth-child(7) { animation-delay: 150ms; }
.ew-table tbody tr:nth-child(8) { animation-delay: 175ms; }
.ew-table tbody tr:nth-child(9) { animation-delay: 200ms; }
.ew-table tbody tr:nth-child(10) { animation-delay: 225ms; }
.ew-table tbody tr:nth-child(11) { animation-delay: 250ms; }
.ew-table tbody tr:nth-child(12) { animation-delay: 275ms; }
.ew-table tbody tr:nth-child(13) { animation-delay: 300ms; }
.ew-table tbody tr:nth-child(14) { animation-delay: 325ms; }
.ew-table tbody tr:nth-child(15) { animation-delay: 350ms; }

.ew-table-empty {
  text-align: center;
  color: var(--ew-text-muted);
  padding: 40px 20px !important;
  font-size: 0.88rem;
}
.ew-table-empty svg {
  width: 32px;
  height: 32px;
  color: var(--ew-text-muted);
  opacity: 0.6;
}

/* 交易类型单元格 */
.ew-tx-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--ew-radius-sm);
  background: var(--ew-primary-soft);
  color: var(--ew-primary);
}
.ew-tx-type svg {
  width: 15px;
  height: 15px;
}
.ew-tx-type[data-type="redeem"] {
  background: var(--ew-amber-soft);
  color: var(--ew-amber-hover);
}

.ew-tx-time {
  font-family: var(--ew-font-mono);
  font-size: 0.82rem;
  color: var(--ew-text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ew-tx-amount {
  font-family: var(--ew-font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ew-tx-amount.positive {
  color: var(--ew-success-text);
}

.ew-tx-desc {
  font-size: 0.85rem;
  color: var(--ew-text-primary);
}

.ew-tx-ip {
  font-family: var(--ew-font-mono);
  font-size: 0.78rem;
  color: var(--ew-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* 徽章 */
.ew-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ew-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.ew-badge-success {
  background: var(--ew-success-soft);
  color: var(--ew-success-text);
}
.ew-badge-pending {
  background: var(--ew-pending-soft);
  color: var(--ew-pending-text);
}
.ew-badge-failed {
  background: var(--ew-error-soft);
  color: var(--ew-error-text);
}

/* 分页 */
.ew-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.ew-pagination-info {
  font-size: 0.8rem;
  color: var(--ew-text-tertiary);
  font-family: var(--ew-font-mono);
  font-variant-numeric: tabular-nums;
}

.ew-pagination-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ew-pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--ew-radius-sm);
  background: var(--ew-bg-elevated);
  border: 1px solid var(--ew-border);
  color: var(--ew-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--ew-font-mono);
  font-variant-numeric: tabular-nums;
  transition: all 0.15s var(--ew-ease);
  box-shadow: var(--ew-shadow-xs);
}
.ew-pagination-btn:hover:not(:disabled):not(.active) {
  border-color: var(--ew-primary-border);
  color: var(--ew-primary);
  background: var(--ew-bg-elevated);
  transform: translateY(-1px);
}
.ew-pagination-btn.active {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border-color: #0284c7;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.25);
}
.ew-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 模态框 ---------- */
.ew-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--ew-ease-fast), visibility 0.2s var(--ew-ease-fast);
}
.ew-modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ew-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--ew-bg-elevated);
  border-radius: var(--ew-radius-xl);
  box-shadow: var(--ew-shadow-xl);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s var(--ew-ease-spring);
}
.ew-modal-overlay.open .ew-modal {
  transform: translateY(0) scale(1);
}

.ew-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ew-border-subtle);
}
.ew-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ew-text-primary);
  letter-spacing: -0.01em;
}

.ew-modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ew-radius-sm);
  color: var(--ew-text-tertiary);
  font-size: 1.4rem;
  line-height: 1;
  transition: all 0.15s var(--ew-ease-fast);
}
.ew-modal-close:hover {
  background: var(--ew-bg-hover);
  color: var(--ew-text-primary);
}

.ew-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ew-modal-amount {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-radius: var(--ew-radius-lg);
  box-shadow: var(--ew-ring-amber);
}
.ew-modal-amount-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ew-amber-deep);
  letter-spacing: 0.02em;
}
.ew-modal-amount-val {
  font-family: var(--ew-font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ew-amber-hover);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ew-modal-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ew-text-tertiary);
  text-align: center;
  line-height: 1.5;
}

.ew-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ---------- Toast ---------- */
.ew-toast {
  position: fixed;
  top: 88px;
  right: 24px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-width: 280px;
  max-width: 420px;
  border-radius: var(--ew-radius-md);
  background: var(--ew-bg-elevated);
  box-shadow: var(--ew-shadow-lg);
  border-left: 3px solid var(--ew-text-tertiary);
  font-size: 0.86rem;
  color: var(--ew-text-primary);
  opacity: 0;
  transform: translateX(20px);
  visibility: hidden;
  transition: opacity 0.25s var(--ew-ease), transform 0.25s var(--ew-ease-spring), visibility 0.25s var(--ew-ease);
}
.ew-toast.show {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
}
.ew-toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.ew-toast span {
  flex: 1;
  line-height: 1.4;
}
.ew-toast-success {
  border-left-color: var(--ew-success);
}
.ew-toast-success svg {
  color: var(--ew-success);
}
.ew-toast-error {
  border-left-color: var(--ew-error);
}
.ew-toast-error svg {
  color: var(--ew-error);
}
.ew-toast-info {
  border-left-color: var(--ew-primary);
}
.ew-toast-info svg {
  color: var(--ew-primary);
}

/* ---------- 动画 ---------- */
.ew-fade-in {
  animation: ewFadeIn 0.5s var(--ew-ease) both;
}
.ew-fade-in:nth-child(1) { animation-delay: 0ms; }
.ew-fade-in:nth-child(2) { animation-delay: 60ms; }
.ew-fade-in:nth-child(3) { animation-delay: 120ms; }
.ew-fade-in:nth-child(4) { animation-delay: 180ms; }
.ew-fade-in:nth-child(5) { animation-delay: 240ms; }

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

/* 加载旋转动画（用于按钮 loading 状态） */
@keyframes ewSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .ew-hero {
    grid-template-columns: 1fr 1fr;
  }
  .ew-balance-main {
    grid-column: span 2;
  }
  .ew-recharge-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .ew-app {
    padding: 16px 14px 32px;
  }
  .ew-container {
    gap: 14px;
  }
  .ew-page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ew-page-title {
    font-size: 1.3rem;
  }
  .ew-hero {
    grid-template-columns: 1fr;
  }
  .ew-balance-main {
    grid-column: auto;
    padding: 18px 18px;
  }
  .ew-balance-num {
    font-size: 2.2rem;
  }
  .ew-balance-foot {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .ew-balance-side {
    padding: 18px;
  }
  .ew-card-header,
  .ew-card-body {
    padding: 16px;
  }
  .ew-calc-key {
    height: 40px;
    font-size: 0.92rem;
  }
  .ew-amount-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ew-tx-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .ew-search {
    width: 100%;
  }
  .ew-table th,
  .ew-table td {
    padding: 10px 10px;
    font-size: 0.82rem;
  }
  .ew-tx-ip {
    display: none;
  }
  .ew-pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .ew-pagination-list {
    justify-content: center;
    flex-wrap: wrap;
  }
  .ew-toast {
    top: auto;
    bottom: 20px;
    right: 14px;
    left: 14px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .ew-amount-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ew-calc-keys {
    gap: 4px;
  }
  .ew-calc-key {
    height: 38px;
    font-size: 0.88rem;
  }
}

/* ---------- 可访问性 ---------- */
:focus-visible {
  outline: 2px solid var(--ew-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ew-progress-bar::after {
    display: none;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .ew-balance-main,
  .ew-balance-side,
  .ew-card,
  .ew-calc {
    border: 1px solid var(--ew-border-strong);
  }
}
