/* 台账公共.css —— 收入台账 / 支出台账 / 订单分析 三页共用 */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* 页面本身不滚动：滚动条在表格内部（表头吸顶），布局同 订单列表.html */
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5; padding: 16px; color: #2c3e50;
  display: flex; flex-direction: column;
}
/* width:100% 必须有：纵向 flex 里 margin:0 auto 是交叉轴 auto 外边距，会让子项按内容收缩而不撑满，两侧就空出一大块 */
.container { width: 100%; max-width: calc(100vw - 32px); margin: 0 auto; flex: 1; display: flex; flex-direction: column; min-height: 0; }
#tabBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
header {
  background: #fff; padding: 14px 22px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-shrink: 0;
}
h1 { font-size: 20px; color: #262626; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; gap: 4px 0; }
nav a { color: #1890ff; text-decoration: none; margin-left: 16px; font-size: 14px; line-height: 24px; }
nav a:hover { text-decoration: underline; }
nav a.active { color: #fa8c16; font-weight: 600; }

/* 顶栏右上角的用户菜单（当前登录人 / 改密码 / 设置 / 退出登录） */
.user-menu { position: relative; margin-left: auto; padding-left: 16px; }
.user-menu-btn {
  color: #1890ff; background: none; border: 0; cursor: pointer; padding: 0;
  font-size: 14px; line-height: 24px; font-family: inherit; white-space: nowrap;
}
.user-menu-btn:hover { text-decoration: underline; }
.user-menu-panel {
  position: absolute; top: 26px; right: 0; min-width: 168px; padding: 4px 0;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12); z-index: 1000; text-align: left;
}
.user-menu-head {
  padding: 7px 14px; font-size: 12px; color: #8c8c8c;
  border-bottom: 1px solid #f0f0f0; margin-bottom: 4px;
}
.user-menu-panel button {
  display: block; width: 100%; text-align: left; padding: 7px 14px;
  font-size: 13px; color: #262626; background: none; border: 0;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.user-menu-panel button:hover { background: #f5f5f5; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; flex-shrink: 0; }
.tabs button {
  padding: 8px 18px; border: 1px solid #d9d9d9; border-radius: 4px 4px 0 0;
  background: #fafafa; cursor: pointer; font-size: 14px; color: #595959;
}
.tabs button.active { background: #fff; color: #1890ff; border-bottom-color: #fff; font-weight: 600; }

.panel {
  background: #fff; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden; margin-bottom: 14px;
  display: flex; flex-direction: column; min-height: 0;
}
/* 主面板（数据表）占满剩余高度 */
.panel-main { flex: 1; min-height: 0; }
.panel-head {
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.panel-head .meta { font-size: 12px; color: #8c8c8c; font-weight: normal; }
.panel-head .actions { display: flex; align-items: center; gap: 12px; }

/* 字典页关键字搜索框（面板头右侧，紧挨「共 N 条」） */
.dict-search {
  padding: 5px 9px; border: 1px solid #d9d9d9; border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fff; width: 300px;
  flex-shrink: 0;   /* 窗口窄的时候不要被 flex 挤窄（挤窄了 placeholder 才会真被截断） */
}
.dict-search:focus { border-color: #1890ff; outline: none; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0; }
.filters .lbl { font-size: 13px; color: #595959; }
.filters input, .filters select {
  padding: 5px 9px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; font-family: inherit;
  background: #fff;
}
.filters input[type=text] { width: 220px; }
.filters input[type=month], .filters input[type=date] { width: 150px; }

/* 多选筛选：一个按钮 + 勾选面板（命中任一即列出） */
.msel { position: relative; }
.msel-btn {
  min-width: 96px; max-width: 240px; padding: 5px 9px; text-align: left;
  border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; font-family: inherit;
  background: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msel-btn:hover { border-color: #1890ff; color: #1890ff; }
.msel-btn.active { border-color: #1890ff; color: #1890ff; background: #f0f8ff; }
.msel-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 900;
  min-width: 180px; max-height: 260px; overflow: auto; padding: 6px 0;
  background: #fff; border: 1px solid #d9d9d9; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.msel-tip { padding: 4px 12px 6px; font-size: 11px; color: #8c8c8c; border-bottom: 1px solid #f0f0f0; margin-bottom: 4px; }
.msel-opt { display: flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 13px; color: #262626; cursor: pointer; white-space: nowrap; }
.msel-opt:hover { background: #f0f8ff; }
/* 自绘复选框（.filters input 的通用样式会把原生勾选框撑变形） */
.msel-opt input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 14px; height: 14px; margin: 0;
  padding: 0; border: 1px solid #d9d9d9; border-radius: 2px; background: #fff; cursor: pointer; position: relative;
}
.msel-opt input[type=checkbox]:checked { background: #1890ff; border-color: #1890ff; }
.msel-opt input[type=checkbox]:checked::after {
  content: '✓'; position: absolute; left: 2px; top: -2px; color: #fff; font-size: 12px; line-height: 14px;
}

/* 口径说明（汇总页） */
.note-row { padding: 0 16px 10px; font-size: 12px; color: #8c8c8c; line-height: 1.7; flex-shrink: 0; }
/* 汇总页表格下方的附加提示（如未对账金额合计） */
.extra-row { padding: 8px 16px; font-size: 12px; color: #d46b08; border-top: 1px solid #f0f0f0; flex-shrink: 0; white-space: pre-line; }

.btn { padding: 6px 14px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; cursor: pointer; background: #fff; font-family: inherit; }
.btn:hover { border-color: #1890ff; color: #1890ff; }
.btn:disabled { color: #bfbfbf; border-color: #e8e8e8; cursor: not-allowed; background: #fafafa; }
.btn:disabled:hover { border-color: #e8e8e8; color: #bfbfbf; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; background: #fff; font-family: inherit; }
.btn-sm:hover { border-color: #1890ff; color: #1890ff; }
.btn-danger { color: #cf1322; border-color: #ffa39e; }
.btn-danger:hover { color: #fff; background: #cf1322; border-color: #cf1322; }
/* 小号主按钮：.btn-sm 排在 .btn-primary 后面会盖掉它的背景色（白底白字看不见）→ 补一条组合规则 */
.btn-sm.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-sm.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }

/* 数据区自己滚动（纵向 + 横向），表头吸顶 */
.table-wrap { flex: 1; min-height: 160px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #fafafa; }
th { padding: 8px 8px; text-align: left; font-size: 12px; color: #595959; font-weight: 600; border-bottom: 1px solid #e8e8e8; white-space: nowrap; position: sticky; top: 0; z-index: 2; background: #fafafa; }
/* 带口径说明的列标题：鼠标移上去显示提示 */
th[title] { cursor: help; }
th[title]:hover { color: #1890ff; }
td { padding: 8px 8px; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
tbody tr:hover { background: #fafafa; }
/* 合计行固定在表体底部 —— 不用滚到最下方才看得到 */
tbody tr.total td {
  font-weight: 600;
  background: #fafafa;
  border-top: 2px solid #d9d9d9;
  position: sticky;
  bottom: 0;
  z-index: 1;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}
.mono { font-family: "SF Mono", Consolas, monospace; font-weight: 600; color: #1890ff; }
/* 二级（主从）展示：一级行 = 一张单，二级行 = 明细 */
tr[hidden] { display: none !important; }
tbody tr.grp { background: #f5f8fc; cursor: pointer; }
tbody tr.grp:hover { background: #eaf2fb; }
tbody tr.grp td { font-weight: 600; }
tbody tr.grp .grp-arrow { display: inline-block; width: 14px; color: #1890ff; font-size: 12px; cursor: pointer; }
tbody tr.grp-child { background: #fcfdff; }
tbody tr.grp-child td { color: #595959; font-weight: 400; }
tbody tr.grp-child td.idx { color: #b0b0b0; }
/* 备注类长文本：限宽 + 省略号，悬停看全文 */
.note-clip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }
td.idx, th.idx { width: 56px; text-align: center; color: #8c8c8c; }
td.idx { width: 96px; }
/* 调整显示顺序：拖拽把手 + 上下移按钮。
   控件放在序号/行号列（那列本来就空着），操作列保持原样 → 表格总宽度不变，不会多出横向滚动条 */
.drag-h { cursor: grab; color: #bfbfbf; user-select: none; font-size: 11px; margin-right: 2px; }
.drag-h:hover { color: #1890ff; }
.btn-sort { padding: 0 3px; font-size: 11px; line-height: 18px; }
.btn-sm:disabled { color: #bfbfbf; border-color: #e8e8e8; background: #fafafa; cursor: not-allowed; }
/* 拖动中的行半透明；落点用蓝线提示插在上方还是下方 */
tbody tr.sortable.dragging { opacity: .45; }
tbody tr.drop-above > td { box-shadow: inset 0 2px 0 #1890ff !important; }
tbody tr.drop-below > td { box-shadow: inset 0 -2px 0 #1890ff !important; }
/* 操作列固定在右侧：横向滚动时「改/删」始终可见，不会被推出屏幕 */
th.op, td.op {
  position: sticky; right: 0; z-index: 3;
  background: #fff;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.05);
}
/* border-collapse 下 sticky 单元格滚动时底边框会消失 → 用内阴影补一条 */
td.op { box-shadow: -2px 0 4px rgba(0, 0, 0, 0.05), inset 0 -1px 0 #f0f0f0; }
th.op { z-index: 4; background: #fafafa; }
tbody tr:hover td.op { background: #fafafa; }
tr.grp td.op { background: #f5f8fc; }
tr.grp:hover td.op { background: #eaf2fb; }
tr.grp-child td.op { background: #fcfdff; }
tr.total td.op { background: #fafafa; }
.tag { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #f0f0f0; color: #595959; }
.tag.ok { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.tag.warn { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }
.tag.bad { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }
/* 疑似漏记发货的行（订单毛利表）：整行淡红底 */
tbody tr.ship-miss { background: #fff1f0; }
/* 期望交期预警：已超期（红）/ 今天·明天到期（黄），只对未完成的单生效 */
/* 交期格子：高对比实底色 + 图标 */
.overdue { background: #cf1322; color: #fff; border-radius: 3px; padding: 0 5px; font-weight: 600; }
.soon { background: #fa8c16; color: #fff; border-radius: 3px; padding: 0 5px; font-weight: 600; }
/* 没填交期、下单很久还没完成（缺交期信息，待跟进）—— 中性灰，不跟红/黄报警色混淆 */
.stale { background: #595959; color: #fff; border-radius: 3px; padding: 0 5px; font-weight: 600; }
/* 整行淡底色（比格子浅，避免抢读） */
tbody tr.dl-over, tbody tr.grp.dl-over, tbody tr.grp-child.dl-over { background: #fff1f0; }
tbody tr.dl-soon, tbody tr.grp.dl-soon, tbody tr.grp-child.dl-soon { background: #fff7e6; }
tbody tr.dl-over td.op, tbody tr.grp.dl-over td.op, tbody tr.grp-child.dl-over td.op { background: #ffe7e5; }
tbody tr.dl-soon td.op, tbody tr.grp.dl-soon td.op, tbody tr.grp-child.dl-soon td.op { background: #fff1d6; }
tbody tr.dl-stale, tbody tr.grp.dl-stale, tbody tr.grp-child.dl-stale { background: #f5f5f5; }
tbody tr.dl-stale td.op, tbody tr.grp.dl-stale td.op, tbody tr.grp-child.dl-stale td.op { background: #ebebeb; }
/* 金额异常：数量 > 1 但金额 = 单价（疑似漏乘数量）—— 整行淡红底 + 金额格标红 */
tbody tr.amt-warn, tbody tr.grp-child.amt-warn { background: #fff1f0; }
tbody tr.amt-warn td.op, tbody tr.grp-child.amt-warn td.op { background: #ffe7e5; }
.amt-bad { color: #cf1322; font-weight: 600; }
.amt-badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 9px;
             font-size: 12px; line-height: 18px; background: #fff1f0; color: #cf1322;
             border: 1px solid #ffa39e; cursor: help; }
/* 可点的异常徽标（顶部「只看异常」开关 + 一级行 ⚠N） */
.amt-badge.amt-btn { font-family: inherit; appearance: none; -webkit-appearance: none; cursor: pointer; }
.amt-badge.amt-btn:hover { background: #ffe7e5; border-color: #ff7875; }
.pay-cell { line-height: 1.7; }
.pay-cell b { font-weight: 600; color: #262626; }
/* 抵扣差额（可抵扣金额 − 付款金额）：正 = 供应商让利，负 = 实付多于账面抵扣 */
.diff-plus { color: #389e0d; font-weight: 600; }
.diff-minus { color: #d46b08; font-weight: 600; }
.diff-zero { color: #8c8c8c; }
.diff-tip { margin-top: 2px; }
.empty { padding: 40px 20px; text-align: center; color: #999; font-size: 14px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 10000; }
/* 弹窗：顶部/底部固定，中间内容滚动（标题栏和「保存/取消」用 sticky 钉住） */
.modal { background: #fff; border-radius: 8px; padding: 0 20px 20px; width: 640px; max-width: 94%; max-height: 90vh; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.modal h3 { font-size: 16px; margin-bottom: 12px; color: #262626; }
/* 弹窗标题栏（标题 + 右上角关闭钮）；点遮罩空白不关弹窗，关闭入口放这里 */
.modal .modal-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; background: #fff; margin: 0 -20px 12px; padding: 14px 20px 10px; }
/* 没标题栏的小弹窗（备注 / 单选 / 快照）：直接用 h3 当标题，同样固定在顶部 */
.modal > h3 { position: sticky; top: 0; z-index: 5; background: #fff; margin: 0 -20px 12px; padding: 14px 20px 10px; }
.modal .modal-head h3 { margin: 0; }
.modal .modal-x { border: none; background: transparent; font-size: 22px; line-height: 1; color: #8c8c8c; cursor: pointer; padding: 0 2px; }
.modal .modal-x:hover { color: #262626; }
/* 弹窗可拖动：标题栏/标题即把手 */
.modal .modal-head, .modal > h3 { cursor: move; }
body.dragging-modal, body.dragging-modal .modal, body.dragging-modal .modal * { cursor: grabbing; }
.modal .form-grid { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; align-items: center; }
/* 宽弹窗（订单台账）：字段排两列对，别拉成一长条 */
.modal.wide-lg .form-grid { grid-template-columns: 120px 1fr 120px 1fr; column-gap: 16px; }
.modal .form-grid label { font-size: 13px; color: #595959; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 6px 9px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; font-family: inherit;
}
.modal textarea { min-height: 60px; resize: vertical; }
/* 金额行：输入框 + 「∑ 算金额」按钮同一行（按钮在输入框右侧） */
.modal .money-row { display: flex; gap: 6px; align-items: center; }
.modal .money-row > input { flex: 1 1 auto; min-width: 0; width: auto; }
.modal .money-row > button { flex: 0 0 auto; white-space: nowrap; }
.modal .hint { font-size: 12px; color: #8c8c8c; margin-top: 4px; }
/* 加工工艺芯片 + 已完成工艺圆点（与订单列表页项目编辑同形态） */
.craft-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.craft-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 3px 2px 8px; border: 1px solid #91caff; border-radius: 10px;
  background: #f0f8ff; color: #0958d9; font-size: 12px; line-height: 18px;
}
.craft-chip-x {
  border: 0; background: transparent; color: #91caff; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px;
}
.craft-chip-x:hover { color: #cf1322; }
.modal .craft-add { width: auto; padding: 2px 6px; font-size: 12px; color: #595959; }
.craft-dots { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.craft-dot-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; }
.craft-dot {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid #d9d9d9; background: #fff;
  cursor: pointer; padding: 0; color: #fff; font-size: 9px; line-height: 1;
}
.craft-dot.on { border-color: #52c41a; background: #52c41a; }
.craft-dot:disabled { cursor: not-allowed; }
.craft-dot-label { color: #8c8c8c; }
.craft-dot-label.on { color: #262626; }
.craft-hint { font-size: 12px; color: #bfbfbf; }
/* 明细表里的工艺控件：格子窄，别把表格撑太开 */
.detail-table .craft-chips, .detail-table .craft-dots { max-width: 300px; }
/* 明细表输入框别被挤成一条缝 */
.detail-table td input, .detail-table td select { min-width: 70px; }
/* 底部操作条：固定在弹窗底部（跟着内容一起滚走就没法随时保存了） */
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; z-index: 5; background: #fff; margin: 16px -20px -20px; padding: 12px 20px 20px; border-top: 1px solid #f0f0f0; }

/* 单选弹窗（导入时的行序方式） */
.modal .choice-list { display: flex; flex-direction: column; gap: 4px; }
.modal .choice {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  border: 1px solid #f0f0f0; border-radius: 4px; cursor: pointer;
}
.modal .choice:hover { border-color: #91caff; background: #f0f8ff; }
.modal .choice input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.modal .choice-label { font-size: 13px; color: #262626; }
.modal .choice-hint { font-size: 12px; color: #8c8c8c; display: block; margin-top: 2px; }

/* 单据弹窗：单据头 + 明细表格（一张单多个品名/规格） */
.modal.wide { width: 1120px; }
/* 订单台账再加一档：字段 15 个 + 明细表 10 列，960/1120 都挤 */
.modal.wide-lg { width: 1240px; }
.detail-sec { margin-top: 16px; }
.detail-tip { font-size: 12px; color: #8c8c8c; margin-bottom: 8px; }
/* 现付采购单：勾选框 + 付款信息区（新增采购单弹窗底部） */
.cash-sec { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e8e8e8; }
.cash-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #595959; cursor: pointer; }
.modal .cash-check input { width: auto; margin: 0; }
.cash-pay { margin-top: 10px; padding: 10px 12px; border: 1px solid #ffe58f; background: #fffbe6; border-radius: 4px; }
.modal .cash-pay .form-grid { grid-template-columns: 110px 1fr; gap: 8px 10px; }
.cash-att-host { margin-top: 10px; }
.cash-sum { margin-top: 8px; font-size: 13px; font-weight: 600; color: #595959; }
.cash-sum.diff-pos { color: #52c41a; }
.cash-sum.diff-neg { color: #cf1322; }
.detail-wrap { border: 1px solid #f0f0f0; border-radius: 4px; overflow-x: auto; }
.detail-table th { padding: 6px 8px; }
.detail-table td { padding: 4px 6px; }
.detail-table input { padding: 4px 6px; }
.detail-table td.idx { width: 52px; text-align: center; }
/* 操作列多一个「🧮 报价计算器」按钮时放宽 */
.detail-table td.idx.op2 { width: 86px; }
.detail-table .btn-danger { padding: 2px 8px; }
/* 明细表底部合计行（口径同台账表格：数量求和 / 单价加权平均 / 金额求和） */
.detail-table tfoot td {
  font-weight: 600; background: #fafafa; border-top: 2px solid #d9d9d9;
  position: sticky; bottom: 0; z-index: 1;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}
/* 明细表上方的「关联订单」选择器：输关键词 → 列出匹配订单 → 选中带出整单明细 */
.order-link { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.order-link label { font-size: 13px; color: #595959; white-space: nowrap; }
.order-link .btn { white-space: nowrap; flex-shrink: 0; }
.order-link .btn:disabled { color: #bfbfbf; border-color: #e8e8e8; cursor: not-allowed; background: #fafafa; }
.order-link .btn:disabled:hover { border-color: #e8e8e8; color: #bfbfbf; }
/* 订单搜索框 + 自建候选下拉（原生 datalist 搜不了品名/规格/备注） */
.os-combo { position: relative; flex: 1; max-width: 520px; }
.os-combo input { width: 100%; }
.os-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: #fff; border: 1px solid #d9d9d9; border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 260px; overflow: auto; margin-top: 2px;
}
.os-item { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f5f5f5; }
.os-item:hover { background: #f5f5f5; }
.os-t1 { font-size: 13px; color: #1890ff; font-weight: 600; }
.os-t2 { font-size: 12px; color: #8c8c8c; margin-top: 1px; }
.os-empty { padding: 12px; color: #999; font-size: 12px; text-align: center; }
/* 数量列下方：订单数量 → 本次发货数量（分批发货时一眼看得出差多少） */
.qty-hint { font-size: 11px; color: #8c8c8c; margin-top: 2px; line-height: 1.2; }
.qty-hint-diff { color: #d46b08; }

/* ===== 报价计算器（订单台账）===== */
/* 报价计算器（视觉对齐 订单列表.html 的「耗材参数 / 线割参数」区） */
.qc { margin: 10px 0 4px; border: 1px solid #f0f0f0; border-radius: 6px; background: #fff; }
.qc-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; }
.qc-title { font-size: 13px; font-weight: 600; color: #262626; }
.qc-hint { font-size: 12px; color: #1890ff; }
.qc-body { padding: 10px 12px; }
.qc-box { border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; }
.qc-box.qc-steel { border: 1px dashed #b7eb8f; background: #f6ffed; }
.qc-box.qc-wire { border: 1px dashed #91d5ff; background: #e6f7ff; }
.qc-box.qc-other { border: 1px dashed #ffd591; background: #fff7e6; }
.qc-box-t { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.qc-steel .qc-box-t { color: #52c41a; }
.qc-wire .qc-box-t { color: #1890ff; }
.qc-other .qc-box-t { color: #d46b08; }
.qc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.qc-grid .field { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.qc-grid .field label { font-size: 11px; color: #8c8c8c; line-height: 1.4; }
.qc-grid .field input, .qc-grid .field select { padding: 4px 6px; font-size: 12px; }
.qc-grid .field input[readonly] { background: #f5f5f5; }
.qc-r-weight { background: #f5f5f5; font-weight: 600; color: #52c41a; }
.qc-r-fee { background: #f5f5f5; font-weight: 600; color: #1890ff; }
.qc-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11px; color: #8c8c8c; margin-top: 8px; }
.qc-line .btn { font-size: 11px; padding: 1px 8px; }
.qc-tip { font-size: 11px; color: #8c8c8c; margin-top: 6px; line-height: 1.6; }
.qc-out { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed #f0f0f0; margin-top: 8px; padding-top: 10px; }
.qc-row { display: flex; flex-direction: column; gap: 2px; }
.qc-k { font-size: 11px; color: #8c8c8c; }
.qc-v { font-size: 13px; color: #262626; font-family: ui-monospace, Menlo, Consolas, monospace; word-break: keep-all; line-height: 1.6; }
.qc-v.big { font-size: 16px; font-weight: 600; color: #1890ff; }
.qc-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* 采购单：带出的订单明细只作参考，提示用户改成实际采购的料（改过品名后消失） */
.ref-hint { font-size: 11px; color: #d46b08; margin-top: 2px; line-height: 1.2; }

#toast { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 10px 18px; border-radius: 4px; color: #fff; font-size: 13px; opacity: 0; transition: opacity 0.2s; white-space: pre-line; max-width: 520px; }
#toast.show { opacity: 1; }
#toast.ok { background: #52c41a; }
#toast.err { background: #cf1322; }

/* 历史快照面板 */
.snapshot-list { padding: 0; margin: 0; list-style: none; }
/* 快照按钮上的数量角标 */
.snap-count { margin-left: 4px; font-size: 11px; color: #1890ff; }
/* 弹窗里的快照列表：限高，超出自身滚动 */
.modal .snapshot-list { max-height: 46vh; overflow: auto; border: 1px solid #f0f0f0; border-radius: 4px; }
.snapshot-list li {
  list-style: none; padding: 8px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.snapshot-list li:last-child { border-bottom: none; }
.snapshot-list .ts { font-family: "SF Mono", Consolas, monospace; font-size: 13px; color: #262626; }
.snapshot-list .size { font-size: 12px; color: #8c8c8c; margin-left: 8px; }
.snapshot-list .actions { display: flex; gap: 8px; flex-shrink: 0; }
.snapshot-list .note {
  margin-top: 4px; font-size: 12px; color: #595959;
  background: #fafafa; padding: 4px 8px; border-radius: 4px;
  border-left: 3px solid #1890ff; white-space: pre-wrap;
}
.snapshot-list .note.plain { border-left-color: #d9d9d9; color: #bfbfbf; }
.snapshot-list li.empty { display: block; text-align: center; color: #999; }

/* ===== T80: 台账附件 ===== */
/* 单据号后面的附件图标 chip（样式对齐订单列表页的 .attach-icon） */
.att-cell {
  cursor: help; font-size: 12px; padding: 1px 7px; border-radius: 10px;
  background: #f0f0f0; color: #1890ff; line-height: 1.4; margin-left: 6px;
  white-space: nowrap;
}
.att-cell:hover { background: #e6f7ff; }

/* 附件面板 */
.att-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.att-tip { font-size: 12px; color: #8c8c8c; }
.att-list { border: 1px solid #f0f0f0; border-radius: 4px; max-height: 46vh; overflow: auto; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #f5f5f5; }
.att-row:last-child { border-bottom: none; }
.att-row:hover { background: #fafafa; }
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
/* 面板里的文件名可点（可预览的打开大图，不可预览的下载） */
.att-name-link { color: #1890ff; cursor: pointer; text-decoration: none; }
.att-name-link:hover { text-decoration: underline; }
.att-size, .att-time { font-size: 12px; color: #8c8c8c; white-space: nowrap; }
.att-actions { display: flex; gap: 6px; flex-shrink: 0; }
.att-empty-tip { padding: 24px; text-align: center; color: #999; font-size: 13px; }
.att-preview-box { margin-top: 12px; text-align: center; border-top: 1px solid #f0f0f0; padding-top: 12px; }
.att-preview-box img { max-width: 100%; max-height: 52vh; border: 1px solid #f0f0f0; border-radius: 4px; }

/* hover 气泡：鼠标移到 📎 角标就弹出文件列表（对齐订单列表页 .drawing-popup） */
.att-popup {
  position: absolute; background: #fff; border: 1px solid #d9d9d9;
  border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 6px; z-index: 1000; min-width: 240px; max-width: 360px;
  font-size: 13px; color: #2c3e50;
}
.att-popup .popup-head {
  padding: 4px 8px 6px; font-size: 12px; color: #8c8c8c;
  border-bottom: 1px solid #f0f0f0; margin-bottom: 2px;
}
.att-popup .file-item {
  display: block; padding: 5px 8px; color: #1890ff;
  text-decoration: none; border-radius: 4px; word-break: break-all;
}
.att-popup .file-item:hover { background: #e6f7ff; text-decoration: underline; }
.att-popup .file-item .ftag { color: #bfbfbf; font-size: 11px; margin-left: 4px; }
.att-popup .popup-empty { padding: 6px 8px; color: #999; font-size: 12px; }

/* 新增弹窗内的附件区（单号生成后即可上传；号变了附件自动搬过去） */
.att-inline { margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0f0f0; }
.att-inline-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: #262626; margin-bottom: 8px; }
.att-inline .att-list { max-height: 28vh; }
.att-inline .att-toolbar { margin-bottom: 8px; }

/* 全屏预览层（点文件名打开） */
.att-viewer {
  /* 遮罩别太深：弹窗挪开后底下的台账表格还要能看清（对账时要对着看） */
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 20000;
  display: flex; align-items: center; justify-content: center;
}
.att-viewer .viewer-box {
  background: #fff; border-radius: 8px; padding: 16px; max-width: 92vw; max-height: 92vh;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;   /* 快捷操作面板的定位参照 */
}
.att-viewer .viewer-title { font-size: 14px; font-weight: 600; color: #262626; word-break: break-all; }
/* min-height 不能省：图片尺寸由 JS 按 body 尺寸算，若 body 没有确定高度，
   flex:1 的基础尺寸取内容高度(0) → 算出 scale=0 → 被钳成 10% 的小图 */
.att-viewer .viewer-body { flex: 1; overflow: auto; text-align: center; min-height: 56vh; }
.att-viewer .viewer-body.pdf { min-height: 0; }
/* 图片尺寸完全交给 JS（真实宽高缩放），这里不再用 max-height 硬压，
   否则竖长对账单会被压成看不清的细条 */
.att-viewer .viewer-body img { display: block; }
/* wrap 承载旋转后的视觉尺寸；img 绝对定位居中，旋转时不会撑错滚动区
   wrap 用 block + 左对齐：图片左上角恒在内容原点 (0,0)，缩放/滚动定位才不会偏 */
/* inline-block + 父级 text-align:center → 水平居中；
   超宽时行盒从行首排，不会把左侧裁掉 */
.att-viewer .viewer-wrap { position: relative; display: inline-block; vertical-align: top; }
.att-viewer .viewer-wrap img { position: absolute; top: 50%; left: 50%; transform-origin: center center; }
/* 图片预览时鼠标可拖动平移 */
.att-viewer .viewer-body.pannable { cursor: grab; }
.att-viewer .viewer-body.panning { cursor: grabbing; user-select: none; }
.att-viewer .viewer-body iframe { width: 100%; height: 74vh; border: 0; }
/* 预览工具条：旋转 / 缩放 / 下载 / 关闭 */
.att-viewer .viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: move; user-select: none; }
/* 拖动弹窗时 */
body.dragging-box, body.dragging-box .att-viewer .viewer-bar { cursor: grabbing; }
body.dragging-box .att-viewer .viewer-bar * { pointer-events: none; }
.att-viewer .viewer-tools { display: flex; gap: 6px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.att-viewer .vt-btn { background: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 3px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; color: #595959; line-height: 1; font-family: inherit; }
.att-viewer .vt-btn:hover:not(:disabled) { border-color: #1890ff; color: #1890ff; }
.att-viewer .vt-btn:disabled { opacity: .4; cursor: not-allowed; }
.att-viewer .vt-label { background: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 3px; padding: 4px 10px; font-size: 12px; color: #595959; min-width: 52px; text-align: center; cursor: pointer; user-select: none; }
.att-viewer .vt-btn.wide { width: auto; padding: 0 9px; font-size: 12px; }
.att-viewer .vt-dim { font-size: 12px; color: #8c8c8c; min-width: 78px; text-align: center; user-select: none; }
/* 快捷操作说明面板：点 ⓘ 展开 */
.att-viewer .vt-help {
  position: absolute; right: 14px; z-index: 6; display: none;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
  padding: 10px 12px; font-size: 12px; color: #595959; min-width: 218px;
}
.att-viewer .vt-help.show { display: block; }
.att-viewer .vt-help-title { font-size: 13px; font-weight: 600; color: #262626; margin-bottom: 7px; }
.att-viewer .vt-help-row { display: flex; justify-content: space-between; gap: 20px; line-height: 1.95; }
.att-viewer .vt-help-row span:first-child { color: #8c8c8c; white-space: nowrap; }
.att-viewer .vt-help-row span:last-child { color: #262626; }
.att-viewer .vt-link { color: #1890ff; background: #f5f5f5; border-radius: 3px; padding: 5px 10px; text-decoration: none; font-size: 12px; line-height: 1.4; }
.att-viewer .vt-link:hover { color: #40a9ff; }
.att-viewer .viewer-none { padding: 40px; color: #595959; font-size: 13px; }

/* ===== 可搜索下拉（搜索下拉.js）=====
   原 <select> 隐藏保留在 DOM 里（取值/联动照旧），外面套一个输入框 + 候选面板 */
.ss-wrap { position: relative; display: block; }
.ss-native { display: none !important; }
.ss-input {
  width: 100%; padding: 5px 9px; border: 1px solid #d9d9d9; border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fff; cursor: pointer;
}
.ss-input:focus { border-color: #1890ff; outline: none; }
.ss-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 900;
  min-width: 100%; max-width: 520px; max-height: 280px; overflow: auto; padding: 4px 0;
  background: #fff; border: 1px solid #d9d9d9; border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.ss-panel.up { top: auto; bottom: calc(100% + 4px); }   /* 下方空间不够 → 往上翻 */
.ss-opt { padding: 6px 10px; font-size: 13px; color: #262626; cursor: pointer; white-space: nowrap; }
.ss-opt:hover { background: #f0f8ff; }
.ss-opt.on { background: #eaf2fb; }
.ss-empty { padding: 8px 10px; font-size: 12px; color: #8c8c8c; }
