/* 运营后台专属样式。基础组件（card / btn / hint / err / tip / tablewrap）复用 styles.css */

/* [hidden] 只是浏览器默认的 display:none，会被 .tabs{display:flex} 这类规则盖掉，
   表现是「已经隐藏了却还在页面上」。统一兜一层，省得逐个元素写 .xxx[hidden]。 */
[hidden] { display: none !important; }

.main { padding: 22px 0 40px; }

/* ---------- 概览数字 ---------- */

.stats {
  display: grid;
  /* 6 张卡：4 列会排成 4+2，看着像漏了；3 列正好两行三列 */
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat__k { font-size: 12px; color: var(--text-3); }
.stat__v {
  font-size: 24px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.stat__v.is-accent { color: var(--red); }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 表单 ---------- */

.frm { margin: 4px 0 18px; }
.frm__row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.frm__row:last-child { border-bottom: 0; }
.frm__k {
  width: 52px; flex: none;
  font-size: 13px; color: var(--text-2);
}
.frm__num {
  width: 88px; height: 32px; padding: 0 8px;
  border: 1px solid #e4e0da; border-radius: 9px;
  font-size: 14px; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.frm__text {
  flex: 1; min-width: 180px; height: 32px; padding: 0 10px;
  border: 1px solid #e4e0da; border-radius: 9px;
  font-size: 14px; color: var(--text);
}
.frm__num:focus, .frm__text:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(176,42,51,.08); }
.frm__unit { font-size: 13px; color: var(--text-3); }
.frm__hint { font-size: 12px; color: var(--text-3); }

/* 人工收款：主表单下面的次级区块。用浅底把它和「批量囤码」分开，
   因为这两件事填错一个字段的后果不同（一个是没订单，一个是订单记错人）。 */
.sub2 {
  margin: 0 0 18px; padding: 12px 14px 4px;
  background: #fafbfc; border: 1px solid var(--line); border-radius: 8px;
}
.sub2__head { font-size: 13px; font-weight: 600; color: var(--text); }
.sub2__hint {
  margin: 6px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-3);
}
.sub2 .frm { margin: 2px 0 10px; }
.sub2 .frm__row { border-bottom-color: #eef0f3; }

/* 生成结果里的订单行 */
.orderline {
  margin: 0 0 12px; padding: 10px 12px;
  background: #f0f9eb; border: 1px solid #d6ebc8; border-radius: 6px;
  font-size: 12.5px; line-height: 1.7; color: var(--text-2);
}
.orderline__tag {
  display: inline-block; margin-right: 8px; padding: 1px 7px;
  border-radius: 3px; background: #529b2e; color: #fff; font-size: 11px;
}
.orderline__ref {
  font: 600 12.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text); user-select: all; margin-right: 8px;
}
.orderline__amt { color: var(--text-2); }
.orderline__warn {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d6ebc8;
  color: #b8791f;
}

/* ---------- 骨架屏（加载态） ---------- */

.sk-stat-k { height: 10px; width: 62px; border-radius: 5px; margin-bottom: 10px; }
.sk-stat-v { height: 22px; width: 84px; border-radius: 6px; }
.sk-cell { display: block; height: 11px; border-radius: 5px; }

table.codes tr.is-skel td { padding: 14px 10px; }
table.codes tr.is-skel .sk-cell { width: 72%; }

/* ---------- 选项小药丸 ---------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  height: 30px; padding: 0 13px; border-radius: 9px;
  font-size: 12.5px; font-family: inherit; color: var(--text-2);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.chip:hover { border-color: #c9c2b8; color: var(--text); }
.chip.is-on {
  border-color: var(--red); color: var(--red);
  background: var(--red-soft); font-weight: 600;
}

/* ---------- 生成结果 ---------- */

.result {
  margin-top: 18px; padding: 16px;
  border: 1px solid #efe0e0; background: #fdfafa; border-radius: 12px;
}
.result__head { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.result__codes {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.result__code {
  font: 600 17px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .5px;
  padding: 9px 12px; border-radius: 9px;
  background: #fff; border: 1px solid #ecd9da; color: var(--red-dark);
  user-select: all;      /* 点一下就能全选，手机上长按复制 */
}
.result__msg {
  margin: 0 0 12px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  font: 13px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  color: var(--text-2); white-space: pre-wrap; word-break: break-all;
}
.result__actions { display: flex; gap: 10px; }
.result__actions .btn { flex: 1; }

/* ---------- 兑换码表 ---------- */

.filters {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-bottom: 14px;
}
.filters .frm__text { max-width: 280px; }

table.codes { width: 100%; border-collapse: collapse; font-size: 13px; }
table.codes th {
  text-align: left; font-weight: 600; color: #6b7079;
  font-size: 11px; letter-spacing: .04em; padding: 10px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fff; position: sticky; top: 0;
}
table.codes td {
  padding: 10px 10px; border-bottom: 1px solid var(--line-soft);
  color: var(--text-2); vertical-align: middle;
}
table.codes tr:hover td { background: #faf9f6; }
table.codes .code {
  font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text); user-select: all; white-space: nowrap;
}
table.codes .muted { color: var(--text-3); }
table.codes .note {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
}
.badge--unused { background: #f0f9eb; color: #529b2e; }
.badge--used { background: #f4f4f5; color: #909399; }
.badge--revoked { background: #fef0f0; color: var(--red); }

.empty { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 查会员结果 ---------- */

#lookupOut { margin-top: 18px; }
.mcard {
  border: 1px solid var(--line); border-radius: 8px; padding: 16px;
  background: #fff;
}
.mcard__top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.mcard__acc { font-size: 15px; font-weight: 600; color: var(--text); }
.mcard__grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
  .mcard__grid { grid-template-columns: 1fr 1fr; }
}
.mcard__k { font-size: 12px; color: var(--text-3); }
.mcard__v { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }

.sub-h { font-size: 13px; color: var(--text-2); margin: 16px 0 8px; }
.mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini td { padding: 6px 8px; border-bottom: 1px solid #f5f7fa; color: var(--text-2); }
.mini td:first-child { font-family: ui-monospace, Menlo, monospace; color: var(--text); }
