* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #222;
}

header {
  background: #2b3a55;
  color: #fff;
  padding: 16px 24px;
}
header h1 { margin: 0 0 12px; font-size: 20px; }
nav button {
  background: transparent;
  color: #cdd6e8;
  border: 1px solid transparent;
  padding: 8px 16px;
  margin-right: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
nav button.active { background: #fff; color: #2b3a55; font-weight: 600; }

#topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 14px; }
#topbar #who { color: #cdd6e8; }
#topbar button { padding: 6px 14px; font-size: 13px; }

main { padding: 24px; max-width: 1440px; margin: 0 auto; }

.panel {
  display: none;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.panel.active { display: block; }
h2 { margin-top: 0; font-size: 17px; }

.panel-head { display: flex; align-items: center; margin-bottom: 16px; gap: 8px; }
.panel-head h2 { margin: 0; margin-right: auto; }

/* 今日刷卡汇总卡 */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.sum-card {
  background: linear-gradient(135deg, #2b6cff, #5a8bff);
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
}
.sum-card.sum-merch {
  grid-column: 1 / -1;
  background: #fff;
  color: #333;
  border: 1px solid #e3e7ee;
}
.sum-card .sum-label { font-size: 12px; opacity: .85; margin-bottom: 6px; }
.sum-merch .sum-label { color: #666; opacity: 1; }
.sum-card .sum-value { font-size: 24px; font-weight: 700; }
.sum-card .sum-detail { font-size: 13px; line-height: 1.6; word-break: break-all; }
.sum-card-click { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.sum-card-click:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(43,108,255,.28); }
.sum-sub { font-size: 11px; opacity: .9; margin-top: 6px; }
.sum-sub .link { text-decoration: underline; font-weight: 600; cursor: pointer; }

/* 今日建议使用商户卡片（可点击，与左侧三卡同宽） */
.sum-card-suggest {
  background: linear-gradient(135deg, #11b886, #2fd0a0);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.sum-card-suggest:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(17,184,134,.35); }
.sum-card-suggest .sum-value { color: #fff; }
.sum-card-suggest .sum-sub { font-size: 11px; opacity: .92; margin-top: 6px; }
.sum-card-suggest .link { text-decoration: underline; font-weight: 600; cursor: pointer; }
/* 建议使用商户内联面板（全宽，仿 idle-wrap 风格） */
.rec-panel { background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; padding: 12px 14px 14px; margin-bottom: 18px; }
.rec-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rec-panel-title { font-size: 14px; font-weight: 700; color: #1a2b4a; }
.rec-panel-head .muted { font-size: 12px; color: #8a93a6; margin-right: auto; }
.rec-view-all { cursor: pointer; color: #2b6cff; font-size: 12px; font-weight: 600; }
.rec-view-all:hover { text-decoration: underline; }
.rec-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rec-chip { display: inline-flex; align-items: center; gap: 8px; background: #f4f7fb; border: 1px solid #e6ebf2; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.rec-chip .rc-name { font-weight: 600; color: #1a2b4a; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-chip .rc-rate { color: #0a8f6e; font-weight: 700; font-size: 12px; background: #e6f7f1; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.rec-chip .rc-add { font-size: 12px; padding: 3px 10px; background: #2b6cff; color: #fff; border: none; border-radius: 5px; cursor: pointer; }
.rec-chip .rc-add:hover { background: #1a5af0; }
.rec-empty { font-size: 13px; color: #8a93a6; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #eef3ff; color: #3a6; font-size: 11px; margin-left: 4px; }

/* 建议使用商户弹窗——按内容自适应放大 */
.modal-box.rec-box { width: -webkit-fit-content; width: fit-content; max-width: 96vw; }
.rec-note { font-size: 12px; margin: -6px 0 10px; }
.rec-list-wrap { max-height: 74vh; overflow: auto; border: 1px solid #eef1f6; border-radius: 8px; }
.rec-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.rec-table th, .rec-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; text-align: left; vertical-align: top; word-break: break-word; }
.rec-table th { color: #667; font-weight: 600; background: #f7f9fc; position: sticky; top: 0; }
.rec-table td.strong { font-weight: 700; color: #1a2b4a; }
.rec-table .m-name { white-space: normal; }
.rec-table .muted { font-size: 11px; }
.rec-add { padding: 4px 10px; border: 1px solid #2b6cff; background: #fff; color: #2b6cff; border-radius: 5px; cursor: pointer; font-size: 12px; }
.rec-add:hover { background: #2b6cff; color: #fff; }

/* 闲置商户统计（近 7 / 15 / 30 天未使用） */
.idle-wrap {
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 18px;
}
.idle-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.idle-title { font-size: 14px; font-weight: 700; color: #1a2b4a; }
.idle-head .muted { font-size: 12px; color: #8a93a6; margin-right: auto; }
.idle-head button { padding: 4px 10px; font-size: 12px; }
.idle-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.idle-filters label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #6b7280; }
.idle-filters select {
  padding: 4px 8px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: #1a2b4a;
  max-width: 190px;
}
.idle-filters select:focus { outline: none; border-color: #3b6fe0; }
.idle-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.idle-card {
  border: 1px solid #ffd8a8;
  background: #fff8ef;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.idle-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.idle-card.lv2 { border-color: #ffc9a0; background: #fff3e6; }
.idle-card.lv3 { border-color: #ffb3b3; background: #fff0f0; }
.idle-card.lv4 { border-color: #d9d9e3; background: #f5f6fa; }
.idle-label { font-size: 12px; color: #7a6146; margin-bottom: 4px; }
.idle-card.lv3 .idle-label { color: #9c4a4a; }
.idle-card.lv4 .idle-label { color: #6b7080; }
.idle-value { font-size: 22px; font-weight: 700; color: #b06a1a; }
.idle-card.lv3 .idle-value { color: #c23b3b; }
.idle-card.lv4 .idle-value { color: #55596b; }
.idle-sub { font-size: 11px; color: #a2a8b8; margin-top: 2px; }

/* 闲置商户明细弹窗 */
.modal-box.modal-wide { width: 880px; max-width: 94vw; }
.idle-modal-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.idle-modal-bar .seg { display: inline-flex; border: 1px solid #ccd2dc; border-radius: 6px; overflow: hidden; }
.idle-modal-bar .seg-btn { border: none; background: #fff; padding: 6px 12px; font-size: 13px; cursor: pointer; border-right: 1px solid #ccd2dc; color: #333; }
.idle-modal-bar .seg-btn:last-child { border-right: none; }
.idle-modal-bar .seg-btn.active { background: #3b6fe0; color: #fff; }
.idle-modal-bar input { padding: 6px 9px; border: 1px solid #ccd2dc; border-radius: 6px; font-size: 13px; width: 180px; }
.idle-modal-bar .idle-sel {
  padding: 6px 8px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1a2b4a;
  max-width: 180px;
}
.idle-modal-bar .idle-sel:focus { outline: none; border-color: #3b6fe0; }
.idle-modal-bar .muted { font-size: 12px; color: #8a93a6; margin-right: auto; }
.idle-table-wrap { max-height: 56vh; overflow-y: auto; border: 1px solid #eef1f6; border-radius: 8px; }
.idle-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.idle-table th, .idle-table td { padding: 7px 10px; border-bottom: 1px solid #eef1f6; text-align: left; }
.idle-table thead th { position: sticky; top: 0; background: #f7f9fc; color: #667; font-weight: 600; z-index: 1; }
.idle-table tbody tr:hover { background: #fafbfe; }
.idle-table td.num { text-align: right; }
.idle-days { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; background: #fff3e0; color: #b06a1a; }
.idle-days.warn { background: #ffece6; color: #d2601a; }
.idle-days.danger { background: #ffe8e8; color: #c23b3b; }
.idle-days.never { background: #ececf2; color: #55596b; }
.idle-empty { padding: 24px; text-align: center; color: #9aa1b1; font-size: 13px; }

/* 今日交易按支付方式拆分 */
.sum-by-channel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.sum-ch-card {
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sum-ch-card .sum-ch-name { font-size: 12px; opacity: .92; }
.sum-ch-card .sum-ch-amt { font-size: 20px; font-weight: 700; line-height: 1.2; }
.sum-ch-card .sum-ch-cnt { font-size: 12px; opacity: .85; }
.sum-ch-card.card { background: #9aa3b2; }
.sum-ch-card.wx   { background: #2aae67; }
.sum-ch-card.ali  { background: #1677ff; }
.sum-ch-card.up   { background: #f0883e; }

/* 今日涉及商户：按渠道拆分的明细表 */
.merch-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.merch-table th, .merch-table td { padding: 6px 10px; border-bottom: 1px solid #eef1f6; }
.merch-table th { color: #667; font-weight: 600; background: #f7f9fc; text-align: left; }
.merch-table th:nth-child(n+2), .merch-table td:nth-child(n+2) { text-align: right; }
.merch-table td.strong, .merch-table th.strong { font-weight: 700; color: #1a2b4a; }
.merch-table .m-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merch-table tfoot td { background: #f0f5ff; border-top: 2px solid #c9d6ee; color: #1a2b4a; }

/* 交易录入弹窗 */
.modal-box {
  position: relative;
  background: #fff;
  padding: 26px 26px;
  border-radius: 12px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.modal-box.note-box { width: 880px; max-width: 94vw; resize: both; overflow: auto; min-width: 500px; min-height: 400px; max-height: 92vh; }
/* wangEditor 内容区自适应弹窗高度 */
.note-box .w-e-text-container { height: auto !important; min-height: 300px; max-height: 65vh; }
.note-box .w-e-text { min-height: 300px; max-height: 65vh; }
/* 用户模块权限 */
.mod-fieldset { border: 1px solid #e3e6ec; border-radius: 10px; padding: 10px 14px 14px; margin: 4px 0 2px; }
.mod-fieldset legend { font-size: 12px; color: #8a93a3; padding: 0 6px; }
.mod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; margin-top: 4px; }
.mod-chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4a5160; cursor: pointer; }
.mod-chk input { margin: 0; }
.mod-actions { margin-top: 10px; display: flex; gap: 8px; }
button.ghost.sm { padding: 4px 10px; font-size: 12px; }
.mod-chip { display: inline-block; background: #eef3ff; color: #2f6bff; border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 1px 3px 1px 0; }
.mod-cell { max-width: 240px; }
.modal-box h2 { padding-right: 38px; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f1f2f5;
  color: #666;
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.modal-close:hover { background: #e3e5ea; color: #222; }
.modal-box h2 { margin: 0 0 16px; font-size: 18px; }
.modal-box label { display: flex; flex-direction: column; font-size: 13px; color: #555; gap: 4px; margin-bottom: 12px; }
.modal-box input, .modal-box select { padding: 9px; border: 1px solid #ccd2dc; border-radius: 6px; font-size: 14px; }
/* 纯二维码商户：禁用不可用的「刷卡」选项，明确置灰 */
.modal-box select option:disabled { color: #b7bdc7; background: #f1f3f6; }
.modal-box .actions { display: flex; gap: 10px; margin-top: 6px; }
#merchantModal .modal-box { max-height: 90vh; overflow-y: auto; }
#cardModal .modal-box { max-height: 90vh; overflow-y: auto; }
#txModal .modal-box { max-height: 90vh; overflow-y: auto; }
#batchTxModal .modal-box { max-height: 90vh; overflow-y: auto; }
#couponModal .modal-box { max-height: 90vh; overflow-y: auto; }
#userModal .modal-box { max-height: 90vh; overflow-y: auto; }
#groupModal .modal-box { max-height: 90vh; overflow-y: auto; }
#pwdModal .modal-box { max-height: 90vh; overflow-y: auto; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px dashed #e3e7ee;
}
.form-grid label { display: flex; flex-direction: column; font-size: 13px; color: #555; gap: 4px; }
.form-grid input, .form-grid select {
  padding: 8px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 14px;
}
.actions { grid-column: 1 / -1; display: flex; gap: 10px; }

button {
  background: #2b6cff;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
button.ghost { background: #eef1f6; color: #333; }
button.del { background: #e2574c; }
button[data-edit] { background: #f0a91b; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eee; }
th { background: #fafbfc; color: #666; font-weight: 600; }
td.op button { margin-right: 6px; padding: 5px 10px; font-size: 12px; }

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #e2574c; }

/* 登录遮罩 */
.overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 45, .55);
  align-items: center;
  justify-content: center;
  z-index: 50;
}
/* 登录遮罩：登录成功前不透明，避免透出任何背景内容 */
#login { background: #1e2638; }
.login-box {
  background: #fff;
  padding: 30px 28px;
  border-radius: 12px;
  width: 300px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.login-box h2 { margin: 0 0 18px; font-size: 18px; text-align: center; }
.login-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 14px;
}
.login-box button { width: 100%; padding: 10px; font-size: 15px; }
.login-box .err { color: #e2574c; font-size: 13px; text-align: center; min-height: 16px; }
.err { color: #e2574c; }

/* 纯二维码标记（显示在商户名称前） */
.qr-tag {
  display: inline-block;
  background: #7b5cff;
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}
/* 可扫码标签 */
.scan-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin: 1px 3px 1px 0;
  color: #fff;
  white-space: nowrap;
}
.scan-badge.wx  { background: #2aae67; }
.scan-badge.ali { background: #1677ff; }
.scan-badge.up  { background: #f0883e; }

/* 商户管理顶部渠道统计：支付宝 / 微信 / 云闪付 */
.merch-channel-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 12px;
}
.mcs-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 12px;
  color: #fff;
  white-space: nowrap;
}
.mcs-item b { font-size: 13px; font-weight: 700; }
.mcs-total { background: #5b6b7f; }
.mcs-ali { background: #1677ff; }
.mcs-wx  { background: #2aae67; }
.mcs-up  { background: #f0883e; }
.qr-thumb { width: 48px; height: 48px; object-fit: cover; border: 1px solid #eee; border-radius: 4px; }
/* 商户列表二维码缩略图可点击查看大图 */
.qr-thumb.qr-click { cursor: zoom-in; transition: transform .12s, box-shadow .12s; }
.qr-thumb.qr-click:hover { transform: scale(1.08); box-shadow: 0 0 0 2px #3b6fe0; }
.qr-view-box { width: auto; max-width: 92vw; padding: 22px; }
.qr-view-body { display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.qr-view-body img { max-width: 78vw; max-height: 76vh; border-radius: 8px; border: 1px solid #eef1f6; background: #fff; }
.muted { color: #bbb; }

/* 交易列表：支付方式标签 */
.ch-tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; color: #fff; background: #9aa3b2; white-space: nowrap; }
.ch-tag.wx  { background: #2aae67; }
.ch-tag.ali { background: #1677ff; }
.ch-tag.up  { background: #f0883e; }
.ch-tag.card { background: #9aa3b2; }
.merch-cell .ch-tag { margin-left: 6px; vertical-align: middle; }

/* 交易录入弹窗：费率提示 + 二维码预览 */
.rate-hint { font-size: 12px; color: #1677ff; margin: -4px 0 8px; }
.tx-qr-box { text-align: center; margin: 0 0 12px; padding: 10px; border: 1px dashed #d8deea; border-radius: 8px; }
.tx-qr-tip { font-size: 12px; color: #666; margin-bottom: 6px; }
.tx-qr-img { width: 360px; height: 360px; object-fit: contain; border: 1px solid #eee; border-radius: 6px; background: #fff; cursor: zoom-in; }
.tx-qr-img.qr-click:hover { filter: brightness(0.97); }
#batchTxQrBox.tx-qr-box { padding: 6px; }

/* 商户表单：纯二维码 / 可扫码 区域 */
.qr-only-label { flex-direction: row; align-items: center; gap: 6px; }
.qr-only-label input { width: auto; }
.qr-scan-group {
  grid-column: 1 / -1;
  border: 1px dashed #d8deea;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qr-scan-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qr-scan-row .chk { flex-direction: row; align-items: center; gap: 6px; width: auto; }
.qr-scan-row .chk input { width: auto; }
.qr-scan-row .rate { flex-direction: row; align-items: center; gap: 6px; width: auto; }
.qr-scan-row .rate input { width: 90px; }
.qr-upload { grid-column: 1 / -1; }
.qr-upload input[type=file] { font-size: 13px; }

/* 交易录入弹窗：可搜索下拉 combobox */
.combo-field { position: relative; }
.combo-input { width: 100%; }
.combo-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  z-index: 60;
}
.combo-item {
  padding: 9px 12px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f2f4f8;
}
.combo-item:last-child { border-bottom: none; }
.combo-item:hover, .combo-item.active { background: #eef4ff; }
.combo-empty { padding: 10px 12px; font-size: 13px; color: #999; }
.plat-cell { color: #6b7280; white-space: nowrap; }

/* 商户作废 / 状态 */
.merch-toolbar { margin: 10px 0; font-size: 13px; color: #555; }
.merch-toolbar .muted { margin-left: 8px; }
.row-disabled td { opacity: 0.55; }
.status-cell { text-align: center; }
.m-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 1.6; }
.m-badge.active { background: #e6f7ec; color: #1a7f37; }
.m-badge.disabled { background: #fde8e8; color: #c0392b; }
/* 商户备注列：限宽 + 省略号，悬停看全文 */
.m-note { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5b6472; font-size: 13px; }
/* 商户优先级徽标 */
.prio-cell { text-align: center; }
.prio-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.6; background: #fff3e0; color: #c77700; border: 1px solid #ffd699; }
.rec-prio { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-weight: 700; background: #fff3e0; color: #c77700; }
button.void { background: #fff3f3; color: #c0392b; border: 1px solid #f0c2c2; margin-right: 4px; }
button.void:hover { background: #fde8e8; }
button.restore { background: #eef7ee; color: #1a7f37; border: 1px solid #bfe3c4; margin-right: 4px; }
button.restore:hover { background: #e0f2e3; }

/* 「查看已作废」切换按钮：默认灰底，进入作废视图后变红底高亮 */
.void-toggle { background: #f4f5f7; color: #6b7280; border: 1px dashed #c9ced8; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; margin-left: auto; }
.void-toggle:hover { background: #eceef2; color: #444; }
.void-toggle.on { background: #fde8e8; color: #c0392b; border: 1px solid #e8b4b4; border-style: solid; font-weight: 600; }
.void-toggle.on:hover { background: #fbdada; }
#merchViewTip { display: block; margin-top: 8px; }

/* 交易筛选栏 */
.tx-filter { margin: 12px 0 14px; }
.tx-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tx-filter .fld { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #555; }
.tx-filter .fld-label { color: #555; }
.tx-filter input[type=date], .tx-filter input[type=text] { padding: 6px 8px; border: 1px solid #ccd2dc; border-radius: 6px; font-size: 13px; }
.tx-filter .fld input[type=text] { width: 120px; }
.tx-filter select {
  padding: 6px 8px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #333;
  cursor: pointer;
  max-width: 190px;
}
.tx-filter select:focus { outline: none; border-color: #3b6fe0; }
#txFilterCard { min-width: 150px; }
#txFilterMerchant { width: 140px; }
.tx-filter .seg { display: inline-flex; border: 1px solid #ccd2dc; border-radius: 6px; overflow: hidden; }
.tx-filter .seg-btn { border: none; background: #fff; padding: 6px 12px; font-size: 13px; cursor: pointer; border-right: 1px solid #ccd2dc; color: #333; }
.tx-filter .seg-btn:last-child { border-right: none; }
.tx-filter .seg-btn.active { background: #3b6fe0; color: #fff; }

/* 交易列表：显示更多（分页懒加载） */
.tx-more-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin: 16px 0 28px;
}
.tx-more-wrap #txMoreBtn { min-width: 140px; padding: 10px 18px; font-size: 14px; }
.tx-more-wrap .muted { font-size: 13px; }

/* ===== 移动端适配（手机浏览器，≤768px） ===== */
@media (max-width: 768px) {
  header { padding: 12px 14px; }
  header h1 { font-size: 17px; margin-bottom: 8px; }
  nav { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  nav button { padding: 7px 12px; font-size: 13px; margin-right: 6px; }
  #topbar { flex-wrap: wrap; gap: 8px; }
  main { padding: 14px; }
  .panel { padding: 14px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head h2 { font-size: 16px; margin: 0 0 4px; }
  .panel-head button { padding: 7px 12px; font-size: 13px; }

  .summary-cards { gap: 10px; }
  .sum-card { padding: 12px 14px; }
  .sum-card .sum-value { font-size: 22px; }

  /* 表格横向滚动，避免多列在手机上挤爆 */
  .table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #txTable, #cardTable, #userTable { min-width: 640px; }
  /* 商户表：手机端改为卡片式，优先级等字段直接可读，不再需要横滑 */
  #merchantTable { min-width: 0; border: none; background: transparent; }
  #merchantTable thead { display: none; }
  #merchantTable tbody, #merchantTable tr, #merchantTable td { display: block; width: 100%; box-sizing: border-box; }
  #merchantTable tr { border: 1px solid #e3e7ee; border-radius: 10px; margin-bottom: 12px; padding: 12px 14px; background: #fff; }
  #merchantTable tr.row-disabled { opacity: .62; }
  #merchantTable td { border: none; padding: 7px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; text-align: right; }
  #merchantTable td::before { content: attr(data-label); flex: 0 0 auto; text-align: left; font-size: 12px; color: #8a93a6; font-weight: 600; padding-top: 1px; }
  #merchantTable .sel-col { display: none; }
  #merchantTable .qr-thumb { width: 96px; height: 96px; }
  #merchantTable .op { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  #merchantTable .op button { padding: 7px 12px; font-size: 13px; }
  #merchantTable .prio-cell { font-size: 15px; }
  #merchantTable .prio-badge { font-size: 14px; padding: 2px 10px; }
  .merch-channel-stats { flex-wrap: wrap; }
  .cpv-row { flex-wrap: wrap; }
  .cpv-row .cpv-valid { flex: 1 1 100%; }
  .cpv-row .cpv-code { flex: 1 1 60%; }
  .cpv-row .cpv-days { flex: 1 1 30%; }
  .cpv-row .cpv-del { flex: 0 0 auto; }

  .rec-panel-head { flex-wrap: wrap; }
  .idle-head { flex-wrap: wrap; }
  .tx-filter-row { gap: 8px; }
  .tx-filter .fld { flex-wrap: wrap; }
  .tx-filter select, #txFilterCard, #txFilterMerchant { max-width: 48vw; }

  /* 弹窗在手机上满宽、减小内边距、放大输入框字号防 iOS 自动缩放 */
  .modal-box { width: auto; max-width: 94vw; padding: 18px 16px; }
  .modal-box.rec-box { width: auto; max-width: 96vw; }
  .modal-box.modal-wide { width: auto; max-width: 96vw; }
  .modal-box.note-box { width: auto; max-width: 96vw; resize: none; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-box label { font-size: 14px; }
  .modal-box input, .modal-box select,
  .tx-filter input, .tx-filter select,
  .merch-toolbar select, .idle-filters select,
  .idle-modal-bar input, .idle-modal-bar .idle-sel,
  .login-box input { font-size: 16px; }
  .login-box { width: auto; max-width: 92vw; }

  .rec-chips { gap: 6px; }
  .rec-chip { padding: 5px 8px; font-size: 12px; }
  .rec-chip .rc-name { max-width: 120px; }

  .idle-modal-bar input, .idle-modal-bar .idle-sel { width: 100%; max-width: 100%; }
}

/* ---------- 信用卡 状态徽标 / 作废视图 ---------- */
.panel-head-actions { display: flex; gap: 8px; align-items: center; }
.view-tip { font-size: 12px; color: #8a93a6; margin: 8px 2px 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 1.6; }
.badge-ok { background: #e6f7ec; color: #1a9c54; }
.badge-void { background: #fdeaea; color: #d04646; }
.row-void { opacity: 0.62; }
.readonly-row { font-size: 14px; color: #445; margin: 4px 0 2px; }
.readonly-row .mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 1px; }
.hint { font-size: 12px; color: #8a93a6; margin: 8px 0 0; line-height: 1.5; }

/* ---------- 批量新增交易弹窗 ---------- */
.batch-note { font-size: 12px; color: #8a93a6; background: #f5f8fc; border: 1px solid #eef1f6; border-radius: 8px; padding: 8px 10px; margin: 10px 0 4px; line-height: 1.5; }
.batch-two { display: flex; gap: 12px; }
.batch-two label { flex: 1; margin-bottom: 0; }
.batch-rows-head, .batch-row { display: grid; grid-template-columns: 1fr 120px 64px; gap: 8px; align-items: center; }
.batch-rows-head { font-size: 12px; color: #667; padding: 0 2px 4px; border-bottom: 1px solid #eef1f6; }
.batch-rows { margin: 6px 0; max-height: 44vh; overflow-y: auto; }
.batch-row { margin-bottom: 8px; }
.batch-row .batch-card-sel, .batch-row .batch-amt { width: 100%; padding: 8px 10px; border: 1px solid #d8dee9; border-radius: 8px; font-size: 14px; box-sizing: border-box; background: #fff; }
.batch-row .batch-amt { -moz-appearance: textfield; }
.batch-row-del { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.batch-add-row { width: 100%; margin: 2px 0 10px; }

@media (max-width: 560px) {
  .batch-two { flex-direction: column; gap: 8px; }
  .batch-rows-head { display: none; }
  .batch-row { grid-template-columns: 1fr 1fr; grid-template-areas: "card card" "amt del"; row-gap: 6px; }
  .batch-row .batch-card-sel { grid-area: card; }
  .batch-row .batch-amt { grid-area: amt; }
  .batch-row-del { grid-area: del; }
}

/* 商户交易明细弹窗 */
/* 商户交易弹窗：限制高度并允许滚动，避免“加载更多”后内容超出屏幕、关闭按钮点不到。
   overlay 不用 align-items:center 居中（内容超高时会把弹窗顶部顶出屏幕、关不掉），
   改为 align-items:flex-start + box margin:auto：矮时居中、高时可滚动。
   弹窗用 flex 纵向布局，表体独立滚动，标题/关闭/筛选始终固定可见。 */
#merchTxModal { align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
#merchTxModal .modal-box {
  margin: auto;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#merchTxModal .table-wrap { max-height: 62vh; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
#merchTxModal .merch-tx-more-wrap { flex: 0 0 auto; }
.merch-tx-compare { display: flex; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.merch-tx-compare .cmp { font-size: 12px; padding: 4px 11px; border-radius: 6px; font-weight: 600; white-space: nowrap; }
.merch-tx-compare .cmp.on { background: #e8f6ee; color: #1a8a4a; }
.merch-tx-compare .cmp.off { background: #f3f4f7; color: #8a93a6; }
.merch-tx-filter { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.merch-tx-filter label { font-size: 13px; color: #667; display: inline-flex; align-items: center; gap: 6px; }
.merch-tx-filter select { padding: 6px 9px; font-size: 14px; border: 1px solid #d8dee9; border-radius: 6px; background: #fff; }
.merch-tx-sum { font-size: 13px; color: #1a2b4a; font-weight: 600; }
.merch-tx-filter button.primary { padding: 7px 16px; font-size: 13px; }
.merch-tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.merch-tx-table th, .merch-tx-table td { padding: 8px 12px; border-bottom: 1px solid #eef1f6; text-align: left; white-space: nowrap; }
.merch-tx-table th { color: #667; font-weight: 600; background: #f7f9fc; }
.merch-tx-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.merch-tx-table tr:hover td { background: #fafbfd; }
.merch-tx-more-wrap { text-align: center; padding: 12px 4px 4px; }
#merchTxMore { display: inline-block; padding: 8px 22px; border: 1px solid #d0d7e2; background: #fff; color: #1a2b4a; border-radius: 8px; cursor: pointer; font-size: 14px; }
#merchTxMore:hover { background: #f3f6fb; }

/* 分组数据共享 */
.group-tip { margin: -4px 0 14px; font-size: 13px; }
.group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.group-card { border: 1px solid #e3e7ee; border-radius: 10px; padding: 14px 16px; background: #fff; }
.group-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-name { font-size: 16px; font-weight: 700; color: #1a2333; }
.group-shares-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.grp-share-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eaf1ff; color: #2b6cff; font-weight: 600; }
.group-members-line { font-size: 13px; color: #667; margin: 10px 0 12px; line-height: 1.5; }
.group-actions { display: flex; gap: 8px; }
.group-shares { background: #f7f9fc; border: 1px solid #eef1f6; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.group-shares .chk, .member-box .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #333; margin: 6px 14px 6px 0; }
.share-title { font-size: 13px; color: #555; font-weight: 600; margin-bottom: 4px; }
.member-box { display: flex; flex-wrap: wrap; gap: 4px 0; padding: 6px 0; max-height: 180px; overflow-y: auto; }
.grp-cell { vertical-align: top; }
.grp-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #fff3e0; color: #c77700; font-weight: 600; white-space: nowrap; border: 1px solid #ffe0b0; }
/* 批量选择与批量栏 */
.sel-col { width: 34px; text-align: center; }
.batch-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.batch-bar .muted { font-size: 13px; }
.sel-all, .row-sel { width: 16px; height: 16px; cursor: pointer; }
/* 交易弹窗：到账金额输入 + 按费率计算按钮 */
.inline-row { display: inline-flex; align-items: center; gap: 6px; width: 100%; }
.inline-row input { flex: 1; min-width: 0; }
button.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* 优惠券模块 */
.coupon-status { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.st-ok { background: #e7f8ec; color: #1f9d4d; border: 1px solid #b7e8c6; }
.st-expired { background: #fdeaea; color: #d23b3b; border: 1px solid #f5c2c2; }
.st-used { background: #eef0f4; color: #8a90a0; border: 1px solid #dfe2ea; }
.coupon-empty { padding: 28px; text-align: center; color: #99a; }
.coupon-actions { display: flex; gap: 8px; white-space: nowrap; }
.coupon-link-tip { font-size: 12px; color: #8a93a6; margin: -4px 0 12px; line-height: 1.5; }

/* 优惠券数量列：可点击触发修改弹窗；为0时弱化提示已用完 */
.cp-qty-cell { cursor: pointer; color: #1f6feb; font-variant-numeric: tabular-nums; font-weight: 600; text-decoration: underline dotted #9bb8ee; text-underline-offset: 3px; }
.cp-qty-cell:hover { background: #eef4ff; }
.cp-qty-cell.is-zero { color: #8a90a0; text-decoration: none; }
.cp-qty-cell.is-zero:hover { background: #f4f5f8; }

/* 修改数量小弹窗 */
.modal-box.cp-qty-box { width: 320px; }
.cp-qty-input-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.cp-qty-input-row .qty-step { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #d8deea; border-radius: 8px; padding: 2px; background: #fff; }
.cp-qty-input-row .qs-btn { width: 28px; height: 28px; border: none; background: #f0f3f8; color: #2b3340; border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; font-weight: 700; }
.cp-qty-input-row .qs-btn:hover { background: #e2e8f2; }
.cp-qty-input-row input { width: 64px; text-align: center; border: none; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 优惠券按键值分组折叠 */
.cp-group-row { cursor: pointer; background: #f5f7fb; }
.cp-group-row:hover { background: #eef2f9; }
.cp-group-row td { padding: 9px 12px; border-top: 1px solid #e6eaf2; border-bottom: 1px solid #eef1f7; }
.cp-caret { display: inline-block; width: 16px; color: #6b7384; font-size: 12px; }
.cp-group-key { font-weight: 700; color: #1f2733; margin-right: 10px; }
.cp-group-meta { font-size: 12px; color: #8a93a6; }

/* 优惠券有效期多行（批量录入） */
.cp-valid-block { margin: 4px 0 2px; }
.cp-valid-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cp-valid-head > span { font-size: 13px; color: #5b6573; font-weight: 600; }
.cp-add-valid { padding: 4px 10px; font-size: 12px; }
.cpv-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.cpv-row .cpv-valid { flex: 1.3; min-width: 0; }
.cpv-row .cpv-days { flex: 0 0 72px; min-width: 0; }
.cpv-row .cpv-code { flex: 1.5; min-width: 0; }
.cpv-row .cpv-del { flex: 0 0 auto; padding: 4px 10px; line-height: 1; font-size: 15px; }
.cpv-row.no-del .cpv-del { display: none; }

/* 优惠券筛选栏 */
.cf-count { margin-left: auto; align-self: center; }
.cf-panel { background: #fafbfc; border: 1px solid #eceef2; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px 12px; }
.cf-item { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #6b7280; }
.cf-item input, .cf-item select { padding: 7px 9px; border: 1px solid #d9dde3; border-radius: 7px; font-size: 13px; background: #fff; color: #1f2937; }
.cf-item input:focus, .cf-item select:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
.cf-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: flex-end; }


/* 昨日汇总区块标题 */
.sum-section-title { font-size: 13px; font-weight: 700; color: #6b7280; margin: 6px 2px 0; letter-spacing: .3px; }

/* 手续费统计 */
.seg { display: inline-flex; gap: 6px; margin-left: 10px; }
.seg-btn { border: 1px solid #d8dee9; background: #fff; color: #46506a; padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.seg-btn:hover { border-color: #1677ff; color: #1677ff; }
.seg-btn.active { background: #1677ff; border-color: #1677ff; color: #fff; }
.stats-total { margin: 14px 2px 10px; font-size: 14px; color: #46506a; }
.stats-total b { color: #1f2937; font-size: 16px; }
.stats-total b.fee { color: #d4380d; }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th, .stats-table td { padding: 9px 12px; border-bottom: 1px solid #eef0f4; font-size: 13px; }
.stats-table th { background: #f6f8fb; color: #46506a; font-weight: 600; text-align: left; }
.stats-table td.num, .stats-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table td.fee { color: #d4380d; font-weight: 600; }
.stats-table tfoot .total-row td { background: #f6f8fb; font-weight: 700; border-top: 2px solid #d8dee9; }
.stats-table tfoot .total-row td.fee { color: #d4380d; }
.idle-empty { padding: 26px; text-align: center; color: #9aa1ad; font-size: 13px; }
/* 统计页筛选条：维度分段 + 日期区间 + 重置 */
.stats-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 2px 0; }
.stats-filter .seg { margin-left: 0; }
.stats-filter .fld { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #46506a; }
.stats-filter .fld input[type=date] { padding: 6px 8px; border: 1px solid #d8dee9; border-radius: 6px; font-size: 13px; color: #1f2937; background: #fff; }
.muted.sm { font-size: 11px; margin-top: 2px; }

/* 优惠券有效期预警：剩余天数<15天高亮有效期单元格 */
.cp-exp-soon { color: #e8830c; font-weight: 600; }
.cp-exp-expired { color: #d93636; font-weight: 700; }

/* 记事本 — 折叠列表 */
#notesList { padding: 4px 0; }
.note-row { border-bottom: 1px solid #ecf0f5; }
.note-row:last-child { border-bottom: none; }
.nr-head { display: flex; align-items: center; padding: 10px 12px; cursor: pointer; user-select: none; transition: background .1s; gap: 8px; }
.nr-head:hover { background: #f5f7fa; }
.nr-caret { font-size: 12px; color: #9aa1ad; flex-shrink: 0; width: 14px; text-align: center; transition: transform .15s; }
.nr-title { flex: 1; font-size: 14px; font-weight: 500; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-time { font-size: 12px; color: #9aa1ad; flex-shrink: 0; white-space: nowrap; }
.nr-body { padding: 2px 12px 10px 34px; }
.nr-content { font-size: 13px; line-height: 1.6; color: #4a5568; word-break: break-word; overflow-x: auto; }
.nr-content table { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 12px; }
.nr-content table td, .nr-content table th { border: 1px solid #d8dee9; padding: 4px 8px; text-align: left; }
.nr-content table th { background: #f5f7fa; font-weight: 600; }
.nr-content table tr:nth-child(even) { background: #fafbfc; }
.nr-content p { margin: 4px 0; }
.nr-content br { display: block; content: ''; margin: 2px 0; }
.nr-actions { padding: 8px 0 4px; display: flex; gap: 8px; }
.nr-actions .ghost { font-size: 12px; padding: 4px 10px; }
.nr-actions .note-del { color: #d93636; }
/* wangEditor 全功能编辑器覆盖 */
.notes-empty { padding: 40px 16px; text-align: center; color: #9aa1ad; font-size: 14px; }

/* === 移动端修复：微信/小屏适配 === */
@media (max-width: 768px) {
  /* 1. 弹窗滚动 + 安全区域（微信底部栏） */
  .modal-box { max-height: 85vh; overflow-y: auto; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  #merchTxModal { padding: 12px 8px; }
  #merchTxModal .modal-box { max-height: calc(100vh - 24px); }
  #merchTxModal .table-wrap { max-height: 58vh; }
  .modal-close { width: 44px; height: 44px; font-size: 26px; top: 8px; right: 8px; z-index: 62; }
  .modal-box .actions { padding: 10px 0 4px; position: static; } /* 微信 X5 不支持 sticky，改用 static */
  .modal-box .actions button { min-height: 44px; font-size: 15px; flex: 1; }

  /* 1a. 记事本（wangEditor）弹窗：覆盖 min-width 防小屏横向溢出、编辑器高度自适应 */
  .modal-box.note-box { min-width: 0; width: 96vw; max-width: 96vw; max-height: 92vh; }
  .modal-box.note-box .w-e-toolbar { flex-wrap: wrap; }
  .modal-box.note-box .w-e-text-container { height: auto !important; min-height: 220px; max-height: 60vh; }
  .modal-box.note-box .w-e-text { min-height: 220px; max-height: 60vh; }

  /* 1b. 批量新增交易行网格窄屏自适应 */
  .batch-rows-head, .batch-row { grid-template-columns: 1fr 90px 46px; gap: 6px; }

  /* 1c. 优惠券有效行 + 数量步进小屏布局 */
  .cp-valid-head { flex-wrap: wrap; gap: 6px; }
  .cp-valid-head span { flex: 1 1 auto; }
  .qty-step button { min-width: 40px; }

  /* 1d. 登录/其他内联 label 区块在手机上不要挤爆 */
  .form-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-row label { width: 100%; }


  /* 2. 导航 Tab 增大 */
  nav button { padding: 10px 10px; min-height: 44px; font-size: 14px; }

  /* 3. 按钮最小触摸目标 */
  button { min-height: 44px; }
  .panel-head button { padding: 8px 12px; font-size: 13px; }
  .tx-filter .seg-btn { min-height: 40px; }
  .idle-head button { min-height: 40px; }
  .stats-filter .seg-btn { min-height: 40px; }

  /* 4. 汇总卡片 2 列 */
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .sum-merch { grid-column: 1 / -1; }
  .sum-card .sum-value { font-size: 20px; }

  /* 5. 交易筛选栏纵向 */
  .tx-filter-row { flex-direction: column; gap: 8px; }
  .tx-filter .fld { width: 100%; }
  .tx-filter .seg { display: flex; width: 100%; }
  .tx-filter .seg-btn { flex: 1; text-align: center; }
  #txFilterCard { width: 100%; max-width: 100%; }
  #txFilterMerchant { width: 100%; }

  /* 6. 手续费统计筛选纵向 */
  .stats-filter { flex-direction: column; align-items: stretch; gap: 8px; }
  .stats-filter .seg { display: flex; width: 100%; }
  .stats-filter .seg-btn { flex: 1; text-align: center; }
  .stats-filter .fld { width: 100%; }

  /* 7. panel-head 紧凑 */
  .panel-head { gap: 6px; }
  .panel-head-actions { width: 100%; justify-content: flex-end; }

  /* 8. 编辑弹窗表单紧凑 */
  .modal-box label { margin-bottom: 8px; }
  .modal-box input, .modal-box select { padding: 10px; }

  /* 9. 优惠券筛选网格 1 列 */
  .cf-grid { grid-template-columns: 1fr; }

  /* 10. 商户筛选栏紧凑 */
  .merch-filter .tx-filter-row { flex-direction: column; gap: 8px; }
  .merch-filter .tx-filter-row .fld { width: 100%; }
  #merchKw { width: 100%; }

  /* 11. 闲置商户明细弹窗筛选紧凑 */
  .idle-modal-bar { flex-direction: column; align-items: stretch; }
  .idle-modal-bar .seg { display: flex; width: 100%; }
  .idle-modal-bar .seg-btn { flex: 1; text-align: center; }
  .idle-modal-bar input { width: 100%; }
  .idle-modal-bar .idle-sel { width: 100%; max-width: 100%; }

  /* 12. 批量改共享分组 */
  .batch-group-btn { font-size: 12px; padding: 6px 10px; }
  .batch-bar { flex-wrap: wrap; gap: 6px; }

  /* 13. 交易表 → 卡片式（类似商户表） */
  #txTable, #couponTable, #cardTable, #userTable { min-width: 0; border: none; background: transparent; }
  #txTable thead, #couponTable thead, #cardTable thead, #userTable thead { display: none; }
  #txTable tbody, #txTable tr, #txTable td,
  #couponTable tbody, #couponTable tr, #couponTable td,
  #cardTable tbody, #cardTable tr, #cardTable td,
  #userTable tbody, #userTable tr, #userTable td { display: block; width: 100%; box-sizing: border-box; }
  #txTable tr, #couponTable tr, #cardTable tr, #userTable tr { border: 1px solid #e3e7ee; border-radius: 10px; margin-bottom: 12px; padding: 12px 14px; background: #fff; }
  #txTable td, #couponTable td, #cardTable td, #userTable td { border: none; padding: 7px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; text-align: right; }
  #txTable td::before, #couponTable td::before, #cardTable td::before, #userTable td::before { content: attr(data-label); flex: 0 0 auto; text-align: left; font-size: 12px; color: #8a93a6; font-weight: 600; padding-top: 1px; min-width: 50px; }
  #txTable .sel-col, #couponTable .sel-col, #cardTable .sel-col, #userTable .sel-col { display: none; }
  #txTable .op, #couponTable .op, #cardTable .op, #userTable .op { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  #txTable .op button, #couponTable .op button, #cardTable .op button, #userTable .op button { padding: 7px 12px; font-size: 13px; }
  #txTable .grp-cell, #couponTable .grp-cell, #cardTable .grp-cell, #userTable .grp-cell { display: none; }
  #txTable .merch-cell { flex-direction: column; align-items: flex-end; gap: 2px; }
  /* 优惠券组折叠行特殊处理（保持全宽） */
  #couponTable .cp-group-row td { display: block; width: 100%; padding: 9px 12px; }
  #couponTable .cp-group-row td::before { content: none; }
  /* 优惠券数量格可点击 */
  #couponTable .cp-qty-cell { justify-content: flex-end; }

  /* 14. 优惠券按键值分组折叠：组头中 meta 换行 */
  .cp-group-meta { display: block; margin-top: 2px; font-size: 11px; }
}

/* 15. 极小屏（<400px）额外紧凑 */
@media (max-width: 400px) {
  header h1 { font-size: 14px; }
  main { padding: 8px; }
  .panel { padding: 10px; }
  .modal-box { max-width: 98vw; padding: 14px 12px; }
  .modal-box label { margin-bottom: 6px; }
  .modal-box input, .modal-box select { padding: 8px; }
  #txTable tr, #couponTable tr, #cardTable tr, #userTable tr { padding: 8px 10px; }
  #txTable td, #couponTable td, #cardTable td, #userTable td { padding: 5px 0; }
  #txTable td::before, #couponTable td::before, #cardTable td::before, #userTable td::before { font-size: 11px; min-width: 40px; }
  .summary-cards { grid-template-columns: 1fr 1fr; gap: 6px; }
  .sum-card { padding: 10px 12px; }
  .sum-card .sum-value { font-size: 18px; }
  /* 记事本编辑器在极小屏：工具栏字号微调、编辑器更矮 */
  .modal-box.note-box .w-e-toolbar { font-size: 12px; }
  .modal-box.note-box .w-e-toolbar .w-e-menu { padding: 4px 3px; }
  .modal-box.note-box .w-e-text-container { min-height: 180px; }
  .modal-box.note-box .w-e-text { min-height: 180px; }
}

/* ===== 记事本 ===== */
.nr-content table { border-collapse: collapse; }


/* ===== 绑定关系 ===== */
.bind-results { margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.bind-results:empty { display: none; }
.bind-card { background: #f7faff; border: 1px solid #d7e3ff; border-left: 4px solid #4a7bff; border-radius: 6px; padding: 8px 12px; min-width: 220px; }
.bind-card .bc-type { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; color: #fff; margin-right: 6px; vertical-align: middle; }
.bind-card .bc-type.wechat { background: #2aae67; }
.bind-card .bc-type.alipay { background: #1678ff; }
.bind-card .bc-type.phone  { background: #f59e0b; }
.bind-card .bc-type.app    { background: #8b5cf6; }
.bind-card .bc-owner { font-weight: 600; color: #1a2b4a; }
.bind-card .bc-item { font-size: 12px; color: #555; margin-top: 3px; }
.bind-card .bc-note { font-size: 12px; color: #999; margin-top: 2px; }
.bind-results .bind-empty { color: #999; font-size: 13px; padding: 6px 2px; }
.cat-badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 9px; color: #fff; }
.cat-badge.wechat { background: #2aae67; }
.cat-badge.alipay { background: #1678ff; }
.cat-badge.phone  { background: #f59e0b; }
.cat-badge.app    { background: #8b5cf6; }
