:root {
  --brand: #a62b2b;
  --brand-soft: #fbf0ec;
  --gold: #b4842f;
  --ink: #23201d;
  --muted: #8a8578;
  --line: #ece7df;
  --bg: #f7f8fa;
  --white: #ffffff;
  --green: #2f7d55;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f7f5f1, #f0e3dc);
}
.login-card {
  width: 420px;
  padding: 40px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(80, 50, 40, 0.10);
}
.login-brand { font-size: 26px; font-weight: 700; color: var(--brand); }
.login-sub { margin-top: 6px; color: var(--muted); font-size: 13px; }
.form-label { display: block; margin: 28px 0 8px; font-size: 13px; color: #5f5a52; }
.form-input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #faf9f7; font-size: 14px; color: var(--ink); outline: none;
}
.form-input:focus { border-color: var(--brand); background: #fff; }
.otp-row { display: flex; gap: 10px; margin-top: 12px; }
.otp-row .form-input { flex: 1; }
.form-msg { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--brand); }
.login-note { margin-top: 18px; font-size: 12px; line-height: 1.7; color: var(--muted); }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--white); border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 26px 22px; border-bottom: 1px solid var(--line); }
.side-logo {
  width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; background: linear-gradient(135deg, var(--brand), #d99a63);
}
.side-name { font-weight: 700; font-size: 15px; }
.side-tag { margin-top: 2px; font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.nav { padding: 18px 12px; flex: 1; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 6px; border: none; border-radius: 10px;
  background: transparent; color: #5f5a52; font-size: 14px; text-align: left; cursor: pointer;
}
.nav-item span { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover { background: #f7f5f1; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-foot { padding: 18px 22px; border-top: 1px solid var(--line); }
.side-admin { font-size: 13px; color: #5f5a52; margin-bottom: 8px; word-break: break-all; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px; background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.status-pill { padding: 7px 14px; border-radius: 999px; background: #eef7f1; color: var(--green); font-size: 12px; }
.status-pill.error { background: #fdecea; color: var(--brand); }
.content { padding: 26px 32px 60px; }

/* ---------- 通用组件 ---------- */
.btn {
  height: 40px; padding: 0 18px; border: none; border-radius: 9px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #8f2323; }
.btn-light { background: var(--brand-soft); color: var(--brand); }
.btn-line { background: #fff; color: #5f5a52; border: 1px solid var(--line); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 7px; }
.btn-text { background: none; color: var(--muted); padding: 0; height: auto; }
.btn-block { width: 100%; margin-top: 18px; }
.btn-danger { background: #fdecea; color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { margin-top: 10px; font-size: 28px; font-weight: 700; }
.stat-hint { margin-top: 6px; font-size: 11px; color: var(--muted); }
.stat.accent .stat-value { color: var(--brand); }
.stat.gold .stat-value { color: var(--gold); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 10px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 10px; border-bottom: 1px solid #f4f1ec; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.thumb-sm {
  width: 42px; height: 42px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.theme-red { background: linear-gradient(135deg,#f7dedb,#f0c2bc); }
.theme-blue { background: linear-gradient(135deg,#dce9f7,#bcd4ef); }
.theme-brown { background: linear-gradient(135deg,#eee0d1,#d9c0a4); }
.theme-green { background: linear-gradient(135deg,#dcefe3,#b9dcc6); }
.theme-purple { background: linear-gradient(135deg,#e8e0f5,#cfc0ea); }
.theme-slate { background: linear-gradient(135deg,#e3e7ec,#c3cbd6); }
.theme-orange { background: linear-gradient(135deg,#fae6cf,#f2cda2); }
.theme-pink { background: linear-gradient(135deg,#f9e0e8,#f0bfd0); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; }
.badge-on { background: #eef7f1; color: var(--green); }
.badge-off { background: #f2f1ee; color: var(--muted); }
.badge-warn { background: #fdf3e3; color: var(--gold); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: #5f5a52; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #faf9f7; font-size: 13px; color: var(--ink); outline: none; font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); background: #fff; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(35, 32, 29, .38);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { width: 560px; max-height: 86vh; overflow: auto; background: #fff; border-radius: 16px; padding: 26px; }
.modal-wide { width: 680px; }
.modal h3 { margin: 0 0 20px; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px; border-radius: 10px; background: var(--ink); color: #fff;
  font-size: 13px; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 160px; flex: 1; }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 9px; background: #faf6ec; color: #8a6d33; font-size: 12px; line-height: 1.7; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 190px; }
  .content { padding: 20px; }
}
