:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --income: #16a34a;
  --expense: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 顶部导航 */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand { font-size: 20px; margin: 0; }
.nav { display: flex; gap: 18px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}
.nav a:hover { color: var(--primary); }

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-form { display: flex; gap: 8px; }

/* 卡片 */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-label { color: var(--muted); font-size: 14px; }
.card-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card-income .card-value { color: var(--income); }
.card-expense .card-value { color: var(--expense); }

/* 表格 */
.table {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: collapse;
  overflow: hidden;
}
.table th, .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
}
.table th { background: #f9fafb; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.num { text-align: right; }
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.empty { text-align: center; color: var(--muted); padding: 28px 0 !important; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.tag-income { background: #ecfdf5; color: var(--income); }
.tag-expense { background: #fef2f2; color: var(--expense); }

/* 面板与表单 */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.panel h2 { margin-top: 0; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; color: var(--muted); }
.form-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.errors { color: var(--expense); margin-bottom: 12px; }
.actions { display: flex; gap: 12px; margin-top: 20px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { border-color: var(--border); color: var(--muted); background: #fff; }

/* 分类链接 */
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* 辅助文本与工具条 */
.muted { color: var(--muted); font-size: 14px; }
.toolbar-actions { display: flex; gap: 12px; }
.cards-result { grid-template-columns: repeat(3, 1fr); }
.errors ul { margin: 6px 0 0; padding-left: 18px; }

@media (max-width: 640px) {
  .cards, .cards-result { grid-template-columns: 1fr; }
  .toolbar-actions { width: 100%; }
}
