/* ===== 学两招代理商 H5版 — 全局样式 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FF6B00;
  --primary-light: #FFF3E8;
  --primary-dark: #E55A00;
  --success: #19BE6B;
  --warning: #FF9900;
  --danger: #ED4014;
  --info: #2D8CF0;
  --bg: #F5F6FA;
  --card-bg: #fff;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-light: #999;
  --border: #eee;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

html, body {
  height: 100%;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── App Shell ── */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0,0,0,.1);
  overflow: hidden;
}

#page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* ── 页面容器 ── */
.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 70px;
  display: none;
}
.page.active { display: block; }
.page.no-tab { padding-bottom: 0; }

/* ── 顶部导航栏 ── */
.nav-bar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  min-height: 50px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-bar.white { background: #fff; color: var(--text-primary); border-bottom: 1px solid var(--border); }
.nav-bar.white .nav-title { color: var(--text-primary); }
.nav-back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; margin-right: 4px; }
.nav-back:active { background: rgba(255,255,255,.2); }
.nav-title { flex: 1; font-size: 17px; font-weight: 600; text-align: center; }
.nav-right { min-width: 32px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.nav-btn { padding: 6px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; border: none; background: rgba(255,255,255,.2); color: #fff; }
.nav-btn:active { background: rgba(255,255,255,.3); }
.nav-btn.primary-btn { background: #fff; color: var(--primary); font-weight: 600; }

/* ── TabBar ── */
#tabbar {
  height: 60px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  flex-shrink: 0;
  z-index: 200;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 2px;
  transition: all .15s;
}
.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; color: #999; }
.tab-item.active .tab-label { color: var(--primary); }
.tab-item.active .tab-icon { filter: none; }
.tab-item .tab-icon { opacity: .5; }
.tab-item.active .tab-icon { opacity: 1; }

/* ── 卡片 ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 16px;
}
.card + .card { margin-top: 0; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }

/* ── 统计格 ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 12px; }
.stat-item { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-item.success .stat-num { color: var(--success); }
.stat-item.info .stat-num { color: var(--info); }
.stat-item.warning .stat-num { color: var(--warning); }

/* ── 列表项 ── */
.list-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 16px 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s;
}
.list-item:active { transform: scale(.98); }
.list-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.list-item-name { font-size: 15px; font-weight: 600; }
.list-item-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.list-item-meta-text { font-size: 12px; color: var(--text-secondary); }

/* ── 标签 ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #e8faf0; color: var(--success); }
.badge-warning { background: #fff8ed; color: var(--warning); }
.badge-danger { background: #fdf0ed; color: var(--danger); }
.badge-info { background: #e8f4fe; color: var(--info); }
.badge-gray { background: #f5f5f5; color: #999; }
.badge-purple { background: #f3ebff; color: #9C27B0; }

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all .15s;
  gap: 6px;
}
.btn:active { opacity: .8; transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-gray { background: #f0f0f0; color: var(--text-secondary); }
.btn-block { width: 100%; border-radius: 12px; padding: 14px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 16px; }

/* ── 表单 ── */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fafafa;
  color: var(--text-primary);
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--primary); background: #fff; }
.form-input::placeholder { color: #bbb; }
textarea.form-input { resize: none; height: 90px; line-height: 1.5; }
select.form-input { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-hint.error { color: var(--danger); }

/* ── 单选组 ── */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-item {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  transition: all .15s;
  background: #fafafa;
}
.radio-item.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }
.radio-item.active.A { border-color: #ED4014; background: #fdf0ed; color: #ED4014; }
.radio-item.active.B { border-color: #FF9900; background: #fff8ed; color: #FF9900; }
.radio-item.active.C { border-color: #19BE6B; background: #edfaf3; color: #19BE6B; }
.radio-item.active.D { border-color: #999; background: #f5f5f5; color: #666; }

/* ── Tabs ── */
.tabs-bar {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 50px;
  z-index: 90;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .15s;
}
.tab-btn.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ── 弹窗 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-box {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 20px 32px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.25,.8,.25,1);
}
.modal-overlay.show .modal-box { transform: translateY(0); }
.modal-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 20px; color: var(--text-primary); }
.modal-center { align-items: center; }
.modal-center .modal-box { border-radius: 16px; max-width: 320px; margin: 0 auto; width: calc(100% - 32px); padding-bottom: 24px; }

/* ── 侧边抽屉 ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.drawer-overlay.show { opacity: 1; pointer-events: all; }
.drawer-box {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 88%;
  max-width: 380px;
  background: #fff;
  overflow-y: auto;
  padding: 20px;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.25,.8,.25,1);
}
.drawer-overlay.show .drawer-box { transform: translateX(0); }
.drawer-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.drawer-close { font-size: 20px; cursor: pointer; color: var(--text-secondary); padding: 4px; }

/* ── 提示 Toast ── */
#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) scale(.8);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2000;
  max-width: 70%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: all .2s;
}
#toast.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }

/* ── Loading ── */
#loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  z-index: 1999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#loading.show { opacity: 1; pointer-events: all; }
.spinner { width: 36px; height: 36px; border: 3px solid #eee; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 空状态 ── */
.empty-wrap { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-text { font-size: 14px; }

/* ── Section 标题 ── */
.section-title { font-size: 13px; color: var(--text-secondary); padding: 12px 16px 6px; }

/* ── 分割线 ── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── 头像 ── */
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.avatar.lg { width: 60px; height: 60px; font-size: 22px; }
.avatar.xl { width: 80px; height: 80px; font-size: 28px; }

/* ── 信息行 ── */
.info-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.info-row:last-child { border-bottom: none; }
.info-row-label { font-size: 13px; color: var(--text-secondary); width: 80px; flex-shrink: 0; }
.info-row-value { font-size: 14px; color: var(--text-primary); flex: 1; }
.info-row-action { color: var(--primary); font-size: 13px; cursor: pointer; }

/* ── 操作行 ── */
.action-row { display: flex; align-items: center; padding: 14px 16px; cursor: pointer; }
.action-row:active { background: #fafafa; }
.action-row-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-right: 12px; flex-shrink: 0; }
.action-row-title { flex: 1; font-size: 14px; font-weight: 500; }
.action-row-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.action-row-arrow { color: #ccc; font-size: 16px; }

/* ── 步骤条 ── */
.step-bar { display: flex; align-items: center; padding: 16px 20px 8px; }
.step-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.step-circle { width: 28px; height: 28px; border-radius: 50%; background: #eee; color: #999; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step-circle.active { background: var(--primary); color: #fff; }
.step-circle.done { background: var(--success); color: #fff; }
.step-label { font-size: 11px; color: #999; margin-top: 4px; }
.step-label.active { color: var(--primary); font-weight: 600; }
.step-line { flex: 1; height: 2px; background: #eee; margin: 0 4px; margin-bottom: 20px; }
.step-line.done { background: var(--success); }

/* ── 搜索框 ── */
.search-bar { display: flex; align-items: center; background: #fff; border-radius: 24px; padding: 8px 14px; margin: 12px 16px; gap: 8px; box-shadow: var(--shadow); }
.search-bar input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
.search-bar .search-icon { color: #ccc; font-size: 16px; }
.search-bar .clear-btn { color: #ccc; cursor: pointer; font-size: 16px; }

/* ── 金额大字展示 ── */
.amount-big { font-size: 32px; font-weight: 700; color: var(--primary); }
.amount-big .amount-unit { font-size: 16px; font-weight: 400; }

/* ── 悬浮按钮 ── */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px; height: 50px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(255,107,0,.4);
  cursor: pointer;
  z-index: 500;
  transition: transform .15s;
}
.fab:active { transform: scale(.9); }

/* ── 公告类型 ── */
.notice-type-important { background: #fdf0ed; color: var(--danger); }
.notice-type-normal { background: var(--primary-light); color: var(--primary); }

/* ── 成交状态 ── */
.settle-pending { color: var(--warning); }
.settle-settled { color: var(--success); }

/* ── 代理状态 ── */
.status-active { color: var(--success); }
.status-pending { color: var(--warning); }
.status-rejected { color: var(--danger); }
.status-disabled { color: #999; }

/* ── 进度条 ── */
.progress-bar { background: #eee; border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }

/* ── 登录页 ── */
.login-page { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 32px; background: linear-gradient(160deg,#fff8f0 0%,#fff 60%); }
.login-logo { margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.login-logo-img { width: 80px; height: 80px; object-fit: contain; }
.login-brand { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.login-slogan { font-size: 13px; color: var(--text-secondary); margin-bottom: 40px; }
.login-form { width: 100%; }
.login-demo-tip { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-secondary); background: var(--primary-light); border-radius: 8px; padding: 10px 16px; line-height: 1.6; }

/* ── 首页 Banner ── */
.home-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #FF8C42 100%);
  padding: 20px;
  color: #fff;
  margin: 12px 16px;
  border-radius: var(--radius);
}
.home-greeting { font-size: 13px; opacity: .9; margin-bottom: 4px; }
.home-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.home-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.home-badge { background: rgba(255,255,255,.2); border-radius: 12px; padding: 3px 10px; font-size: 12px; }

/* ── 快捷操作 ── */
.quick-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 0 16px 12px; }
.quick-item { background: #fff; border-radius: var(--radius); padding: 16px 10px; text-align: center; cursor: pointer; box-shadow: var(--shadow); }
.quick-item:active { transform: scale(.96); }
.quick-item-icon { font-size: 26px; margin-bottom: 6px; }
.quick-item-text { font-size: 12px; color: var(--text-secondary); }

/* ── 公告列表 ── */
.notice-item { padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.notice-item:last-child { border-bottom: none; }
.notice-item:active { opacity: .7; }
.notice-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notice-title { font-size: 14px; font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-date { font-size: 12px; color: var(--text-light); flex-shrink: 0; }

/* ── 跟进时间线 ── */
.timeline { padding: 0 4px; }
.timeline-item { display: flex; gap: 12px; margin-bottom: 16px; }
.timeline-left { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }
.timeline-line { width: 2px; flex: 1; background: #eee; margin-top: 4px; }
.timeline-content { flex: 1; padding-bottom: 4px; }
.timeline-time { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.timeline-text { font-size: 14px; color: var(--text-primary); line-height: 1.5; }

/* ── 管理员后台特殊样式 ── */
.admin-header { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); color: #fff; padding: 20px; margin: 12px 16px; border-radius: var(--radius); }
.admin-header h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.admin-header p { font-size: 13px; opacity: .7; }

/* ── 确认弹窗 ── */
.confirm-modal .modal-box { border-radius: 16px 16px 0 0; }
.confirm-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.confirm-content { font-size: 14px; color: var(--text-secondary); text-align: center; line-height: 1.6; margin-bottom: 20px; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns .btn { flex: 1; }

/* ── 代理类型卡片 ── */
.type-card { background: #fff; border-radius: var(--radius); padding: 16px; margin: 0 16px 10px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.type-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.type-card-name { font-size: 15px; font-weight: 600; }
.type-card-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.type-card-rates { display: flex; gap: 8px; flex-wrap: wrap; }
.rate-tag { background: var(--primary-light); color: var(--primary); border-radius: 8px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ── 详情页 header ── */
.detail-header { background: var(--primary); color: #fff; padding: 20px; text-align: center; }
.detail-header .avatar { margin: 0 auto 12px; background: rgba(255,255,255,.25); }
.detail-header-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.detail-header-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.detail-header-badge { background: rgba(255,255,255,.2); border-radius: 12px; padding: 4px 12px; font-size: 12px; }

/* ── 成交金额 ── */
.deal-amount-card { text-align: center; padding: 24px; }
.deal-amount-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }

/* ── 响应式 ── */
@media (min-width: 500px) {
  #app { border-radius: 0; }
}
