/* 宗门管理系统 · 销售运营后台 公共样式（国风仙侠） */
:root {
  --dark: #1A1F2C;
  --dark-2: #232a3b;
  --dark-3: #2d3547;
  --gold: #C9A962;
  --gold-2: #E3C57F;
  --gold-dim: rgba(201, 169, 98, 0.14);
  --cinnabar: #A03A24;
  --bg: #F5F1E8;
  --card: #FFFFFF;
  --text: #26282E;
  --text-2: #6B7280;
  --line: #E6E0D2;
  --ok: #3E8E5A;
  --warn: #C77E1F;
  --err: #B3342A;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #2d3547 0%, var(--dark) 55%, #12151f 100%);
  padding: 20px;
}
.login-card {
  width: 400px; max-width: 100%; background: rgba(255,255,255,0.97);
  border-radius: 14px; padding: 38px 36px 30px; box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  border-top: 3px solid var(--gold);
}
.login-seal {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 10px;
  background: var(--cinnabar); color: #F7E8D8; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; font-family: "KaiTi","STKaiti","SimSun",serif;
  box-shadow: 0 4px 12px rgba(160,58,36,0.35);
}
.login-title { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--text); }
.login-sub { text-align: center; font-size: 12px; color: var(--text-2); margin: 6px 0 24px; }
.frm { display: flex; flex-direction: column; gap: 14px; }
.frm label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 5px; }
.frm input, .frm select, .frm textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #FBFAF6; outline: none; transition: border .2s;
}
.frm input:focus, .frm select:focus, .frm textarea:focus { border-color: var(--gold); background: #fff; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; transition: all .18s;
}
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #33260a; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--gold); color: #8a6d2f; }
.btn-ghost:hover { background: var(--gold-dim); }
.btn-dark { background: var(--dark); color: #E8DFC8; }
.btn-dark:hover { background: var(--dark-2); }
.btn-danger { background: #FDF0EE; border-color: #E8C4BE; color: var(--err); }
.btn-danger:hover { background: #F9E2DF; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 后台布局 ---------- */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; background: linear-gradient(180deg, var(--dark) 0%, #141722 100%);
  color: #C9C4B4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.side-seal {
  width: 34px; height: 34px; border-radius: 8px; background: var(--cinnabar); color: #F7E8D8;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
  font-family: "KaiTi","STKaiti",serif;
}
.side-brand-t { font-size: 15px; font-weight: 700; color: #EDE5CE; letter-spacing: 1px; }
.side-brand-s { font-size: 10px; color: #8B8DA0; margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-group { font-size: 11px; color: #6f7188; padding: 12px 18px 6px; letter-spacing: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 18px; font-size: 13px; cursor: pointer;
  color: #B4B7C6; border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #EDE5CE; }
.nav-item.active { background: var(--gold-dim); color: var(--gold-2); border-left-color: var(--gold); font-weight: 600; }
.nav-ico { width: 16px; text-align: center; font-size: 13px; }
.nav-extra { padding: 8px 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.nav-extra .nav-item { cursor: pointer; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.07); font-size: 11px; color: #7c7e92; }
.side-link-btn { background: none; border: none; padding: 0; margin: 0; font: inherit; color: #7c7e92; cursor: pointer; font-size: 11px; }
.side-link-btn:hover { color: #c9a962; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 17px; font-weight: 700; }
.page-title small { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: 10px; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }
.top-user { font-weight: 600; color: var(--text); }
.content { padding: 22px 24px 40px; }

/* ---------- 卡片/表格 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .sub { font-size: 12px; color: var(--text-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 10px; background: #F8F5EC; color: #575757;
  font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid #F0ECE1; vertical-align: middle; }
.tbl tr:hover td { background: #FCFAF4; }
.tbl .num { font-variant-numeric: tabular-nums; }
.amt { font-weight: 700; color: #7A5A1E; }
.empty { text-align: center; color: var(--text-2); padding: 34px 0; font-size: 13px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-ok { background: #E4F3E9; color: var(--ok); }
.b-warn { background: #FBF0DC; color: var(--warn); }
.b-err { background: #FCE9E7; color: var(--err); }
.b-gold { background: var(--gold-dim); color: #8a6d2f; }
.b-gray { background: #EEF0F3; color: #6B7280; }
.b-blue { background: #E5EEF9; color: #1A2B4A; }
.b-purple { background: #EFEAF7; color: #6C4BA1; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat-card .lbl { font-size: 12px; color: var(--text-2); }
.stat-card .val { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .val small { font-size: 12px; color: var(--text-2); font-weight: 400; }
.stat-card::after { content: ""; position: absolute; right: -18px; top: -18px; width: 74px; height: 74px; border-radius: 50%; background: var(--gold-dim); }
.stat-card.gold::after { background: var(--gold-dim); }
.stat-card.green::after { background: rgba(62,142,90,0.10); }
.stat-card.red::after { background: rgba(179,52,42,0.09); }
.stat-card.blue::after { background: rgba(46,95,158,0.09); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,28,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 520px; max-width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 12px; padding: 22px 24px; border-top: 3px solid var(--gold);
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .frm { gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 工具 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #FBFAF6; }
.filter-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-2); font-size: 12px; }
.mt8 { margin-top: 8px; } .mb8 { margin-bottom: 8px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.copyable { cursor: pointer; color: #1A2B4A; }
.copyable:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 14px; font-size: 13px; margin: 8px 0; }
.kv dt { color: var(--text-2); }
.kv dd { font-weight: 600; }
.tip { background: #FBF7EC; border: 1px dashed #D8C79A; border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #7A5A1E; margin-bottom: 14px; }
.err-tip { color: var(--err); font-size: 12px; min-height: 16px; }
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--dark); color: #EDE5CE; padding: 10px 22px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); opacity: 0; transition: all .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--err); color: #fff; }
.code-box { background: #232a3b; color: #E8DFC8; padding: 14px 18px; border-radius: 8px; font-family: Consolas, Menlo, monospace; font-size: 16px; letter-spacing: 2px; text-align: center; }
.switch { position: relative; width: 42px; height: 22px; display: inline-block; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: #D5D8DE; border-radius: 20px; transition: .2s; }
.switch .track::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.switch input:checked + .track { background: var(--gold); }
.switch input:checked + .track::after { left: 22px; }

@media (max-width: 900px) {
  .sidebar { width: 62px; }
  .side-brand-t, .side-brand-s, .nav-item span:not(.nav-ico), .nav-group { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .content { padding: 14px; }
}

/* ---------- 移动端适配（≤768px）：侧边栏抽屉 + 表格横向滚动 ---------- */
.menu-btn { display: none; }
@media (max-width: 768px) {
  .admin { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; width: 218px;
    transform: translateX(-100%); transition: transform .28s ease; z-index: 90;
    box-shadow: 0 0 24px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .side-mask {
    position: fixed; inset: 0; background: rgba(15,18,28,.45); z-index: 85;
    display: none;
  }
  .side-mask.show { display: block; }
  .main { width: 100%; }
  .topbar { padding: 0 12px; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; margin-right: 8px; border: none; border-radius: 8px;
    background: var(--gold-dim); color: #7A5A1E; font-size: 20px; line-height: 1;
    cursor: pointer; flex-shrink: 0; padding: 0;
  }
  .menu-btn:active { opacity: .7; }
  .page-title { font-size: 15px; }
  .top-user { display: none; }
  .content { padding: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 860px; }
  .card { padding: 14px; }
  .modal { padding: 18px 16px; }
}

/* 消息角标 */
.msg-badge{position:absolute;top:2px;right:2px;background:#C0452C;color:#fff;border-radius:10px;font-size:10px;line-height:1;padding:3px 5px;font-style:normal;min-width:16px;text-align:center;}
.tab-item,.nav-item{position:relative;}
