:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --side: #101828;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #e4e7ec;
  --line-soft: #f2f4f7;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #eff4ff;
  --ok: #12b76a;
  --ok-soft: #e7f7ef;
  --warn: #f79009;
  --warn-soft: #fff4e5;
  --err: #f04438;
  --err-soft: #fee4e2;
  --r: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ================= 布局 ================= */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 208px; flex: 0 0 208px;
  background: var(--side); color: #fff;
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 18px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: #98a2b3; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  border: 0; background: none; color: #cbd5e1;
  font-family: inherit; font-size: 13px; text-align: left;
  padding: 9px 10px; border-radius: 7px; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-ico { font-size: 14px; opacity: .9; }

.side-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.side-stat { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #98a2b3; padding: 4px 6px; }
.side-stat b { color: #fff; font-size: 13px; }
.side-status { margin: 8px 6px 0; font-size: 11px; color: #fdb022; line-height: 1.5; }
.side-status.ok { color: #6ce9a6; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.page-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 14px; gap: 16px; }
.page-head h1 { margin: 0; font-size: 19px; font-weight: 600; }
.page-sub { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); }
.head-actions { display: flex; gap: 8px; }

/* ================= 按钮 ================= */
.btn {
  border: 1px solid transparent; border-radius: var(--r);
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.primary[disabled] { background: #b6c3e0; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { border-color: #d0d5dd; background: #fcfcfd; }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* ================= 工具栏 ================= */
.filter-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 24px 10px;
}
.filter-row .input { height: 32px; font-size: 12px; width: 132px; }
.filter-row .input::placeholder { color: #c1c7d0; }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range .input { width: 138px; }
.date-range .dash { color: var(--ink-3); font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 0 24px 12px; }
.input {
  border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; font-family: inherit; font-size: 13px;
  padding: 7px 10px; color: var(--ink); height: 34px;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input.search { width: 300px; }
.input.wide { width: 200px; }
.toolbar .spacer { flex: 1; }

.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.remote-tip { font-size: 12px; color: var(--ink-3); }
.remote-tip.warn { color: var(--warn); }
.remote-tip.ok { color: var(--ok); }

/* ================= 表格 ================= */
.table-wrap {
  flex: 1; overflow: auto;
  margin: 0 24px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f9fafb; color: var(--ink-2);
  font-weight: 600; font-size: 12px; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid thead th.num { text-align: right; }
.grid tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; color: var(--ink);
}
.grid tbody tr:hover td { background: #fafbfc; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.w-no { min-width: 132px; }
.w-taobao { min-width: 120px; }
.w-date { min-width: 104px; }
.w-source { min-width: 82px; }
.w-type { min-width: 76px; }
.w-cust { min-width: 130px; }
.w-content { min-width: 150px; }
.w-acc { min-width: 108px; }
.w-owner { min-width: 88px; }
.w-name { min-width: 110px; }
.w-login { min-width: 110px; }
.w-role { min-width: 90px; }
.w-orders { min-width: 84px; }
.w-act2 { min-width: 150px; }

.grid tbody tr.row-off td { color: var(--ink-3); background: #fcfcfd; }
.w-remark { min-width: 120px; }
.w-act { min-width: 132px; }
.w-state { min-width: 90px; }

.mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }

.amount { font-weight: 600; }
.amount .net { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.amount .net::before { content: '('; }
.amount .net::after { content: ')'; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tag.pending { background: var(--warn-soft); color: #b54708; }
.tag.synced { background: var(--ok-soft); color: #027a48; }
.tag.failed { background: var(--err-soft); color: #b42318; }
.tag.remote { background: #eef2ff; color: #3538cd; }
.tag.local { background: #f2f4f7; color: var(--ink-2); }

.sync-btn { color: #027a48 !important; font-weight: 600; }
.sync-btn:hover { color: #05603a !important; }
.sync-done { color: var(--ok); font-size: 12px; }
.sync-err {
  margin-top: 4px; font-size: 11px; color: var(--err);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.row-actions { display: flex; gap: 8px; }
.link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--brand);
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--err); }
.link[disabled] { color: var(--ink-3); cursor: not-allowed; text-decoration: none; }

.table-empty { padding: 60px 20px; text-align: center; color: var(--ink-3); }
.table-empty .empty-ico { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.table-empty p { margin: 4px 0; font-size: 13px; }
.table-empty .empty-hint { font-size: 12px; color: #c1c7d0; }

/* ================= 抽屉表单 ================= */
.drawer-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16,24,40,.4);
  display: flex; justify-content: flex-end;
}
.drawer {
  width: 560px; max-width: 92vw; height: 100%;
  background: #fff; display: flex; flex-direction: column;
  animation: slideIn .22s cubic-bezier(.2,.8,.3,1);
  box-shadow: -8px 0 24px rgba(16,24,40,.1);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.drawer-head, .modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.drawer-head h2, .modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 2px; }
.x:hover { color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }

.section { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.section:last-child { border-bottom: 0; }
.section-title { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; letter-spacing: .3px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title-row .section-title { margin: 0; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span2 { grid-column: 1 / -1; }
.field > label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.field > label i { color: var(--err); font-style: normal; }
.field .opt { color: var(--ink-3); font-size: 11px; font-weight: 400; }

.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=datetime-local], .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 7px 10px; font-size: 13px; font-family: inherit;
  color: var(--ink); background: #fff; width: 100%; height: 34px;
}
.field textarea { height: auto; resize: vertical; min-height: 54px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.field input[readonly] { background: #f9fafb; color: var(--ink-2); }

.segment { display: flex; gap: 6px; }
.segment button {
  flex: 1; border: 1px solid var(--line); background: #fff;
  border-radius: var(--r); padding: 7px 6px; height: 34px;
  font-family: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.segment button:hover { border-color: #d0d5dd; }
.segment button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

.drawer-foot, .modal-foot {
  flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--line); background: #fcfcfd;
}

.hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.hint.warn { color: var(--warn); }

/* ================= 入款列表 ================= */
.pay-list { display: flex; flex-direction: column; gap: 6px; }
.pay-item {
  display: flex; align-items: center; gap: 12px;
  background: #f9fafb; border: 1px solid var(--line);
  border-radius: var(--r); padding: 9px 12px;
}
.pay-item .pi-main { flex: 1; min-width: 0; }
.pay-item .pi-acc { font-size: 13px; font-weight: 600; }
.pay-item .pi-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.pay-item .pi-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-item .pi-x { border: 0; background: none; color: var(--ink-3); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; }
.pay-item .pi-x:hover { color: var(--err); }
/* 驰朗已有订单的入款只读：不给删除，也不给新增 */
.pay-item .pi-lock { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.pay-item .pi-voucher { display: inline-block; margin-top: 3px; font-size: 11px; color: var(--brand); text-decoration: none; }
.pay-item .pi-voucher:hover { text-decoration: underline; }
.pay-empty { font-size: 12px; color: var(--ink-3); padding: 16px; text-align: center; background: #f9fafb; border-radius: var(--r); }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(16,24,40,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 620px; max-width: 100%; max-height: 88vh;
  background: #fff; border-radius: 10px;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 40px rgba(16,24,40,.16);
  animation: pop .16s ease;
}
.modal.narrow { width: 440px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.modal-body .field { margin-bottom: 12px; }

/* ================= 上传 ================= */
.uploader {
  border: 1.5px dashed #d0d5dd; border-radius: var(--r);
  background: #fcfcfd; min-height: 88px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer;
}
.uploader:hover { border-color: var(--brand); background: var(--brand-soft); }
.uploader.drop-hover {
  border-color: var(--brand); border-style: solid;
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.uploader.drop-hover .upload-empty { color: var(--brand); font-weight: 600; }
.uploader.drop-hover .upload-empty .plus { transform: scale(1.15); }
.upload-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-3); font-size: 12px; }
.upload-empty .plus { font-size: 18px; line-height: 1; }
.uploader img { width: 100%; max-height: 200px; object-fit: contain; display: block; }

/* ================= 余额记录选择 ================= */
.record-picker { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.rec-opt {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 12px; cursor: pointer; background: #fff;
}
.rec-opt:hover { border-color: #d0d5dd; }
.rec-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.rec-opt input { width: 15px; height: 15px; accent-color: var(--brand); flex: 0 0 15px; }
.rec-opt .ro-main { flex: 1; min-width: 0; }
.rec-opt .ro-acc { font-size: 13px; font-weight: 600; }
.rec-opt .ro-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.rec-opt .ro-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-opt .ro-diff { font-size: 11px; color: var(--warn); margin-top: 2px; }
.rec-opt .ro-diff.same { color: var(--ok); }
.rec-empty { font-size: 12px; color: var(--ink-3); padding: 16px; text-align: center; background: #f9fafb; border-radius: var(--r); }

/* ================= 详情 ================= */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item span { font-size: 11px; color: var(--ink-3); }
.detail-item b { font-size: 13px; font-weight: 500; word-break: break-all; }
.detail-sec { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 16px 0 8px; }
.detail-voucher { max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid var(--line); }

/* ================= 登录页 ================= */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #26364f 100%);
  padding: 24px;
}
.login-card {
  width: 360px; max-width: 100%;
  background: #fff; border-radius: 12px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-brand { display: flex; gap: 11px; align-items: center; margin-bottom: 22px; }
.login-brand .logo {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 40px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}
.login-title { font-size: 16px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
.login-field input {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--r);
  padding: 0 11px; font-size: 13px; font-family: inherit; color: var(--ink);
}
.login-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.cap-row { display: flex; gap: 8px; align-items: center; }
.cap-row input { flex: 1; min-width: 0; }
.cap-img {
  width: 132px; height: 48px; flex: 0 0 132px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.cap-img:hover { border-color: var(--brand); }

.btn.block { width: 100%; height: 38px; margin-top: 6px; font-size: 14px; }

.login-err {
  margin: 0 0 10px; padding: 8px 10px; font-size: 12px;
  color: #b42318; background: var(--err-soft); border-radius: 6px;
}

.login-hint { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.lh-label { color: var(--ink-3); margin-right: 6px; }
.lh-name {
  border: 1px solid var(--line); background: #fcfcfd; border-radius: 6px;
  padding: 3px 9px; margin: 3px 4px 3px 0; font-size: 12px;
  font-family: inherit; color: var(--ink-2); cursor: pointer;
}
.lh-name:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ================= 侧边栏用户区 ================= */
.side-user {
  margin-top: 10px; padding: 8px 0 0;
  border-top: 1px solid rgba(255,255,255,.1);
}
.su-main {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
  border-radius: 7px; padding: 7px 8px; cursor: pointer;
  font-family: inherit; text-align: left;
}
.su-main:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
.su-dot {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.su-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.su-name { font-size: 12px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-role { font-size: 10px; color: #98a2b3; margin-top: 1px; }
.su-caret { color: #64748b; font-size: 12px; }

.switch-menu {
  margin-top: 6px; padding: 4px;
  background: #1e293b; border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.35);
  max-height: 260px; overflow-y: auto;
}
.sw-title { font-size: 10px; color: #64748b; padding: 4px 8px 6px; }
.sw-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: none; border-radius: 6px;
  padding: 6px 8px; cursor: pointer; font-family: inherit; text-align: left;
}
.sw-item:hover { background: rgba(255,255,255,.09); }
.sw-dot {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  background: rgba(59,130,246,.35); color: #dbeafe;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}
.sw-name { flex: 1; font-size: 12px; color: #e2e8f0; }
.sw-login { font-size: 10px; color: #64748b; font-family: Consolas, monospace; }
.sw-out .sw-name { color: #94a3b8; }
.sw-empty { font-size: 11px; color: #64748b; padding: 8px; text-align: center; }
.su-out {
  border: 0; background: none; color: #98a2b3;
  font-size: 11px; font-family: inherit; cursor: pointer; padding: 4px 2px;
}
.su-out:hover { color: #fff; }

/* ================= 显示列菜单 ================= */
.col-picker { position: relative; }
.col-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 190px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16,24,40,.14);
}
.col-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.col-item:hover { background: #f9fafb; }
.col-item.on { color: var(--ink); font-weight: 500; }
.col-item input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.col-actions {
  display: flex; gap: 6px; justify-content: space-between;
  margin-top: 6px; padding: 8px 8px 2px; border-top: 1px solid var(--line-soft);
}
.col-actions button {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 11px; color: var(--brand);
}
.col-actions button:hover { text-decoration: underline; }

/* ================= 客户选择器 ================= */
.combo { position: relative; }
.combo-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 45;
  max-height: 240px; overflow-y: auto; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16,24,40,.14);
}
.combo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 9px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: var(--ink);
}
.combo-item:hover { background: var(--brand-soft); }
.ci-name { font-weight: 500; }
.ci-src {
  font-style: normal; font-size: 10px; font-weight: 400;
  color: #3538cd; background: #eef2ff;
  padding: 1px 4px; border-radius: 3px; margin-left: 4px;
}
.ci-phone { color: var(--ink-3); font-size: 11px; font-family: Consolas, monospace; }
.ci-phone i { color: var(--warn); font-style: normal; }
.combo-new { color: var(--brand); font-weight: 500; }
.combo-empty { padding: 12px; text-align: center; color: var(--ink-3); font-size: 12px; }

.w-phone { min-width: 130px; }

.gen-err {
  margin: 12px 0 0; padding: 9px 11px;
  background: var(--err-soft); color: #b42318;
  border-radius: 6px; font-size: 12px; line-height: 1.5;
}
.btn.block { width: 100%; height: 36px; margin-top: 10px; }

/* ================= 侧边栏用户区 ================= */
.side-token {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 8px; padding: 8px 6px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}
.side-token span { font-size: 11px; color: #98a2b3; }

/* ================= 来源 / 同步状态 ================= */
.w-sync { min-width: 130px; }
.src-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; margin-right: 4px; white-space: nowrap;
}
.src-tag.remote { background: #eef2ff; color: #3538cd; }
.src-tag.local { background: #f2f4f7; color: #475467; }
.src-tag.wait { background: #fff4e5; color: #b54708; }
.src-tag.fail { background: #fee4e2; color: #b42318; }
.src-tag.done { background: #e7f7ef; color: #027a48; }
.src-sub { font-size: 10px; color: var(--ink-3); margin-top: 2px; font-family: Consolas, monospace; }
/* 驰朗里订单来源可以是「未选择」，用橙色标出来，和已选区分 */
.src-none { color: #b54708; font-weight: 600; }

/* 行底色：待同步最醒目，驰朗回显最淡 */
.grid tbody tr.row-pending td { background: #fffdf5; }
.grid tbody tr.row-pending:hover td { background: #fffae8; }
.grid tbody tr.row-failed td { background: #fffbfa; }
.grid tbody tr.row-failed:hover td { background: #fff5f3; }
.grid tbody tr.row-synced td { background: #fafefb; }
.grid tbody tr.row-remote td { background: #fff; }
.grid tbody tr.row-remote td:first-child { box-shadow: inset 2px 0 0 #c7d2fe; }
.grid tbody tr.row-pending td:first-child { box-shadow: inset 2px 0 0 #fdb022; }
.grid tbody tr.row-failed td:first-child { box-shadow: inset 2px 0 0 #fda29b; }
.grid tbody tr.row-synced td:first-child { box-shadow: inset 2px 0 0 #6ce9a6; }

/* ================= 入款 · 余额记录 ================= */
.pay-customer {
  font-size: 13px; color: var(--ink-2); background: #f9fafb;
  border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 12px;
}
.pay-bill { margin-top: 14px; }
.pb-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--ink-2); font-weight: 500;
}
.pb-head i { color: var(--err); font-style: normal; }
.pb-selected {
  font-size: 12px; line-height: 1.6;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; background: #f0fdf4; color: var(--ink);
}
.pb-selected.empty { background: #fcfcfd; color: var(--ink-3); border-style: dashed; }
.pb-selected b { color: var(--brand); }
.pb-warn { color: var(--warn); font-weight: 600; }

.modal.wide { width: 1080px; }
.bill-wrap { margin: 0; border: 0; max-height: 420px; }
.bill-grid { font-size: 12px; }
.bill-grid thead th { font-size: 11px; padding: 8px 10px; white-space: nowrap; }
.bill-grid tbody td { padding: 8px 10px; }
.bill-row { cursor: pointer; }
.bill-row:hover td { background: #f9fafb; }
.bill-row.on td { background: var(--brand-soft); }
.bill-row input { width: 15px; height: 15px; accent-color: var(--brand); pointer-events: none; }
.bill-type {
  display: inline-block; font-size: 11px; background: #eef2ff; color: #3538cd;
  padding: 1px 6px; border-radius: 4px;
}
.bill-desc {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bill-status {
  display: inline-block; font-size: 11px; background: var(--ok-soft); color: #027a48;
  padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.bill-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.w-check { width: 36px; }
.w-id { width: 78px; }
.bill-pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 10px 0 0; font-size: 12px;
}

/* ================= 分页器 ================= */
.pager {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 10px 14px; background: #fff;
  border-top: 1px solid var(--line); font-size: 12px;
}
.pg-total { color: var(--ink-3); margin-right: auto; }
.pg-size { height: 28px; width: 96px; font-size: 12px; padding: 2px 6px; }
.pg {
  min-width: 28px; height: 28px; padding: 0 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  font-family: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.pg:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg[disabled] { color: #c1c7d0; cursor: not-allowed; }
.pg-gap { color: var(--ink-3); padding: 0 2px; }

/* ================= Toast ================= */
.toast {
  position: fixed; left: 50%; top: 24px;
  transform: translate(-50%, -12px);
  background: rgba(16,24,40,.94); color: #fff;
  font-size: 13px; padding: 9px 16px; border-radius: 7px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200; max-width: 60vw; text-align: center; line-height: 1.5;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(180,35,24,.96); }

/* ================= 操作日志 ================= */
.log-grid { min-width: 900px; }
.w-logtime { min-width: 92px; }
.w-logkind { min-width: 92px; }
.w-logwho { min-width: 88px; }
.w-logstatus { min-width: 104px; }
.log-row { cursor: pointer; }
.log-row:hover { background: #f9fafb; }
.log-row.is-err td { background: #fffbfb; }
.log-time { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.log-text { font-size: 12px; line-height: 1.5; word-break: break-all; }
.log-kind {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: #f2f4f7; color: #475467; white-space: nowrap;
}
.log-status { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.log-status.ok { color: #027a48; }
.log-status.warn { color: #b54708; }
.log-status.bad { color: #b42318; }
.log-pre {
  font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 11px; line-height: 1.6;
  background: #f9fafb; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; max-height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* 批量生成：勾选列与按钮 */
.w-checkcell { width: 34px; min-width: 34px; text-align: center; padding-left: 8px; padding-right: 0; }
.w-checkcell input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
#btnBatchGenerate { font-weight: 600; }

/* 批量生成：进度与结果 */
.batch-progress { margin-bottom: 14px; }
.bp-bar { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.bp-fill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .2s ease; }
.bp-text { margin-top: 8px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.batch-list {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fcfcfd;
}
.batch-list:empty { display: none; }
.batch-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; border-bottom: 1px solid #f0f1f3;
}
.batch-row:last-child { border-bottom: 0; }
.batch-row .br-icon { flex: 0 0 16px; font-weight: 700; }
.batch-row.ok .br-icon { color: #027a48; }
.batch-row.fail .br-icon { color: #b42318; }
.batch-row.fail { background: #fffbfb; }
.batch-row .br-main { flex: 0 0 auto; font-weight: 600; }
.batch-row .br-msg { flex: 1; color: var(--ink-3); }

/* 批量生成：内嵌在订单页的进度面板 */
.batch-panel {
  margin: 10px 0 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfd;
}
.batch-panel .bp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.batch-panel .bp-head b { font-size: 13px; }
.batch-panel .bp-head .spacer { flex: 1; }
.batch-panel .bp-text { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.batch-panel .bp-bar { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.batch-panel .bp-fill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .2s ease; }
.batch-panel .batch-list { max-height: 220px; overflow-y: auto; margin-top: 10px; }
.batch-panel .batch-list:empty { display: none; }
.batch-panel .batch-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; font-size: 12px; border-radius: 6px;
}
.batch-panel .batch-row:nth-child(odd) { background: #f7f8fa; }
.batch-panel .batch-row .br-icon { flex: 0 0 14px; font-weight: 700; }
.batch-panel .batch-row.ok .br-icon { color: #027a48; }
.batch-panel .batch-row.fail { background: #fff1f0 !important; }
.batch-panel .batch-row.fail .br-icon { color: #b42318; }
.batch-panel .batch-row .br-main { flex: 0 0 auto; font-weight: 600; }
.batch-panel .batch-row .br-msg { flex: 1; color: var(--ink-3); }

/* ================= 采集信息管理 ================= */
.collect-panel {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px;
}
.collect-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.cstep { display: flex; gap: 10px; align-items: flex-start; }
.cstep-no {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.cstep b { font-size: 13px; display: block; margin-bottom: 2px; }
.cstep p { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin: 0; }

.collect-range {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line); margin-bottom: 10px;
}
.collect-range .cr-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.collect-range .cr-hint { font-size: 11px; color: var(--ink-3); }

.collect-paste textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.5;
  padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px;
  background: #fafbfc; color: var(--ink);
}
.collect-paste textarea:focus {
  outline: none; border-color: var(--brand); border-style: solid; background: #fff;
}
.collect-msg {
  font-size: 12px; color: var(--ink-2); margin: 10px 0 0;
  padding: 8px 10px; background: #f7f8fa; border-radius: 6px; line-height: 1.6;
}
.collect-msg.err { color: #b42318; background: #fff1f0; }

.collect-result .cr-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.collect-result .cr-stat { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.collect-result .cr-check { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.collect-result .cr-warn {
  font-size: 12px; color: #b54708; background: var(--warn-soft);
  padding: 8px 10px; border-radius: 6px; margin: 0 0 10px; line-height: 1.6;
}
.collect-grid .w-phone { width: 104px; }
.collect-grid .w-type { width: 96px; }
.collect-grid .w-state { width: 190px; }
.collect-grid .row-dim td { color: var(--ink-3); background: #fbfbfc; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: #027a48; }
.pill.err { background: var(--err-soft); color: #b42318; }
.pill.muted { background: #f2f4f7; color: var(--ink-3); }
.cell-note { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.cell-note.warn { color: #b54708; }
#btnCollectImport.is-busy { opacity: .65; cursor: progress; }

/* 采集：文件通道与凭证缩略图 */
.collect-file {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 10px; margin-top: 4px; border-top: 1px dashed var(--line);
}
.collect-file .cf-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.collect-file .cf-hint { font-size: 11px; color: var(--ink-3); }
.collect-grid .w-voucher { width: 74px; }
.voucher-thumb {
  width: 42px; height: 42px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 5px; vertical-align: middle;
}

/* 采集页：上面是固定高度的操作面板，下面是可独立滚动的结果表。
   .page 是 flex 容器且 overflow:hidden，如果 .collect-result 不变成
   flex 列容器，里面 .table-wrap 的 flex:1 就不生效，结果表会被直接裁掉、
   既看不到底部也滚不动。 */
#page-collect .collect-panel { flex: 0 0 auto; }
#page-collect .collect-result {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-collect .collect-result .cr-bar,
#page-collect .collect-result .cr-warn { flex: 0 0 auto; }
#page-collect .collect-result .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* 采集结果表列多，给个最小宽度，窄屏时改为横向滚动而不是把列挤扁 */
#page-collect .collect-grid { min-width: 1080px; }
.pill.warn { background: var(--warn-soft); color: #b54708; }

/* ================= 采集：三条通道 ================= */
.collect-ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 14px 0 4px;
}
.cway {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  background: #fcfcfd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cway.active { border-color: var(--brand); background: #fbfcff; }
.cway-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cway-ico {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: #eef2ff; color: var(--brand);
  font-size: 12px; font-weight: 700;
}
.cway p { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.cway-tag {
  margin-left: auto; font-size: 11px; padding: 1px 7px;
  border-radius: 999px; white-space: nowrap;
}
.cway-tag.ok { background: var(--ok-soft); color: #027a48; }
.cway-tag.warn { background: var(--warn-soft); color: #b54708; }
.cway-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.collect-ways .collect-paste textarea { min-height: 78px; }
.collect-ways .cf-hint { font-size: 11px; color: var(--ink-3); word-break: break-all; }

/* 令牌管理 */
.collect-token {
  margin-top: 14px; padding: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fcfcfd;
}
.collect-token .ct-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.collect-token .ct-head b { font-size: 13px; }
.collect-token .ct-hint { margin: 0 0 10px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.token-list { display: flex; flex-direction: column; gap: 6px; }
.token-empty { font-size: 12px; color: var(--ink-3); padding: 8px 0; }
.token-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.token-row.is-revoked { opacity: .55; }
.token-row .tk-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.token-row .tk-main b { font-size: 12px; }
.token-row .tk-meta { font-size: 11px; color: var(--ink-3); }
.token-row button { margin-left: auto; }

/* 新建后只显示一次的明文 */
.token-plain {
  margin-bottom: 10px; padding: 12px;
  border: 1px solid #a6f4c5; border-radius: 8px; background: #ecfdf3;
}
.token-plain .tp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.token-plain .tp-head b { font-size: 13px; }
.token-plain .tp-warn { font-size: 11px; color: #b54708; font-weight: 600; }
.token-plain .tp-value {
  font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12px;
  background: #fff; border: 1px dashed #a6f4c5; border-radius: 6px;
  padding: 8px 10px; word-break: break-all; user-select: all;
}
.token-plain .tp-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ================= 采集页：极简主按钮 ================= */
.collect-simple { padding: 18px 20px; }
.cs-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cs-range { display: flex; align-items: center; gap: 8px; }
.cs-range .cr-hint { font-size: 12px; color: var(--ink-3); }
.cs-btn {
  min-width: 96px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 22px;
}
.cs-file { flex: 0 0 auto; }
.cs-file-name { font-size: 11px; color: var(--ink-3); }
.cs-paste { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cs-paste textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.5;
  padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px;
  background: #fafbfc;
}
.cs-paste textarea:focus { outline: none; border-color: var(--brand); border-style: solid; background: #fff; }
.cs-paste button { align-self: flex-start; }
.cs-more {
  margin-top: 12px; padding: 0; border: 0; background: none;
  font-size: 12px; color: var(--ink-3); cursor: pointer; text-decoration: underline;
}
.cs-more:hover { color: var(--brand); }

/* 采集页：表格脚本采集区 */
.cs-btn2 { flex: 0 0 auto; }
.cs-btn2.is-open { background: var(--brand); color: #fff; border-color: var(--brand); }
.cs-script {
  margin-top: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 9px; background: #fcfcfd;
}
.cscript-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.cscript-head b { font-size: 13px; }
.cscript-sub { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.cscript-steps {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px; margin-bottom: 12px;
  background: #f7f8fa; border-radius: 7px;
  font-size: 12px; color: var(--ink-2); line-height: 1.7;
}
.cscript-box {
  padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
}

/* 采集页：脚本代码展示 */
.cscript-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cscript-tip { font-size: 11px; color: #027a48; }
.cscript-code {
  max-height: 320px; overflow: auto; margin: 0;
  padding: 12px; background: #1e2229; color: #d6deeb;
  border-radius: 8px; font-size: 11px; line-height: 1.6;
  font-family: Consolas, "SF Mono", Menlo, monospace;
  white-space: pre; tab-size: 2;
}

/* 最近采集记录 */
.cs-runs {
  margin-top: 16px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 9px; background: #fcfcfd;
}
.cs-runs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cs-runs-head b { font-size: 13px; }
.cs-runs-sub { font-size: 11px; color: var(--ink-3); }
.runs-list { display: flex; flex-direction: column; gap: 6px; }
.runs-empty { font-size: 12px; color: var(--ink-3); padding: 14px 0; text-align: center; }
.run-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  font-size: 12px;
}
.run-row .rr-time { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 118px; }
.run-row .rr-src { color: var(--ink-3); min-width: 64px; }
.run-row .rr-stat { display: flex; gap: 5px; flex-wrap: wrap; }
.run-row .rr-range { color: var(--ink-3); font-size: 11px; }
.run-row button { margin-left: auto; }
.run-meta { font-size: 12px; color: var(--ink-2); margin: 0 0 10px; line-height: 1.6; }
