/* 终本通 H5 · 公共样式
   视觉对齐小程序：主色 #1677ff，页面底 #f5f5f5，卡片白底圆角 12px */

:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #222222;
  --text-2: #666666;
  --text-3: #999999;
  --border: #eeeeee;
  --danger: #f5222d;
  --warn: #fa8c16;
  --success: #52c41a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

a { color: inherit; text-decoration: none; }

/* ===== 顶部标题区 ===== */
.header {
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
  color: #fff;
  padding: 14px 16px calc(14px + env(safe-area-inset-top));
  padding-top: calc(14px + env(safe-area-inset-top));
}
.header-title { font-size: 17px; font-weight: 500; }
.header-sub { font-size: 12px; opacity: .85; margin-top: 2px; }

.env-badge {
  display: inline-block;
  background: rgba(255,255,255,.22);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ===== 搜索 / 筛选吸顶 ===== */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  padding: 10px 12px 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.search-bar {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 18px;
  padding: 7px 12px;
}
.search-icon { font-size: 13px; margin-right: 6px; opacity: .6; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
}
.search-input::placeholder { color: #bbb; }

/* 状态 Tab */
.status-tabs { display: flex; margin-top: 10px; border-bottom: 1px solid var(--border); }
.status-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-2);
  position: relative;
}
.status-tab.active { color: var(--primary); font-weight: 500; }
.status-tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 28px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

/* 筛选标签 */
.filter-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-tags { display: flex; gap: 8px; padding: 10px 0 2px; white-space: nowrap; }
.filter-tag {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-2);
  background: #f5f5f5;
  border-radius: 14px;
  cursor: pointer;
}
.filter-tag.active { background: #e6f4ff; color: var(--primary); }

/* ===== 列表区 ===== */
.list-section { padding: 12px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.section-title { font-size: 15px; font-weight: 500; }
.section-count { font-size: 12px; color: var(--text-3); }

/* 案件卡片 */
.debt-card {
  display: flex;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
  cursor: pointer;
}
.card-thumb {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}
.thumb-company { background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%); }
.thumb-personal { background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%); }
.thumb-mixed { background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%); }
.thumb-text { color: #fff; font-size: 12px; text-align: center; line-height: 1.3; padding: 0 4px; }

.card-info { flex: 1; min-width: 0; }
.debt-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.debt-tags { display: flex; gap: 6px; margin: 6px 0 4px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 3px; }
.tag-invest { background: #fff2f0; color: var(--danger); }
.tag-auction { background: #fff7e6; color: var(--warn); }
.tag-type { background: #f6ffed; color: #389e0d; }
.tag-gray { background: #f5f5f5; color: var(--text-2); }

.debt-location { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.debt-amount { font-size: 13px; margin-top: 4px; }
.amount-label { color: var(--text-2); }
.amount-value { color: var(--danger); font-weight: 500; }

/* ===== 状态 ===== */
.loading-state, .empty-state, .loadmore-state {
  text-align: center;
  padding: 28px 0;
  color: var(--text-3);
  font-size: 13px;
}
.empty-icon { font-size: 32px; margin-bottom: 8px; }
.loading-icon {
  width: 22px; height: 22px; margin: 0 auto 8px;
  border: 2px solid #e6f4ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 游客提示 */
.register-prompt {
  background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-top: 12px;
}
.register-prompt-icon { font-size: 22px; }
.register-prompt-text { font-size: 14px; font-weight: 500; margin: 4px 0 2px; }
.register-prompt-desc { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.register-prompt-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 7px 26px;
  border-radius: 18px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 详情页 ===== */
.detail-body { padding: 12px; }
.panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
.panel-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
  padding-left: 9px;
  border-left: 3px solid var(--primary);
  line-height: 1.2;
}
.row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}
.row:last-child { border-bottom: none; }
.row-label { color: var(--text-2); flex-shrink: 0; }
.row-value { text-align: right; word-break: break-all; }

.debtor-card {
  background: #fafafa;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.debtor-name { font-size: 14px; font-weight: 500; }
.debtor-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* 联系方式（平台客服，显眼展示） */
.contact-panel {
  background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 10px;
}
.contact-name { font-size: 13px; color: var(--text-2); }
.contact-phone {
  font-size: 24px;
  font-weight: 500;
  color: var(--primary);
  margin: 4px 0 10px;
  letter-spacing: .5px;
}
.contact-actions { display: flex; gap: 10px; }
.contact-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 20px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}
.contact-btn-primary { background: var(--primary); color: #fff; }
.contact-btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* 返回按钮 */
.back-btn {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.94);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

/* ===== 统一返回栏（renderBack 渲染，清单页除外所有页面都有） =====
   此前 .nav-back 在 CSS 中根本没有定义，9 个页面的返回栏是裸 div：
   无背景、不吸顶、箭头是纯文本 ‹，因此显得又小又不醒目 */
.nav-back {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}
.nav-back:active { background: #f2f3f5; }
.nav-back .back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: #f2f3f5;
  color: var(--primary);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  padding-bottom: 3px;
}
.nav-back:active .back-arrow { background: #e6f0ff; }
.nav-back .back-text { font-size: 15px; }

/* ===== 二维码弹窗（长按可添加好友） ===== */
.qr-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.qr-box {
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 300px;
  text-align: center;
}
.qr-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.qr-sub { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.qr-img { width: 200px; height: 200px; display: block; margin: 0 auto; }
.qr-id {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-top: 12px; letter-spacing: .5px;
}
.qr-tip { font-size: 12px; color: var(--text-3); margin-top: 8px; line-height: 1.6; }
.qr-close {
  margin-top: 16px; padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 15px; color: var(--text-2);
  cursor: pointer;
}

/* 联系方式彩色图标 */
.ci {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.ci-phone { background: #e8f5e9; }
.ci-wechat { background: #e8f5e9; }
.ci-loc { background: #fff1e6; }
.ci-mail { background: #e6f0ff; }

/* 未读小红点（列表项用） */
.dot {
  display: inline-block;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  margin-left: 6px;
  vertical-align: middle;
}

/* ===== 底部 tabBar ===== */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.tabbar-item {
  flex: 1;
  text-align: center;
  padding: 8px 0 7px;
  font-size: 12px;
  font-weight: 500;
  color: #8a8f99;
  cursor: pointer;
  position: relative;
  transition: color .15s, background .15s;
}
.tabbar-item:active { background: #f2f3f5; }
/* 选中态：浅蓝底 + 顶部蓝条 + 图标放大，三重提示 */
.tabbar-item.active {
  color: var(--primary);
  background: #f0f7ff;
  font-weight: 600;
}
.tabbar-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}
.tabbar-icon {
  font-size: 26px;
  display: block;
  line-height: 1.25;
  margin-bottom: 1px;
  filter: grayscale(1) opacity(.45);
  transition: filter .15s, transform .15s;
}
.tabbar-item.active .tabbar-icon {
  filter: none;
  transform: scale(1.08);
}
/* 未读数字角标 */
.tabbar-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 8px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 1.5px #fff;
}

/* 底部操作栏 */
.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 50;
}
.bottom-btn {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 22px;
  font-size: 15px;
  cursor: pointer;
}
.bottom-btn-primary { background: var(--primary); color: #fff; }
.bottom-btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 999;
  max-width: 80%;
  text-align: center;
}

/* ===== 登录弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 0 32px;
}
.modal-box {
  width: 100%; max-width: 340px; background: #fff; border-radius: 12px;
  padding: 22px 20px 18px; box-shadow: 0 6px 24px rgba(0,0,0,.15);
}
.modal-title { font-size: 17px; font-weight: 600; color: #1a1a1a; text-align: center; }
.modal-tip { font-size: 12px; color: #86909c; text-align: center; margin-top: 6px; }
.modal-field { margin-top: 14px; }
.modal-field-row { display: flex; gap: 8px; }
.modal-box input {
  width: 100%; box-sizing: border-box; border: 1px solid #e5e6eb; border-radius: 8px;
  padding: 11px 12px; font-size: 15px; outline: none; background: #fff;
}
.modal-box input:focus { border-color: #1677ff; }
.modal-field-row input { flex: 1; }
.modal-code-btn {
  flex: 0 0 104px; border: 1px solid #1677ff; background: #fff; color: #1677ff;
  border-radius: 8px; font-size: 13px; padding: 0 6px;
}
.modal-code-btn:disabled { border-color: #c9cdd4; color: #c9cdd4; }
.modal-err { min-height: 18px; font-size: 12px; color: #f53f3f; margin-top: 8px; text-align: center; }
.modal-submit {
  width: 100%; background: #1677ff; color: #fff; border: none; border-radius: 8px;
  padding: 12px 0; font-size: 16px; font-weight: 600; margin-top: 4px;
}
.modal-submit:disabled { background: #a3c9ff; }
.modal-foot { font-size: 11px; color: #a9aeb8; text-align: center; margin-top: 10px; }

/* ===== 协议浮层（在页面内嵌 iframe 打开，不整页跳转，避免表单状态丢失）===== */
.doc-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: #fff; display: flex; flex-direction: column;
}
.doc-head {
  flex: 0 0 auto; display: flex; align-items: center; height: 46px;
  padding: 0 6px; background: #fff; border-bottom: 1px solid #f0f0f0;
  font-size: 16px; font-weight: 600;
}
.doc-back {
  flex: 0 0 auto; font-size: 15px; color: #1677ff;
  padding: 8px 10px; cursor: pointer;
}
.doc-title { flex: 1 1 auto; text-align: center; color: #1a1a1a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-spacer { flex: 0 0 56px; }
.doc-frame { flex: 1 1 auto; width: 100%; border: none; background: #fff; }

/* ===== 首页标题居中（Simon 2026-09-07 要求）===== */
.header.header-center { text-align: center; }
.header.header-center .header-title { text-align: center; }
.header.header-center .header-sub { text-align: center; }

/* 有底部操作栏的页面：tabBar(56) + bottom-bar(约58) 双重留白 */
body.has-bottom-bar { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }

/* ===== 首页广告 banner（移植自小程序 pages/list/list.wxss）===== */
.banner-swiper {
  position: relative;
  height: 90px;
  margin: 12px 12px 0;
  border-radius: 8px;
  overflow: hidden;
}
.banner-track {
  display: flex;
  height: 100%;
  transition: transform .45s ease;
}
.banner-slide {
  flex: 0 0 100%;
  height: 100%;
}
.banner-item {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-sizing: border-box;
  cursor: pointer;
}
.banner-text { flex: 1; min-width: 0; }
.banner-title { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.banner-desc { font-size: 12px; color: rgba(255,255,255,.9); }
.banner-icon { font-size: 36px; margin-left: 12px; flex: 0 0 auto; }
.banner-dots {
  position: absolute;
  bottom: 7px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.banner-dot {
  width: 6px; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.4);
  transition: width .3s, background .3s;
}
.banner-dot.active { width: 14px; background: #fff; }

/* ===== 首页底部操作栏（移植自小程序 bottom-bar）===== */
/* H5 底部还有 tabBar，故操作栏上移，避免重叠 */
.bottom-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #eee;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  z-index: 60;
  box-shadow: 0 -2px 8px rgba(0,0,0,.04);
}
.bottom-btn {
  flex: 1;
  border-radius: 24px;
  padding: 10px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.bottom-btn-primary { background: var(--primary); color: #fff; }
.bottom-btn-outline {
  background: #fff; color: var(--primary);
  border: 1px solid var(--primary); margin-left: 12px;
}
.bottom-btn:active { opacity: .85; }
.bottom-btn-icon { font-size: 18px; }

/* ===== 案件卡片标签组 ===== */
.debt-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.tag-sealed { background: #fff7e8; color: #ff7d00; }
.tag-mortgage { background: #f0f4ff; color: #5a6acf; }
.tag-agent { background: #e6f4ff; color: #1677ff; font-weight: 500; }
.tag-transfer { background: #e6fffb; color: #13c2c2; }
