/* 渠道中心（channel）专用样式。
   只依赖 base.css 的 :root 变量；不复用 admin.css / chat-panel.css，避免跨端耦合。
   视觉口径：白卡片 + 12px 圆角 + 轻阴影，主色只用在「可操作」的地方。 */

body.channel-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #f5f7fa);
  color: var(--text, #1f2937);
}

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 26px 24px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}

/* 卡片首行：左「FigTalk 渠道中心」+ 右「登录 | 注册」。
   两边字号不同（19px / 12.5px），用 baseline 对齐——按基线才是一条水平线，
   按顶对齐或中心对齐都会看着一高一低。 */
.auth-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.auth-topnav {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  white-space: nowrap;
}

.auth-topnav a {
  color: var(--text-secondary, #6b7280);
  text-decoration: none;
  transition: color 0.15s;
}

.auth-topnav a:hover {
  color: var(--primary, #2563eb);
}

.auth-topnav a[aria-current="page"] {
  color: var(--text, #1f2937);
  font-weight: 600;
  cursor: default;
}

.auth-topnav span {
  color: var(--border, #e5e7eb);
}

.auth-brand b {
  font-size: 19px;
  font-weight: 700;
  color: var(--text, #1f2937);
}

.auth-brand span {
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

.auth-sub {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary, #6b7280);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #1f2937);
}

/* 高度 36px：40px 在渠道端 13–14px 字号下显松，上下各收 2px 后仍是可点区域
   （远大于 24px 的最小点击尺寸），login/register/dashboard 三页同步。 */
.field input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  /* 已输入内容比标题轻一档（#374151 vs #1f2937）：长串邮箱整行铺满时偏压眼 */
  color: #374151;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  color: var(--text, #1f2937);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field .hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

/* 登录第二步：验证码输入 + 重新发送（与 input 同高） */
.code-row {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1 1 auto;
  width: auto;
  /* 手机窄屏（320px）必须允许压到 min-content 以下，否则「获取验证码」被挤出屏幕 */
  min-width: 0;
}

.code-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.code-btn:hover:not(:disabled) {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.code-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  border: 0;
  border-radius: 9px;
  background: var(--primary, #2563eb);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit:hover:not(:disabled) {
  background: var(--primary-hover, #1d4ed8);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-switch {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
}

.auth-switch a {
  color: var(--primary, #2563eb);
  text-decoration: none;
}

.auth-msg {
  display: none;
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.auth-msg.show {
  display: block;
}

.auth-msg.error {
  background: #fef2f2;
  color: #b91c1c;
}

.auth-msg.ok {
  background: #f0fdf4;
  color: #15803d;
}

/* ---------------- 顶部栏 ---------------- */
.ch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.ch-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.ch-brand span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-secondary, #6b7280);
}

.ch-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
}

.ch-logout {
  padding: 6px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
}

.ch-logout:hover {
  border-color: #d1d5db;
  color: var(--text, #1f2937);
}

/* ---------------- 主体 ---------------- */
.ch-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.ch-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

/* 码 + 标签 + 「更换」成组，比例单独靠右 */
.ch-code-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ch-code-label {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
}

/* 标签旁的用途说明：渠道码是「合作方发给自己客户」的注册码，容易与「邀请渠道」混淆 */
.ch-code-hint {
  margin-left: 6px;
  font-size: 12px;
  color: #94a3b8;
}

/* 分成比例：重要信息，用与全站一致的「浅灰底 + 细边 + 8px 圆角」小卡，
   靠字号与字重拉层级（不靠渐变/重描边，避免与白卡+细边的整体语言打架）。
   它是按钮：默认掩码，点一下才显示比例（渠道方隐私）。 */
.ch-ratio {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #f8fafc;
  /* button 不继承字体，显式给（否则会回退到系统默认宋体/黑体） */
  font: inherit;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.ch-ratio:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--primary-light, #eff6ff);
}

.ch-ratio:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.ch-ratio b {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}

/* 掩码态：圆点比数字弱一档（浅灰），不让人误以为是真实值；
   字距拉开，视觉宽度接近真实比例的 5 个字符 */
.ch-ratio b.is-masked {
  color: #cbd5e1;
  letter-spacing: 1px;
}

.ch-code {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 13px;
  border: 1px dashed #bfdbfe;
  border-radius: 8px;
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  /* 不用 user-select:all —— 会让单击全选、出现蓝色高亮（复制由 JS 负责） */
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

/* 码块内右侧提示：说明「可点」，但不是独立按钮（伪元素不进 textContent） */
.ch-code::after {
  content: "复制";
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px dashed #bfdbfe;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-secondary, #6b7280);
}

.ch-code:hover {
  border-color: var(--primary, #2563eb);
  background: #dbeafe;
}

.ch-code:hover::after {
  color: var(--primary, #2563eb);
}

.ch-code:active {
  transform: translateY(1px);
}

.ch-code:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

/* 渠道码状态胶囊：未激活 / 待激活 / 激活未通过 / 已停用（与码同处一行） */
.ch-code-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

.ch-code-status.is-pending {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.ch-code-status.is-rejected {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.ch-code-status.is-disabled {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #6b7280;
}

/* 下面两个元素自带 display:inline-flex，会盖掉 UA 的 [hidden]{display:none} */
.ch-code[hidden],
.ch-code-status[hidden] {
  display: none !important;
}

.ch-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ch-btn:hover:not(:disabled) {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  background: var(--primary-light, #eff6ff);
}

.ch-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ch-btn--primary {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
}

.ch-btn--primary:hover:not(:disabled) {
  border-color: var(--primary-hover, #1d4ed8);
  background: var(--primary-hover, #1d4ed8);
  color: #fff;
}

/* 文字按钮：次要动作（如「更换渠道码」），hover 才现底色 */
.ch-btn--ghost {
  height: 36px;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
}

.ch-btn--ghost:hover:not(:disabled) {
  border-color: transparent;
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb);
}

/* 分享语：渠道码下方的一条可复制文案（含注册链接 + 邀请码）。
   整块点一下即复制：是辅助动作，浅灰底块 + 不动声色，不和渠道码/数据抢视线 */
.ch-share {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #f8fafc;
  /* 不用 user-select:all —— 会让单击就全选、出现蓝色高亮（复制已由 JS 负责） */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.ch-share[hidden] {
  display: none;
}

.ch-share:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--primary-light, #eff6ff);
}

.ch-share:active {
  transform: translateY(1px);
}

.ch-share:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.ch-share-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ch-share-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1f2937);
}

/* 分享语按真实文本展示（客户收到的就是这个纯文本） */
.ch-share-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--text-secondary, #6b7280);
  white-space: pre-line;
  word-break: break-all;
}

/* 「点击复制」：说明可点，不是独立按钮（取消复制按钮后靠它提示）。
   手机端字号提到 13px：渠道方常用手机运营，提示要看得清 */
.ch-share-hint {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.ch-share:hover .ch-share-hint {
  color: var(--primary, #2563eb);
}

@media (max-width: 520px) {
  .ch-share-hint {
    font-size: 13px;
  }
}

/* ---------------- Tab ---------------- */
.ch-tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  /* 窄屏（手机 320–360px）5 个 tab 放不下一行：横向滑动而不是折行。
     折行会把「概览」压成两行竖排，下划线也跟着错位。 */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ch-tabs::-webkit-scrollbar {
  display: none;
}

.ch-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 10px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  white-space: nowrap;
}

.ch-tab.active {
  color: var(--primary, #2563eb);
  font-weight: 600;
}

.ch-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary, #2563eb);
}

/* ---------------- 概览卡 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

.stat-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text, #1f2937);
}

.stat-value small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary, #6b7280);
}

/* 主卡（未结清）：唯一能直接动的钱，只换描边颜色与数字色，不引入渐变（保持白卡语言） */
.stat-card--primary {
  border-color: #bfdbfe;
}

.stat-card--primary .stat-value {
  color: var(--primary, #2563eb);
}

/* ---------------- 概览：上手流程图 ---------------- */
/* 与「结算细则」并列的两块说明：流程图默认展开（给新渠道方看），细则默认收起 */
.ch-guide,
.ch-note--fold {
  margin-top: 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

.ch-guide > summary,
.ch-note--fold > summary {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1f2937);
  list-style: none;
  user-select: none;
}

.ch-guide > summary::-webkit-details-marker,
.ch-note--fold > summary::-webkit-details-marker {
  display: none;
}

.ch-guide > summary::before,
.ch-note--fold > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  color: #94a3b8;
  transition: transform 0.15s;
}

.ch-guide[open] > summary::before,
.ch-note--fold[open] > summary::before {
  transform: rotate(90deg);
}

.ch-guide > summary:hover,
.ch-note--fold > summary:hover {
  color: var(--primary, #2563eb);
}

.ch-guide[open] > summary,
.ch-note--fold[open] > summary {
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.cg-body {
  padding: 14px 16px 16px;
}

/* 纵向步骤：左侧一条极浅竖线串起序号，序号白底盖住线 */
.cg-map {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cg-map::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: #e8eef7;
}

.cg-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cg-idx {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid #dbeafe;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--primary, #2563eb);
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

.cg-box {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1px;
}

.cg-box > b {
  display: block;
  font-size: 13.5px;
  color: var(--text, #1f2937);
}

.cg-box > em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-secondary, #6b7280);
}

.cg-go {
  height: 28px;
  margin-top: 8px;
  padding: 0 12px;
  font-size: 12.5px;
}

/* 结算细则（折叠）：沿用 .ch-note 的字号与颜色，只是把内边距交给 summary / ol */
.ch-note--fold {
  padding: 0;
}

.ch-note--fold > ol {
  margin: 0;
  padding: 12px 16px 14px 34px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary, #6b7280);
}

@media (max-width: 720px) {
  .cg-map::before {
    display: none;
  }
}

/* 概览底部说明卡 */
.ch-note {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary, #6b7280);
}

.ch-note b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text, #1f2937);
}

.ch-note ol {
  margin: 0;
  padding-left: 18px;
}

/* ---------------- 表格 ---------------- */
.table-card {
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

/* 表格上方小计/说明行 */
.table-note {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

.table-note b {
  color: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
}

.ch-table th,
.ch-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
  /* 不换行：订单号/时间被挤成两行会把整张表截断 */
  white-space: nowrap;
}

.ch-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.ch-table tbody tr:last-child td {
  border-bottom: 0;
}

.ch-table tbody tr:hover td {
  background: #fafbfc;
}

.ch-table .num {
  font-variant-numeric: tabular-nums;
}

/* 金额列右对齐（财务表习惯，方便竖着对数字） */
.ch-table .is-amount {
  text-align: right;
}

.ch-table .muted {
  color: var(--text-secondary, #6b7280);
}

/* 单号/码这类标识用等宽字体，竖列对得齐 */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* 不可结算行：整行压暗 + 可悬停看原因 */
.ch-table tr.is-blocked td {
  color: #9ca3af;
  background: #fcfcfd;
}

.ch-table tr.is-blocked:hover td {
  background: #f8fafc;
}

.ch-table tr.is-settled td {
  color: #9ca3af;
}

.ch-tip {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  border-bottom: 1px dotted #cbd5e1;
  cursor: help;
}

.ch-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
  font-size: 13px;
}

/* ---------------- 流水筛选 + 操作卡片 ---------------- */
.orders-panel {
  position: sticky;
  top: 0;
  z-index: 6;
  margin-bottom: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.orders-filter {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.filter-field select,
.filter-field input {
  height: 34px;
  min-width: 132px;
  padding: 0 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text, #1f2937);
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 筛选下拉与「结算方式」保持同一个自绘箭头（同页两种下拉外观会很割裂） */
.filter-field select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.75 6 7.75l3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.orders-filter .ch-btn {
  height: 34px;
}

.ch-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary, #2563eb);
  cursor: pointer;
  vertical-align: middle;
}

/* ---------------- 流水操作条（卡片第二行） ---------------- */
.orders-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid #f1f5f9;
  background: #fbfcfd;
}

.orders-sum {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
}

.orders-sum b {
  font-size: 16px;
  color: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}

.orders-actions {
  display: flex;
  gap: 10px;
}

/* ---------------- 结算单 ---------------- */
/* 结算单页工具条：汇总 + 导出 */
.settle-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.settle-toolbar .table-note {
  margin-bottom: 0;
}

.settle-item {
  margin-bottom: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.settle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.settle-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.settle-title span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-secondary, #6b7280);
}

.settle-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.6;
}

.badge--submitted {
  background: #fff7ed;
  color: #c2410c;
}

.badge--settled {
  background: #f0fdf4;
  color: #15803d;
}

.badge--void {
  background: #f3f4f6;
  color: #6b7280;
}

/* 结算单明细（紧凑表） */
.settle-items {
  padding: 4px 8px 8px;
}

.ch-table--sm th,
.ch-table--sm td {
  padding: 8px 12px;
  font-size: 12.5px;
}

.settle-item .settle-foot {
  padding: 8px 16px 12px;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

/* ---------------- 站内确认弹窗（替代原生 confirm） ---------------- */
.ch-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

/* flex 会盖掉 [hidden] 的 display:none，必须显式关 */
.ch-modal[hidden] {
  display: none;
}

.ch-dialog {
  width: min(420px, 100%);
  padding: 20px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.ch-dialog-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #1f2937);
}

.ch-dialog-text {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary, #4b5563);
}

.ch-dialog-hint {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary, #6b7280);
}

/* 结算弹窗顶部：笔数 + 应结合计（让提交前一眼看到核心数字） */
.settle-sum {
  display: flex;
  gap: 10px;
  margin: 0 0 12px;
}

.settle-sum-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f8fafc;
}

.settle-sum-label {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

.settle-sum-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text, #1f2937);
}

.settle-sum-value.is-amount {
  color: var(--primary, #2563eb);
}

.ch-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ch-dialog-btn {
  min-width: 88px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary, #4b5563);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ch-dialog-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  color: var(--text, #1f2937);
}

.ch-dialog-btn:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

/* 不可逆操作：实心红，但初始焦点在「取消」上 */
.ch-dialog-btn--danger {
  border-color: var(--danger, #dc2626);
  background: var(--danger, #dc2626);
  color: #fff;
}

.ch-dialog-btn--danger:hover {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.ch-dialog-btn--primary {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
}

.ch-dialog-btn--primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

/* 弹窗内的表单（提交结算：结算方式 / 收款账号 / 备注） */
.ch-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
}

.ch-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ch-form-label {
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

.ch-form-field input[type="text"],
.ch-form-field input[type="password"],
.acct-field input[type="text"],
.acct-field input[type="password"] {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--text, #1f2937);
}

.ch-form-field input[type="text"]:focus,
.ch-form-field input[type="password"]:focus,
.acct-field input[type="text"]:focus,
.acct-field input[type="password"]:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ch-form-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}
.ch-form-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger, #dc2626);
}

/* 账户信息页：满宽卡片（与邀请用户 / 充值流水 / 结算单同宽），三段之间用分隔线；
   字段按可用宽度自动分列（宽屏 2~3 列），保存按钮固定在段标题右侧 */
.acct-card {
  padding: 18px 20px 20px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

/* 段标题行：标题左、保存按钮右（按钮与所属段落绑在一起，不单独占行） */
.acct-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.acct-head--sep {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.acct-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #1f2937);
}

/* 三个保存按钮等宽，右边缘对齐成一条竖线 */
.acct-head .ch-btn {
  min-width: 88px;
  justify-content: center;
}

.acct-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

/* 字段网格：每列至少 240px，空轨道自动收起 */
.acct-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 20px;
  align-items: start;
}

.acct-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.acct-label {
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
}

/* 只读行（登录邮箱）：独占整行，label 与值同行 */
.acct-readonly {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 0 0 14px;
  border-bottom: 1px dashed var(--border, #e5e7eb);
}

.acct-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text, #1f2937);
  word-break: break-all;
}

/* 联系方式的提示里「不用于收款」要能看见，但不能抢过正文 */
.acct-form .ch-form-hint b {
  font-weight: 600;
  color: var(--text, #1f2937);
}

@media (max-width: 720px) {
  .acct-card {
    padding: 16px 16px 18px;
  }
}

/* 结算方式下拉（账户信息 / 结算弹窗）：与输入框同高同风格。
   原生 select 在 Windows 下带系统按钮与内阴影，与站内输入框放一起很突兀 →
   去掉原生外观，自绘一个细箭头，右侧留出箭头位。 */
select.ch-select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.75 6 7.75l3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  font: inherit;
  font-size: 13.5px;
  line-height: normal;
  color: var(--text, #1f2937);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select.ch-select:hover {
  border-color: #cbd5e1;
}

select.ch-select:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select.ch-select option {
  color: var(--text, #1f2937);
}

/* ---------------- 通用 ---------------- */
.ch-panel[hidden] {
  display: none;
}

.ch-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
  font-size: 13px;
}

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 999;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

.toast.success {
  background: rgba(21, 128, 61, 0.95);
}

.toast.error {
  background: rgba(185, 28, 28, 0.95);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- 窄屏 ---------------- */
@media (max-width: 720px) {
  .ch-main {
    padding: 14px 16px 40px;
  }

  .ch-head {
    padding: 12px 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 表格：容器内横向滚动，不撑破页面 */
  .table-card {
    overflow-x: auto;
  }

  .ch-table {
    min-width: 620px;
  }

  /* 筛选条：两列排布，按钮占满一行 */
  .orders-filter {
    padding: 10px 12px;
  }

  /* 窄屏：比例胶囊换行到下一行左侧 */
  .ch-ratio {
    margin-left: 0;
  }

  .filter-field {
    flex: 1 1 46%;
  }

  .filter-field select,
  .filter-field input {
    width: 100%;
    min-width: 0;
  }

  .orders-filter .ch-btn {
    flex: 1 1 auto;
  }
}
