/* 中禾智能记账系统 · 移动优先样式 */
:root {
  --brand: #1a6b4f;
  --brand-light: #e6f4ee;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #7a8494;
  --line: #e6eaef;
  --pos: #c0392b;   /* 收入/盈利：红（国内习惯） */
  --neg: #1e8449;   /* 支出/亏损：绿 */
  --danger: #c0392b;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 76px; position: relative; }
a { color: var(--brand); cursor: pointer; }
button { font-family: inherit; }

/* ---------- 加载 / 提示 ---------- */
.boot-loading, .loading, .center-msg { text-align: center; color: var(--muted); padding: 80px 20px; }
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(10px);
  background: rgba(28,36,48,.92); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; opacity: 0; transition: all .25s; z-index: 999; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 登录 / 向导 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  background: var(--card); border-radius: 18px; padding: 30px 26px; width: 100%; max-width: 380px;
  box-shadow: 0 6px 30px rgba(0,0,0,.06);
}
.auth-logo { text-align: center; font-size: 44px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; margin-top: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 22px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.wiz-step { color: var(--brand); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.wiz-hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 4px; }
.conf-list { margin: 14px 0; }
.conf-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.conf-row:last-child { border-bottom: none; }
.conf-row span { color: var(--muted); }
.conf-row.on b { color: var(--brand); }
.link { color: var(--brand); font-size: 13px; }

/* ---------- 表单 ---------- */
.fld { display: block; margin: 13px 0 3px; }
.fld > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.fld input, .fld select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fbfcfd; outline: none; transition: border .15s;
  -webkit-appearance: none;
}
.fld input:focus, .fld select:focus { border-color: var(--brand); background: #fff; }
.fld-help { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fff; color: var(--text); font-size: 15px; cursor: pointer; margin-top: 14px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:active { opacity: .85; }
.btn.danger { background: #fdf0ee; border-color: #f0c4bd; color: var(--danger); }
.btn.block { display: block; width: 100%; text-align: center; }

/* ---------- 订阅横幅 ---------- */
.sub-banner {
  background: var(--brand-light); color: var(--brand); font-size: 12.5px;
  padding: 8px 16px; display: flex; justify-content: space-between; align-items: center;
}
.sub-banner.expired { background: #fdf0ee; color: var(--danger); }
.sub-banner a { font-weight: 600; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 50;
}
.nav-item { flex: 1; text-align: center; cursor: pointer; padding: 4px 0; }
.ni-icon { font-size: 20px; line-height: 1.2; filter: grayscale(1) opacity(.55); }
.ni-label { font-size: 11px; color: var(--muted); }
.nav-item.on .ni-icon { filter: none; }
.nav-item.on .ni-label { color: var(--brand); font-weight: 600; }

/* ---------- 页面通用 ---------- */
#page { padding: 16px 16px 8px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.page-head.with-back { align-items: center; }
.hi { font-size: 20px; font-weight: 700; }
.sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.back { font-size: 20px; padding: 2px 12px 2px 0; color: var(--text); text-decoration: none; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-title { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }

/* ---------- 看板 ---------- */
.hero-card {
  background: linear-gradient(135deg, #1a6b4f, #2e8b6d); color: #fff;
  border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px;
}
.hero-label { font-size: 13px; opacity: .85; }
.hero-num { font-size: 34px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero-num.pos { color: #ffd9d0; }
.hero-num.neg { color: #b8f0d4; }
.hero-note { font-size: 12.5px; opacity: .8; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-num { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-num.plus { color: var(--brand); text-align: center; font-size: 26px; }
.bars { display: flex; align-items: flex-end; height: 92px; padding-top: 6px; }
.bar-col { flex: 1; text-align: center; }
.bar-zone { height: 52px; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 46%; border-radius: 4px 4px 0 0; }
.bar.pos { background: #e88a7a; }   /* 盈利红 */
.bar.neg { background: #6dbf94; }   /* 亏损绿 */
.bar-val { font-size: 10px; color: var(--muted); margin-top: 3px; }
.bar-label { font-size: 11px; color: var(--muted); }

/* ---------- 记录行 ---------- */
.rec-row { display: flex; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rec-row:last-child { border-bottom: none; }
.rec-icon { width: 38px; height: 38px; background: var(--bg); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-right: 11px; flex-shrink: 0; }
.rec-main { flex: 1; min-width: 0; }
.rec-title { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-title.voided { text-decoration: line-through; color: var(--muted); }
.rec-sub { font-size: 12px; color: var(--muted); }
.rec-amt { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.rec-amt.pos { color: var(--pos); }
.voided + .rec-amt { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.num.neg, .neg { color: var(--neg); }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0; }

/* ---------- 场景选择 ---------- */
.scene-group { margin-bottom: 16px; }
.scene-group-title { font-size: 13px; color: var(--muted); margin: 4px 2px 8px; }
.scene-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scene-card {
  background: var(--card); border-radius: 12px; padding: 14px 6px; text-align: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.04); transition: transform .1s;
}
.scene-card:active { transform: scale(.96); }
.sc-icon { font-size: 24px; }
.sc-label { font-size: 12px; margin-top: 6px; color: var(--text); }

/* ---------- 凭证详情 ---------- */
.ve-row { display: flex; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ve-row.head { border-bottom: 1.5px solid var(--line); }
.ve-row:last-child { border-bottom: none; }
.ve-main { flex: 1; }
.ve-name { font-weight: 500; }
.ve-sub { font-size: 12px; color: var(--muted); }
.ve-amt { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- 报表 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 9px; background: #fff;
  font-size: 13px; color: var(--muted); cursor: pointer; border: 1.5px solid transparent;
}
.tab.on { background: var(--brand-light); color: var(--brand); font-weight: 600; border-color: var(--brand); }
.rrow { display: flex; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rrow:last-child { border-bottom: none; }
.rrow.thead { color: var(--muted); font-size: 12px; font-weight: 600; }
.rrow.total { font-weight: 700; border-top: 1.5px solid var(--line); }
.rname { flex: 1.6; }
.rbegin, .rend { flex: 1; text-align: right; font-variant-numeric: tabular-nums; }
.ok-note { font-size: 12.5px; color: var(--brand); margin-top: 8px; text-align: right; }
.ok-note.neg { color: var(--danger); }

/* ---------- 订阅弹层 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,26,34,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; border-radius: 20px 20px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto;
}
.modal-title { font-size: 19px; font-weight: 700; }
.modal-sub { font-size: 13px; color: var(--muted); margin: 4px 0 14px; }
.plan-card {
  border: 2px solid var(--line); border-radius: 12px; padding: 13px 16px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; position: relative;
}
.plan-card.best { border-color: var(--brand); }
.plan-tag {
  position: absolute; top: -9px; right: 12px; background: var(--brand); color: #fff;
  font-size: 10.5px; padding: 2px 8px; border-radius: 8px;
}
.plan-name { font-weight: 600; }
.plan-price { font-size: 21px; font-weight: 800; color: var(--brand); }
.plan-price span { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 桌面端适度加宽 */
@media (min-width: 720px) {
  body { font-size: 15.5px; }
  #app { max-width: 560px; }
}
