/* ==========================================================
   全局样式 phone-topup-ims-h5
   rem 适配：基准 font-size 37.5px（设计稿 375px，1rem = 37.5px）
   视觉规范：单一主色 #1677FF + 黑白灰中性色，无渐变、无彩色光晕
   ========================================================== */
html {
  font-size: 37.5px;
}
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* 禁止横向滚动 */
  font-size: 0.37rem;
  color: var(--text-1);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, button, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}
a {
  text-decoration: none;
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
}
ul, li, p, h1, h2, h3, h4 {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- 设计令牌 ---------- */
/* 主色：#1677FF 商务蓝（全站唯一彩色）；风险红：#f53f3f；背景：#f5f6f8；卡片：#ffffff
   动效曲线：进出 ease-out / 屏内移动 ease-in-out（勿用 ease-in） */
:root {
  --brand: #1677ff;
  --brand-deep: #0958d9;
  --brand-light: #e8f1ff;
  --brand-grad: #1677ff; /* 兼容旧引用：纯色，不再渐变 */
  --risk: #f53f3f;
  --text-1: #1f2329;
  --text-2: #666;
  --text-3: #999;
  --bg: #f5f6f8;
  --card-radius: 16px;
  --card-border: 1px solid #eef0f3;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);     /* 强 ease-out：进入/退出 */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* 强 ease-in-out：屏内移动 */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);  /* iOS 抽屉曲线 */
}

/* ---------- 通用布局 ---------- */
.page-content {
  min-height: 100vh;
  /* 页面内容距底部 tab 留出高度，防止内容被 tab 遮挡（含 iPhone 小黑条） */
  padding-bottom: calc(50px + env(safe-area-inset-bottom));
}
/* 首屏内容块依次轻入场：只在页面加载时播一次，transform+opacity 走合成器 */
@keyframes page-rise {
  from { opacity: 0; transform: translateY(10px); }
}
.page-content > * {
  animation: page-rise 360ms var(--ease-out) backwards;
}
.page-content > *:nth-child(2) { animation-delay: 45ms; }
.page-content > *:nth-child(3) { animation-delay: 90ms; }
.page-content > *:nth-child(4) { animation-delay: 135ms; }
.page-content > *:nth-child(5) { animation-delay: 180ms; }
.page-content > *:nth-child(6) { animation-delay: 225ms; }
/* 顶部导航属于页面 chrome，保持稳定不参与入场 */
.page-content > .nav-bar { animation: none; }

.card {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  margin: 0.27rem 0.27rem 0;
  padding: 0.32rem;
}
.section-title {
  font-size: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0.4rem 0.27rem 0.2rem;
  display: flex;
  align-items: center;
}
.section-title::before {
  content: "";
  width: 0.1rem;
  height: 0.4rem;
  background: var(--brand);
  border-radius: 4px;
  margin-right: 0.16rem;
}

/* ---------- 子页面顶部导航 ---------- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 1.2rem;
  padding: 0 0.32rem;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #eef0f3;
  color: var(--text-1);
  font-size: 0.45rem;
}
.nav-bar .nav-back {
  width: 0.7rem;
  height: 0.7rem;
  line-height: 0.66rem;
  text-align: center;
  border-radius: 50%;
  background: #f2f3f5;
  font-size: 0.45rem;
  margin-right: 0.2rem;
  flex-shrink: 0;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.nav-bar .nav-back:active {
  transform: scale(0.92);
  background: #e8eaee;
}
.nav-bar .nav-title {
  flex: 1;
  text-align: center;
  margin-right: 0.7rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 0.42rem;
  font-weight: 600;
  letter-spacing: 1px;
  height: 1.1rem;
  line-height: 1.1rem;
  text-align: center;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}
.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.88;
}
.btn-primary[disabled] {
  background: #aecbff;
  color: rgba(255, 255, 255, 0.9);
}
.btn-warn {
  background: var(--risk);
}
.btn-plain {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: none;
}

/* ---------- 表单 ---------- */
.form-item {
  display: flex;
  align-items: center;
  background: #fff;
  border: var(--card-border);
  border-radius: 10px;
  padding: 0.3rem 0.32rem;
  margin-bottom: 0.27rem;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.form-item:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}
.form-item label {
  width: 2.4rem;
  color: var(--text-2);
  flex-shrink: 0;
}
.form-item input, .form-item select {
  flex: 1;
  border: none;
  font-size: 0.4rem;
}
input::placeholder, textarea::placeholder { color: #b9bfc7; }
/* 原生控件品牌化 */
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 1.6rem 0;
  color: var(--text-3);
  font-size: 0.37rem;
}
.empty-state .empty-icon {
  font-size: 1.2rem;
  margin-bottom: 0.27rem;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 0.05rem 0.2rem;
  border-radius: 999px;
  font-size: 0.3rem;
  color: var(--brand);
  background: var(--brand-light);
}
.tag-red { color: var(--risk); background: rgba(245, 63, 63, 0.08); }
.tag-gray { color: var(--text-2); background: #f0f1f3; }
/* 低饱和琥珀：仅用于"待支付/进行中"这类中间态语义 */
.tag-orange { color: #d97a00; background: rgba(217, 122, 0, 0.1); }

/* ---------- 风险提示框 ---------- */
.risk-tip {
  margin: 0.27rem;
  padding: 0.3rem 0.32rem;
  background: rgba(245, 63, 63, 0.05);
  border: 1px solid rgba(245, 63, 63, 0.22);
  border-radius: var(--card-radius);
  color: var(--risk);
  font-size: 0.35rem;
  line-height: 1.6;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%) scale(0.94);
  background: rgba(17, 21, 26, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 0.28rem 0.5rem;
  border-radius: 12px;
  font-size: 0.35rem;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  max-width: 80%;
  text-align: center;
  /* 出场：visibility 延迟到过渡结束后再隐藏 */
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out),
    visibility 0s linear 240ms;
}
#toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out),
    visibility 0s;
}

/* ---------- 动效降级 ---------- */
/* 系统开启"减弱动态效果"时：动效几乎瞬时完成，保留状态变化本身 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
