:root {
  --gold: #C9973A;
  --gold-deep: #8A6420;
  --gold-light: #E7C57A;
  --ink: #2B2620;
  --ink-soft: #6B6255;
  --cream: #F7F2E9;
  --cream-2: #FBF8F2;
  --line: #E9DFCE;
  --sidebar-bg: #1F1A12;
  --sidebar-ink: #CBBDA4;
  --sidebar-active: #E7C57A;
  --danger: #C1442E;
  --ok: #3F8A5B;
  --shadow: 0 14px 40px rgba(63,48,20,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC","Microsoft YaHei","Hiragino Sans GB",system-ui,sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ===== 登录页 ===== */
.login-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 85% -10%, #3b2d14 0%, transparent 60%),
    linear-gradient(135deg, #fbf6ec 0%, #f0e2c6 100%);
  overflow: hidden;
  position: relative;
}
.login-deco { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(201,151,58,.25), transparent 70%); }
.login-deco-1 { width: 460px; height: 460px; top: -120px; right: -80px; }
.login-deco-2 { width: 380px; height: 380px; bottom: -140px; left: -100px; }

.login-card {
  position: relative;
  width: 400px;
  background: rgba(255,253,248,.86);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201,151,58,.35);
  border-radius: 22px;
  padding: 40px 38px 30px;
  box-shadow: var(--shadow);
  animation: rise .6s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(201,151,58,.4);
  font-family: "STSong","SimSun",serif;
}
.login-brand-text h1 { font-size: 26px; letter-spacing: 2px; color: var(--ink); font-family: "STSong","SimSun",serif; }
.login-brand-text p { font-size: 12px; color: var(--ink-soft); letter-spacing: 4px; margin-top: 2px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 7px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--cream-2); font-size: 15px; color: var(--ink);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,151,58,.18); }

.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login-hint { text-align: center; font-size: 12px; color: var(--ink-soft); margin-top: 20px; }

.btn {
  border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
  height: 46px; padding: 0 22px; transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; box-shadow: 0 8px 18px rgba(201,151,58,.35);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(201,151,58,.45); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--cream-2); border: 1px solid var(--line); color: var(--ink-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 12px; }

/* ===== 主框架 ===== */
.app-body { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background:
    radial-gradient(400px 300px at 20% -10%, #33290f 0%, transparent 60%),
    var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 26px 22px; }
.sidebar-brand h1 { font-size: 20px; color: #F3E7C8; letter-spacing: 2px; font-family: "STSong","SimSun",serif; }
.sidebar-brand p { font-size: 11px; color: #9a8b6e; letter-spacing: 3px; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 8px 14px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 6px;
  border-radius: 10px; color: var(--sidebar-ink);
  text-decoration: none; font-size: 15px;
  transition: background .2s, color .2s, transform .1s;
}
.nav-item:hover { background: rgba(231,197,122,.08); color: #F3E7C8; }
.nav-item.active { background: linear-gradient(90deg, rgba(201,151,58,.25), rgba(201,151,58,.06)); color: var(--sidebar-active); }
.nav-item .nav-ico { font-size: 18px; width: 22px; text-align: center; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(201,151,58,.14); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; background: rgba(251,248,242,.9);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 20px; font-weight: 700; font-family: "STSong","SimSun",serif; letter-spacing: 1px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.content { padding: 26px 30px 40px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ===== 面板 ===== */
.panel {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 4px 16px rgba(63,48,20,.05);
  overflow: hidden;
}
.panel-toolbar { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-toolbar .spacer { flex: 1; }
.panel-title { font-size: 16px; font-weight: 700; }

.input, .select, .textarea {
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  padding: 0 12px; height: 38px; font-size: 14px; color: var(--ink); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,151,58,.15); }
.textarea { padding: 10px 12px; height: auto; resize: vertical; }
.select { min-width: 130px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 600;
  padding: 13px 18px; background: #F3ECDE; white-space: nowrap;
}
tbody td { padding: 13px 18px; font-size: 14px; border-top: 1px solid var(--line); }
tbody tr:hover { background: #FBF6EC; }
.tnum { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-plain { background: #EDE7DA; color: #7a7162; }
.badge-gold { background: rgba(201,151,58,.16); color: var(--gold-deep); }
.badge-green { background: rgba(63,138,91,.14); color: var(--ok); }
.badge-red { background: rgba(193,68,46,.12); color: var(--danger); }
.badge-purple { background: rgba(126,87,194,.12); color: #7e57c2; }

.op-link { color: var(--gold-deep); background: none; border: none; font-size: 13px; padding: 4px 8px; cursor: pointer; }
.op-link.danger { color: var(--danger); }

.empty { text-align: center; color: var(--ink-soft); padding: 50px 0; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 8px; padding: 16px 20px; justify-content: flex-end; font-size: 13px; color: var(--ink-soft); }
.pagination button {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer;
}
.pagination button:disabled { opacity: .4; cursor: default; }
.pagination button.active { background: var(--gold); border-color: var(--gold); color: #fff; }

/* ===== 消息发送表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; padding: 22px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 7px; }
.form-item .input, .form-item .select, .form-item .textarea { width: 100%; }
.form-actions { padding: 0 20px 22px; display: flex; justify-content: flex-end; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(31,26,18,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade .2s ease;
}
.modal { width: 480px; max-width: 92vw; background: var(--cream-2); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); animation: rise .25s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head span { font-size: 17px; font-weight: 700; font-family: "STSong","SimSun",serif; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--ink-soft); }
.modal-body { padding: 22px; }
.modal-body .field { margin-bottom: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 覆盖 hidden 属性：避免 display:flex 覆盖隐藏状态 */
[hidden] { display: none !important; }

/* 登录页底部备案信息 */
.login-icp {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
  line-height: 18px;
  color: #999;
}
.login-icp a {
  color: #999;
  text-decoration: none;
}
.login-icp a:hover {
  color: #b8860b;
}
.login-icp img {
  vertical-align: text-bottom;
}

.money { font-weight: 700; color: var(--gold-deep); }

@media (max-width: 720px) {
  .sidebar { width: 68px; }
  .sidebar-brand h1, .sidebar-brand p, .sidebar .nav-item span:not(.nav-ico) { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
