:root {
  --ink: #0E1726;
  --ink-2: #28374D;
  --muted: #7C8798;
  --line: #E7EBF2;
  --bg: #F2F4F8;
  --card: #FFFFFF;
  --brand: #12305B;
  --brand-2: #1B4A85;
  --gold: #B8892F;
  --gold-2: #D9AD5B;
  --gold-soft: #FBF3E3;
  --green: #0E9F6E;
  --green-soft: #E6F7F0;
  --blue: #2563EB;
  --blue-soft: #E9F0FF;
  --orange: #C2740B;
  --orange-soft: #FDF1DF;
  --red: #D92D20;
  --red-soft: #FDECEB;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #E9EDF3;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
.hidden { display: none !important; }
em { font-style: normal; }

.app {
  position: relative;
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  box-shadow: 0 0 60px rgba(15, 23, 42, .12);
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 18px;
  color: #fff;
  background: linear-gradient(135deg, #0E1726 0%, #16345C 58%, #1C4477 100%);
  border-radius: 0 0 22px 22px;
  box-shadow: 0 12px 30px rgba(14, 23, 38, .2);
}
.topbar::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(217, 173, 91, .18), transparent 65%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #F3D9A4, #C79A45);
  color: #3A2A0C;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 11px; color: rgba(255, 255, 255, .58); letter-spacing: .4px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  flex: none;
  transition: transform .18s ease, background .18s ease;
}
.icon-btn:active { transform: scale(.92); background: rgba(255, 255, 255, .16); }
.icon-btn.small { width: 32px; height: 32px; color: var(--muted); background: var(--bg); border: 0; }

.view { padding: 16px 16px 8px; animation: fadeUp .32s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 通用 ---------------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.search-box svg { color: var(--muted); flex: none; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  color: var(--ink);
}
.search-box input::placeholder { color: #A5AEBD; }
.search-box .clear {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #DDE3EC;
  color: #6B7688;
  font-size: 12px;
  display: none;
  place-items: center;
  flex: none;
}
.search-box.has-value .clear { display: grid; }

.chips-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  transition: all .18s ease;
}
.chip-btn.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(18, 48, 91, .22);
}
.chip-btn.filter {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand);
  border-color: rgba(18, 48, 91, .18);
  background: #F7F9FC;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 16px 2px 10px;
}
.section-head strong { font-size: 14px; letter-spacing: .2px; }
.section-head span { font-size: 12px; color: var(--muted); }

/* ---------------- 号码卡片 ---------------- */
.num-list { display: flex; flex-direction: column; gap: 11px; }
.num-card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, .045);
  border-radius: var(--radius);
  padding: 15px 15px 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .16s ease;
}
.num-card:active { transform: scale(.992); }
.num-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}
.num-card.s-installment::before { background: var(--blue); }
.num-card.s-mortgage::before { background: var(--orange); }
.num-card.s-sold::before { background: #AEB7C5; }
.num-card.s-reserved::before { background: #8B5CF6; }

.num-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.num-phone {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: .4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.num-price {
  font-size: 19px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.num-price small { font-size: 12px; font-weight: 600; color: var(--gold); margin-right: 1px; }
.num-price .free { color: var(--muted); font-size: 14px; }

.num-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--muted);
}
.num-meta .sep { color: #D2D8E2; }
.num-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #5C6879;
  background: #F4F6FA;
  white-space: nowrap;
}
.tag.brand { color: var(--brand); background: #EDF2FA; font-weight: 600; }
.badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.in_stock { color: var(--green); background: var(--green-soft); }
.badge.sold { color: #74808F; background: #F0F2F6; }
.badge.installment { color: var(--blue); background: var(--blue-soft); }
.badge.mortgage { color: var(--orange); background: var(--orange-soft); }
.badge.overdue { color: var(--red); background: var(--red-soft); }
.badge.reserved { color: #7C3AED; background: #F1EBFE; }

/* ---------------- 分期 / 抵押卡片 ---------------- */
.bill-list { display: flex; flex-direction: column; gap: 12px; }
.bill-card {
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, .045);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}
.bill-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bill-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #EDF2FA, #DCE7F6);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}
.bill-who strong { font-size: 15px; display: block; }
.bill-who span { font-size: 12px; color: var(--muted); }
.bill-amount { text-align: right; }
.bill-amount strong { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.bill-amount span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: #EDF0F5;
  margin: 13px 0 8px;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2E5C99, #4F86C9);
  transition: width .5s ease;
}
.bill-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.bill-meta b { color: var(--ink-2); font-weight: 600; }
.bill-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.bill-due {
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #F7F9FC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
}
.bill-due.overdue { background: var(--red-soft); color: var(--red); }
.bill-due.today { background: var(--orange-soft); color: var(--orange); }
.bill-due strong { font-size: 13px; }

/* ---------------- 提醒 ---------------- */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 6px;
}
.stat-tile {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .045);
  padding: 13px 12px;
  box-shadow: var(--shadow);
}
.stat-tile span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.stat-tile strong { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-tile.danger strong { color: var(--red); }
.stat-tile.warn strong { color: var(--orange); }

.reminder-group { margin-top: 16px; }
.reminder-group > h3 {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .3px;
  margin: 0 2px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reminder-group > h3 i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.reminder-group.overdue > h3 { color: var(--red); }
.reminder-group.today > h3 { color: var(--orange); }
.reminder-group.soon > h3 { color: var(--blue); }
.reminder-group.later > h3 { color: var(--muted); }

.rem-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .045);
  padding: 12px 13px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.rem-date {
  width: 46px;
  flex: none;
  text-align: center;
  padding: 5px 0;
  border-radius: 10px;
  background: #F4F6FA;
}
.rem-date strong { display: block; font-size: 15px; font-weight: 750; line-height: 1.1; }
.rem-date span { font-size: 10px; color: var(--muted); }
.rem-date.overdue { background: var(--red-soft); color: var(--red); }
.rem-date.today { background: var(--orange-soft); color: var(--orange); }
.rem-body { flex: 1; min-width: 0; }
.rem-body strong { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.rem-body strong .kind {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
}
.rem-body strong .kind.mortgage { background: var(--orange-soft); color: var(--orange); }
.rem-body p { margin: 3px 0 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-money { text-align: right; flex: none; }
.rem-money strong { display: block; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.rem-money span { font-size: 10.5px; color: var(--muted); }
.rem-money span.danger { color: var(--red); }

/* ---------------- 状态 / 空态 ---------------- */
.empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}
.empty .empty-icon {
  width: 62px; height: 62px;
  margin: 0 auto 14px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: #B6C0CF;
  box-shadow: var(--shadow);
}
.empty p { margin: 0 0 4px; font-size: 14px; color: var(--ink-2); }
.empty span { font-size: 12px; }

.skeleton { background: #fff; border-radius: var(--radius); height: 118px; margin-bottom: 11px; position: relative; overflow: hidden; }
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(226, 232, 240, .65), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.load-more {
  margin: 14px auto 4px;
  display: block;
  padding: 10px 22px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
}
.load-more:disabled { color: var(--muted); }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 40;
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .975);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(15, 23, 42, .06);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 3px;
  color: #98A2B3;
  font-size: 10.5px;
  transition: color .18s ease;
}
.tab.active { color: var(--brand); font-weight: 700; }
.tab.active svg { stroke: var(--brand); }
.tab:active { opacity: .7; }
.tab-dot {
  position: absolute;
  top: 3px;
  right: calc(50% - 17px);
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

/* ---------------- 访问码 ---------------- */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(184, 137, 47, .22), transparent 60%),
    linear-gradient(160deg, #0E1726 0%, #12294A 55%, #0C1522 100%);
}
.gate-inner { width: 100%; max-width: 340px; text-align: center; color: #fff; }
.gate-mark {
  width: 66px; height: 66px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 20px;
  font-size: 30px;
  font-weight: 800;
  color: #3A2A0C;
  background: linear-gradient(135deg, #F3D9A4, #C79A45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
.gate h1 { font-size: 21px; margin: 0 0 7px; letter-spacing: .4px; }
.gate-sub { font-size: 13px; color: rgba(255, 255, 255, .55); margin: 0 0 26px; }
.gate-input {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 20px;
  letter-spacing: 8px;
  text-align: center;
  outline: 0;
  margin-bottom: 12px;
}
.gate-input::placeholder { font-size: 14px; letter-spacing: 1px; color: rgba(255, 255, 255, .35); }
.gate-input:focus { border-color: rgba(217, 173, 91, .6); background: rgba(255, 255, 255, .1); }
.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, #1D4E8A, #2768AE);
  box-shadow: 0 8px 22px rgba(29, 78, 138, .35);
  transition: transform .16s ease, opacity .16s ease;
}
.btn-primary:active { transform: scale(.98); opacity: .92; }
.btn-ghost {
  height: 46px;
  border-radius: 13px;
  font-size: 14px;
  color: var(--ink-2);
  background: #F3F5F9;
}
.gate-error { min-height: 18px; font-size: 12px; color: #FFB4A8; margin: 10px 0 0; }
.gate-foot { margin-top: 26px; font-size: 11px; color: rgba(255, 255, 255, .3); letter-spacing: .5px; }

/* ---------------- 筛选面板 ---------------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(9, 15, 26, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: maskIn .2s ease;
}
@keyframes maskIn { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp .28s cubic-bezier(.2, .8, .25, 1);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head strong { font-size: 16px; }
.sheet-body { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.field select, .field input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #F9FAFC;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ink);
  outline: 0;
  width: 100%;
  appearance: none;
}
.field select:focus, .field input:focus { border-color: #9DB4D6; background: #fff; }
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row em { color: var(--muted); }
.sheet-foot { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 18px; }
.sheet-foot .btn-primary { box-shadow: none; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 90;
  max-width: 82vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(14, 23, 38, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  body { background: #0B1220; }
  .app { min-height: 100vh; }
  .gate { min-height: 100vh; }
}
