* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
}
:root {
  --primary: #2e7d32;
  --primary-light: #4caf50;
  --primary-dark: #1b5e20;
  --border: #e8e8e8;
  --bg: #fff;
  --text: #333;
  --text-light: #666;
  --danger: #f44336;
  --warning: #ff9800;
  --radius: 4px;
}
.login-page {
  height: 100vh;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 400px;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.15);
  padding: 40px;
}
.login-title {
  text-align: center;
  color: var(--primary);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 30px;
}
.form-item {
  margin-bottom: 20px;
}
.form-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-light);
}
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-item textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 100px;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: var(--primary-light);
}
.btn {
  display: inline-block;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  height: 40px;
  line-height: 24px;
  font-size: 16px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-small {
  padding: 4px 12px;
  font-size: 13px;
  background: var(--primary);
  color: #fff;
  margin-right: 8px;
}
.btn-small:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-default { background: #f5f5f5; color: var(--text); border: 1px solid var(--border); }
.btn-default:hover { background: #e8e8e8; }
.login-links {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}
.login-links a {
  color: var(--primary);
  text-decoration: none;
  margin: 0 10px;
}
.login-links a:hover { text-decoration: underline; }

/* 主布局 */
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 200px;
  background: var(--primary-dark);
  color: #fff;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  background: rgba(0,0,0,0.1);
}
.sidebar-menu { list-style: none; margin-top: 10px; }
.sidebar-menu li {
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}
.sidebar-menu li:hover { background: rgba(255,255,255,0.1); }
.sidebar-menu li.active { background: var(--primary); }
.sidebar-menu li .menu-group-title { font-weight: 600; color: rgba(255,255,255,0.7); margin-top: 10px; padding-left: 0; }
.sidebar-menu li .menu-group-title:hover { background: transparent; cursor: default; }
.main-content {
  flex: 1;
  margin-left: 200px;
  padding: 20px;
}
.header {
  height: 50px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 20px;
}
.header-user { font-size: 14px; }
.header-user a { color: var(--primary); text-decoration: none; margin-left: 15px; }

/* 内容卡片 */
.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}
.filter-bar input, .filter-bar select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
}
.table-container { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table th, table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-light);
}
table tr:hover { background: #f9f9f9; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.pagination {
  margin-top: 15px;
  text-align: right;
}
.pagination button {
  margin-left: 8px;
}
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg);
  border-radius: 8px;
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-footer {
  margin-top: 20px;
  text-align: right;
}
.modal-footer button { margin-left: 10px; }
.stats-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  margin: 8px 0;
}
/* 统计卡片的负值（记账结余、账户总资产）：正数保持默认绿，负数标红 */
.stat-value.neg { color: var(--danger); }
.stat-label {
  font-size: 14px;
  color: var(--text-light);
}
.hidden { display: none !important; }
.done-text { text-decoration: line-through; color: #999; }
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius);
  color: #fff;
  z-index: 9999;
  font-size: 14px;
}
.toast-success { background: var(--primary); }
.toast-error { background: var(--danger); }

/* ---------- 账户管理（fund.html） ---------- */
.fund-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.fund-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fund-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fund-name { font-size: 15px; font-weight: 600; color: var(--text); word-break: break-all; }
.fund-type {
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.6;
  padding: 0 8px;
  border-radius: 10px;
  background: #e8f5e9;
  color: var(--primary-dark);
}
.fund-type.type-card { background: #e3f2fd; color: #1565c0; }
.fund-type.type-wechat { background: #e8f5e9; color: #2e7d32; }
.fund-type.type-alipay { background: #e3f2fd; color: #0277bd; }
.fund-type.type-cash { background: #fff3e0; color: #e65100; }
.fund-balance { font-size: 22px; font-weight: 700; color: var(--text); }
.fund-balance.pos { color: var(--primary); }
.fund-balance.neg { color: var(--danger); }
.fund-meta { font-size: 12px; color: var(--text-light); display: flex; flex-wrap: wrap; gap: 10px; }
.fund-actions { display: flex; gap: 8px; margin-top: 2px; }
.fund-actions .btn { padding: 3px 10px; font-size: 12px; }
.income-text { color: var(--primary); }
.expense-text { color: var(--danger); }

/* ---------- 还款配对标记（记账页 / 账户管理明细） ---------- */
.link-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 18px;
  border-radius: 9px;
  background: #e3f2fd;
  color: #1565c0;
  white-space: nowrap;
  vertical-align: middle;
}
.form-hint {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-light);
}

/* ---------- 页脚备案信息（ICP + 公安备案） ---------- */
.site-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 20px;
  padding: 16px 20px 22px;
  font-size: 12px;
  color: #7a7a7a;
  text-align: center;
  /* 在主内容右侧留出侧边栏宽度，与页面主体对齐 */
  margin-left: 200px;
}
/* 登录/注册/找回密码这类居中卡片页：页脚固定在窗口底部居中 */
body.login-page {
  flex-direction: column;
  justify-content: center;
  position: relative;
}
body.login-page .site-beian {
  margin-left: 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px 14px;
}
.site-beian a.beian-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7a7a7a;
  text-decoration: none;
}
.site-beian a.beian-item:hover { color: var(--primary); text-decoration: underline; }
.site-beian .beian-icon {
  width: 14px;
  height: 14px;
  display: block;
}
/* 页面高度不够时，把页脚顶到底部，避免悬在内容中间 */
.layout { min-height: 100vh; }

