:root {
  --bg: #f6f2ee;
  --card: #ffffff;
  --primary: #c98a9b;
  --primary-d: #b06f82;
  --ink: #2b2326;
  --muted: #9b8f8f;
  --line: #ece3df;
  --green: #4a9d7f;
  --gold: #c8a866;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px; padding-bottom: 64px;
}
.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff; padding: 14px 16px; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: 1px; }

.page { display: none; padding: 14px 14px 20px; }
.page.active { display: block; }
.page-title { font-size: 18px; margin: 4px 0 14px; }
.sub-title { font-size: 15px; margin: 18px 0 8px; color: var(--primary-d); }

.cards { display: flex; gap: 12px; }
.card {
  flex: 1; background: var(--card); border-radius: 14px; padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.card-label { color: var(--muted); font-size: 13px; }
.card-value { font-size: 24px; font-weight: 700; margin: 6px 0 4px; color: var(--primary-d); }
.card-sub { font-size: 12px; color: var(--muted); }

.quick { display: flex; gap: 12px; margin: 16px 0; }
.mini-info { font-size: 13px; color: var(--muted); line-height: 1.7; }

.sub-box { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.04); margin-top: 10px; }
.form label, .modal-box label, .sub-box label {
  display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px;
}
input, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--primary); }

.btn {
  border: none; background: var(--line); color: var(--ink); padding: 11px 16px;
  border-radius: 10px; font-size: 15px; cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-d); }
.btn.block { width: 100%; margin-top: 16px; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn:active { transform: scale(.97); }

.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 9px; border: 1px solid var(--line); background: #fff; border-radius: 10px; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.list { list-style: none; padding: 0; margin: 12px 0; }
.list li {
  background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.list .li-main { flex: 1; }
.list .li-title { font-weight: 600; }
.list .li-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.list .li-actions { display: flex; gap: 6px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f3e9ec; color: var(--primary-d); margin-left: 6px; }
.tag.green { background: #e7f3ee; color: var(--green); }
.tag.gold { background: #f7efdd; color: var(--gold); }
.tag.blue { background: #e7f0fb; color: #3a7bc0; }

.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.range span { color: var(--muted); }
.range input { flex: 1; min-width: 110px; }

.totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
.totals .t {
  background: var(--card); border-radius: 12px; padding: 12px; text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.totals .t .v { font-size: 20px; font-weight: 700; color: var(--primary-d); }
.totals .t .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
th { background: #faf5f3; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 58px; background: #fff;
  display: flex; border-top: 1px solid var(--line); z-index: 20;
}
.navbtn {
  flex: 1; border: none; background: none; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.navbtn span { font-size: 11px; }
.navbtn.active { color: var(--primary-d); font-weight: 700; }

.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal.active { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; }
.modal-box h3 { margin: 0 0 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(40,30,33,.92); color: #fff; padding: 10px 18px; border-radius: 30px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99;
}
.toast.show { opacity: 1; }

/* 月历视图 */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-cell {
  background: var(--card); border-radius: 8px; min-height: 58px; padding: 4px 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04); cursor: pointer; overflow: hidden;
}
.cal-cell:active { background: #faf1f3; }
.cal-cell.empty { background: transparent; box-shadow: none; cursor: default; }
.cal-cell.unset { opacity: .55; }
.cal-cell .d { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.today-mark { font-style: normal; color: #fff; background: var(--primary); border-radius: 4px; padding: 0 3px; font-size: 10px; margin-left: 2px; }
.shift-line { margin-top: 2px; }
.cal-tag { display: inline-block; font-size: 10px; padding: 1px 4px; border-radius: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-tag.s-zao { background: #e7f0fb; color: #3a7bc0; }
.cal-tag.s-wan { background: #fdeee0; color: #c07a2a; }
.cal-tag.s-xiu { background: #f0ebe9; color: var(--muted); }
.cal-tag.s-wei { background: #f7f4f2; color: #c2b8b8; }
