:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dfe4ec;
  --line-strong: #c3cbd9;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1f6feb;
  --primary-dark: #1858c4;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --head: #eef2f7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Microsoft YaHei", "微软雅黑", -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------------- header ---------------- */
header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  height: 46px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.logo {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  letter-spacing: 1px;
}
nav { display: flex; gap: 4px; }
.tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 13px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.tab:hover { background: var(--head); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.status { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status b { color: var(--text); }

/* ---------------- layout ---------------- */
/*
 * main 是 header 之外剩余空间的容器。
 * 它必须是 flex 容器且 min-height:0，否则里面那个 .view 的
 * `flex:1 1 auto; min-height:0; overflow-y:auto` 全是空话 ——
 * main 是 display:block 时子元素的 flex 属性不起作用，
 * main 又是 overflow:hidden，超出的下半截就被无声裁掉了。
 * 运费规则页「看不到下面」就是这条链断在这里。
 */
main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/*
 * #app 是 header + 各个 .view 的容器。它**必须**是能撑满剩余高度、
 * 且能被压缩（min-height:0）的 flex 容器 —— 否则它就是个普通块级元素，
 * 高度随内容一路长到 2572px，而 body 是 overflow:hidden，
 * 导致下半截页面既滚不动也看不见（运费规则页踩的就是这个坑）。
 */
.app { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.app > header { flex: 0 0 auto; }

.view { display: none; padding: 10px; }
/*
 * 关键：.view.active 必须「能被 flex 压缩 + 自己滚动」。
 * 早先写的是 height:100%，但 body 是 flex 容器、.view 是 flex 子项，
 * 百分比高度解析不出确定值 -> 高度变成 auto -> 内容一路撑开，
 * 而 body 又是 overflow:hidden，结果**下半截页面根本滚不到**（运费规则页就是这样）。
 */
.view.active {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
/* 文档型页面（运费规则/历史/数据源/合同设置/账号管理）：卡片随内容长高，由 .view 滚动 */
.view.active > .pane.wide { height: auto; min-height: 0; }
.split { display: grid; grid-template-columns: minmax(420px, 44%) 1fr; gap: 10px; height: 100%; }
/* 开单页：检索 | 报价单 | 预计运费 */
.split3 {
  display: grid;
  grid-template-columns: minmax(340px, 26%) minmax(420px, 1fr) minmax(238px, 20%);
  gap: 10px;
  height: 100%;
}
@media (max-width: 1500px) {
  .split3 { grid-template-columns: minmax(300px, 24%) minmax(380px, 1fr) minmax(216px, 19%); }
}

/* ---------------- 预计运费模块 ---------------- */
.freight-pane .pane-title { margin: 0; font-size: 14px; }
.freight-body { padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 9px; }
.fld { display: block; }
.fld > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.fld select, .fld input { width: 100%; }
.fld .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.fld.checkbox { display: flex; align-items: center; gap: 6px; }
.fld.checkbox input { width: auto; }
.fld.checkbox span { margin: 0; color: var(--text); }
.region-row { display: flex; flex-direction: column; gap: 5px; }
button.wide { width: 100%; }
.tip { color: var(--muted); font-size: 11px; line-height: 1.5; }
.tip code { background: var(--head); padding: 1px 4px; border-radius: 3px; font-size: 11px; }

.freight-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fafbfd;
  margin-top: 2px;
}
.fr-amount { display: flex; justify-content: space-between; align-items: baseline; }
.fr-amount span { color: var(--muted); font-size: 12px; }
.fr-amount b { font-size: 20px; color: var(--primary); }
.fr-detail { color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.5; }
.fr-warn { color: var(--warn); font-size: 11px; line-height: 1.5; }
.fr-warn:empty { display: none; }

/* ---------------- 收件地址识别 ---------------- */
.addr-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fafbfd;
}
.addr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.addr-head span { font-size: 12px; font-weight: 600; }
.addr-panel { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.addr-panel textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  resize: vertical;
  line-height: 1.5;
}
.addr-result { display: flex; flex-direction: column; gap: 6px; }
.addr-result .fld { margin: 0; }
.sub.err { color: var(--danger); }

/* ---------------- 运费规则管理 ---------------- */
.rule-card { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: #fff; }
.rule-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: #fafbfd; border-bottom: 1px solid var(--line);
}
.rule-head b { font-size: 13px; }
.rule-head .badge { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--head); color: var(--muted); }
.rule-head .badge.jst { background: #e8f2ff; color: var(--primary); }
.rule-head .right { margin-left: auto; display: flex; gap: 6px; }
.rule-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rule-table th, .rule-table td { border-bottom: 1px solid var(--line); padding: 4px 6px; }
.rule-table th { background: #fafbfd; font-weight: 600; }
.rule-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding: 8px 10px; background: #f7f9fc; }
.rule-form label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.rule-form input, .rule-form select { padding: 4px 6px; font-size: 12px; }
.rule-form input.num { width: 72px; }
.rule-form input.prov { width: 122px; }
.rule-form .actions { padding: 0; border: none; background: none; }

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.pane.wide { margin: 0 auto; max-width: 1100px; }
.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.pane-head.col { flex-direction: column; align-items: stretch; gap: 6px; }
.pane-head h2 { margin: 0; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
label.grow { flex: 1 1 200px; }
label.grow input { flex: 1 1 auto; }

input, button, select {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 5px 8px;
  background: #fff;
  color: var(--text);
}
input:focus { outline: 2px solid rgba(31,111,235,.25); border-color: var(--primary); }
input.sm { width: 108px; }
input.xs { width: 64px; }
button { cursor: pointer; background: #f7f8fa; }
button:hover { background: var(--head); }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.primary:hover { background: var(--primary-dark); }
button.danger { color: var(--danger); border-color: #f3c2c2; }
button.sm { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

#kw { flex: 1 1 auto; min-width: 200px; }

.hint { padding: 5px 10px; color: var(--muted); font-size: 12px; min-height: 22px; }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }

/* ---------------- 表格 ---------------- */
.table-wrap { flex: 1 1 auto; overflow: auto; }
.table-wrap.flex { min-height: 0; }

/* 列宽可调的表：横向滚动，绝不压缩列把内容藏起来 */
.hscroll { overflow-x: auto; overflow-y: auto; }
.hscroll > table { table-layout: fixed; width: max-content; min-width: 100%; }
.hscroll > table th, .hscroll > table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hscroll > table td input { width: 100%; }

/* 列宽拖拽手柄 */
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 3;
}
.col-resizer::after {
  content: '';
  position: absolute;
  top: 15%;
  right: 3px;
  width: 1px;
  height: 70%;
  background: var(--line-strong);
  opacity: 0;
  transition: opacity .12s;
}
th:hover .col-resizer::after { opacity: 1; }
.col-resizer:hover::after { opacity: 1; background: var(--primary); width: 2px; }
body.col-resizing { cursor: col-resize !important; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }
thead th { position: sticky; top: 0; background: var(--head); z-index: 2; }

table { border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: middle; }
th {
  position: sticky;
  top: 0;
  background: var(--head);
  font-weight: 600;
  z-index: 1;
  font-size: 12px;
  white-space: nowrap;
}
td.num, th.num { text-align: right; }
td.ctr, th.ctr { text-align: center; }
tbody tr:hover { background: #f0f6ff; }
tr.picked { background: #e8f2ff; }
td input { width: 100%; padding: 3px 5px; border-radius: 4px; }
td.name { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cartTable input[type="number"] { min-width: 50px; }
/* 单价与金额居中显示（需求4），输入框内的数字也居中 */
td.ctr input.ctr-input { text-align: center; }
td.amt-cell { text-align: center; }
td.seq-cell { color: var(--muted); }
/* 鼠标停在哪一行，整行高亮 + 光标提示（该行 title 里有成本单价与毛利） */
#cartTable tbody tr { cursor: help; }
#cartTable tbody tr:hover { background: #e8f2ff; }
#cartTable tbody tr:hover td.seq-cell { color: var(--primary); font-weight: 600; }
.oos { color: var(--danger); font-weight: 600; }
.low { color: var(--warn); font-weight: 600; }
.in-stock { color: var(--ok); }

.empty { padding: 30px; text-align: center; color: var(--muted); }
.empty.hide { display: none; }

/* ---------------- totals / actions ---------------- */
.totals {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
/*
 * 合计那一排：每块都**不参与压缩**（flex: 0 0 auto）+ 不换行。
 * 只写 flex-direction: column 的话，窗口一窄 flex 会把每块压窄，
 * 而「￥1050.00」这种长数字没有断行点，就会溢出到相邻块上 ——
 * 看起来就是两个金额叠在一起。
 */
.tot { display: flex; flex-direction: column; flex: 0 0 auto; white-space: nowrap; }
.tot span { color: var(--muted); font-size: 11px; }
.tot b { font-size: 15px; }
.tot.big b { font-size: 20px; color: var(--primary); }
.tot.cn { flex: 1 1 auto; min-width: 160px; white-space: normal; }
.tot.cn b { font-size: 12px; font-weight: 500; }

.actions {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  align-items: center;
}
.actions button { white-space: nowrap; }

/* ---------------- status page ---------------- */
.status-body { padding: 12px; overflow: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fafbfd; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 18px; font-weight: 600; margin-top: 3px; }
.card .note { color: var(--muted); font-size: 11px; margin-top: 3px; }
.check { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.check .icon { width: 18px; text-align: center; flex: 0 0 auto; }
.check.ok .icon { color: var(--ok); }
.check.bad .icon { color: var(--danger); }
.check.warn .icon { color: var(--warn); }
.check .nm { width: 128px; flex: 0 0 auto; }
.check .ms { color: var(--muted); flex: 1 1 auto; }
.actions-line { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
h3 { font-size: 13px; margin: 16px 0 6px; }
.banner {
  padding: 9px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.6;
}
.banner.warn { background: #fff7e6; border: 1px solid #ffe0a3; color: #8a5300; }
.banner.err { background: #fdecec; border: 1px solid #f7c6c6; color: #9b1c1c; }
.banner.ok { background: #eafbf0; border: 1px solid #b7ecc9; color: #14652f; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 9px 18px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: all .18s ease;
  max-width: 70vw;
  font-size: 13px;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------------- 登录页 ---------------- */
.hidden { display: none !important; }
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #f7f9fc 55%, #eaf1fb 100%);
  z-index: 50;
}
.login-card {
  width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px 28px 22px;
  box-shadow: 0 12px 40px rgba(31, 63, 120, .12);
  text-align: center;
}
.login-logo {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 18px;
  letter-spacing: 3px;
  margin-bottom: 14px;
}
.login-card h1 { font-size: 17px; margin: 0 0 3px; font-weight: 600; }
.login-sub { color: var(--muted); font-size: 12px; margin: 0 0 20px; }
.login-field { display: block; text-align: left; margin-bottom: 12px; }
.login-field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.login-field input { width: 100%; padding: 8px 10px; font-size: 14px; }
.login-error { color: var(--danger); font-size: 12px; min-height: 18px; text-align: left; margin-bottom: 4px; }
.login-btn { width: 100%; padding: 9px; font-size: 15px; letter-spacing: 3px; }
.login-hint { color: var(--muted); font-size: 11px; margin: 14px 0 0; }

/* ---------------- 顶栏用户区 ---------------- */
.user-box { display: flex; align-items: center; gap: 6px; margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); }
#userLabel { font-size: 12px; color: var(--text); white-space: nowrap; }
.status { margin-left: auto; }

/* ---------------- 单元格省略 ---------------- */
td.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 1px; }

/* ---------------- 弹窗 ---------------- */
.dlg { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; min-width: 320px; box-shadow: 0 12px 40px rgba(31,63,120,.18); }
.dlg::backdrop { background: rgba(15, 23, 42, .35); }
.dlg h3 { margin: 0 0 14px; font-size: 15px; }
.dlg-field { display: block; margin-bottom: 10px; }
.dlg-field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.dlg-field input { width: 100%; padding: 7px 9px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------------- 操作日志 ---------------- */
.audit-box { border: 1px solid var(--line); border-radius: 6px; overflow: auto; max-height: 280px; background: #fff; }
.audit-row { display: flex; gap: 10px; padding: 4px 8px; border-bottom: 1px dashed var(--line); font-size: 12px; }
.audit-row:last-child { border-bottom: none; }
.audit-row .at { width: 140px; flex: 0 0 auto; color: var(--muted); }
.audit-row .un { width: 90px; flex: 0 0 auto; }
.audit-row .ac { width: 150px; flex: 0 0 auto; color: var(--primary); }
.audit-row .tg { width: 150px; flex: 0 0 auto; }
.audit-row .dt { flex: 1 1 auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

select.sm { padding: 3px 6px; font-size: 12px; }

/* ---------------- 店铺选择 ---------------- */
.shop-label { display: inline-flex; align-items: center; gap: 5px; }
#shopSelect {
  max-width: 260px;
  padding: 5px 8px;
  font-size: 13px;
}
#shopSelect optgroup { font-style: normal; color: var(--muted); }

/* ---------------- 导入对话框 ---------------- */
.dlg-wide { min-width: 720px; max-width: 92vw; }
.dlg-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.dlg-row .dlg-field { margin-bottom: 0; }
.dlg-field textarea {
  width: 100%;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  resize: vertical;
  line-height: 1.6;
}
.dlg-field input, .dlg-field select { padding: 6px 8px; font-size: 13px; }
#zProvinces { width: 380px; }
#zMin, #zMax, #zFirstW, #zFirstP, #zAddW, #zAddP { width: 96px; }
#zRemark { width: 380px; }
.import-preview { max-height: 260px; overflow: auto; margin: 6px 0; }
.import-preview table { width: 100%; }
.import-ok { color: var(--ok); font-weight: 600; margin-bottom: 6px; }

/* 运费档表格：同样支持横向滚动 + 拖拽列宽 */
#zoneTable { font-size: 12px; }

/* ---------------- 权限对照表 ---------------- */
.perm-matrix { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 6px; }
.perm-matrix table { width: 100%; }
.permkey {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-family: Consolas, monospace;
}
.perm-yes { color: var(--ok); font-weight: 700; }
.perm-no { color: #c3cbd9; }

/* 合同对话框小标题 */
.dlg-sub { font-size: 13px; margin: 12px 0 6px; color: var(--muted); font-weight: 600; }
#contractSummary { max-height: 220px; overflow: auto; }

/* ---------------- 「？」说明气泡 ---------------- */
.help-wrap { position: relative; display: inline-flex; align-items: center; gap: 3px; }
.help-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--head);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  user-select: none;
  flex: 0 0 auto;
}
.help-mark:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.help-pop {
  position: absolute;
  top: 22px;
  left: 0;
  z-index: 40;
  width: 380px;
  background: #1f2937;
  color: #f3f4f6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.75;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .28);
}
.help-pop b { display: block; margin-bottom: 4px; color: #fff; font-size: 13px; }
.help-pop code {
  background: rgba(255, 255, 255, .13);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}
.help-pop div { margin-top: 2px; }

/* ---------------- 对公信息识别 ---------------- */
.biz-parse { border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: #fafbfd; margin-bottom: 8px; }
.biz-head { display: flex; align-items: center; justify-content: space-between; }
.biz-head span { font-size: 12px; font-weight: 600; }
.biz-panel { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; }
.biz-panel textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  resize: vertical;
  line-height: 1.55;
}

/* ---------------- 打印：只打印报价单区，运费模块不打印 ---------------- */
@media print {
  header, nav, .search-pane, .actions, .toast, .pane-head.col,
  #view-status, #view-history, #view-users, #view-freight,
  .freight-pane { display: none !important; }
  body { height: auto; overflow: visible; background: #fff; }
  main, .view, .split, .split3, .pane, .table-wrap { overflow: visible !important; height: auto !important; display: block !important; }
  .split, .split3 { grid-template-columns: 1fr; }
  .pane { border: none; }
  .totals { border: none; }
}

/* ---------------- 导入运费模板：模式切换 + 图片识别 ---------------- */
.import-tabs { display: flex; gap: 6px; margin: 4px 0 10px; border-bottom: 1px solid var(--line); }
.itab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 6px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.itab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.img-drop {
  border: 2px dashed var(--line-strong); border-radius: 8px; padding: 18px;
  text-align: center; cursor: pointer; background: #fafbfd;
  transition: background .15s, border-color .15s;
}
.img-drop:hover, .img-drop.over { border-color: var(--primary); background: #eef4ff; }
.img-drop-main { font-size: 13px; font-weight: 600; color: #374151; }
.img-drop-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.img-drop kbd {
  background: #eef1f5; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 3px; padding: 0 4px; font-size: 11px; font-family: inherit;
}
.img-preview-wrap { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.img-preview-wrap img {
  max-width: 380px; max-height: 240px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff;
}
.img-meta { font-size: 12px; color: var(--muted); }

/* 识别结果的可编辑预览 */
.warn-list {
  background: #fff8e6; border: 1px solid #f0d79a; border-radius: 6px;
  padding: 8px 10px; margin-bottom: 10px; font-size: 12px; line-height: 1.7;
}
.warn-list b { color: #92610a; }
.warn-list ul { margin: 4px 0 0; padding-left: 20px; }
.ov-head {
  font-size: 12px; margin-bottom: 8px; padding: 6px 8px;
  background: #f6f8fb; border-radius: 6px;
}
.ov-head input.xs { width: 56px; }
.ov-table { font-size: 12px; }
.ov-table td { padding: 2px 3px; }
.ov-table input.ov-in {
  width: 100%; padding: 2px 4px; font-size: 12px; text-align: right;
  border: 1px solid var(--line-strong); border-radius: 3px;
}
.ov-table input.ov-in.bad {
  border-color: var(--danger); background: #fff1f1; box-shadow: 0 0 0 2px rgba(220,38,38,.12);
}
.ov-table input.ov-prov {
  width: 100%; padding: 2px 5px; font-size: 12px;
  border: 1px solid var(--line-strong); border-radius: 3px;
}
.warn-text { color: var(--danger); font-weight: 600; }

/* ---------------- 运费档表：操作列固定在右侧 ----------------
 * 早先「编辑/复制/删除」在表格最后一列，而表格比容器宽，必须横向滚到底才能看见，
 * 用户直接以为没有删除功能。做成 sticky 后它始终贴在右边。 */
#zoneTable th:last-child,
#zoneTable td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -4px 0 6px -4px rgba(0, 0, 0, .18);
  z-index: 1;
}
#zoneTable thead th:last-child { background: #fafbfd; z-index: 3; }
#zoneTable tbody tr:hover td:last-child { background: #f7f9fc; }
#zoneTable td:last-child { white-space: nowrap; }

/* 重量上限被截到 5555 时的提示小标 */
.cap-hint { color: var(--muted); font-size: 11px; }

/* ---------------- 图片导入：多张缩略图 ---------------- */
.img-thumbs { display: flex; flex-wrap: wrap; gap: 8px; max-width: 560px; }
.img-thumb { position: relative; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: #fff; }
.img-thumb img { display: block; width: 104px; height: 78px; object-fit: cover; object-position: top left; }
.img-thumb-no {
  position: absolute; left: 3px; top: 3px;
  background: rgba(31, 41, 55, .78); color: #fff;
  font-size: 11px; border-radius: 3px; padding: 0 4px;
}
.img-thumb-del {
  position: absolute; right: 2px; top: 2px;
  width: 18px; height: 18px; line-height: 16px; padding: 0;
  border: none; border-radius: 3px; cursor: pointer;
  background: rgba(220, 38, 38, .88); color: #fff; font-size: 13px;
}
.img-thumb-del:hover { background: #b91c1c; }
.img-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------------- 账号管理：单人权限编辑 ---------------- */
.perm-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.perm-head b { font-size: 13px; }
.perm-head .right { margin-left: auto; display: flex; gap: 6px; }
.perm-edit {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  max-height: 300px; overflow-y: auto; background: #fff;
}
.perm-group { margin-bottom: 8px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-title { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.perm-group-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 2px 10px; }
.perm-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 2px 4px; border-radius: 4px; white-space: normal;
}
.perm-item:hover { background: #f6f8fb; }
.perm-item.changed { background: #fff8e6; }
.perm-item.locked { opacity: .62; }
.perm-item input { flex: 0 0 auto; }
.perm-item span { flex: 1 1 auto; }
.perm-diff {
  flex: 0 0 auto; font-size: 10px; font-weight: 700; color: #92610a;
  background: #fde9b8; border-radius: 3px; padding: 0 3px;
}
.perm-tuned { display: block; font-size: 11px; color: #92610a; margin-top: 2px; }

/* ---------------- 合计金额上的「成本/毛利」气泡 ---------------- */
/* 合计金额上的悬停：只加提示光标和下划线，**不能**带尺寸/形状（那是 .help-mark 的活） */
.tot-help { cursor: help; border-bottom: 1px dashed currentColor; }
.tot-help:hover { filter: brightness(1.1); }
/* 合计在页面右下角，气泡往上弹 */
.help-pop-up { top: auto; bottom: 24px; left: auto; right: 0; }
.help-pop-up::after {
  content: ''; position: absolute; left: auto; right: 22px; bottom: -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 6px solid #1f2937;
}

/* ---------------- 开票主体 + 电子合同章 ---------------- */
.ent-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ent-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff;
}
.ent-card.is-default { border-color: #93c5fd; background: #f7fbff; }
.ent-seal {
  flex: 0 0 auto; width: 76px; height: 76px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-strong); border-radius: 6px; background: #fafbfd;
}
.ent-seal img { max-width: 70px; max-height: 70px; }
.ent-no-seal { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.ent-info { flex: 1 1 auto; min-width: 0; }
.ent-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.ent-badge { margin-left: 6px; background: #dbeafe !important; color: #1d4ed8 !important; }
.ent-line { font-size: 12px; color: var(--muted); line-height: 1.6; }
.ent-warn { color: #b45309; }
.ent-ops { flex: 0 0 auto; display: flex; gap: 5px; }

/* 实体编辑对话框里的章上传区 */
.seal-block { display: flex; gap: 14px; margin: 10px 0 4px; }
.seal-left { flex: 1 1 auto; }
.seal-right { flex: 0 0 auto; width: 190px; }
.seal-head { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.seal-drop {
  border: 2px dashed var(--line-strong); border-radius: 8px; padding: 14px;
  text-align: center; cursor: pointer; background: #fafbfd;
}
.seal-drop:hover, .seal-drop.over { border-color: var(--primary); background: #eef4ff; }
.seal-drop-txt { font-size: 12px; color: var(--muted); line-height: 1.9; }
.seal-actions { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.seal-preview {
  border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff;
  min-height: 110px; display: flex; align-items: center; justify-content: center; padding: 8px;
}
.seal-preview img { max-width: 100%; }

/* 合同对话框里的章缩略图 */
.seal-mini img {
  max-height: 34px; max-width: 34px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}

/* ---------------- 报价单：单位列 + 批量设单位 ---------------- */
.unit-sel {
  width: 100%;
  padding: 2px 2px;
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}
/* 还没选单位时淡一点，一眼看出哪些行没填 */
.unit-sel.is-empty { color: #b6bfcc; }
.unit-bar {
  gap: 8px;
  padding: 6px 0 2px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}
.unit-bar-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------------- 反馈 ---------------- */
.tab-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); margin-left: 4px; vertical-align: top;
}
.fb-item {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; background: #fff;
}
.fb-item.done { background: #fafbfd; opacity: .78; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.fb-kind {
  background: #eef2f7; border-radius: 4px; padding: 1px 6px;
  font-size: 11px; color: #475569;
}
.fb-status { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.fb-status.open { background: #fef3c7; color: #92400e; }
.fb-status.done { background: #dcfce7; color: #166534; }
.fb-body { margin: 6px 0 4px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.fb-reply {
  background: #f1f5f9; border-left: 3px solid var(--primary);
  padding: 5px 8px; border-radius: 4px; font-size: 12px; margin: 5px 0;
}
.fb-ops { display: flex; gap: 6px; margin-top: 6px; }
.fbfilter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
#fbBody {
  width: 100%; font-family: inherit; font-size: 13px; padding: 7px;
  border: 1px solid var(--line-strong); border-radius: 5px; resize: vertical; line-height: 1.6;
}

.login-beian { margin: 10px 0 0; font-size: 11px; }
.login-beian a { color: var(--muted); text-decoration: none; }
.login-beian a:hover { text-decoration: underline; }
