/* 消息通道 · 分类卡片 + 账号矩阵（三主题自适应，强调色走品牌红） */

.ch-actions { display: flex; align-items: center; gap: 10px; }

.ch-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--eng-line);
  border-radius: 10px;
  background: var(--eng-surface);
}
.ch-switch button {
  height: 28px; padding: 0 14px;
  border: none; border-radius: 7px;
  background: transparent; color: var(--eng-text-dim);
  font-family: inherit; font-size: 12.5px; cursor: pointer;
  transition: .16s;
}
.ch-switch button.on { background: #C8102E; color: #fff; font-weight: 600; }

/* 顶部汇总 */
.ch-totals {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin: 4px 0 18px;
  font-size: 12px; color: var(--eng-text-dim);
}
.ch-totals b { color: var(--eng-text); font-size: 15px; font-weight: 800; margin-right: 4px; }

/* ---------- 卡片 ---------- */
.ch-group { margin-bottom: 22px; }
.ch-group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 12px; color: var(--eng-text-dim); letter-spacing: .05em;
}
.ch-group-head::after {
  content: ""; flex: 1; height: 1px; background: var(--eng-line);
}

.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.ch-card {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--eng-line);
  border-radius: 14px;
  background: var(--eng-surface);
  cursor: pointer;
  transition: .18s;
  overflow: hidden;
}
.ch-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--cc, #C8102E);
  opacity: .9;
}
.ch-card:hover { border-color: rgba(200, 16, 46, .42); transform: translateY(-1px); }
.ch-card.on {
  border-color: #C8102E;
  box-shadow: 0 0 0 1px rgba(200, 16, 46, .34), 0 8px 26px rgba(200, 16, 46, .14);
}
.ch-card.off { opacity: .72; }

.ch-card-top { display: flex; align-items: flex-start; gap: 11px; }
.ch-logo {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--cc, #C8102E), var(--ca, #7a0a1c));
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}
.ch-card-id { flex: 1; min-width: 0; }
.ch-card-id b { display: block; font-size: 14.5px; }
.ch-card-id em {
  display: block; font-style: normal; margin-top: 3px;
  font-size: 11px; color: var(--eng-text-dim);
}
.ch-state {
  flex: none; height: 20px; padding: 0 8px;
  display: inline-flex; align-items: center;
  border-radius: 6px; font-size: 10.5px;
  border: 1px solid var(--eng-line);
  color: var(--eng-text-dim);
}
.ch-state.ok { color: #22c55e; border-color: rgba(34, 197, 94, .38); }
.ch-state.no { color: #ff5c73; border-color: rgba(200, 16, 46, .34); }

.ch-metrics {
  display: flex; gap: 16px;
  margin-top: 12px; padding-top: 11px;
  border-top: 1px dashed var(--eng-line);
  font-size: 12px; color: var(--eng-text-dim);
}
.ch-metrics span b { color: var(--eng-text); font-weight: 700; margin-right: 3px; }

.ch-note {
  margin-top: 9px; font-size: 11.5px; line-height: 1.6;
  color: var(--eng-text-dim);
  min-height: 34px;
}
.ch-caps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.ch-cap {
  height: 19px; padding: 0 7px;
  display: inline-flex; align-items: center;
  border-radius: 5px; font-size: 10.5px;
  background: color-mix(in srgb, var(--cc, #C8102E) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--cc, #C8102E) 34%, transparent);
  color: var(--eng-text);
}

/* ---------- 展开的账号区 ---------- */
.ch-acct-panel {
  margin-top: 16px;
  border: 1px solid var(--eng-line);
  border-radius: 14px;
  background: var(--eng-surface);
  overflow: hidden;
}
.ch-acct-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--eng-line);
  background: color-mix(in srgb, var(--eng-bg) 40%, transparent);
}
.ch-acct-head b { font-size: 13.5px; }
.ch-acct-head .sub { font-size: 11.5px; color: var(--eng-text-dim); flex: 1; }

.acct-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--eng-line);
}
.acct-row:last-child { border-bottom: none; }

.acct-avatar {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--ca, #7a0a1c), var(--cc, #C8102E));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13);
  overflow: hidden;
}
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; }

.acct-main { flex: 1; min-width: 0; }
.acct-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.acct-sub {
  margin-top: 4px; font-size: 11.5px; color: var(--eng-text-dim);
  display: flex; gap: 12px; flex-wrap: wrap;
}
.acct-samples {
  margin-top: 5px; font-size: 11px; color: var(--eng-text-dim);
  opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.acct-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.acct-ctl select {
  height: 30px; max-width: 190px;
  padding: 0 9px;
  background: var(--eng-bg);
  border: 1px solid var(--eng-line);
  border-radius: 8px;
  color: var(--eng-text); font-family: inherit; font-size: 12px;
  outline: none;
}
.ch-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--eng-line); border-radius: 8px;
  background: var(--eng-bg);
  font-size: 11.5px; color: var(--eng-text-dim);
  cursor: pointer; user-select: none;
  transition: .16s;
}
.ch-toggle .sw {
  width: 26px; height: 14px; border-radius: 7px;
  background: rgba(120, 130, 150, .4); position: relative; transition: .16s;
}
.ch-toggle .sw::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; transition: .16s;
}
.ch-toggle.on { color: #fff; border-color: #C8102E; background: #C8102E; }
.ch-toggle.on .sw { background: rgba(255, 255, 255, .34); }
.ch-toggle.on .sw::after { left: 14px; }

/* ---------- 矩阵表 ---------- */
.mx-wrap {
  border: 1px solid var(--eng-line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--eng-surface);
}
.mx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mx-table thead th {
  text-align: left; padding: 11px 14px;
  font-size: 11px; letter-spacing: .06em;
  color: var(--eng-text-dim); font-weight: 600;
  background: color-mix(in srgb, var(--eng-bg) 40%, transparent);
  border-bottom: 1px solid var(--eng-line);
  white-space: nowrap;
}
.mx-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--eng-line); vertical-align: middle; }
.mx-table tbody tr:last-child td { border-bottom: none; }
.mx-table tbody tr:hover { background: color-mix(in srgb, var(--eng-bg) 42%, transparent); }

.mx-plat { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.mx-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cc, #C8102E);
  box-shadow: 0 0 8px color-mix(in srgb, var(--cc, #C8102E) 60%, transparent);
}
.mx-acct { display: flex; align-items: center; gap: 10px; }
.mx-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--ca, #7a0a1c), var(--cc, #C8102E));
  overflow: hidden;
}
.mx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mx-acct b { font-size: 13px; }
.mx-acct em { display: block; font-style: normal; font-size: 10.5px; color: var(--eng-text-dim); margin-top: 2px; }
.mx-num { font-variant-numeric: tabular-nums; }
.mx-table select {
  height: 30px; max-width: 190px;
  padding: 0 9px;
  background: var(--eng-bg);
  border: 1px solid var(--eng-line);
  border-radius: 8px;
  color: var(--eng-text); font-family: inherit; font-size: 12px;
  outline: none;
}
.mx-table select:focus { border-color: #C8102E; }
.mx-num.hot { color: #ff5c73; font-weight: 700; }
.mx-time { font-size: 11px; color: var(--eng-text-dim); white-space: nowrap; }
.mx-empty { padding: 40px; text-align: center; color: var(--eng-text-dim); font-size: 12.5px; }

/* 原始凭证折叠区 */
.ch-raw { margin-top: 24px; font-size: 12px; color: var(--eng-text-dim); }
.ch-raw summary { cursor: pointer; padding: 8px 0; }
.ch-raw .ch-table-wrap { margin-top: 8px; }

/* ---------- 扫码 / 登录浮层 ---------- */
.qr-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 8, 12, .72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.qr-mask[hidden] { display: none; }
.qr-card {
  width: 420px; max-width: 100%; max-height: 88vh; overflow: auto;
  border: 1px solid var(--eng-line);
  border-radius: 18px;
  background: var(--eng-bg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  padding: 18px 20px 22px;
}
.qr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qr-head b { flex: 1; font-size: 15px; }
.qr-head button {
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--eng-line); background: transparent; color: var(--eng-text-dim);
}
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-img {
  width: 240px; height: 240px; object-fit: contain;
  border-radius: 12px; padding: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
.qr-img[hidden] { display: none; }
.qr-hint { font-size: 12px; line-height: 1.7; color: var(--eng-text-dim); text-align: center; }
.qr-status {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px; border-radius: 8px;
  font-size: 12px; color: var(--eng-text-dim);
  border: 1px solid var(--eng-line);
}
.qr-status.ok { color: #22c55e; border-color: rgba(34, 197, 94, .4); }
.qr-status.no { color: #ff5c73; border-color: rgba(200, 16, 46, .4); }
.qr-spin {
  width: 8px; height: 8px; border-radius: 50%;
  background: #C8102E; animation: qrp 1s infinite;
}
@keyframes qrp { 0%,100% { opacity: .25 } 50% { opacity: 1 } }

.qr-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.qr-inbox {
  width: 100%; margin-top: 6px;
  border-top: 1px dashed var(--eng-line);
  padding-top: 12px;
  font-size: 12px;
}
.qr-conv {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  border: 1px solid var(--eng-line);
  margin-bottom: 6px;
  cursor: pointer;
}
.qr-conv:hover { border-color: rgba(200, 16, 46, .44); }
.qr-conv.on { border-color: #C8102E; background: color-mix(in srgb, #C8102E 12%, transparent); }
.qr-conv b { font-size: 12.5px; }
.qr-conv em { font-style: normal; color: var(--eng-text-dim); font-size: 11px; }
.qr-send { width: 100%; display: flex; gap: 8px; margin-top: 10px; }
.qr-send input {
  flex: 1; height: 34px; padding: 0 10px;
  background: var(--eng-surface); border: 1px solid var(--eng-line);
  border-radius: 9px; color: var(--eng-text); font-family: inherit; font-size: 12.5px;
  outline: none;
}
.qr-send button {
  height: 34px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  border: none; background: #C8102E; color: #fff; font-family: inherit; font-size: 12.5px; font-weight: 600;
}
.qr-send button:disabled { opacity: .5; cursor: not-allowed; }
.qr-warn {
  width: 100%; margin-top: 8px; padding: 8px 10px;
  border-radius: 8px; font-size: 11.5px; line-height: 1.6;
  color: #ffb4a2; background: rgba(200, 16, 46, .12);
  border: 1px solid rgba(200, 16, 46, .3);
}

@media (max-width: 980px) {
  .ch-grid { grid-template-columns: 1fr; }
  .acct-row { flex-wrap: wrap; }
  .acct-ctl { width: 100%; }
}
