/* =========================================================
   债务管理 · 微信小程序原型  样式
   Light / Dark 共用一套设计令牌；颜色均通过变量取用
   ========================================================= */

:root {
  color-scheme: light;
  --page: #f4f5f7;
  --page-glow: #eef2ff;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #e8ecf3;
  --text-primary: #101828;
  --text-secondary: #475467;
  --muted: #98a2b3;
  --grid: #eef1f6;
  --axis: #d0d5dd;
  --border: rgba(16, 24, 40, 0.08);
  --border-strong: rgba(16, 24, 40, 0.14);
  --accent: #3d5cf5;
  --accent-strong: #2f49d6;
  --accent-soft: rgba(61, 92, 245, 0.10);
  --series-1: #3d5cf5;      /* 本金 / 现金 */
  --series-2: #f38744;      /* 利息 / 投资 */
  --series-3: #12a67a;      /* 借出应收 */
  --good: #12b76a;
  --warning: #f79009;
  --critical: #e5484d;
  --success-text: #067647;
  /* 收益涨跌：国内习惯「涨红跌绿」，同时带 +/− 符号，不只靠颜色 */
  --gain-up: #e5484d;
  --gain-down: #067647;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 28px -18px rgba(16, 24, 40, .22);
  --shadow-pop: 0 1px 2px rgba(16, 24, 40, .05), 0 18px 44px -16px rgba(16, 24, 40, .26);
  --focus: 0 0 0 3px rgba(61, 92, 245, .22);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0b0d12;
    --page-glow: #131a2b;
    --surface: #151922;
    --surface-2: #1b202b;
    --surface-3: #232a37;
    --text-primary: #f2f4f7;
    --text-secondary: #aeb6c4;
    --muted: #6f7a8b;
    --grid: #222836;
    --axis: #344054;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --accent: #7c94ff;
    --accent-strong: #9aacff;
    --accent-soft: rgba(124, 148, 255, 0.14);
    --series-1: #6d86ff;
    --series-2: #f08a4b;
    --series-3: #2ecf9a;
    --success-text: #3ddc97;
    --gain-up: #f97066;
    --gain-down: #3ddc97;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 32px -18px rgba(0, 0, 0, .8);
    --shadow-pop: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 54px -18px rgba(0, 0, 0, .9);
    --focus: 0 0 0 3px rgba(124, 148, 255, .28);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d12;
  --page-glow: #131a2b;
  --surface: #151922;
  --surface-2: #1b202b;
  --surface-3: #232a37;
  --text-primary: #f2f4f7;
  --text-secondary: #aeb6c4;
  --muted: #6f7a8b;
  --grid: #222836;
  --axis: #344054;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --accent: #7c94ff;
  --accent-strong: #9aacff;
  --accent-soft: rgba(124, 148, 255, 0.14);
  --series-1: #6d86ff;
  --series-2: #f08a4b;
  --series-3: #2ecf9a;
  --success-text: #3ddc97;
  --gain-up: #f97066;
  --gain-down: #3ddc97;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 32px -18px rgba(0, 0, 0, .8);
  --shadow-pop: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 54px -18px rgba(0, 0, 0, .9);
  --focus: 0 0 0 3px rgba(124, 148, 255, .28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "SF Pro Display", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1100px 700px at 12% -10%, #e9efff 0%, transparent 58%),
    radial-gradient(900px 620px at 105% 25%, #e9f8f2 0%, transparent 55%),
    #eef0f3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 28px;
}

@media (prefers-color-scheme: dark) {
  body:where(:not([data-theme="light"])) {
    background:
      radial-gradient(900px 600px at 15% -5%, #16203a 0%, transparent 60%),
      radial-gradient(800px 560px at 100% 30%, #10231d 0%, transparent 55%),
      #0a0b0f;
  }
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(900px 600px at 15% -5%, #16203a 0%, transparent 60%),
    radial-gradient(800px 560px at 100% 30%, #10231d 0%, transparent 55%),
    #0a0b0f;
}

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ---------- 手机外壳 ---------- */

.phone {
  position: relative;
  width: 375px;
  height: 812px;
  background:
    radial-gradient(120% 55% at 50% -8%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 62%),
    var(--page);
  border-radius: 46px;
  box-shadow: 0 0 0 10px #23262e, 0 0 0 11px rgba(255, 255, 255, .06),
    0 32px 80px -20px rgba(16, 24, 40, .5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部状态栏与导航同色，去掉硬分隔，让内容先出现 */
.statusbar {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 28px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-primary);
  background: var(--page);
}
.statusbar .sb-right {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.sb-sim {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
}

.navbar {
  flex: none;
  height: 48px;
  display: grid;
  grid-template-columns: 76px 1fr 76px;
  align-items: center;
  background: var(--page);
}
.navbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-align: center;
}
.nav-back, .nav-action {
  background: none; border: 0; cursor: pointer; font-family: inherit;
  font-size: 13px; white-space: nowrap; color: var(--text-secondary);
  padding: 0 8px; height: 30px; border-radius: 999px;
}
.nav-back { text-align: left; color: var(--text-primary); font-weight: 500; }
.nav-back:active { opacity: .55; }
.nav-action {
  justify-self: end;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  padding: 0 12px;
  height: 28px;
  margin-right: 4px;
}
.nav-action:active { opacity: .7; }

.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 28px;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}
.view::-webkit-scrollbar { width: 4px; }
.view::-webkit-scrollbar-thumb { background: var(--axis); border-radius: 4px; }
/* 有悬浮按钮的页面多留一截，免得按钮压住最后一行 */
.view.has-fab { padding-bottom: 84px; }

.tabbar {
  flex: none;
  height: 62px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--border);
  padding-bottom: 6px;
}
.tabbar button {
  background: none; border: 0; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10px; font-weight: 500; color: var(--muted);
  padding-top: 6px; transition: color .15s ease;
}
.tabbar button svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.tabbar button.on { color: var(--accent); font-weight: 600; }
.tabbar button.on svg { stroke-width: 2; }

/* ---------- 通用卡片与文字 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.card.tight { padding: 4px 16px; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.head-tools { display: flex; align-items: center; gap: 6px; flex: none; }
/* 卡片右上角要同时放下「收益额/收益率」和「图/表」，按钮收得更紧一点 */
.head-tools .segmented { gap: 1px; padding: 1px; }
.head-tools .segmented button { padding: 4px 7px; font-size: 11px; }
.card-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.card-head > .chev { margin-top: 2px; }

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--text-secondary);
  margin: 22px 4px 10px;
}

/* 主数字卡：一层很淡的品牌色光晕，不抢数字 */
.hero-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 150% at 100% 0%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 58%),
    linear-gradient(152deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 5%, var(--surface)) 100%);
  border-color: color-mix(in srgb, var(--accent) 12%, var(--border));
}
.hero-card::after {
  content: '';
  position: absolute; right: -64px; top: -96px;
  width: 210px; height: 210px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  filter: blur(26px);
  pointer-events: none;
}
.hero-card > * { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); letter-spacing: .02em; }
.hero-delta {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  font-size: 10.5px; font-weight: 500; color: var(--muted);
  white-space: nowrap;
}
.hero-delta .gain-up, .hero-delta .gain-down, .hero-delta .gain-flat { font-weight: 650; }
.hero-value {
  font-size: 44px;
  font-weight: 680;
  letter-spacing: -.04em;
  line-height: 1.04;
  margin: 9px 0 7px;
  font-variant-numeric: tabular-nums;
}
.hero-note { font-size: 12px; line-height: 1.65; color: var(--text-secondary); }
.hero-hint { font-size: 10.5px; line-height: 1.6; color: var(--muted); margin-top: 8px; }
.page-note {
  font-size: 10.5px; line-height: 1.7; color: var(--muted);
  padding: 14px 4px 0;
}

/* KPI：四块独立的小卡片，比 1px 分隔线更像现代终端 */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-row.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  min-width: 0;
}
.kpi .k-label {
  font-size: 11px; color: var(--muted); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.kpi .k-value {
  font-size: 19px; font-weight: 650; letter-spacing: -.025em;
  margin-top: 6px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi .k-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.kpi-row.three .kpi { padding: 12px 10px; }
.kpi-row.three .k-value { font-size: 16px; letter-spacing: -.035em; }
.card > .kpi-row { margin-bottom: 0; }
.card > .kpi-row .kpi { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card > .kpi-row.three .kpi { padding: 12px 10px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.principal, .dot.d-principal, .dot.cash, .dot.d-cash { background: var(--series-1); }
.dot.interest, .dot.d-interest, .dot.invest, .dot.d-invest { background: var(--series-2); }
.dot.recv, .dot.d-recv { background: var(--series-3); }
.section-label .dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px var(--surface-2); }

/* 涨跌：红涨绿跌（国内习惯），数字自带 +/− 符号，不靠颜色单独表意 */
.gain-up, .gain-down, .gain-flat { white-space: nowrap; }
.gain-up { color: var(--gain-up); }
.gain-down { color: var(--gain-down); }
.gain-flat { color: var(--text-secondary); }

/* 进度计量条 */
.meter { margin-top: 12px; }
.meter + .meter { margin-top: 14px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 7px; }
.meter-head .m-name { color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.meter-head .m-val {
  font-variant-numeric: tabular-nums; color: var(--text-primary);
  font-weight: 650; font-size: 12.5px;
}
.meter-track {
  height: 7px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--series-1) 12%, var(--surface));
}
.meter-track.interest, .meter-track.invest { background: color-mix(in srgb, var(--series-2) 14%, var(--surface)); }
.meter-track.recv { background: color-mix(in srgb, var(--series-3) 14%, var(--surface)); }
.meter-track.neutral { background: color-mix(in srgb, var(--muted) 18%, var(--surface)); }
.meter-fill { height: 100%; border-radius: 999px; background: var(--series-1); transition: width .35s cubic-bezier(.2,.8,.3,1); }
.meter-fill.interest, .meter-fill.invest { background: var(--series-2); }
.meter-fill.recv { background: var(--series-3); }
.meter-fill.neutral { background: var(--text-secondary); }
.meter-fill.danger { background: var(--critical); }
.meter-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 6px; }

/* ---------- 图表 ---------- */

.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.legend { display: flex; gap: 8px; font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; flex-wrap: wrap; }
.legend span {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
}
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-axis { stroke: var(--axis); stroke-width: 1; }
.chart-tick {
  fill: var(--muted); font-size: 9px;
  font-variant-numeric: tabular-nums; font-family: inherit; letter-spacing: .01em;
}
.chart-mark.m-principal, .chart-mark.m-cash { fill: var(--series-1); }
.chart-mark.m-interest, .chart-mark.m-invest { fill: var(--series-2); }
.chart-mark.m-recv { fill: var(--series-3); }
.chart-line {
  fill: none; stroke: var(--series-1); stroke-width: 2.25;
  stroke-linejoin: round; stroke-linecap: round;
}
.chart-area { stroke: none; }
.chart-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart-dot-sm { fill: var(--series-1); stroke: var(--surface); stroke-width: 1.5; }
.chart-hit { fill: transparent; cursor: pointer; outline: none; }
.chart-hit:focus-visible { fill: color-mix(in srgb, var(--muted) 12%, transparent); }
.chart-cursor {
  position: absolute; top: 0; bottom: 24px; pointer-events: none;
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  border-radius: 6px; transform: translateX(-50%);
}
.chart-tip {
  position: absolute; top: 0; z-index: 5; pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 9px 11px; min-width: 132px;
  font-size: 11px; color: var(--text-secondary);
}
.tip-title { font-weight: 650; color: var(--text-primary); margin-bottom: 6px; font-size: 11.5px; }
.tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.75; }
.tip-row b {
  margin-left: auto; color: var(--text-primary);
  font-variant-numeric: tabular-nums; font-weight: 650;
}
.tip-row .key { width: 7px; height: 7px; border-radius: 50%; }
.key.k-principal, .key.k-cash { background: var(--series-1); }
.key.k-interest, .key.k-invest { background: var(--series-2); }
.key.k-recv { background: var(--series-3); }
.tip-total { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 5px; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--muted); font-size: 12px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.data-table th, .data-table td {
  padding: 8px 4px; border-bottom: 1px solid var(--border);
  text-align: left; font-variant-numeric: tabular-nums;
}
.data-table th { color: var(--muted); font-weight: 500; font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }
.data-table tfoot td { font-weight: 650; border-bottom: 0; border-top: 1px solid var(--border); }

/* ---------- 控件 ---------- */

.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; padding: 1px 1px 2px;
}

.segmented {
  display: inline-flex; background: var(--surface-2);
  border-radius: 12px; padding: 3px; gap: 2px;
  border: 1px solid var(--border);
  flex: none;
}
.segmented button {
  border: 0; background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--text-secondary);
  padding: 6px 12px; border-radius: 9px; white-space: nowrap;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.segmented button.on {
  background: var(--surface); color: var(--text-primary);
  font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}
.filter-row .segmented button.on { color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
.chip.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--success-text); }
.chip.warn { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: var(--text-primary); }
.chip.danger { background: color-mix(in srgb, var(--critical) 12%, var(--surface)); color: var(--critical); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.cash { background: color-mix(in srgb, var(--series-1) 12%, var(--surface)); color: var(--series-1); }
.chip.invest { background: color-mix(in srgb, var(--series-2) 15%, var(--surface)); color: color-mix(in srgb, var(--series-2) 80%, var(--text-primary)); }

.btn {
  border: 0; border-radius: 14px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  padding: 12px 18px;
  background: var(--surface-2); color: var(--text-primary);
  transition: transform .12s ease, opacity .12s ease;
}
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn.block { display: block; width: 100%; }
.btn.ghost { background: var(--surface); border: 1px solid var(--border-strong); }
.btn.danger {
  background: color-mix(in srgb, var(--critical) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--critical) 28%, transparent);
  color: var(--critical);
}
.btn.sm { font-size: 12px; padding: 7px 12px; border-radius: 10px; }
.btn:active { transform: scale(.985); opacity: .85; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* 表单主操作吸底，长表单不用滚到最后才能提交 */
.submit-bar {
  position: sticky; bottom: -28px; margin: 18px -16px -28px; padding: 14px 16px 28px;
  background: linear-gradient(to bottom, transparent, var(--page) 30%);
}

/* 调试用：?expand 展开整页，方便一次看完长页面 */
.expand { align-items: flex-start; }
.expand .phone { height: auto; }
.expand .view { overflow: visible; }

.fab {
  position: absolute; right: 18px; bottom: 78px; z-index: 20;
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff) 0%, var(--accent) 100%);
  color: #fff; font-size: 27px; font-weight: 300; line-height: 1;
  box-shadow: 0 12px 26px -8px color-mix(in srgb, var(--accent) 65%, transparent),
    0 2px 6px rgba(16, 24, 40, .18);
  transition: transform .15s ease;
}
.fab:active { transform: scale(.94); }

/* ---------- 列表 ---------- */

.list {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden; margin-bottom: 14px;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer;
  background: var(--surface);
  border-bottom: 0;
  transition: background .12s ease;
}
.row + .row { border-top: 1px solid var(--border); }
.row:active { background: var(--surface-2); }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 6px;
}
.row .r-sub {
  font-size: 11px; color: var(--muted); margin-top: 4px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.row .r-right { text-align: right; flex: none; }
.row .r-amount { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.row .r-note { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.row .chev { color: var(--axis); font-size: 18px; line-height: 1; flex: none; }
.row-progress {
  height: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--series-1) 14%, var(--surface));
  margin-top: 9px; overflow: hidden;
}
.row-progress i { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }

/* 还款计划表 */
.sched-row {
  display: grid; grid-template-columns: 30px 1fr 88px 20px; gap: 8px; align-items: center;
  padding: 12px 16px; border-bottom: 0; cursor: pointer;
  background: var(--surface); transition: background .12s ease;
}
.sched-row + .sched-row { border-top: 1px solid var(--border); }
.sched-row:active { background: var(--surface-2); }
.sched-no { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sched-date {
  font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 6px;
}
.sched-split { font-size: 10.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; }
.sched-split span { display: flex; align-items: center; gap: 4px; }
.sched-amt { text-align: right; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sched-state { text-align: right; font-size: 10px; color: var(--muted); margin-top: 4px; }
.sched-row.paid .sched-date, .sched-row.paid .sched-amt { color: var(--text-secondary); }
.sched-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 16px; font-size: 11px; color: var(--muted);
  background: var(--surface-2);
}
.sched-head + .sched-row { border-top: 0; }

/* ---------- 表单 ---------- */

.form-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px; overflow: hidden;
}
.field {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}
.field:last-child { border-bottom: 0; }
.field:focus-within { background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.field label { font-size: 13px; color: var(--text-secondary); flex: none; width: 86px; }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; background: none;
  font-size: 15px; font-weight: 500; color: var(--text-primary);
  font-family: inherit; text-align: right; padding: 2px 0; outline: none;
  font-variant-numeric: tabular-nums;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); font-weight: 400; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: none; }
.field input[type="date"] { text-align: right; }
.field textarea { text-align: left; resize: vertical; min-height: 44px; font-weight: 400; }
.field .suffix { font-size: 12px; color: var(--muted); flex: none; }
.field.col { display: block; }
.field.col label { width: auto; display: block; margin-bottom: 8px; }
.field-hint { font-size: 10.5px; line-height: 1.6; color: var(--muted); padding: 0 16px 12px; margin-top: -4px; }

.method-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 16px; }
.method-pick button {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 14px; padding: 12px; cursor: pointer; text-align: left;
  font-family: inherit; transition: border-color .15s ease, background .15s ease;
}
.method-pick button.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.method-pick button[disabled] { cursor: default; opacity: .55; }
.method-pick button[disabled].on { opacity: 1; }
.method-pick .mp-title { font-size: 13px; font-weight: 650; color: var(--text-primary); }
.method-pick .mp-desc { font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--surface-3); transition: .2s; pointer-events: none;
}
.switch i::after {
  content: ''; position: absolute; width: 23px; height: 23px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px; transition: .2s;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .25);
}
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(19px); }

.preview-box {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), color-mix(in srgb, var(--accent) 4%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
  border-radius: 16px; padding: 14px 16px; margin-bottom: 14px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.preview-box > * { min-width: 0; }
.preview-box > :only-child { grid-column: 1 / -1; }
.preview-box div { font-size: 10.5px; color: var(--text-secondary); }
.preview-box b {
  display: block; font-size: 17px; font-weight: 650; letter-spacing: -.02em;
  color: var(--text-primary); margin-top: 4px; font-variant-numeric: tabular-nums;
}

.empty {
  text-align: center; padding: 64px 24px; color: var(--muted);
  font-size: 13px; line-height: 1.8;
}
.empty .e-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2);
  font-size: 24px; opacity: .7;
}

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--warning) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 20%, transparent);
  border-radius: 16px; padding: 12px 14px;
  font-size: 11.5px; line-height: 1.65; margin-bottom: 14px;
}
.notice.danger {
  background: color-mix(in srgb, var(--critical) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--critical) 18%, transparent);
}
.notice .n-icon {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--warning) 35%, transparent);
  font-weight: 700; font-size: 11px;
}
.notice.danger .n-icon { background: color-mix(in srgb, var(--critical) 20%, transparent); color: var(--critical); }
.notice button { margin-top: 8px; }

/* 底部弹出层 */
.sheet-mask {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(16, 24, 40, .42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0 } }
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 8px 18px 24px;
  max-height: 84%; overflow-y: auto;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .35);
  animation: up .26s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(100%) } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--axis); margin: 8px auto 16px;
}
.sheet h3 { margin: 0 0 5px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.sheet .sheet-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }

.toast {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(16, 24, 40, .9); color: #fff;
  font-size: 12.5px; font-weight: 500; padding: 10px 18px; border-radius: 999px;
  z-index: 60; max-width: 80%; text-align: center;
  animation: fade .2s ease; line-height: 1.5;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
}

/* ---------- 右侧扫码面板（仅桌面） ---------- */
.scan-card {
  width: 300px; align-self: center; padding: 26px 24px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow-pop);
}
.scan-card h2 { font-size: 16px; font-weight: 650; margin: 0; color: var(--text-primary); }
.scan-frame {
  width: 224px; height: 224px; margin: 18px auto 14px;
  display: grid; place-items: center;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 30px -18px rgba(16, 24, 40, .3);
}
.scan-frame img { width: 100%; height: 100%; display: block; object-fit: contain; }
/* .scan-frame img 的 display 会盖掉 [hidden] 的 UA 样式，兜底态要显式藏起来 */
.scan-frame img[hidden] { display: none; }
.scan-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  font-size: 13px; line-height: 1.7; color: var(--muted);
}
.scan-fallback[hidden] { display: none; }
.scan-name { margin: 0; font-size: 14px; font-weight: 650; color: var(--text-primary); }
.scan-hint { margin: 7px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-secondary); }
.scan-note { margin: 12px 0 0; font-size: 11px; line-height: 1.6; color: var(--muted); }
.scan-note code {
  background: var(--surface-2);
  padding: 1px 4px; border-radius: 4px; font-size: 10.5px;
}

@media (max-width: 760px) {
  body { padding: 0; display: block; }
  .phone {
    width: 100%; height: 100dvh;
    border-radius: 0; box-shadow: none;
  }
  .scan-card { display: none; }
  .statusbar {
    padding-top: env(safe-area-inset-top);
    height: calc(44px + env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
