/* 默认浅色模式 */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #222222;
  --text-second: #888888;
  --border: #e2e8f0;
  --line: #f1f5f9;
  --primary: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
}
/* 深色模式强制覆盖变量 */
body.dark {
  --bg: #121212;
  --card: #1e1e1e;
  --text: #eaeaea;
  --text-second: #aaaaaa;
  --border: #333333;
  --line: #2a2a2a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
}
body {
  background: var(--bg);
  color: var(--text);
  padding-bottom: 70px;
  transition: 0.2s background-color, 0.2s color;
}
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
}
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
h3 {
  margin-bottom: 12px;
  font-size: 18px;
}
h2 {
  text-align: center;
  margin-bottom: 20px;
}
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 0;
  font-size: 16px;
  background: var(--card);
  color: var(--text);
}
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  margin-top: 6px;
  cursor: pointer;
}
.btn-primary {
  background: #3b82f6;
  color: #fff;
}
.btn-success {
  background: #10b981;
  color: #fff;
}
.btn-gray {
  background: #666666;
  color: #fff;
}
.tab-group {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.empty {
  text-align: center;
  color: var(--text-second);
  padding: 30px 0;
}
.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.record-right {
  display: flex;
  gap: 10px;
  align-items: center;
}
.inc {
  color: #10b981;
  font-weight: 500;
}
.exp {
  color: #ef4444;
  font-weight: 500;
}
.del-btn {
  font-size: 12px;
  color: #ef4444;
  padding: 3px 6px;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  text-decoration: none;
}
body.dark .del-btn {
  border-color: #772222;
}
.cate-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.stat-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.tip {
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
  text-align: center;
}
.tip.err {
  background: #fee2e2;
  color: #dc2626;
}
body.dark .tip.err {
  background: #471919;
  color: #ff9999;
}
.tip.suc {
  background: #dcfce7;
  color: #16a34a;
}
body.dark .tip.suc {
  background: #19472c;
  color: #89ffb8;
}
.link {
  display: block;
  text-align: center;
  margin-top: 12px;
  color: var(--primary);
  text-decoration: none;
}
.login-card {
  margin-top: 60px;
}
/* 底部导航 */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  display: flex;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
}
.nav-link {
  flex: 1;
  text-align: center;
  padding: 12px;
  text-decoration: none;
  color: var(--text-second);
}
.nav-link.active {
  color: var(--primary);
  font-weight: 500;
}
.nav-link.danger {
  color: #ef4444;
}
canvas {
  width: 100% !important;
  height: auto !important;
  margin-top: 10px;
}
/* 主题切换按钮 */
.theme-switch {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}