/* ============================================================
   点数记账管理系统 · 样式
   桌面优先（目标是 PC 端窗口应用），最窄兼容到 1024px
   ============================================================ */

:root {
  --bg:        #0f1319;
  --bg-2:      #161c25;
  --panel:     #1b2029;
  --panel-2:   #212836;
  --line:      #2b3442;
  --line-soft: #232b37;

  --text:      #e6ebf2;
  --text-2:    #9aa7b8;
  --text-3:    #6b7787;

  --brand:     #4c8dff;
  --brand-2:   #3a76e0;
  --add:       #2ea36b;
  --add-2:     #268a5b;
  --sub:       #e0574a;
  --sub-2:     #c5473c;
  --warn:      #e0a34a;

  --radius:    8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* 组件用 display 覆盖了 UA 的 [hidden]，这里统一兜底 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
        "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

.muted { color: var(--text-2); }
.sm    { font-size: 12.5px; }

/* ---------- 登录 / 安装页 ---------- */
.auth-body {
  display: grid;
  place-items: center;
  background: radial-gradient(1000px 600px at 50% -10%, #1c2635 0%, var(--bg) 60%);
}

.auth-card {
  width: 360px;
  padding: 32px 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.auth-card.wide { width: 460px; }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand h1 { font-size: 18px; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), #6f5cff);
  color: #fff; font-weight: 700; font-size: 17px;
  flex: none;
}
.brand-mark.sm { width: 30px; height: 30px; font-size: 14px; border-radius: 7px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, .16);
}
input::placeholder { color: var(--text-3); }
input:read-only { background: #12161d; color: var(--text-2); }

select { cursor: pointer; }

/* ---------- 按钮 ---------- */
/* 链接默认色（页面里绝大多数 <a> 都套了 .btn / .tab，会被下面覆盖） */
a { color: var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.2;
  /* 用 <a> 做的按钮必须去掉浏览器默认的下划线和链接蓝 */
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:visited { color: inherit; }
.btn:hover  { background: #2a3242; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--brand-2); }

.btn.add { background: var(--add); border-color: var(--add); color: #fff; font-weight: 500; }
.btn.add:hover { background: var(--add-2); }

.btn.sub { background: var(--sub); border-color: var(--sub); color: #fff; font-weight: 500; }
.btn.sub:hover { background: var(--sub-2); }

.btn.danger { background: transparent; border-color: rgba(224, 87, 74, .45); color: #ff9c92; }
.btn.danger:hover:not(:disabled) { background: var(--sub); border-color: var(--sub); color: #fff; }

.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }

.btn.block { width: 100%; display: block; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-row.end { justify-content: flex-end; }
.btn-row.end .btn { flex: none; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.err  { background: rgba(224, 87, 74, .12);  border-color: rgba(224, 87, 74, .35);  color: #ff9c92; }
.alert.ok   { background: rgba(46, 163, 107, .12); border-color: rgba(46, 163, 107, .35); color: #6ddba4; }
.alert.warn { background: rgba(224, 163, 74, .12); border-color: rgba(224, 163, 74, .35); color: #f0c584; }

.hint { font-size: 12px; color: var(--text-3); margin: 10px 0 0; }
.hint code { background: var(--bg-2); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); }

.install-env {
  margin: 18px 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.install-env div {
  display: flex; justify-content: space-between;
  padding: 8px 12px; font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.install-env div:last-child { border-bottom: 0; }
.install-env span { color: var(--text-2); }
.install-env b { font-family: var(--mono); font-weight: 500; }

/* ============================================================
   主界面
   ============================================================ */
body.app { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 顶部统计栏 ---------- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-left  { display: flex; align-items: center; gap: 14px; flex: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }

/* 顶栏的平台选择：标签和下拉框并排。
   这里套了 .field，而 .field 是 flex-direction:column，必须显式改回 row，
   否则「对应平台」会叠在下拉框上面。 */
/* 用 .field.platform-picker 提高优先级：
   .field 的 flex-direction:column 定义在本文件更靠后的位置，
   单靠 .platform-picker 会被它覆盖回去，标签又会叠到下拉框上面。 */
.field.platform-picker {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.platform-picker label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.platform-picker select { width: 150px; padding: 7px 10px; }

.stat-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 16px;
  border-radius: var(--radius-sm);
  min-width: 108px;
}
.stat.sep { border-left: 1px solid var(--line); margin-left: 8px; padding-left: 24px; }

.stat-label { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
/* 统计项的小注脚，例如「账户余额（全渠道）」 */
.stat-note {
  font-style: normal; margin-left: 4px; padding: 0 4px;
  border: 1px solid var(--line); border-radius: 3px;
  font-size: 10px; color: var(--text-3);
}
.stat-value {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  white-space: nowrap;
  transition: color .3s;
}
.stat-value.strong { color: #fff; }
.stat-value.neg    { color: var(--sub); }

@keyframes flash {
  0%   { background: rgba(76, 141, 255, .28); }
  100% { background: transparent; }
}
.stat.flash { animation: flash .9s ease-out; }

.who { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.role-tag {
  font-style: normal;
  font-size: 11px;
  padding: 1.5px 6px;
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text-2);
}
.role-tag.admin   { background: rgba(76, 141, 255, .18); color: #8db6ff; }
.role-tag.finance { background: rgba(46, 163, 107, .18); color: #6ddba4; }

/* ---------- 工作区（中部 + 右侧） ---------- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 460px;
  min-height: 0;
}

/* ---------- 中部业务操作区 ---------- */
.ops {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  align-content: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}

.panel-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: 15px; }
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
}

/* 操作面板的字段两列排布。
   一个字段占满一整行时，平台下拉框会被拉到近 900px 宽，
   面板也长得把下面的代理面板挤出屏幕。 */
.op-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 加了「收款渠道」一行之后行数变多，行距收紧一点，
     让两个面板连同按钮仍能落在一屏里 */
  gap: 11px 16px;
  align-items: end;
}
/* 需要独占整行的元素（拆分预览留在右半格，跟备注并排） */
.op-form .span-2,
.op-form .btn-row,
.op-form .rule-hint { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .op-form { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--text-2); }
.field .req { font-style: normal; color: var(--sub); }
.field .opt { font-style: normal; color: var(--text-3); font-size: 11.5px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 下拉框 + 快捷新增按钮 */
.with-add { display: flex; gap: 8px; }
.with-add select { flex: 1; min-width: 0; }
.btn.icon {
  flex: none;
  width: 36px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.req-mark { color: var(--sub); font-style: normal; }

.suffix-wrap { position: relative; display: block; }
.suffix-wrap input { padding-right: 30px; }
.suffix {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-style: normal; color: var(--text-3); font-size: 13px; pointer-events: none;
}

.split-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.split-preview div { display: flex; flex-direction: column; gap: 3px; }
.split-preview span { font-size: 11.5px; color: var(--text-3); }
.split-preview b { font-family: var(--mono); font-size: 15px; }

.rule-hint {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-3);
}
.rule-hint b { color: var(--text-2); font-weight: 600; }

/* ---------- 右侧操作日志 ---------- */
.logs {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
}

.logs-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.logs-head h2 { font-size: 14px; }
.logs-tools select { width: auto; padding: 5px 9px; font-size: 12.5px; }

.logs-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.logs-foot { flex: none; padding: 10px 12px; border-top: 1px solid var(--line); }

.log-item {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 10px 12px;
  margin-bottom: 8px;
  animation: slidein .25s ease-out;
}
@keyframes slidein {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.log-item.add    { border-left-color: var(--add); }
.log-item.sub    { border-left-color: var(--sub); }
.log-item.adjust { border-left-color: var(--brand); }
.log-item.failed { border-left-color: var(--warn); background: rgba(224, 163, 74, .06); }

.log-row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.log-type { font-size: 12.5px; font-weight: 600; }
.log-item.add .log-type    { color: #56c893; }
.log-item.sub .log-type    { color: #ff8f84; }
.log-item.adjust .log-type { color: #8db6ff; }

/* 每条记录上的平台名 */
.log-pf {
  font-size: 10.5px; padding: 1px 7px; border-radius: 3px;
  background: rgba(122, 162, 247, .14); color: #9db6f0;
  border: 1px solid rgba(122, 162, 247, .22);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.log-badge {
  font-size: 10.5px; padding: 1px 6px; border-radius: 3px;
  background: rgba(224, 163, 74, .18); color: var(--warn);
}
.log-time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

.log-row2 {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: 12px; color: var(--text-2);
  margin-bottom: 7px;
}
.log-row2 b { font-family: var(--mono); color: var(--text); font-weight: 600; }

.log-delta {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 2px 8px;
  font-size: 11.5px;
  padding-top: 7px;
  border-top: 1px dashed var(--line-soft);
  color: var(--text-3);
}
.log-delta .k { color: var(--text-3); }
.log-delta .v { font-family: var(--mono); color: var(--text-2); }
.log-delta .v i { font-style: normal; color: var(--text-3); margin: 0 5px; }
.log-delta .v em { font-style: normal; color: var(--text); }

.log-fail { font-size: 11.5px; color: var(--warn); margin-top: 5px; }
.log-remark { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

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

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(6, 9, 13, .6);
  display: grid; place-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-mask[hidden] { display: none; }

.modal {
  width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  animation: pop .16s ease-out;
}
.modal.narrow { width: 340px; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.modal h3 { font-size: 15px; margin-bottom: 10px; }
.modal p  { font-size: 13px; color: var(--text-2); margin: 0 0 16px; line-height: 1.6; }
.modal .form { margin-top: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: #2a3242;
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  animation: pop .18s ease-out;
}
.toast[hidden] { display: none; }
.toast.ok  { border-color: rgba(46, 163, 107, .5);  color: #7fe0ae; }
.toast.err { border-color: rgba(224, 87, 74, .5);   color: #ff9c92; }

/* ============================================================
   后台管理
   ============================================================ */
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.admin-wrap.wide { max-width: 1320px; }
.admin-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.admin-head h1 { font-size: 19px; }
.admin-head .spacer { margin-left: auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 14.5px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.grid th { font-weight: 500; color: var(--text-2); font-size: 12px; background: var(--bg-2); }
table.grid tbody tr:hover { background: rgba(255, 255, 255, .02); }
table.grid td.num { font-family: var(--mono); text-align: right; }
table.grid td.num.neg { color: var(--sub); }
table.grid input { padding: 6px 9px; font-size: 13px; }
table.grid .w-num { width: 130px; }

/* 筛选 / 新增这类横排表单：
   字段会伸展填满整行，换行后不会剩下一两个孤零零的窄格子；
   按钮和勾选框收成一组，始终跟在最后。 */
.inline-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
/* 可以伸展填满一行，但要封顶：
   否则换行后剩下的那一两个字段（比如「每页」这种下拉）会被拉成整行宽。 */
.inline-form .field { flex: 1 1 150px; min-width: 130px; max-width: 240px; }
.inline-form .form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}
.inline-form .form-actions .btn { flex: none; }

/* datetime-local 精确到秒，比普通字段需要更多宽度，否则会显示成 "…" */
.inline-form .field.dt-field { flex: 1 1 205px; min-width: 200px; max-width: 225px; }
input[type=datetime-local] { font-family: var(--mono); font-size: 13px; }

/* 对冲给客户：明显区别于普通收款渠道 */
.hedge-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(224, 163, 74, .18);
  color: var(--warn);
  font-size: 11.5px;
  white-space: nowrap;
}
.log-row2 .hedge-tag b { color: var(--warn); }

/* 日结表里给财务填数的输入框 */
.num-input {
  width: 110px;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: right;
}

/* 当前生效的时间范围（营业日）标签 */
.biz-tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(76, 141, 255, .16);
  border: 1px solid rgba(76, 141, 255, .4);
  color: #8db6ff;
  white-space: nowrap;
  font-family: var(--mono);
}
/* 用户自己改过时间范围时换个颜色，提示「这不是默认的营业日」 */
.biz-tag.custom {
  background: rgba(224, 163, 74, .14);
  border-color: rgba(224, 163, 74, .4);
  color: var(--warn);
}

.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 20px; }
.pill.on  { background: rgba(46, 163, 107, .16); color: #6ddba4; }
.pill.off { background: rgba(155, 167, 184, .14); color: var(--text-2); }

/* ============================================================
   全局顶部导航（四个页面共用）
   ============================================================ */
body.page { background: var(--bg); }

.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav .brand-mark { text-decoration: none; flex: none; }
.nav-tabs { margin-bottom: 0; }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }

.page-body { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.page-body.wide { max-width: 1320px; }

/* ---------- Tab 切换（分段控件样式）----------
   选中态用实心填充 + 阴影，和未选中的差别一眼可见，
   不再依赖一条细下划线。 */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  margin-bottom: 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 7px;
  white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s;
}
.tab:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}
.tab.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(76, 141, 255, .35);
}

/* tab 上的数量角标 */
.tab-badge {
  font-size: 11px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-3);
  font-family: var(--mono);
  transition: background .15s, color .15s;
}
.tab.active .tab-badge {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

/* 后台内部的分区 tab：比全局导航轻一级，用蓝色描边填充而不是实心蓝，
   避免两排 tab 长得一样、分不清哪个是页面导航哪个是分区导航 */
.tabs.section-tabs {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 8px;
}
.section-tabs .tab {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}
.section-tabs .tab:hover:not(.active) { background: var(--panel-2); }
.section-tabs .tab.active {
  background: rgba(76, 141, 255, .16);
  border-color: var(--brand);
  color: #cfe0ff;
  box-shadow: none;
}
.section-tabs .tab.active .tab-badge { background: rgba(76, 141, 255, .3); color: #cfe0ff; }

/* 台账里的会员 / 代理子切换：比主 tab 轻一级，用描边而不是实心 */
.subtabs {
  display: inline-flex;
  gap: 6px;
}
.subtab {
  padding: 5px 18px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  transition: all .15s;
}
.subtab:hover:not(.active) { color: var(--text); background: var(--panel-2); }
.subtab.active {
  background: rgba(76, 141, 255, .16);
  border-color: var(--brand);
  color: #8db6ff;
  font-weight: 600;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pager .spacer { margin-left: auto; }
.pager-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.pager-btns .btn { min-width: 34px; text-align: center; text-decoration: none; }
.btn.is-off { opacity: .4; pointer-events: none; }

.empty-row { text-align: center; color: var(--text-3); padding: 26px; }
.scroll-x { overflow-x: auto; }

/* ============================================================
   明细表（Excel 风格）
   横向放不下就左右滚，纵向超出就上下滚；
   表头和左边两列固定不动，滚动时始终知道自己在看哪一行哪一列。
   ============================================================ */
.sheet-wrap {
  overflow: auto;
  max-height: calc(100vh - 320px);
  min-height: 260px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  white-space: nowrap;
  min-width: 100%;
}

table.sheet th,
table.sheet td {
  padding: 7px 10px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  background: var(--panel);
}

/* 固定表头 */
table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-2);
  color: var(--text-2);
  font-weight: 500;
  font-size: 11.5px;
  border-bottom: 1px solid var(--line);
}

/* 固定左侧两列（时间 + 操作类型）
   col-time 的宽度要放得下完整的 "YYYY-MM-DD HH:MM:SS"，
   否则时间会被右边那根固定列压住、只露出半截。 */
.col-time  { position: sticky; left: 0;      z-index: 2; min-width: 172px; width: 172px; }
.col-type  { position: sticky; left: 172px;  z-index: 2; min-width: 96px;
             box-shadow: 1px 0 0 var(--line); }
thead .col-time, thead .col-type { z-index: 4; }

table.sheet .num   { text-align: right; font-family: var(--mono); min-width: 82px; }
table.sheet .mono  { font-family: var(--mono); }
.col-delta  { min-width: 178px; }
.col-remark { min-width: 150px; max-width: 260px; overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }

.pos { color: #56c893; }
.neg { color: #ff8f84; }
.warn-txt { color: var(--warn); }

/* ---- 组头行：平台 / 账号 + 该账号的加减点合计 ---- */
tr.grp td.grp-bar {
  background: linear-gradient(90deg, rgba(76, 141, 255, .16), rgba(76, 141, 255, .03));
  border-top: 2px solid var(--brand);
  border-bottom: 1px solid var(--line);
  border-right: 0;
  padding: 0;
}
/* 组头横幅整体吸在容器左侧：横向滚到最右边，也始终看得见这些流水属于哪个平台的哪个账号。
   标题和合计是同一个元素里的两段，所以不存在互相盖住的问题。 */
.grp-inner {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  width: max-content;
  padding: 9px 12px;
}
.grp-title { display: inline-flex; align-items: center; white-space: nowrap; }
.grp-pf {
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
}
.grp-sep { color: var(--text-3); margin: 0 7px; }
.grp-acc {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: #8db6ff;
}
.grp-acc.is-pf { font-family: inherit; color: var(--text-2); font-style: italic; }
.grp-count {
  margin-left: 10px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 20px;
}
.grp-sum {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.grp-sum b { font-family: var(--mono); font-size: 13px; }
.grp-time { font-family: var(--mono); color: var(--text-3); }

/* ---- 明细行 ---- */
tr.det td { color: var(--text-2); }
tr.det:hover td { background: #202634; }
tr.det.failed td { background: rgba(224, 163, 74, .07); }
tr.det.failed:hover td { background: rgba(224, 163, 74, .12); }

.op-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-2);
}
.op-tag.add    { background: rgba(46, 163, 107, .18); color: #6ddba4; }
.op-tag.sub    { background: rgba(224, 87, 74, .18);  color: #ff9c92; }
.op-tag.adjust { background: rgba(76, 141, 255, .18); color: #8db6ff; }

.d-b { color: var(--text-3); }
.d-a { color: var(--text); font-weight: 600; }
.col-delta i { font-style: normal; color: var(--text-3); margin: 0 6px; }

.pill.warn { background: rgba(224, 163, 74, .18); color: var(--warn); }

.check-inline { flex-direction: row !important; align-items: center; gap: 7px !important; }
.check-inline input { width: auto; }

/* ---------- 平台汇总 ---------- */
.sum-total { border-color: rgba(76, 141, 255, .35); }
.sum-total .card-head { background: rgba(76, 141, 255, .07); }
.sum-card.is-off { opacity: .62; }
.sum-card .card-head { gap: 10px; }

.sc-grid {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sc-grid.big { grid-template-columns: repeat(6, 1fr); }
.sc-grid.sub { grid-template-columns: repeat(6, 1fr); margin-top: 14px; }
.sc-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.sc-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* 「当前状态」角标：说明这个数跟时间筛选无关 */
.sc-now {
  font-style: normal; margin-left: 5px; padding: 0 4px;
  border: 1px solid var(--line); border-radius: 3px;
  font-size: 10px; color: var(--text-3);
}

.sc {
  background: var(--panel);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.sc-k { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.sc-v {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.3px;
  overflow-wrap: anywhere;
}
.sc-v.neg { color: var(--sub); }
.sc-grid.sub .sc-v { font-size: 14px; font-weight: 500; color: var(--text); }

/* 分业务类型明细 */
.op-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.opc {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.opc.add { border-left-color: var(--add); }
.opc.sub { border-left-color: var(--sub); }
.opc-k { font-size: 11.5px; color: var(--text-2); }
.opc-p { font-family: var(--mono); font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.opc.add .opc-p { color: #56c893; }
.opc.sub .opc-p { color: #ff8f84; }
.opc-c { font-size: 11px; color: var(--text-3); }

@media (max-width: 1240px) {
  .sc-grid.big, .sc-grid.sub { grid-template-columns: repeat(3, 1fr); }
  .op-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr 400px; }
  .stat { min-width: 92px; padding: 5px 10px; }
  .stat-value { font-size: 15px; }
}

/* 日结表里的录入框：别被列宽拉得太长 */
.sheet .num-input { width: 130px; max-width: 100%; text-align: right; }

/* 后台表格里的金额输入框：期初余额可能是 1,000,000.0000 这种，别挤成一小格 */
table.grid input[name=opening_balance] {
  width: 124px;
  min-width: 124px;
  text-align: right;
  font-family: var(--mono);
}
