:root {
  --paper: #F6F1E7;
  --paper-2: #FFFDF8;
  --ink: #1C1B19;
  --ink-2: #4A463F;
  --muted: #8B8378;
  --line: #E7DDC9;
  --red: #B5342A;
  --red-soft: #F6E7E3;
  --green: #3F6B54;
  --green-soft: #E8F0EA;
  --gold: #B8892F;
  --gold-soft: #F7EEDC;
  --sidebar: #1F1D1A;
  --sidebar-2: #2B2723;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 400px; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(74,70,63,.12);
}
.login-seal {
  width: 56px; height: 56px; border-radius: 14px; background: var(--red); color: #FFF6EF;
  font-family: "Songti SC", "STSong", serif; font-size: 30px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.login-card h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
.input, .select, .textarea {
  width: 100%; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; color: var(--ink); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); }
.btn {
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 14px;
  background: var(--paper); color: var(--ink-2); border: 1px solid var(--line);
}
.btn-primary { background: var(--red); color: #FFF9F4; border-color: var(--red); }
.btn-primary:hover { background: #9C2C23; }
.btn-dark { background: var(--ink); color: #FBF7EF; border-color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; padding: 12px; }
.btn-ghost { background: transparent; color: var(--red); border-color: rgba(181,52,42,.35); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(181,52,42,.35); }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar); color: #E8E1D4;
  display: flex; flex-direction: column; padding: 24px 14px; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand-seal {
  width: 38px; height: 38px; border-radius: 10px; background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-family: "Songti SC", serif; font-size: 20px; color: #FFF6EF;
}
.brand-name { font-size: 18px; letter-spacing: 3px; }
.brand-sub { font-size: 11px; color: #9A9083; letter-spacing: 1px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  background: transparent; border: none; color: #B8AE9E; text-align: left;
  padding: 11px 14px; border-radius: 9px; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.nav-item:hover { background: var(--sidebar-2); color: #F3ECE0; }
.nav-item.active { background: var(--red); color: #FFF6EF; }
.nav-icon { width: 18px; text-align: center; font-family: "Songti SC", serif; }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; font-size: 12px; color: #857B6D; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.7);
}
.topbar h2 { font-size: 19px; margin: 0; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.content { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }

/* ---------- 卡片与表格 ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.stat-value { font-size: 32px; font-weight: 600; font-family: "Songti SC", serif; margin-top: 6px; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.panel {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.panel-title::before {
  content: ""; display: inline-block; width: 4px; height: 16px; background: var(--red);
  border-radius: 2px; margin-right: 8px; vertical-align: -3px;
}
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(246,241,231,.55); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.muted { color: var(--muted); font-size: 12px; }
.strong { font-weight: 600; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px;
  background: var(--paper); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.tag-red { background: var(--red-soft); color: var(--red); border-color: rgba(181,52,42,.16); }
.tag-green { background: var(--green-soft); color: var(--green); border-color: rgba(63,107,84,.16); }
.tag-gold { background: var(--gold-soft); color: var(--gold); border-color: rgba(184,137,47,.18); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 50px 0; font-size: 13px; }

/* 趋势条 */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding: 10px 4px 0; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #C04437, #8E2A22); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.bar-label { font-size: 11px; color: var(--muted); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(28,27,25,.45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal-card {
  background: var(--paper-2); border-radius: 18px; width: 640px; max-width: 100%;
  max-height: 88vh; overflow: auto; padding: 26px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: var(--ink); color: #FBF7EF; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; z-index: 80; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.badge-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: 1px; }
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 72px; padding: 18px 8px; }
  .brand-name, .brand-sub, .nav-item span:not(.nav-icon), .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .content { padding: 18px; }
}
