:root {
  --primary: #2b5cff;
  --primary-light: #eef2ff;
  --success: #18b566;
  --warning: #f5a623;
  --danger: #f5222d;
  --text: #1f2329;
  --muted: #8a8f99;
  --border: #e8eaef;
  --bg: #f0f2f5;
  --sidebar: #1f2b48;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ---------- 登录 ---------- */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f2b48 0%, #2b5cff 100%);
}
.login-box {
  width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #2b5cff, #6f8cff);
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-box h2 { margin: 0; font-size: 20px; }
.login-sub { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.login-tip { color: var(--muted); font-size: 12px; text-align: center; margin-top: 18px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px;
  background: var(--sidebar);
  color: #cfd6e4;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  overflow-y: auto;
}
.logo {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.logo-text { color: #fff; font-size: 15px; font-weight: 600; }
.menu { padding: 12px 0; }
.menu-group-title { padding: 14px 20px 6px; font-size: 12px; color: #6b7793; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; cursor: pointer; font-size: 14px;
  border-left: 3px solid transparent;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.menu-item.active {
  background: rgba(43, 92, 255, 0.18); color: #fff; border-left-color: var(--primary);
}
.menu-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #4a5670; }

.main { margin-left: 224px; flex: 1; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.merchant-name { color: var(--muted); }
.role-tag {
  background: var(--primary-light); color: var(--primary);
  padding: 3px 10px; border-radius: 4px; font-size: 12px;
}
.user-drop { position: relative; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.user-drop:hover { background: #f5f6fa; }
.drop-menu {
  display: none; position: absolute; right: 0; top: 38px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; min-width: 120px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); overflow: hidden;
}
.user-drop:hover .drop-menu { display: block; }
.drop-menu a { display: block; padding: 10px 14px; color: var(--text); text-decoration: none; font-size: 13px; }
.drop-menu a:hover { background: #f5f6fa; }

.content { padding: 20px 24px 40px; }

/* ---------- 卡片 / 统计 ---------- */
.panel { background: #fff; border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-title::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: var(--primary); margin-right: 8px; vertical-align: -2px; border-radius: 2px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 600; margin-top: 6px; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.stat-icon.blue { background: linear-gradient(135deg, #2b5cff, #6f8cff); }
.stat-icon.green { background: linear-gradient(135deg, #18b566, #4ddb9a); }
.stat-icon.orange { background: linear-gradient(135deg, #f5a623, #ffc069); }
.stat-icon.red { background: linear-gradient(135deg, #f5222d, #ff7875); }
.stat-icon.purple { background: linear-gradient(135deg, #722ed1, #b37feb); }

/* ---------- 筛选栏 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 16px;
}
.filter-item { display: flex; flex-direction: column; gap: 6px; }
.filter-item label { font-size: 12px; color: var(--muted); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; height: 38px; border: 1px solid #dcdfe6; border-radius: 6px;
  padding: 0 12px; font-size: 14px; outline: none; background: #fff; color: var(--text);
}
textarea { height: auto; min-height: 72px; padding: 8px 12px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.switch { display: flex; align-items: center; gap: 8px; }
.switch input { width: 40px; height: 20px; }

/* ---------- 按钮 ---------- */
.btn {
  height: 38px; padding: 0 18px; border-radius: 6px; border: 1px solid #dcdfe6;
  background: #fff; cursor: pointer; font-size: 14px; color: var(--text);
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; display: block; }
.btn-link { border: none; background: none; color: var(--primary); padding: 0 6px; cursor: pointer; font-size: 13px; }
.btn-link.danger { color: var(--danger); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  background: #fafbfc; text-align: left; padding: 12px 14px; font-weight: 600;
  color: #4a5364; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.grid td { padding: 12px 14px; border-bottom: 1px solid #f2f3f5; }
table.grid tr:hover td { background: #fafbff; }
table.grid .empty-row td { text-align: center; color: var(--muted); padding: 40px 0; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px;
  background: var(--primary-light); color: var(--primary);
}
.tag.green { background: #e8f8f0; color: var(--success); }
.tag.orange { background: #fff4e6; color: var(--warning); }
.tag.red { background: #ffeaea; color: var(--danger); }
.tag.gray { background: #f2f3f5; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 0 4px; }
.pager .total { color: var(--muted); margin-right: auto; }
.pager button {
  min-width: 32px; height: 30px; border: 1px solid #dcdfe6; background: #fff;
  border-radius: 4px; cursor: pointer;
}
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { color: #c0c4cc; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  width: 560px; max-width: 92vw; max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 10px; padding: 22px 24px;
}
.modal.wide { width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 提示 ---------- */
.toast-root { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  background: rgba(0, 0, 0, 0.78); color: #fff; padding: 10px 20px;
  border-radius: 6px; margin-bottom: 10px; font-size: 14px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------- 其他 ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.chart-bar .bar {
  width: 100%; max-width: 46px; background: linear-gradient(180deg, #6f8cff, #2b5cff);
  border-radius: 4px 4px 0 0; min-height: 2px;
}
.chart-bar .bar-label { font-size: 12px; color: var(--muted); }
.chart-bar .bar-value { font-size: 12px; color: #4a5364; }

.kv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kv { background: #fafbfc; border-radius: 8px; padding: 12px 14px; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { font-size: 16px; font-weight: 600; margin-top: 4px; }

.prize-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.prize-row input { flex: 1; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.row-actions { display: flex; gap: 6px; }
.mt20 { margin-top: 20rpx; margin-top: 20px; }
.loading { padding: 30px 0; text-align: center; color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
