:root {
  --red: #9e2b25;
  --red-soft: #c1453d;
  --gold: #a8842c;
  --green: #4a7c59;
  --ink: #1f2933;
  --muted: #6b7a8c;
  --line: #e3ddd4;
  --bg: #f5f2ed;
  --card: #ffffff;
  --sidebar: #23282f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c3138 0%, #4a3a34 60%, #7a4438 100%);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.login-logo {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--red);
  letter-spacing: 2px;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 28px;
}
.login-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--red); }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 8px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  background: var(--sidebar);
  color: #c8cdd4;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 22px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  letter-spacing: 1px;
}
.brand small { display: block; font-size: 11px; font-weight: 400; color: #8b929c; margin-top: 4px; letter-spacing: 0; }

.nav { flex: 1; padding: 12px 0; }
.nav-item {
  padding: 11px 20px;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); }
.nav-item.active {
  background: rgba(158, 43, 37, .18);
  border-left-color: var(--red);
  color: #fff;
}

.side-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
}
.side-foot b { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }

.content { padding: 20px 24px 40px; flex: 1; overflow-x: auto; }

/* ---------------- 卡片/统计 ---------------- */
.card {
  background: var(--card);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(31, 41, 51, .06);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(31, 41, 51, .06);
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-sub { font-size: 11px; color: #9aa5b1; margin-top: 4px; }
.num-red { color: var(--red); }
.num-gold { color: var(--gold); }
.num-green { color: var(--green); }

/* ---------------- 表格 ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 10px;
  background: #faf8f5;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid #f0ece6; }
tr:hover td { background: #fdfcfa; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------------- 控件 ---------------- */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: var(--red); color: var(--red); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-soft); color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-danger { color: var(--red); border-color: #e8c5c2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type="text"], input[type="number"], input[type="password"],
input[type="date"], select, textarea {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
textarea { height: auto; padding: 8px 10px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 18px;
}
.tag-red { background: rgba(158, 43, 37, .1); color: var(--red); }
.tag-gold { background: rgba(168, 132, 44, .12); color: var(--gold); }
.tag-green { background: rgba(74, 124, 89, .12); color: var(--green); }
.tag-gray { background: #f0ece6; color: var(--muted); }

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 51, .48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 560px;
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row { display: flex; margin-bottom: 14px; }
.form-label {
  width: 92px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
  padding-top: 7px;
}
.form-row > input, .form-row > select, .form-row > textarea { flex: 1; }
.form-row textarea { width: 100%; }

/* ---------------- 趋势图 ---------------- */
.trend { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding: 10px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.trend-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--red-soft), var(--red));
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  position: relative;
}
.trend-val {
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--ink);
}
.trend-label { font-size: 11px; color: var(--muted); margin-top: 6px; }

.desc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; }
.desc-item { font-size: 13px; }
.desc-item span { color: var(--muted); margin-right: 8px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-cell {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
  min-height: 62px;
}
.cal-cell.cal-head { background: #faf8f5; color: var(--muted); text-align: center; min-height: 0; }
.cal-cell.cal-blank { border: none; background: none; }
.cal-date { font-weight: 600; margin-bottom: 3px; }
.cal-info { color: var(--muted); line-height: 1.4; }
.cal-closed { background: #fdf0ef; border-color: #f0cfcc; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }