:root {
  --bg: #f4f4f7;
  --card: #fff;
  --line: #e6e6ec;
  --ink: #1a1a22;
  --ink-2: #5a5a6b;
  --ink-3: #9191a3;
  --out: #e2564a;
  --in: #2f9e6e;
  --brand: #4f46e5;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: 40px;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 0; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 18px; }
.brand { display: flex; align-items: center; gap: 9px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px #eceafe; }
.brand h1 { font-size: 17px; font-weight: 600; margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 12px; letter-spacing: .3px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0 0 12px; }
.weak { font-size: 12px; color: var(--ink-3); }

/* 月份 */
.month { display: flex; align-items: center; justify-content: space-between; }
.arrow {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 18px; cursor: pointer; line-height: 1;
}
.arrow:hover { background: #fafafd; }
.m-now { text-align: center; }
.m-now strong { font-size: 17px; }
.m-now span { display: block; font-size: 11.5px; color: var(--ink-3); }

.sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; text-align: center; }
.sums span { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.sums strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sums .out { color: var(--out); }
.sums .in { color: var(--in); }

/* 记一笔 */
.seg { display: flex; gap: 3px; padding: 3px; background: #f0f0f4; border-radius: 10px; }
.seg button {
  border: 0; background: transparent; padding: 5px 14px; border-radius: 7px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.07); }

.field.amount { display: flex; align-items: center; gap: 8px; border-bottom: 1.5px solid var(--line); padding-bottom: 6px; }
.cny { font-size: 24px; color: var(--ink-3); }
#f-amount {
  flex: 1; border: 0; outline: none; font-size: 30px; font-weight: 600;
  color: var(--ink); background: transparent; font-family: inherit;
  font-variant-numeric: tabular-nums; min-width: 0;
}
#f-amount::-webkit-outer-spin-button, #f-amount::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.cat {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 6px 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; font-family: inherit;
  transition: .15s;
}
.cat:hover { border-color: #d3d3de; }
.cat.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.row { display: flex; gap: 8px; }
.row input {
  border: 1px solid var(--line); background: #fbfbfd; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--ink); font-family: inherit; outline: none;
}
#f-note { flex: 1; min-width: 0; }
#f-date { width: 140px; }
.row input:focus { border-color: #d3d3de; background: #fff; }

.btn-main {
  width: 100%; margin-top: 12px; border: 0; background: var(--brand); color: #fff;
  padding: 12px; border-radius: 11px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-main:hover { background: #4338ca; }
.btn-main:active { transform: translateY(1px); }

/* 分类占比 */
.cbar { margin-bottom: 11px; }
.cbar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.cbar-top b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cbar-track { height: 7px; border-radius: 7px; background: #f0f0f4; overflow: hidden; }
.cbar-track span { display: block; height: 100%; border-radius: 7px; background: var(--brand); }

/* 预算 */
#budget {
  width: 120px; border: 1px solid var(--line); background: #fbfbfd; border-radius: 9px;
  padding: 6px 10px; font-size: 13px; color: var(--ink); font-family: inherit; outline: none; text-align: right;
}
.budget-bar { height: 9px; border-radius: 9px; background: #f0f0f4; overflow: hidden; }
.budget-bar span { display: block; height: 100%; width: 0; background: var(--in); border-radius: 9px; transition: width .3s, background .3s; }
.budget-bar span.warn { background: #e5a94a; }
.budget-bar span.over { background: var(--out); }
.budget-text { font-size: 12.5px; color: var(--ink-3); margin: 9px 0 0; }

/* 近 6 月 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 96px; }
.bcol { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.bcol i { flex: 1; display: block; border-radius: 4px 4px 0 0; background: #eceaf7; min-height: 3px; }
.bcol i.o { background: #e9b6b2; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; justify-content: center; }
.lg { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 10px; }
.lg.out { background: #e9b6b2; }
.lg.in { background: #eceaf7; }
.xlab { display: flex; gap: 8px; margin-top: 4px; }
.xlab span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); }

/* 明细 */
.day { font-size: 12px; color: var(--ink-3); padding: 12px 0 6px; display: flex; justify-content: space-between; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #f2f2f6; }
.item .ic {
  width: 32px; height: 32px; border-radius: 9px; background: #f4f4f8;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex: 0 0 auto;
}
.item .meta { flex: 1; min-width: 0; }
.item .meta b { font-weight: 500; font-size: 14px; }
.item .meta small { display: block; font-size: 11.5px; color: var(--ink-3); }
.item .amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.item .amt.out { color: var(--out); }
.item .amt.in { color: var(--in); }
.del {
  border: 0; background: none; color: #c9c9d4; cursor: pointer; font-size: 17px;
  padding: 0 2px; line-height: 1; font-family: inherit;
}
.del:hover { color: var(--out); }

.empty { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.linkbtn { border: 0; background: none; color: var(--ink-3); font-size: 12px; cursor: pointer; font-family: inherit; padding: 0; }
.linkbtn:hover { color: var(--brand); }
.foot { text-align: center; font-size: 12px; color: #b3b3c1; padding: 8px 0 20px; }

@media (max-width: 420px) {
  #f-date { width: 126px; }
  .sums strong { font-size: 18px; }
}
