/* 集团 VIP 权益系统 — 克制极简样式 */
:root {
  --bg: #F4F2ED;
  --card: #FFFFFF;
  --line: #E4E0D5;
  --line-soft: #EFECE4;
  --primary: #3E5C76;
  --primary-dark: #2F485E;
  --primary-soft: #EAF0F5;
  --text: #2B3440;
  --muted: #7A828C;
  --success: #2E6B4F;
  --success-bg: #EAF3EE;
  --warn: #9A6B2F;
  --warn-bg: #F8F1E4;
  --danger: #A13D3D;
  --danger-bg: #F8EAEA;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(43, 52, 64, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { max-width: 680px; margin: 0 auto; padding: 24px 18px 56px; }
.wrap.wide { max-width: 1080px; }

@media (max-width: 720px) {
  .wrap { padding: 16px 14px 48px; }
}

/* 页头 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 0 18px; border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-title { font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
.lead { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.section { margin-bottom: 28px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card.tight { padding: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text);
  cursor: pointer; font-size: 14px; line-height: 1.2;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #FAF9F6; border-color: #D5D0C4; }
.btn[hidden] { display: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--card); border-color: #D9B9B9; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--primary); padding: 4px 2px; min-height: 0; }
.btn-link:hover { text-decoration: underline; background: none; }

/* 表单 */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
textarea { min-height: 84px; resize: vertical; }
input.readonly { background: #FAF9F6; color: var(--muted); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 600px) { .row { flex-direction: column; gap: 0; } }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 16px; height: 16px; }

/* 步骤条 */
.steps { display: flex; gap: 0; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.step {
  flex: 1; padding: 0 4px 10px; text-align: center;
  font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent;
}
.step b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.step.active { color: var(--primary); border-bottom-color: var(--primary); }
.step.active b { color: var(--primary); }

/* 状态徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-unclaimed { color: var(--muted); background: #F4F2ED; border-color: var(--line); }
.badge-claimed { color: var(--primary); background: var(--primary-soft); border-color: #CFDBE5; }
.badge-redeemed { color: var(--success); background: var(--success-bg); border-color: #CCE2D5; }
.badge-error { color: var(--danger); background: var(--danger-bg); border-color: #E5CACA; }
.badge-on { color: var(--success); background: var(--success-bg); border-color: #CCE2D5; }
.badge-off { color: var(--muted); background: #F4F2ED; border-color: var(--line); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: #E8D6B8; }

/* 提示条 */
.notice {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #FAF9F6;
  font-size: 13px; margin-bottom: 16px;
}
.notice-info { background: var(--primary-soft); border-color: #CFDBE5; color: var(--primary-dark); }
.notice-success { background: var(--success-bg); border-color: #CCE2D5; color: var(--success); }
.notice-error { background: var(--danger-bg); border-color: #E5CACA; color: var(--danger); }
.notice-warn { background: var(--warn-bg); border-color: #E8D6B8; color: var(--warn); }
.notice strong { display: block; margin-bottom: 3px; font-size: 14px; }

/* 加载 */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

/* 表格 */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { background: #FAF9F6; color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; }

/* 权益列表 */
.benefit-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.benefit-item:last-child { border-bottom: none; }
.benefit-main { min-width: 0; flex: 1; }
.benefit-name { font-weight: 600; margin-bottom: 3px; }
.counts { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }

/* 券面 */
.coupon {
  position: relative; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow); margin-top: 18px;
}
.coupon-top { padding: 22px 22px 18px; border-bottom: 1px dashed #D8D3C8; }
.coupon-kicker { font-size: 11px; letter-spacing: .18em; color: var(--muted); margin-bottom: 8px; }
.coupon-title { font-size: 20px; font-weight: 600; line-height: 1.4; margin-bottom: 10px; }
.coupon-desc { font-size: 14px; color: var(--text); margin-bottom: 12px; white-space: pre-wrap; }
.coupon-terms { font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.coupon-bottom { padding: 18px 22px 22px; display: flex; gap: 20px; align-items: center; }
.coupon-info { flex: 1; min-width: 0; }
.info-line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.info-line:last-child { border-bottom: none; }
.info-line span:first-child { color: var(--muted); flex-shrink: 0; }
.info-line span:last-child { text-align: right; word-break: break-all; }
.code-line { margin-top: 12px; font-size: 20px; font-weight: 600; letter-spacing: .16em; color: var(--primary); }
.code-label { font-size: 11px; color: var(--muted); letter-spacing: .1em; margin-bottom: 2px; }
.coupon-qr { flex-shrink: 0; text-align: center; }
.coupon-qr canvas { width: 108px; height: 108px; display: block; }
.coupon-qr .small { margin-top: 6px; color: var(--muted); }
.coupon.notch::before, .coupon.notch::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 1px solid var(--line);
  top: calc(100% - 130px);
}
.coupon.notch::before { left: -8px; }
.coupon.notch::after { right: -8px; }
@media (max-width: 520px) {
  .coupon-bottom { flex-direction: column; align-items: stretch; }
  .coupon-qr { order: -1; }
  .coupon-qr canvas { margin: 0 auto; }
}

/* 核销结果 */
.result-box { text-align: center; padding: 26px 16px; }
.result-mark {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; font-size: 24px; font-weight: 600;
}
.result-mark.ok { background: var(--success-bg); color: var(--success); border: 1px solid #CCE2D5; }
.result-mark.no { background: var(--danger-bg); color: var(--danger); border: 1px solid #E5CACA; }
.result-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.result-sub { color: var(--muted); font-size: 13px; }

/* 后台分区标签 */
.admin-tabs-wrap {
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}
.admin-tabs { display: flex; gap: 22px; min-width: max-content; }
.admin-tab {
  background: none; border: none; padding: 0 2px 12px;
  color: var(--muted); font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 后台卡片小节 */
.admin-section-label {
  font-size: 11px; letter-spacing: .16em; color: var(--muted);
  margin: 0 0 10px;
}

/* 页脚版权 */
.site-footer {
  margin-top: 48px; padding: 20px 18px 32px;
  border-top: 1px solid var(--line);
  text-align: center; line-height: 1.9;
}
.site-footer .footer-org {
  font-size: 12px; letter-spacing: .14em; color: var(--text);
}
.site-footer .footer-org span { color: #C6A15B; margin: 0 10px; }
.site-footer .footer-power {
  font-size: 10px; letter-spacing: .22em; color: var(--muted); margin-top: 4px;
}

/* 弹层 */
.overlay {
  position: fixed; inset: 0; background: rgba(43,52,64,.32);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; z-index: 50;
}
.overlay[hidden] { display: none; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; z-index: 100; max-width: 90vw; text-align: center;
}
.toast[hidden] { display: none; }

/* 登录页 */
.login-page { max-width: 400px; margin: 8vh auto 0; padding: 0 18px; }
.login-page .card { padding: 28px 24px; }
.login-logo { font-size: 13px; letter-spacing: .16em; color: var(--muted); margin-bottom: 6px; }
.login-title { font-size: 21px; font-weight: 600; margin-bottom: 22px; }

/* 首页入口 */
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.entry {
  display: block; padding: 20px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.entry:hover { border-color: #C8D2DC; }
.entry-title { font-weight: 600; margin-bottom: 5px; }
.entry-desc { font-size: 13px; color: var(--muted); }
.entry-arrow { float: right; color: var(--muted); }

/* 高风险操作强确认 */
.typed-confirm-target {
  padding: 10px 12px; background: var(--danger-bg); border: 1px solid #E4C4C4;
  border-radius: var(--radius-sm); font-size: 14px; color: var(--danger);
  overflow-wrap: anywhere;
}
.typed-confirm-target b { font-weight: 700; user-select: all; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 客户名单页：当前权益标识 */
.current-benefit {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; margin-bottom: 16px; background: var(--primary-soft);
  border: 1px solid #C9D8E4; border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); flex-wrap: wrap;
}
.current-benefit .cb-label { font-size: 12px; color: var(--primary); letter-spacing: .5px; }
.current-benefit .cb-name { font-size: 17px; font-weight: 700; color: var(--text); margin-top: 2px; }
.current-benefit .cb-count { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 权益搜索框 */
.benefit-search {
  width: 100%; max-width: 320px; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
}
.benefit-search:focus { outline: none; border-color: var(--primary); }
