* { box-sizing: border-box; }

/* hidden 属性必须压过 .login-wrap{display:flex} 之类的布局样式，
   否则 JS 里 el.hidden = true 会失效（登录后登录页不消失） */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #1f2328;
  background: #f4f5f7;
  line-height: 1.6;
}

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 12px;
  padding: 32px 28px;
}
.login-card h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-card .sub { color: #6b7280; margin: 0 0 20px; font-size: 13px; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e3e5e8;
  padding: 12px 24px;
}
.brand { font-size: 16px; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox span { color: #4b5563; font-size: 13px; }

/* 整页锁定一屏：顶栏和卡片不动，只有下面的账目表格内部滚动。
   这里用 100dvh 而不是 position: fixed —— 老浏览器不认 inset 简写，
   fixed 又没给宽高时会塌成 0，里面的 flex 高度全算不出来，
   表格区就没法滚了（手机上是这么踩的）。 */
#appWrap {
  height: 100vh;
  height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
/* 页面本身不滚，滚动只发生在表格里。登录页不受影响。 */
body:has(#appWrap:not([hidden])) { overflow: hidden; }
.wrap {
  flex: 1 1 auto;
  min-height: 0; /* flex 子项默认不收缩，不写这个内部滚动会失效 */
  width: 100%;
  max-width: 1560px; margin: 0 auto;
  padding: 20px 28px 20px;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* 卡片 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
  flex: 0 0 auto;
}
.card {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 10px;
  padding: 16px;
  position: relative;
}
.card .label { font-size: 12px; color: #6b7280; line-height: 1.5; }
/* 单位并进标题行，显示成「当前余额（元）」，不再单独占一行 */
.card .label .unit { font-size: 12px; color: #9ca3af; margin-left: 2px; }
.card .value { font-size: 24px; font-weight: 600; margin-top: 2px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.card.balance { border-color: #185FA5; background: #f5f9ff; }
.card.balance .value { color: #185FA5; }
.card.money-in .value { color: #C0392B; }
.card.money-out .value { color: #0F6E56; }
.linkbtn {
  position: absolute; right: 12px; top: 12px;
  background: none; border: none; color: #185FA5; cursor: pointer; font-size: 12px; padding: 0;
}
.linkbtn:hover { text-decoration: underline; }

/* 面板 */
.panel {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-head, .filters, .subtotal, .pager { flex: 0 0 auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.field.inline { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
.field.inline > span { margin-bottom: 0; white-space: nowrap; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d6d9dd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #1f2328;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(24,95,165,.35); outline-offset: 0; border-color: #185FA5; }
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
/* 弹窗首行固定四列：日期 / 方向 / 金额 / 名目 挤在一行 */
.row-4 { grid-template-columns: 1.1fr 1.15fr .95fr 1.5fr; }

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: 1px solid #d6d9dd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: #1f2328;
}
.btn:hover { border-color: #9ca3af; background: #fafafa; }
.btn.primary { background: #185FA5; border-color: #185FA5; color: #fff; }
.btn.primary:hover { background: #134b84; }
.btn.danger { background: #C0392B; border-color: #C0392B; color: #fff; }
.btn.danger:hover { background: #a32e22; border-color: #a32e22; }
.btn.ghost { background: transparent; border-color: transparent; color: #4b5563; }
.btn.ghost:hover { background: #f0f1f3; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.msg { font-size: 13px; }
.msg.ok { color: #0F6E56; }
.msg.err { color: #C0392B; }
.err { color: #C0392B; font-size: 13px; min-height: 20px; margin-top: 8px; }

/* 筛选 */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #eceef1;
  border-radius: 8px;
  margin-bottom: 12px;
}
.filters input, .filters select { width: auto; min-width: 120px; }

.subtotal { font-size: 13px; color: #4b5563; margin-bottom: 8px; }
.subtotal b { font-variant-numeric: tabular-nums; }
.subtotal .in { color: #C0392B; }
.subtotal .out { color: #0F6E56; }

/* 表格：这里是整页唯一能滚的地方，横竖都滚，表头吸在顶部 */
.tablewrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* table-layout: fixed —— 列宽严格按 th 的 width 走，不再被长内容挤变形。
   auto 布局下「取出」标签和「编辑/删除」按钮都算可换行，
   浏览器会把这两列的最小宽度当成一个字/一个按钮宽，于是被压成竖排。 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.tbl th, .tbl td {
  padding: 9px 10px;
  border-bottom: 1px solid #eceef1;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere; /* 超长无空格串也不会撑破固定列宽 */
}
.tbl th {
  background: #fafbfc; font-weight: 600; color: #4b5563; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
  /* border-collapse: collapse 下 sticky 元素的 border 会跟着滚走，改用内阴影画线 */
  box-shadow: inset 0 -1px 0 #eceef1;
}
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.tag.in { background: #fdecea; color: #C0392B; }
.tag.out { background: #e6f4ee; color: #0F6E56; }
.amt.in { color: #C0392B; font-weight: 600; }
.amt.out { color: #0F6E56; font-weight: 600; }
/* 名目：宽度锁死 5.2em（5 个中文字），配合强制断行，
   名目最长 10 字 → 列表里正好两行、每行 5 个字。
   用 em 而不是 px，表格被缩放或移动端字号变小时依然成立。 */
/* 关联项目：名字比名目长，一行放不下就打省略号，鼠标悬停看全名。
   这里不能复用 .cat-cell —— 那个锁了 5.2em 宽，项目名会被压成一列字。 */
.proj-cell {
  color: #374151;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tbl td .dim { color: #c7cbd1; }

.cat-cell {
  width: 5.2em;
  word-break: break-all;
  line-height: 1.5;
}
/* 备注：短备注原样显示；长备注折两行截断，点一下看全文 */
.remark-cell { color: #4b5563; white-space: pre-wrap; word-break: break-word; max-width: 100%; }
.remark-cell.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.remark-cell.clamp:hover { color: #1f2328; }
/* 添加/编辑时间：一格里两行，等宽数字 + 不换行 */
.time-cell { color: #6b7280; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.6; }
.time-cell .t-row { display: flex; align-items: baseline; gap: 5px; }
.time-cell i { font-style: normal; color: #9ca3af; font-size: 11px; flex-shrink: 0; }
/* 附件列：只显示类型徽标，长文件名靠 title 悬停看 */
.att-icons { display: flex; flex-wrap: wrap; gap: 4px; }
.att-ico {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 24px; padding: 0 5px;
  border-radius: 5px; font-size: 9.5px; font-weight: 700; letter-spacing: .3px;
  text-decoration: none; white-space: nowrap; transition: transform .1s ease, box-shadow .1s ease;
}
.att-ico:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.att-ico.img  { background: #e6f4ee; color: #0F6E56; }
.att-ico.pdf  { background: #fdecea; color: #C0392B; }
.att-ico.ofd  { background: #e7edfd; color: #1a4fd6; }
.att-ico.doc  { background: #e8f0fe; color: #185FA5; }
.att-ico.xls  { background: #e4f6ec; color: #127a4e; }
.att-ico.ppt  { background: #fff1e6; color: #c2410c; }
.att-ico.zip  { background: #f3e8ff; color: #7c3aed; }
.att-ico.txt  { background: #f0f1f3; color: #4b5563; }
.att-ico.file { background: #f0f1f3; color: #6b7280; }
.att-list { display: flex; flex-direction: column; gap: 3px; }
.att-list a { color: #185FA5; text-decoration: none; font-size: 12px; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-list a:hover { text-decoration: underline; }
.rowbtns { display: flex; gap: 6px; flex-wrap: nowrap; }
/* 操作列的按钮一旦允许折行，「报销」就会竖成两行 —— 这里钉死不换行，
   再把左右 padding 收一点，三个按钮才排得进 200px 的列宽 */
.rowbtns .btn { white-space: nowrap; padding: 5px 9px; }
.empty { padding: 28px; text-align: center; color: #9ca3af; }

/* 勾选列：全局 input 是 width:100% + padding + border，checkbox 必须显式还原成小方块 */
.tbl th.pickcol, .tbl td.pickcol { text-align: center; padding-left: 6px; padding-right: 6px; }
.tbl .pickcol input {
  width: 15px; height: 15px;
  margin: 0; padding: 0; border: none; border-radius: 3px;
  cursor: pointer; accent-color: #185FA5; vertical-align: middle;
}

/* 两个人工状态列（报销单 / 简道云）：开关样式，点一下切换。
   未办是灰底圆点在左，已办是绿底圆点滑到右边 —— 状态一眼分明，
   又比按钮+文字省地方。列宽 60、padding 收到 4，开关 34×20。 */
/* 三个开关列：横竖都居中。td 默认是 top 对齐，开关只有 20px 高，
   不显式 middle 就会贴在行顶，看着像没对齐。 */
.tbl th.flagcol, .tbl td.flagcol {
  text-align: center;
  padding-left: 4px; padding-right: 4px;
}
.tbl td.flagcol { vertical-align: middle; }
.tbl td.flagcol .flag { vertical-align: middle; }
.tbl td.pickcol { vertical-align: middle; }
.tbl td.pickcol input { vertical-align: middle; }
.tbl .flag {
  position: relative;
  display: inline-block;
  width: 34px; height: 20px; padding: 0; margin: 0;
  border: none; border-radius: 10px;
  background: #d5dae0; color: transparent;
  cursor: pointer;
  transition: background .18s ease;
  -webkit-tap-highlight-color: transparent;
}
/* 白色滑块：关在左，开滑到右 */
.tbl .flag::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .28);
  transition: transform .18s ease;
}
/* 视觉只有 34×20，热区往外扩一圈，手机上不至于点不中 */
.tbl .flag::after { content: ''; position: absolute; inset: -8px; border-radius: 12px; }
.tbl .flag:hover { background: #c9ced5; }
.tbl .flag.on { background: #34C759; }
.tbl .flag.on:hover { background: #2FB350; }
.tbl .flag.on::before { transform: translateX(14px); }
/* 两列各一色：单据绿，钉钉蓝，扫一眼就知道哪列没办完 */
.tbl .flag[data-flag="bill"].on { background: #34C759; }
.tbl .flag[data-flag="bill"].on:hover { background: #2FB350; }
.tbl .flag[data-flag="jdcloud"].on { background: #007AFF; }
.tbl .flag[data-flag="jdcloud"].on:hover { background: #0066DB; }
/* 报销也是开关，但点它会先弹窗确认时间，所以单独一个橙色 */
.tbl .flag[data-flag="reim"].on { background: #FF9500; }
.tbl .flag[data-flag="reim"].on:hover { background: #EE8800; }
.tbl .flag:disabled { cursor: default; opacity: .45; }

/* 计算栏：勾了东西才出现，占一条，不压表格 */
.calcbar {
  position: relative;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding: 7px 12px;
  background: #f0f7ff; border: 1px solid #cfe3f7; border-radius: 8px;
  font-size: 13px; color: #374151;
}
.calcbar-info { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.calcbar-count { color: #185FA5; font-weight: 600; white-space: nowrap; }
.calcbar-count b { font-size: 15px; font-variant-numeric: tabular-nums; }
.calcbar-groups { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.calcseg { white-space: nowrap; color: #4b5563; }
.calcseg b { font-weight: 600; font-variant-numeric: tabular-nums; color: #1f2328; }
.calcseg.in b { color: #C0392B; }
.calcseg.out b { color: #0F6E56; }
.calcseg.total { padding-left: 12px; border-left: 1px solid #cfe3f7; }
.calcseg.total b { color: #185FA5; font-size: 15px; }
.calcbar-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
/* 复制按钮点完会临时改成「已复制 N 条」，给个最小宽度免得整条计算栏跟着抖 */
#btnCalcCopy { min-width: 78px; white-space: nowrap; }

/* 明细面板：从计算栏往上弹，免得被视口底边裁掉 */
.calcpanel {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 60;
  width: 400px; max-width: calc(100vw - 24px); max-height: 340px;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}
.calcpanel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid #f0f1f3;
  font-size: 13px; font-weight: 600; color: #374151;
}
.calcpanel-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px 6px 8px; }
.calcgroup + .calcgroup { border-top: 1px solid #f0f1f3; margin-top: 4px; padding-top: 4px; }
.calcgroup-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 6px 4px; font-size: 12px; font-weight: 600; color: #185FA5;
}
.calcgroup-head span { font-weight: 400; color: #9ca3af; white-space: nowrap; }
.calcitem { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; font-size: 12.5px; }
.calcitem:hover { background: #f6f7f9; }
.calcitem-date { flex-shrink: 0; color: #9ca3af; font-variant-numeric: tabular-nums; }
.calcitem-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.calcitem-amt { flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.calcitem-amt.in { color: #C0392B; }
.calcitem-amt.out { color: #0F6E56; }
.calcitem-x {
  flex-shrink: 0; width: 20px; height: 20px; padding: 0;
  border: none; border-radius: 4px; background: transparent;
  color: #9ca3af; font-size: 15px; line-height: 1; cursor: pointer;
}
.calcitem-x:hover { background: #fdecea; color: #C0392B; }

/* 附件选择器：原生 file input 换目录再选会覆盖，这里改成自己维护的文件队列 */
.filer { border: 1px dashed #d6d9dd; border-radius: 8px; padding: 10px 12px; background: #fafbfc; }
.filer-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filer-tip { font-size: 12px; color: #9ca3af; }
.filer-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.filer-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #eceef1; border-radius: 6px; padding: 6px 8px; }
.filer-item .idx { width: 18px; flex-shrink: 0; text-align: center; color: #9ca3af; font-size: 12px; font-variant-numeric: tabular-nums; }
.filer-item .thumb { width: 34px; height: 34px; flex-shrink: 0; border-radius: 4px; background: #f2f4f6; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #6b7280; letter-spacing: -.3px; }
.filer-item .meta { flex: 1; min-width: 0; }
.filer-item .fname { font-size: 13px; color: #1f2328; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filer-item .fsize { font-size: 11px; color: #9ca3af; }
.filer-item .fops { display: flex; gap: 3px; flex-shrink: 0; }
.filer-item .fops .btn { padding: 2px 7px; font-size: 11px; line-height: 1.6; }
.filer-item .fops .btn:disabled { opacity: .35; cursor: not-allowed; }
.filer-item .fops .btn[data-fdel] { color: #C0392B; }
.filer-item .fops .btn[data-fdel]:hover { background: #fdecea; }

/* 附件预览弹窗 */
.preview-card { max-width: 900px; }
.preview-body { display: flex; align-items: center; justify-content: center; min-height: 120px; max-height: 72vh; overflow: auto; }
.preview-body img { max-width: 100%; max-height: 72vh; border-radius: 6px; display: block; }
.preview-body iframe { width: 100%; height: 72vh; border: 0; border-radius: 6px; background: #fff; }
.preview-body pre { width: 100%; margin: 0; padding: 12px; background: #f8f9fa; border-radius: 6px; font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: #374151; }
.preview-tip { padding: 40px 20px; color: #9ca3af; font-size: 13px; text-align: center; }

.att-edit { margin-bottom: 12px; padding: 10px; background: #f8f9fa; border-radius: 6px; font-size: 13px; }
.att-edit .item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.att-edit .item a { color: #185FA5; text-decoration: none; }
/* 图标链接不加下划线，只给文件名链接加 */
.att-edit .item a:not(.att-ico):hover { text-decoration: underline; }
.att-edit .item .att-ico { flex-shrink: 0; }
.att-edit .att-name {
  flex: 1; min-width: 0; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-edit .att-size { flex-shrink: 0; color: #9ca3af; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 附件排序：上下两个小箭头，比拖拽可靠 —— 手机上也能点，
   拖动在触摸屏里经常和滚动打架。序号只是给人看当前位置。 */
.att-edit .att-ord { flex-shrink: 0; display: flex; align-items: center; gap: 2px; }
.att-edit .att-ord .idx {
  min-width: 16px; color: #9ca3af; font-size: 11px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.att-edit .att-mv {
  width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #dcdfe3; border-radius: 5px;
  color: #4b5563; font-size: 12px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.att-edit .att-mv:hover:not(:disabled) { background: #eef4fb; border-color: #9dc0e4; color: #185FA5; }
.att-edit .att-mv:disabled { opacity: .35; cursor: default; }

/* 拖拽手柄：只是个提示，抓行上任何地方都能拖 */
.att-edit .att-grip {
  flex-shrink: 0; width: 12px;
  color: #bcc2ca; font-size: 13px; line-height: 1;
  text-align: center; user-select: none;
  -webkit-user-select: none;
}
.att-edit .item[draggable="true"] { cursor: grab; }
.att-edit .item[draggable="true"]:active { cursor: grabbing; }
/* 拖起来的那行淡一点，看得出正在搬它 */
.att-edit .item.dragging { opacity: .4; }
/* 插入位置：贴在上沿或下沿一条蓝线，比整行高亮更准 */
.att-edit .item.drop-before { box-shadow: inset 0 2px 0 #185FA5; }
.att-edit .item.drop-after  { box-shadow: inset 0 -2px 0 #185FA5; }

/* 附件悬停缩略图：贴在鼠标旁边的小浮层，不拦鼠标事件 */
.att-tip {
  position: fixed; z-index: 300; pointer-events: none;
  padding: 6px 6px 7px;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .18);
  max-width: 268px;
}
.att-tip-img {
  display: block; max-width: 240px; max-height: 200px;
  border-radius: 5px; background: #f6f7f9;
}
.att-tip-badge {
  display: flex; align-items: center; justify-content: center;
  width: 96px; height: 70px; margin: 2px auto 7px;
  border-radius: 6px; font-size: 15px; font-weight: 700; letter-spacing: .5px;
}
.att-tip-badge.img  { background: #e6f4ee; color: #0F6E56; }
.att-tip-badge.pdf  { background: #fdecea; color: #C0392B; }
.att-tip-badge.ofd  { background: #e7edfd; color: #1a4fd6; }
.att-tip-badge.doc  { background: #e8f0fe; color: #185FA5; }
.att-tip-badge.xls  { background: #e4f6ec; color: #127a4e; }
.att-tip-badge.ppt  { background: #fff1e6; color: #c2410c; }
.att-tip-badge.zip  { background: #f3e8ff; color: #7c3aed; }
.att-tip-badge.txt  { background: #f0f1f3; color: #4b5563; }
.att-tip-badge.file { background: #f0f1f3; color: #6b7280; }
.att-tip-name {
  margin-top: 5px; padding: 0 2px;
  font-size: 11.5px; color: #374151; line-height: 1.5;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-tip-sub { padding: 0 2px; margin-top: 1px; font-size: 11px; color: #9ca3af; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; font-size: 13px; color: #4b5563; }

/* ---------- 新增/编辑弹窗 ---------- */
.head-actions { display: flex; align-items: center; gap: 8px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  animation: fade .12s ease-out;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
  animation: pop .14s ease-out;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; }
.modal-x {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 6px;
}
.modal-x:hover { background: #f3f4f6; color: #374151; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* 确认弹窗：比表单弹窗窄，重点突出「删的是哪一笔」 */
.confirm-card { max-width: 420px; }
.confirm-body { padding: 2px 0 18px; }
.confirm-main { margin: 0 0 8px; font-size: 14px; color: #1f2328; line-height: 1.6; }
.confirm-amt { margin: 0 0 10px; font-size: 20px; font-weight: 600; color: #C0392B; font-variant-numeric: tabular-nums; }
.confirm-warn { margin: 0; font-size: 12px; color: #9ca3af; line-height: 1.6; }
.confirm-card .actions { margin-top: 0; }

/* 列设置：勾选要显示的列，非全屏时只留重点。
   隐藏靠 .hide-N 打到 th 和 td 的同一个 nth-child 上，
   剩下的列由 table-layout: fixed 自动按比例撑满，不用改列宽。 */
.colpick { position: relative; }
.colpick-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 212px; max-width: calc(100vw - 24px); padding: 12px 10px 10px;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}
.colpick-head {
  padding: 0 4px; margin-bottom: 8px;
  font-size: 12px; font-weight: 600; color: #6b7280;
}
.colpick-list {
  display: flex; flex-direction: column; gap: 1px;
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
}
.colpick-list::-webkit-scrollbar { width: 6px; }
.colpick-list::-webkit-scrollbar-thumb { background: #dcdfe3; border-radius: 3px; }
.colpick-list::-webkit-scrollbar-thumb:hover { background: #c6cad0; }
.colpick-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 6px; border-radius: 6px;
  font-size: 13px; color: #374151; line-height: 1.4; cursor: pointer;
}
.colpick-item:hover { background: #f6f7f9; }
/* 全局 input 是 width:100% + padding + border，会把 checkbox 撑成一整条，
   把文字挤到右边只剩一个字宽。这里必须显式还原成小方块。 */
.colpick-item input {
  flex: 0 0 auto;
  width: 14px; height: 14px;
  margin: 0; padding: 0; border: none; border-radius: 3px;
  cursor: pointer; accent-color: #185FA5;
}
.colpick-item span {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.colpick-tip { margin-top: 7px; padding: 0 4px; font-size: 11px; color: #C0392B; }
.colpick-foot {
  display: flex; gap: 6px; margin-top: 9px; padding: 9px 4px 0;
  border-top: 1px solid #f0f1f3;
}
.colpick-foot .btn { flex: 1; padding: 4px 6px; font-size: 12px; }

.tbl.hide-1 th:nth-child(2), .tbl.hide-1 td:nth-child(2) { display: none; }
.tbl.hide-2 th:nth-child(3), .tbl.hide-2 td:nth-child(3) { display: none; }
.tbl.hide-3 th:nth-child(4), .tbl.hide-3 td:nth-child(4) { display: none; }
.tbl.hide-4 th:nth-child(5), .tbl.hide-4 td:nth-child(5) { display: none; }
.tbl.hide-5 th:nth-child(6), .tbl.hide-5 td:nth-child(6) { display: none; }
.tbl.hide-6 th:nth-child(7), .tbl.hide-6 td:nth-child(7) { display: none; }
.tbl.hide-7 th:nth-child(8), .tbl.hide-7 td:nth-child(8) { display: none; }
.tbl.hide-8 th:nth-child(9), .tbl.hide-8 td:nth-child(9) { display: none; }
.tbl.hide-9 th:nth-child(10), .tbl.hide-9 td:nth-child(10) { display: none; }
.tbl.hide-10 th:nth-child(11), .tbl.hide-10 td:nth-child(11) { display: none; }
.tbl.hide-11 th:nth-child(12), .tbl.hide-11 td:nth-child(12) { display: none; }
.tbl.hide-12 th:nth-child(13), .tbl.hide-12 td:nth-child(13) { display: none; }
.tbl.hide-13 th:nth-child(14), .tbl.hide-13 td:nth-child(14) { display: none; }
.tbl.hide-14 th:nth-child(15), .tbl.hide-14 td:nth-child(15) { display: none; }

/* 报销列：已报销显示具体时间，未报销只占一个灰色小标 */
/* 已报销的行，操作列那个按钮用绿色，一眼能看出状态 */
.btn.reim-on { color: #0F6E56; }
.btn.reim-on:hover { background: #e6f4ee; }

/* 报销弹窗 */
.reim-card { max-width: 460px; }
.reim-body { padding: 2px 0 14px; }
.reim-info { margin: 0 0 14px; font-size: 13px; color: #4b5563; line-height: 1.9; }
.reim-info b { display: block; color: #1f2328; font-size: 14px; }
.reim-info span { margin-right: 10px; }
.reim-info .reim-was { color: #0F6E56; }
.reim-quick { display: flex; gap: 6px; margin: -2px 0 10px; }
.danger-text { color: #C0392B; }
.danger-text:hover { background: #fdecea; }

/* 备注全文弹窗 */
.note-card { max-width: 560px; }
.note-body {
  font-size: 14px;
  color: #374151;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 640px) {
  .modal { padding: 12px; }
  .modal-card { max-width: 100%; max-height: 94vh; padding: 16px; }
}

/* ---------- 移动端适配 ---------- */
/* 「筛选」按钮只在手机上出现，PC 上筛选区一直展开 */
.filter-toggle { display: none; }

@media (max-width: 640px) {
  /* 顶栏：一行塞下，标题和用户名都不折行 */
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 15px; white-space: nowrap; flex-shrink: 0; }
  .userbox { gap: 6px; min-width: 0; }
  .userbox span {
    font-size: 12px;
    max-width: 76px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .userbox .btn { padding: 4px 8px; font-size: 12px; }

  /* 主体留白收紧 */
  .wrap { padding: 12px 12px 40px; }

  /* 四张卡片压成 2×2，纵向高度直接减半 */
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .card { padding: 10px 12px; border-radius: 8px; }
  .card .label { font-size: 11px; }
  .card .label .unit { font-size: 11px; }
  .card .value { font-size: 17px; }
  .linkbtn { right: 8px; top: 8px; font-size: 11px; }

  /* 面板 */
  .panel { padding: 12px; border-radius: 8px; margin-bottom: 12px; }
  .panel-head { margin-bottom: 10px; gap: 6px; flex-wrap: wrap; }
  .panel-head h2 { font-size: 14px; }
  .head-actions { gap: 6px; flex-wrap: wrap; }
  .head-actions .btn { padding: 5px 9px; font-size: 12px; }

  /* 筛选区默认收起，点「筛选」展开；展开后两列排布 */
  .filter-toggle { display: inline-flex; align-items: center; }
  .filters { display: none; }
  .filters.open {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }
  .filters .field.inline { margin-bottom: 0; }
  /* 关键词那一格占满整行（报销下拉插在前面，序号往后挪了一位） */
  .filters .field.inline:nth-child(6) { grid-column: 1 / -1; }
  .filters input, .filters select { width: 100%; min-width: 0; }

  .subtotal { font-size: 12px; margin-bottom: 6px; }

  /* 手机上也保持一屏布局，表格区自己滚；矮屏就把留白再压一压 */
  .wrap { padding: 10px 10px 8px; }
  .panel { padding: 10px; margin-bottom: 0; }
  .subtotal { margin-bottom: 4px; }
  .pager { margin-top: 8px; }
  .tablewrap { -webkit-overflow-scrolling: touch; touch-action: pan-y pan-x; }
  /* 计算栏在手机上会换行，别让它吃掉太多表格高度 */
  .calcbar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; font-size: 12px; }
  .calcbar-info { gap: 10px; }
  .calcbar-groups { gap: 10px; }
  .calcseg.total { padding-left: 10px; }
  .calcseg.total b { font-size: 14px; }
  .calcpanel { width: calc(100vw - 24px); right: auto; left: 0; max-height: 46vh; }
  .calcitem { font-size: 12px; padding: 4px; }
  /* min-width 交给 JS 按可见列动态算（layoutCols），
     写死 1280 会让隐藏列后仍然这么宽，横向滚动条一点不变短 */
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 8px; }
  /* 编辑/删除两个按钮在手机上贴紧一点，省纵向空间 */
  .rowbtns { gap: 3px; }
  .rowbtns .btn { padding: 3px 7px; font-size: 11px; }

  .pager { gap: 10px; font-size: 12px; }

  /* 弹窗表单改单列 */
  .modal-card .row { grid-template-columns: 1fr; gap: 8px; }
  .modal-head h2 { font-size: 15px; }
}


/* ---------- 用户管理（多人共用） ---------- */

/* 「看谁的账」下拉：塞在右上角，不能把整行撑高 */
.owner-pick {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 8px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
}
.owner-pick > span { font-size: 12px; color: #64748b; white-space: nowrap; }
.owner-pick select {
  border: 0; background: transparent; outline: none;
  font-size: 13px; color: #185FA5; font-weight: 500;
  max-width: 160px; cursor: pointer;
}
.owner-pick select:focus-visible { outline: 2px solid #185FA5; outline-offset: 2px; border-radius: 4px; }

.users-card { width: min(760px, 94vw); }
.users-body { padding: 4px 18px 18px; }

/* 列表：一行一个用户，左名字、中权限、右余额 */
.users-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 118px auto;
  align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid #e8ebef; background: #fff;
}
.user-row:hover { border-color: #cfd8e3; }
/* 停用的人整行压暗，一眼能分出来 */
.user-row.off { background: #fafafa; }
.user-row.off .u-name, .user-row.off .u-num { color: #9aa1ab; }

.u-main { min-width: 0; }
.u-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.u-sub {
  font-size: 12px; color: #8b93a1; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.u-tag {
  flex-shrink: 0; padding: 0 5px; border-radius: 4px;
  font-size: 11px; font-weight: 400; line-height: 16px;
}
.u-tag.admin { background: #e6f0fa; color: #185FA5; }
.u-tag.off { background: #f2f3f5; color: #8b93a1; }

/* 权限用单字缩写：增 改 删 看 导，比五个勾选框省地方 */
.u-perm { font-size: 12px; color: #6b7280; letter-spacing: 1px; text-align: center; }
.u-num { text-align: right; line-height: 1.25; }
.u-num b { display: block; font-size: 13px; color: #1f2937; font-variant-numeric: tabular-nums; }
.u-num span { font-size: 11px; color: #9aa1ab; }

.users-empty { padding: 28px 0; text-align: center; color: #9aa1ab; font-size: 13px; }

/* 表单 */
.user-form {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid #eef0f3;
}
.user-form-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.form-row .field { margin: 0; }

.perm-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 9px 12px; border-radius: 8px; background: #f8f9fb;
}
.perm-label { font-size: 13px; color: #6b7280; margin-right: 2px; }
.perm-row label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: #374151; cursor: pointer;
}
.perm-row input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

.perm-tip { font-size: 12px; color: #9aa1ab; margin-top: 8px; }
.user-form .actions { margin-top: 12px; display: flex; gap: 10px; }
.user-form .msg { margin-top: 8px; }

@media (max-width: 720px) {
  .owner-pick > span { display: none; }
  .owner-pick select { max-width: 96px; }
  .users-card { width: calc(100vw - 24px); }
  .users-body { padding: 4px 12px 14px; }
  /* 手机上权限和余额挤在一行会换行错乱，改成两行 */
  .user-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .u-perm { grid-column: 1; text-align: left; }
  .u-num { grid-column: 2; grid-row: 1 / span 2; }
  .form-row { grid-template-columns: 1fr; gap: 8px; }
}
