:root {
  --navy: #1f3864;
  --navy-2: #2e75b6;
  --navy-3: #4a8fd4;
  --lblue: #deebf7;
  --paper: #f5f7fa;
  --card: #ffffff;
  --line: #dfe4ec;
  --ink: #1a1d24;
  --ink-2: #5a6273;
  --ink-3: #8b93a5;
  --red: #c0392b;
  --lred: #fdecea;
  --green: #1e7a45;
  --lgreen: #e8f5ec;
  --amber: #a9750a;
  --lamb: #fff8e1;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.side {
  width: 208px;
  flex: 0 0 208px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-brand b { display: block; font-size: 15px; letter-spacing: .3px; }
.side-brand span { display: block; font-size: 11px; color: rgba(255,255,255,.55); margin-top: 3px; }
.side-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 2px;
  color: rgba(255,255,255,.78); font-size: 13.5px; width: 100%; text-align: left;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .ico { width: 17px; text-align: center; font-size: 14px; }
.nav-badge {
  margin-left: auto; background: rgba(255,255,255,.2); border-radius: 9px;
  padding: 1px 7px; font-size: 11px; font-weight: 600;
}
.side-foot { padding: 12px 16px 16px; font-size: 11px; color: rgba(255,255,255,.45); border-top: 1px solid rgba(255,255,255,.12); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 14px 24px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.top h1 { font-size: 17px; font-weight: 600; }
.top .sub { font-size: 12px; color: var(--ink-3); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.view { padding: 20px 24px 40px; flex: 1; }
.view.hide { display: none; }

/* 通用隐藏工具类。
   必须放在这里：登录门的注册面板用 class="auth-pane hide"，不带任何前置限定，
   若没有这条通用规则就会匹配不到 .view.hide / .mask.hide 等限定规则，
   导致"登录"和"注册"两组表单上下同时显示。 */
.hide { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--navy-3); color: var(--navy-2); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ok:hover { background: #16603a; border-color: #16603a; color: #fff; }
.btn-danger { color: var(--red); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--lred); border-color: var(--red); color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* 弹层内的确认按钮沿用主按钮样式 */
.btn-go { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-go:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-h {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-h h3 { font-size: 14px; font-weight: 600; }
.card-h .hint { font-size: 11.5px; color: var(--ink-3); }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--navy-2); }
.kpi.neg::before { background: var(--red); }
.kpi.warn::before { background: var(--amber); }
.kpi.good::before { background: var(--green); }
.kpi .k { font-size: 11.5px; color: var(--ink-3); margin-bottom: 5px; }
.kpi .v { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.kpi .v.neg { color: var(--red); }
.kpi .v.pos { color: var(--green); }
.kpi .x { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
/* 可点击跳转的 KPI 卡片 */
.kpi.link { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.kpi.link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .1);
  border-color: var(--navy-3);
}
.kpi.link .k { display: flex; align-items: center; gap: 5px; }
.kpi.link .go {
  font-size: 10px; color: var(--navy-3); opacity: 0;
  transition: opacity .12s; margin-left: auto;
}
.kpi.link:hover .go { opacity: 1; }
.lnk { color: var(--navy-2); text-decoration: none; font-weight: 600; border-bottom: 1px dashed var(--navy-3); }
.lnk:hover { color: var(--navy); }

/* ---------- 表单 ---------- */
.f-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.f { display: flex; flex-direction: column; gap: 5px; }
.f label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.f label .req { color: var(--red); margin-left: 2px; }
.f input, .f select, .f textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; outline: none; transition: border .15s; width: 100%;
}
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(46,117,182,.1); }
.f input.bad, .f select.bad { border-color: var(--red); background: #fffbfb; }
.f .msg { font-size: 11px; color: var(--red); min-height: 14px; }

/* ---------- 模糊提示输入框 ---------- */
.ac-wrap { position: relative; }
.ac-f label { display: flex; align-items: center; gap: 6px; }
.ac-f .ac-tip {
  font-size: 10px; color: var(--navy-3); background: #eaf2fb;
  border: 1px solid #cfe1f5; border-radius: 4px; padding: 0 5px;
  font-weight: 500; cursor: help;
}
.ac-box {
  position: absolute; top: calc(100% + 3px); left: 0; z-index: 300;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
  /* 明细表格里列宽很窄（名称/型号列仅 130px），若只给 min-width:100% 会被列宽锁死，
     长型号/长客户名只能显示两三个字，且条目高度被压缩到只剩一条。
     这里给一个实用的最小宽度，并允许在父容器不挤压时自由伸展。 */
  min-width: 340px;
  width: max-content;
  max-width: min(560px, 80vw);
  /* 单条约 30px 高（padding 12 + 行高 17.5 + 边距），底部提示约 26px。
     用户要求至少能看 3-5 条 → 5 条 = 150px + 提示 26px ≈ 176px，取 180px。 */
  min-height: 180px;
  max-height: 244px; overflow-y: auto; padding: 3px;
}
.ac-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1.35;
}
.ac-item:hover { background: #f4f8fd; }
.ac-item.on { background: var(--navy); color: #fff; }
.ac-item.on .hl { color: #ffe28a; }
.ac-item.on .ac-n,
.ac-item.on .ac-sub { color: rgba(255, 255, 255, .72); border-color: rgba(255, 255, 255, .3); }
.ac-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-txt .hl { color: #c0392b; font-weight: 600; }
.ac-item.on .ac-txt .hl { color: #ffe28a; }
/* 副标题与次数不参与压缩，确保长型号名也能看出条目边界 */
.ac-sub {
  font-size: 11px; color: var(--ink-3); max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 1px solid var(--line); padding-left: 8px; flex: 0 0 auto;
}
.ac-n {
  font-size: 10.5px; color: var(--ink-3); flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
  font-variant-numeric: tabular-nums;
}
.ac-foot {
  padding: 6px 9px 3px; margin-top: 2px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--ink-3);
}
/* 选中型号后自动带出参考单价的短暂高亮 */
.items-edit tr.ref-filled td { animation: refFlash .9s ease-out; }
@keyframes refFlash {
  0% { background: #fff6d6; }
  100% { background: transparent; }
}
.items-edit .f-ref {
  font-size: 10.5px; color: var(--amber); line-height: 1.3;
  white-space: normal; max-width: 190px;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--ink-2); transition: all .12s;
}
.chip:hover { border-color: var(--navy-3); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 500; }

/* ---------- 明细录入 ---------- */
.items-edit { width: 100%; font-size: 13px; }
.items-edit th {
  background: #f8fafc; border-bottom: 1px solid var(--line); padding: 8px 6px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-align: left; white-space: nowrap;
}
.items-edit td { border-bottom: 1px solid #eef1f6; padding: 3px 6px; vertical-align: middle; }
.items-edit tr:hover td { background: #fafcff; }
.items-edit input, .items-edit select {
  width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; outline: none;
}
.items-edit input:hover, .items-edit select:hover { border-color: var(--line); background: #fff; }
.items-edit input:focus, .items-edit select:focus { border-color: var(--navy-3); background: #fff; box-shadow: 0 0 0 3px rgba(46,117,182,.1); }
.items-edit input.num { text-align: right; font-variant-numeric: tabular-nums; }
.items-edit .calc { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.items-edit .calc.neg { color: var(--red); font-weight: 600; }
/* 编辑弹层的明细输入框列宽。
   实测最长名称 34 字、最长型号 31 字（如 DH-SD-WPT2449DA-ST-PV-4G1-LED-L），
   中文字符约 13px/字、英文字符约 7px/字 → 名称列需 ~260px、型号列需 ~200px。
   低于这个宽度输入框会不断横向滚动，下拉框也会被挤压。 */
.items-edit .f-name { min-width: 240px; }
.items-edit .f-model { min-width: 200px; }
.items-edit .ac-wrap { width: 100%; }
/* 明细表外层 .tbl-wrap 是 overflow-x:auto，会把下拉框裁掉；
   录入弹层（#mdBody）本身可滚动，这里让明细表格容器允许溢出，
   保证型号列靠右时下拉框也能完整显示。 */
#mdBody .items-edit { position: relative; }
#mdBody .tbl-wrap { overflow: visible; min-height: 260px; }
/* 出货明细框整体加高：每行更舒展、留白更多；框体保持舒适最小高度，
   单行录入时也不会显得太矮 */
#mdBody .items-edit th { padding: 10px 6px; }
#mdBody .items-edit td { padding: 9px 6px; }
#mdBody .items-edit input, #mdBody .items-edit select { padding: 7px 8px; }
/* 明细表列加宽后总宽可能超过弹层，弹层本体保留横向滚动兜底 */
#mdBody .card { overflow-x: auto; }

#mdBody .items-edit .ac-box { min-width: 340px; }
/* 注意：不要再给 .items-edit .ac-box 设 min-width:100% ——
   明细表列宽只有 200-240px，100% 会把下拉框压扁成列宽，
   长型号/长名称只能显示两三个字，且条目高度被挤到只剩一条。
   这里只需让输入框撑满单元格。 */
.items-edit td .ac-wrap > input { width: 100%; }
.items-edit .f-qty { min-width: 58px; }
.items-edit .f-cost, .items-edit .f-sup { min-width: 82px; }
.w-num { width: 84px; } .w-name { width: 22%; } .w-model { width: 20%; } .w-qty { width: 68px; } .w-price { width: 96px; }
.row-del { color: var(--ink-3); padding: 4px 7px; border-radius: 5px; }
.row-del:hover { background: var(--lred); color: var(--red); }

.calc-bar {
  display: flex; gap: 22px; padding: 12px 16px; background: #f8fafc;
  border-radius: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center;
}
.calc-bar .ci { display: flex; flex-direction: column; }
.calc-bar .ci .k { font-size: 11px; color: var(--ink-3); }
.calc-bar .ci .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-bar .ci .v.neg { color: var(--red); }
.calc-bar .ci .v.pos { color: var(--green); }
.calc-bar .grow { flex: 1; }

.alert {
  padding: 10px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px;
  display: flex; gap: 9px; align-items: flex-start; line-height: 1.55;
}
.alert-err { background: var(--lred); color: #8c231a; border: 1px solid #f5c6c0; }
.alert-warn { background: var(--lamb); color: #7a5504; border: 1px solid #f5e0aa; }
.alert-ok { background: var(--lgreen); color: #14512e; border: 1px solid #b8e0c6; }
.alert-info { background: var(--lblue); color: #1b4a7a; border: 1px solid #bfd9f0; }

/* ---------- 列表 ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { font-size: 13px; min-width: 1120px; }
.tbl th {
  background: #f8fafc; padding: 9px 10px; text-align: left; font-size: 11.5px;
  font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; cursor: pointer; user-select: none;
}
.tbl th:hover { color: var(--navy-2); }
.tbl th .sort { color: var(--navy-2); font-size: 10px; margin-left: 3px; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; white-space: nowrap; }
.tbl tbody tr:hover td { background: #fafcff; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .neg { color: var(--red); font-weight: 600; }
.tbl .pos { color: var(--green); }
.tbl .dim { color: var(--ink-3); }
.tbl .row-no { color: var(--navy-3); font-weight: 600; cursor: pointer; }
.tbl .row-no:hover { text-decoration: underline; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px;
  background: #eef1f6; color: var(--ink-2); font-weight: 500;
}
.tag.t-未税 { background: #e3f0fb; color: #1b5e9c; }
.tag.t-含税 { background: #e8f5ec; color: #1e7a45; }
.tag.t-电商 { background: #fdf0e0; color: #96590a; }
.tag.p-已付款 { background: var(--lgreen); color: var(--green); }
.tag.p-未付款 { background: var(--lred); color: var(--red); }
.tag.p-赠送 { background: #f3e8fd; color: #6b21a8; }
.tag.p-已出货 { background: var(--lamb); color: var(--amber); }
.tag.p-未填写 { background: #f0f0f0; color: var(--ink-3); }
.tag.warn { background: var(--lred); color: var(--red); }
.issue-dot {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px;
  border-radius: 5px; font-size: 11px; background: var(--lred); color: var(--red);
}

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.filters .f { min-width: 132px; }
.pager {
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2);
}
.pager .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.empty { padding: 48px 16px; text-align: center; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 22, 36, .5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.mask.hide { display: none; }
.modal {
  background: var(--card); border-radius: 12px; width: 100%; max-width: 1080px;
  max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-h { padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h3 { font-size: 15.5px; font-weight: 600; }
.modal-h .x { margin-left: auto; font-size: 22px; color: var(--ink-3); line-height: 1; padding: 0 4px; }
.modal-h .x:hover { color: var(--red); }
.modal-b { padding: 20px; overflow-y: auto; flex: 1; }
.modal-f {
  padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px;
  justify-content: flex-end; background: #fafbfd;
}
.modal-sm { max-width: 460px; }
.modal-sm .modal-b { padding: 22px; }

/* 订单录入/编辑弹层（#mask）：明细随行数自动增高，不再被 92vh 上限裁成内部滚动。
   做法：取消 modal 高度上限 + 让 modal-b 由内容撑开；整层在超高时可滚动且顶部可达
   （用 margin:auto 实现"够高则居中、超高则可滚动"，避免 align-items:center 把顶部裁掉）。
   仅作用于订单弹层，不影响明细查看/批量粘贴等其它弹层。 */
#mask { overflow-y: auto; }
#mask .modal { max-height: none; margin: auto; }
#mask .modal-b { overflow: visible; flex: 0 1 auto; }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; height: 300px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); padding: 0 4px 10px; }
.chart-legend i { width: 11px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.bar-row .nm { width: 82px; text-align: right; color: var(--ink-2); flex: 0 0 82px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; height: 17px; background: #f0f3f7; border-radius: 4px; overflow: hidden; display: flex; }
.bar-row .fill { height: 100%; }
.bar-row .val { width: 108px; text-align: right; font-variant-numeric: tabular-nums; flex: 0 0 108px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13.5px; z-index: 200; opacity: 0; transition: all .22s; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
.toast.warn { background: var(--orange, #c2760a); }

.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; }
.sec-gap { margin-top: 4px; }
.nowrap { white-space: nowrap; }

/* ---------- 登录门禁 ---------- */
.app.guest { display: none; }
.auth-gate {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #eef3f9 0%, #e3ecf7 100%);
}
.auth-gate.hide { display: none; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(16,24,40,.14);
  padding: 30px 30px 26px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand b { display: block; font-size: 20px; font-weight: 700; color: var(--navy); letter-spacing: .3px; }
.auth-brand span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.auth-tabs {
  display: flex; gap: 0; margin-bottom: 22px;
  background: #f1f4f9; border-radius: 8px; padding: 4px;
}
.auth-tab {
  flex: 1; padding: 8px 0; text-align: center; font-size: 13.5px; font-weight: 500;
  border-radius: 6px; color: var(--ink-2); transition: all .15s;
}
.auth-tab.on { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.auth-pane .f { margin-bottom: 14px; }
.auth-mode {
  display: flex; gap: 18px; margin: -4px 0 14px; font-size: 13px; color: var(--ink-2);
}
.auth-radio { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.auth-radio input { accent-color: var(--navy-2); }
.f-row { display: flex; gap: 8px; align-items: stretch; }
.f-row input { flex: 1; }
.f-row .btn { white-space: nowrap; flex: 0 0 auto; }
.f-msg { font-size: 12px; color: var(--red); min-height: 16px; margin: 2px 0 6px; }
.auth-submit { width: 100%; padding: 10px 0; font-size: 15px; margin-top: 4px; }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 14px; }
.auth-switch { color: var(--navy-2); font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--navy-3); }
.auth-note {
  font-size: 12px; color: var(--ink-3); background: #f4f7fb;
  border-radius: 6px; padding: 7px 10px; margin: -4px 0 10px;
}
/* ---------- 迁移冻结提示（登录卡内置顶） ---------- */
.auth-pause {
  background: #fff6e8; border: 1px solid #f0c88a; border-radius: 8px;
  padding: 10px 12px; margin: 0 0 16px; text-align: left;
}
.auth-pause.hide { display: none; }
.auth-pause b { display: block; font-size: 13.5px; color: #a35f00; line-height: 1.5; font-weight: 700; }
.auth-pause span { display: block; font-size: 12px; color: #8a6216; margin-top: 5px; line-height: 1.6; }
.adm-email { width: 180px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- 待审批 / 被拒绝页面 ---------- */
.wait-gate {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #eef3f9 0%, #e3ecf7 100%);
}
.wait-gate.hide { display: none; }
.wait-card {
  width: 100%; max-width: 420px; background: var(--card);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(16,24,40,.14);
  padding: 34px 32px 28px; text-align: center;
}
.wait-card h2 { margin: 14px 0 4px; font-size: 19px; color: var(--navy); }
.wg-tag {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 3px 11px; border-radius: 12px;
}
.wg-tag.wait { background: #fdf3e0; color: #a9750a; }
.wg-tag.bad { background: #fdeceb; color: var(--red); }
.wg-who { margin: 10px 0 14px; font-size: 15px; color: var(--ink); }
.wg-who .wg-phone { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.wg-msg { font-size: 13.5px; color: var(--ink-2); line-height: 1.65; margin: 0 0 6px; }
.wg-tip { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin: 0 0 20px; }
.wg-actions { display: flex; gap: 10px; justify-content: center; }

/* 待审批行高亮提示 */
.pending-row td { background: #fffdf7; }

/* ---------- 顶栏用户区 ---------- */
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px;
  background: #f4f7fb; border: 1px solid var(--line); border-radius: 20px;
}
.user-chip .uc-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.user-chip .uc-role {
  font-size: 10.5px; font-weight: 600; color: var(--navy-2);
  background: #eaf2fb; border-radius: 5px; padding: 1px 6px;
}
.user-chip .uc-btn {
  font-size: 12px; color: var(--ink-2); padding: 4px 8px; border-radius: 6px; transition: all .12s;
}
.user-chip .uc-btn:hover { background: #e6ecf5; color: var(--navy); }
.user-chip .uc-out:hover { background: var(--lred); color: var(--red); }

/* ---------- 返利 / 红包 录入 ---------- */
.rp-summary { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.rp-summary > div {
  flex: 1; min-width: 124px; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.rp-summary span { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.rp-summary b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rp-summary b.pos { color: var(--green); }
.rp-summary b.neg { color: var(--red); }

/* ---------- 序列号 ---------- */
.sn-input {
  width: 100%; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.sn-input:focus { outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 2px rgba(74, 143, 212, .12); }
.sn-input::placeholder { color: var(--ink-3); font-family: inherit; }

.sn-list { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.sn-chip {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: #eef3fa; color: var(--navy-2); border: 1px solid #d5e3f5;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 退货管理 ---------- */
.f-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.f-row .f { min-width: 150px; }
.pager {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px;
}

/* ---------- 项目管理 / 服务单管理 ---------- */
/* 项目管理 / 服务单管理录入弹窗：表单用与「新建订单」一致的 .f-grid 网格 */

/* 组合框：输入并记忆下拉（所投品牌 / 负责人 / 操作人 / 参与单位） */
.cb { display: block; width: 100%; position: relative; }
.cb-box {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  min-height: 34px; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff;
}
.cb-input {
  flex: 1 1 70px; min-width: 70px; border: none; background: transparent;
  outline: none; font-size: 13px; font-family: inherit; padding: 4px 2px; width: auto;
}
.cb-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.14); max-height: 210px; overflow: auto; display: none;
}
.cb-opt { padding: 7px 10px; font-size: 13px; cursor: pointer; }
.cb-opt:hover { background: var(--lblue); }
.cb-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
  background: var(--lblue); border: 1px solid var(--navy-3); color: var(--navy-2);
  border-radius: 999px; font-size: 12px;
}
.cb-x {
  border: none; background: transparent; color: var(--navy-2); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 1px;
}
.cb-x:hover { color: var(--red); }

/* 列表卡片顶部的「新建」醒目按钮条（弹窗入口） */
.pj-newbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.pj-newbar .btn-primary { font-size: 13px; padding: 8px 16px; }

/* 图片单元格按钮 */
.pj-imgbtn {
  position: relative; display: inline-block; width: 42px; height: 42px;
  padding: 0; border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; background: var(--paper); cursor: pointer;
}
.pj-imgbtn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-imgbtn:hover { border-color: var(--navy-3); }
.pj-imgbtn.on { border-color: var(--navy-2); box-shadow: 0 0 0 2px rgba(74, 143, 212, .18); }
.pj-imgn {
  position: absolute; right: 2px; bottom: 2px;
  background: rgba(26, 29, 36, .72); color: #fff; font-size: 10px;
  padding: 0 4px; border-radius: 3px; line-height: 14px;
}

/* 图片上传区 */
.pj-imgup { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.pj-imgup-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pj-imgsz {
  position: absolute; left: 2px; bottom: 2px;
  background: rgba(26, 29, 36, .72); color: #fff; font-size: 10px;
  padding: 0 4px; border-radius: 3px; line-height: 14px; font-style: normal;
}
.pj-drop {
  margin-top: 6px; padding: 8px 10px; text-align: center; font-size: 12px;
  color: var(--ink-2); background: var(--paper);
  border: 1px dashed var(--line); border-radius: 8px; transition: .15s;
}
.pj-drop-on { color: var(--navy-2); border-color: var(--navy-2); background: var(--lblue); }
.pj-imglist { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 42px; }
.pj-imgitem { position: relative; display: inline-block; }
.pj-imgitem img {
  width: 54px; height: 54px; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: 6px; background: var(--paper);
}
.pj-imgitem button {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border: none; border-radius: 50%; background: var(--red); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
}

/* 统计结果区 */
.pj-stats { margin: 14px 0; padding: 12px 14px; background: var(--paper); border-radius: 8px; }
.pj-stats-h { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.pj-bar { height: 8px; background: var(--lblue); border-radius: 4px; overflow: hidden; }
.pj-bar i { display: block; height: 100%; background: var(--navy-2); border-radius: 4px; }

/* 详情页字段网格 */
.pj-kv-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px;
}
.pj-kv { min-width: 0; }
.pj-kv-t { font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.pj-kv-v { font-size: 13px; color: var(--ink); word-break: break-word; }
.pj-text {
  font-size: 13px; line-height: 1.65; color: var(--ink-2);
  background: var(--paper); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap;
}

/* 通用多选组件（服务单执行人 / 项目所投品牌共用） */
.ms-multi {
  display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  max-height: 120px; overflow: auto;
}
.ms-chk { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; cursor: pointer;
  padding: 1px 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.ms-chk input { cursor: pointer; width: auto; margin: 0; }
/* 手动添加的项，带删除按钮并高亮，便于与字典项区分 */
.ms-added { background: var(--lblue); border-radius: 4px; padding: 1px 5px; }
.ms-del {
  border: none; background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px;
}
.ms-del:hover { color: var(--red); }
.ms-new { margin-top: 4px; width: 150px; height: 28px; font-size: 12px;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
/* 多选控件在栅格里占满整行；执行人框在窄屏也不至于过大 */
.ms-multi { min-width: 240px; max-width: 100%; }

/* ---------- 模块权限分配 ---------- */
.pj-perm-h { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.pj-perm-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px;
  margin: 10px 0; align-items: stretch;
}
.pj-perm-item {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.pj-perm-item:hover { border-color: var(--navy-3); background: #fbfcfe; }
.pj-perm-item input { margin-top: 2px; cursor: pointer; flex: none; }
.pj-perm-t { font-size: 13px; color: var(--ink); }
.pj-perm-s { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

/* ---------- 应收应付模块（ar）---------- */
.ar-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px 0; }
.ar-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  font-size: 12.5px; color: var(--ink-2);
}
.ar-tab:hover { border-color: var(--navy-3); color: var(--navy); }
.ar-tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ar-tab .n {
  font-size: 11px; padding: 0 5px; border-radius: 999px;
  background: var(--paper); color: var(--ink-3);
}
.ar-tab.on .n { background: rgba(255, 255, 255, .22); color: #fff; }

.ar-stock { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.ar-stockc {
  flex: 1 1 160px; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; background: #fff;
}
.ar-stockc-sum { background: var(--lblue); border-color: #c8dcf2; }
.ar-stockc .s-t { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.ar-stockc .s-v { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.ar-stockc .s-x { font-size: 11px; color: var(--ink-3); }

.ar-neg { color: var(--red); font-weight: 600; }
.ar-ok { color: var(--green); }
.ar-total td { background: #fafbfd; border-top: 2px solid var(--line); }

/* 应收应付：统计卡可点 + 合同日期月份行可点（2026-10-28） */
.kpi[data-arkpi] { cursor: pointer; }
.kpi[data-arkpi]:hover { box-shadow: 0 2px 10px rgba(46, 117, 182, .16); }
.ar-cdrow { cursor: pointer; }
.ar-cdrow:hover td { background: #f2f7ff; }
.ar-cdrow.on td { background: #e8f1fb; }
.ar-cdsel {
  display: inline-block; margin-left: 5px; padding: 0 6px;
  font-size: 10.5px; font-weight: 600; color: var(--navy-2);
  background: var(--lblue); border-radius: 8px;
}
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.ar-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; font-size: 12px; color: var(--navy-2);
  background: var(--lblue); border: 1px solid #c9dcf0; border-radius: 12px;
}
.ar-chip b { cursor: pointer; color: var(--ink-3); font-weight: 400; }
.ar-chip b:hover { color: var(--red); }
.ar-cdmore { padding: 8px 12px; }
.ar-cdmore:empty { display: none; }

/* 回款比例：百分比 + 细进度条（明细表跟金额列一起右对齐） */
.ar-ratio { display: inline-flex; align-items: center; gap: 6px; }
.ar-ratio b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ar-ratio b.ar-ok { color: var(--green); }
.ar-bar { width: 46px; height: 5px; border-radius: 3px; background: #eceff5; overflow: hidden; flex: none; }
.ar-bar i { display: block; height: 100%; background: var(--navy-3); border-radius: 3px; }
.ar-bar.done i { background: var(--green); }

/* 入库条目的「输入即搜」下拉（2026-10-26）
   老板口径：不要「下拉只能选」再「点新增条目切换」两步，一个框搞定。 */
.sku-wrap { position: relative; }
.sku-input { width: 100%; box-sizing: border-box; }
.sku-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 80;
  max-height: 250px; overflow-y: auto; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 22px rgba(16, 24, 40, .14);
}
.sku-opt {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 11px; cursor: pointer; font-size: 13px; line-height: 1.35;
  border-bottom: 1px solid #f1f4f8;
}
.sku-opt:last-child { border-bottom: 0; }
.sku-opt:hover { background: var(--lblue); }
.sku-opt b { color: var(--ink); font-weight: 600; }
.sku-name { color: var(--ink-3); font-size: 12px; }
.sku-qty { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.sku-opt.sku-new { color: var(--navy-2); font-weight: 600; background: #f7fafd; }
.sku-opt.sku-new:hover { background: var(--lblue); }

/* 铺货 KPI 点击筛选（2026-10-26）：点卡片只看这一类，再点取消 */
.kpi.kpi-on {
  border-color: var(--navy-2);
  background: var(--lblue);
  box-shadow: inset 0 0 0 1px var(--navy-2);
}
.kpi.kpi-on .go { opacity: 1 !important; color: var(--navy); }
.kpi.kpi-on .k { color: var(--navy-2); font-weight: 600; }
.ph-quick-tip {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--lblue);
  border: 1px solid #c9dcf0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.ph-quick-tip b { color: var(--navy); }
.ph-quick-tip a { margin-left: 12px; color: var(--navy-2); text-decoration: underline; }
.ph-quick-tip .dim { margin-left: 6px; }

/* 铺货中详情：出货单号做成可点链接（点一下跳到铺货页看那张单） */
.ph-link { color: var(--blue, #1a73e8); text-decoration: none; border-bottom: 1px dashed rgba(26,115,232,.45); }
.ph-link:hover { border-bottom-style: solid; }
.ph-link .row-no { font-weight: 600; }

/* ---------- 客户统计（订单 + 铺货 + AI 评级） ---------- */
.cs-badge-ai {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #2e75b6, #6a4fd4);
  border-radius: 20px; vertical-align: middle; letter-spacing: .5px;
}
.cs-sel {
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.cs-chk {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.cs-chk input { accent-color: var(--navy-2); }
.filters .cs-chk { min-width: auto; padding-bottom: 1px; }

.cs-cols {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 12px; margin-bottom: 12px;
  background: #f8fafd; border: 1px dashed #c9dcf0; border-radius: 8px;
}
.cs-cols-t { font-size: 12.5px; font-weight: 600; color: var(--navy); }
.cs-cols-h { font-size: 11.5px; color: var(--ink-3); }

/* 仅超管模块：分配面板里锁死，不允许勾选 */
.pj-perm-item.pm-lock { opacity: .62; cursor: not-allowed; background: #f6f7fa; }
.pm-only {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  font-size: 10.5px; font-weight: 600; color: var(--red);
  background: var(--lred); border-radius: 8px; vertical-align: middle;
}

.cs-badge {
  display: inline-block; padding: 1px 8px; border-radius: 12px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.cs-badge.g-good { background: var(--lgreen); color: var(--green); }
.cs-badge.g-ok { background: var(--lblue); color: var(--navy-2); }
.cs-badge.g-watch { background: var(--lamb); color: var(--amber); }
.cs-badge.g-bad { background: #fdf0e3; color: #b3541e; }
.cs-badge.g-high { background: var(--lred); color: var(--red); }

.cs-name { font-weight: 600; color: var(--ink); white-space: normal; max-width: 260px; }
.cs-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.cs-tag {
  display: inline-block; padding: 0 5px; border-radius: 3px;
  font-size: 10.5px; color: var(--ink-2); background: #eef1f6; white-space: nowrap;
}
.tbl td.cs-diag {
  white-space: normal; min-width: 230px; max-width: 320px;
  font-size: 12px; color: var(--ink-2); line-height: 1.45;
}
.tbl th.cs-sortable { cursor: pointer; user-select: none; }
.tbl th.cs-sortable:hover { color: var(--navy-2); }
#csTbl { min-width: 1180px; }
#csKpis { margin-bottom: 12px; }

/* 产品排行：三个模式切换按钮 */
.btn.st-mode.on {
  background: var(--navy-2); color: #fff; border-color: var(--navy-2);
  box-shadow: 0 1px 2px rgba(46, 117, 182, .3);
}
.btn.st-mode.on:hover { background: var(--navy); border-color: var(--navy); }


/* 2026-11-11 明细列表表头点击排序 + 统计卡点击筛选（通用） */
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--navy-2); background: rgba(46, 117, 182, .07); }
.kpi[data-qkpi], .kpi[data-pjkpi] { cursor: pointer; }
.kpi[data-qkpi]:hover, .kpi[data-pjkpi]:hover { box-shadow: 0 2px 10px rgba(46, 117, 182, .16); }
.kpi[data-qkpi][data-on], .kpi[data-pjkpi][data-on] {
  border-color: var(--navy-2); box-shadow: 0 0 0 1px rgba(46, 117, 182, .35) inset;
}
.kpi[data-qkpi][data-on] .k, .kpi[data-pjkpi][data-on] .k { color: var(--navy-2); font-weight: 600; }
.kpi[data-qkpi][data-on] .go, .kpi[data-pjkpi][data-on] .go { opacity: 1 !important; color: var(--navy); }


/* 2026-11-11 第 2 批：审批分栏 / 待我审批角标 / 事由弹窗 */
.del-appr-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.del-appr-tabs .btn { min-width: 92px; }
#delBadge { background: #d9822b; color: #fff; }
#reasonMask .modal-b textarea {
  font: inherit; line-height: 1.5; border: 1px solid #d5dce6;
  border-radius: 4px; resize: vertical; background: #fff; color: var(--ink);
}
#reasonMask .modal-b textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 2px rgba(46,117,182,.15); }
#reasonMask .alert-info { font-size: 13px; }
