/* 外贸跟单系统 —— 后台样式（离线可用，不依赖外部 CDN） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root{
  --primary:#2E7CF6; --primary-d:#1f5fd0; --side:#1f2a44; --side-d:#16203a;
  --bg:#f4f6fb; --card:#fff; --line:#e6e9f2; --text:#26304a; --muted:#7a86a1;
  --ok:#1faa59; --warn:#f5a623; --danger:#e44; --chip:#eef3ff;
}
body{ font-family:-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  background:var(--bg); color:var(--text); font-size:14px; }
a{ color:var(--primary); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* 布局 */
.layout{ display:flex; min-height:100vh; }
.sidebar{ width:176px; background:linear-gradient(180deg,var(--side),var(--side-d));
  color:#cfd8ee; flex-shrink:0;
  display:flex; flex-direction:column;        /* 让 .me 真正贴底 */
  position:sticky; top:0; height:100vh; overflow-y:auto; }
.sidebar .brand{ padding:14px 14px 11px; font-size:15px; font-weight:700; color:#fff;
  border-bottom:1px solid rgba(255,255,255,.08); flex:0 0 auto; }
.sidebar .brand small{ display:block; font-size:10.5px; font-weight:400; color:#8fa3cf; margin-top:3px; }
.sidebar nav{ padding:8px 0; flex:0 0 auto; }
.sidebar nav a{ display:flex; align-items:center; gap:8px; padding:10px 14px; color:#c4cfe8;
  font-size:13.5px; border-left:3px solid transparent; }
.sidebar nav a:hover{ background:rgba(255,255,255,.06); text-decoration:none; color:#fff; }
.sidebar nav a.active{ background:rgba(46,124,246,.18); border-left-color:var(--primary); color:#fff; }
.sidebar .nav-sec{ padding:11px 14px 4px; font-size:10.5px; color:#6f80a8; letter-spacing:1px; }

/* 阶段35：侧边栏分组导航（父项 + 右侧箭头 + 子项缩进） */
.sidebar .nav-grp{ position:relative; }
.sidebar .nav-grp > a.nav-p{ padding-right:42px; }
.sidebar .nav-tg{ position:absolute; right:4px; top:6px; width:28px; height:28px;
  display:flex; align-items:center; justify-content:center; padding:0; border:0;
  background:transparent; border-radius:6px; color:#8fa3cf; cursor:pointer;
  font-size:11px; line-height:1; font-family:inherit; }
.sidebar .nav-tg:hover{ background:rgba(255,255,255,.10); color:#fff; }
.sidebar .nav-tg .chev{ display:block; transition:transform .16s ease; }
.sidebar .nav-grp.open .nav-tg .chev{ transform:rotate(90deg); }
.sidebar .nav-grp.has-active > a.nav-p{ color:#fff; }
.sidebar .nav-sub{ overflow:hidden; }
.sidebar .nav-sub[hidden]{ display:none !important; }
.sidebar .nav-sub a{ padding:7px 14px 7px 34px; font-size:12.5px; color:#a8b6d6;
  border-left:3px solid transparent; }
.sidebar .nav-sub a:hover{ background:rgba(255,255,255,.06); color:#fff; text-decoration:none; }
.sidebar .nav-sub a.active{ background:rgba(46,124,246,.14);
  border-left-color:rgba(46,124,246,.7); color:#fff; }

.sidebar .me{ margin-top:auto; padding:12px 14px; border-top:1px solid rgba(255,255,255,.08);
  font-size:12px; color:#9fb0d6; flex:0 0 auto; }
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar{ height:56px; background:#fff; border-bottom:1px solid var(--line); display:flex;
  align-items:center; justify-content:space-between; padding:0 22px; }
.topbar .title{ font-size:16px; font-weight:600; }
.topbar .right{ display:flex; align-items:center; gap:14px; color:var(--muted); font-size:13px; }
.content{ padding:22px; overflow:auto; }

/* 卡片 / 看板 */
.cards{ display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:16px; margin-bottom:22px; }
.card{ background:var(--card); border:1px solid var(--line); border-radius:12px; padding:18px 20px; }
.card .k{ font-size:13px; color:var(--muted); }
.card .v{ font-size:26px; font-weight:700; margin-top:6px; }
.card .v.small{ font-size:20px; }
.card.accent{ border-top:3px solid var(--primary); }
.card.warn{ border-top:3px solid var(--warn); }
.card.ok{ border-top:3px solid var(--ok); }
.card.danger{ border-top:3px solid var(--danger); }

.panel{ background:var(--card); border:1px solid var(--line); border-radius:12px; padding:18px; }
.panel h3{ font-size:15px; margin-bottom:14px; }

/* 表格 */
.table-wrap{ overflow-x:auto; border:1px solid var(--line); border-radius:10px; background:#fff; }
table{ width:100%; border-collapse:collapse; font-size:13.5px; }
th,td{ padding:10px 12px; text-align:left; border-bottom:1px solid var(--line); white-space:nowrap; }
th{ background:#f7f9fd; color:var(--muted); font-weight:600; font-size:12.5px; }
tbody tr:hover{ background:#fafcff; }
td .sub{ color:var(--muted); font-size:12px; }

/* 按钮 */
.btn{ display:inline-block; padding:8px 16px; border-radius:8px; border:1px solid transparent;
  font-size:13.5px; cursor:pointer; background:var(--primary); color:#fff; }
.btn:hover{ background:var(--primary-d); text-decoration:none; }
.btn.ghost{ background:#fff; border-color:var(--line); color:var(--text); }
.btn.ghost:hover{ background:#f3f6fc; }
.btn.sm{ padding:5px 11px; font-size:12.5px; }
.btn.danger{ background:var(--danger); }
.btn.ok{ background:var(--ok); }
/* 带 hidden 属性的按钮要真的隐藏：.btn 的 display 会盖掉浏览器默认的 [hidden]{display:none} */
.btn[hidden]{ display:none !important; }
.toolbar{ display:flex; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.toolbar .search{ flex:1; min-width:200px; max-width:360px; }
input,select,textarea{ width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px;
  font-size:13.5px; font-family:inherit; background:#fff; color:var(--text); }
textarea{ resize:vertical; min-height:70px; }
label{ display:block; font-size:13px; color:var(--muted); margin-bottom:5px; }
.field{ margin-bottom:14px; }

/* ---------- 通用表单：横向多列排布（新增/编辑页默认） ---------- */
.form-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(248px,1fr));
  gap:14px 18px; align-items:start; }
.form-grid .field{ margin:0; }
.form-grid .field-wide{ grid-column:1 / -1; }
@media (max-width:760px){ .form-grid{ grid-template-columns:1fr; } }

/* 徽标 */
.chip{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; background:var(--chip);
  color:var(--primary); }
.chip.g{ background:#e7f7ee; color:var(--ok); }
.chip.w{ background:#fdf2dc; color:#b9791a; }
.chip.r{ background:#fdeaea; color:var(--danger); }

/* 提示 */
.flash{ padding:11px 16px; border-radius:9px; margin-bottom:14px; font-size:13.5px; }
.flash.success{ background:#e7f7ee; color:#1f7a45; border:1px solid #bfe9cd; }
.flash.danger{ background:#fdeaea; color:#b22; border:1px solid #f3c4c4; }
.flash.info{ background:#eef3ff; color:#2a55c4; border:1px solid #cdd9fb; }

/* 登录页 */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#1f2a44,#2E7CF6); }
.login-box{ background:#fff; width:380px; border-radius:16px; padding:34px 32px; box-shadow:0 20px 50px rgba(0,0,0,.25); }
.login-box h1{ font-size:20px; margin-bottom:4px; }
.login-box .sub{ color:var(--muted); font-size:13px; margin-bottom:22px; }
.login-box .field{ margin-bottom:16px; }
.login-box .btn{ width:100%; padding:11px; }
.login-box .hint{ margin-top:16px; font-size:12px; color:var(--muted); background:#f7f9fd;
  border:1px solid var(--line); border-radius:8px; padding:10px 12px; line-height:1.6; }

.split{ display:grid; grid-template-columns:1.4fr 1fr; gap:18px; align-items:start; }
@media(max-width:900px){ .split{ grid-template-columns:1fr; } }
.pbar{ height:8px; background:var(--line); border-radius:99px; overflow:hidden; margin:10px 0 4px; }
.pbar > i{ display:block; height:100%; background:linear-gradient(90deg,#2e7cf6,#6c4fe0); border-radius:99px; }
.muted{ color:var(--muted); }
.att-item{ display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px dashed var(--line); }
.att-item .nm{ flex:1; font-size:13.5px; }
.att-item .meta{ font-size:12px; color:var(--muted); margin-top:2px; }
.kv{ font-size:13.5px; }
.kv div{ display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px dashed var(--line); }
.kv div span:first-child{ color:var(--muted); }

/* 云服务相关 */
.cloud-badge{ margin-top:8px; font-size:12px; }
.cloud-ok{ color:#0f9d58; }
.cloud-off{ color:#c0392b; text-decoration:none; }
.ai-out{ background:#0f172a; color:#e6edf7; border-radius:10px; padding:14px 16px;
  font-size:13.5px; line-height:1.75; white-space:pre-wrap; min-height:120px;
  max-height:460px; overflow:auto; font-family:ui-monospace,Menlo,Consolas,monospace; }
.att-item{ display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px dashed var(--line); font-size:13.5px; }
.att-item .nm{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.att-item .meta{ color:var(--muted); font-size:12px; white-space:nowrap; }
.check-row{ display:flex; align-items:center; gap:8px; padding:7px 0; font-size:13.5px; border-bottom:1px dashed var(--line); }
.pill{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:11.5px; }
.pill.ok{ background:#e6f6ec; color:#0f7b43; }
.pill.bad{ background:#fdecea; color:#b3261e; }
.pill.wait{ background:#fff4e5; color:#a35a00; }

/* ---------- 商品/订单改造新增组件 ---------- */
/* 订单顶部四栏信息区 */
.order-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:0 22px; }
@media(max-width:1100px){ .order-grid{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:700px){ .order-grid{ grid-template-columns:1fr; } }
.order-grid .kv div{ padding:7px 0; }
.money{ font-variant-numeric:tabular-nums; }

/* 装箱资料抬头：6 列栅格（标签/控件交替成对），让「柜型」紧跟「出货方式」右侧 */
.pack-head{ display:grid; align-items:center; font-size:13.5px;
  grid-template-columns:auto minmax(0,200px) auto minmax(0,200px) auto minmax(0,200px);
  gap:9px 12px; }
.pack-head .ph-l{ color:var(--muted); white-space:nowrap; }
.pack-head .ph-c{ min-width:0; display:flex; flex-direction:column; }
.pack-head .ph-c > input, .pack-head .ph-c > select{ width:100%; }
.pack-head .fkbox{ display:block; }
.pack-head .field-hint{ margin-top:2px; }
@media(max-width:1100px){
  .pack-head{ grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr); }
}

/* 订单详情三分栏 */
.order-3col{ display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:18px; align-items:start; }
@media(max-width:1100px){ .order-3col{ grid-template-columns:1fr; } }

/* 明细行内输入 */
.cell-in{ width:100%; padding:5px 8px; font-size:13px; border-radius:6px; }

/* 装箱数：只读纯数字展示（取自商品管理，不可改） */
.pack-val{ display:inline-block; min-width:34px; text-align:right; padding:2px 4px;
  font-size:13px; font-variant-numeric:tabular-nums; color:var(--text,#333);
  border:1px dashed transparent; border-radius:6px; }
.pack-val:hover{ border-color:var(--line); }

/* 列表页快速改状态 */
.quick-sel{ width:auto; min-width:96px; padding:4px 8px; font-size:12.5px; border-radius:6px; }

/* 多选复选框组 */
.multi{ display:flex; gap:16px; flex-wrap:wrap; padding:4px 0; }
.cb{ display:inline-flex; align-items:center; gap:6px; font-size:13.5px;
  color:var(--text); margin:0; cursor:pointer; }
.cb input[type=checkbox]{ width:16px; height:16px; margin:0; accent-color:var(--primary); }

/* 图片上传 */
.imgbox{ display:flex; flex-direction:column; gap:8px; }
.img-preview{ min-height:96px; border:1px dashed var(--line); border-radius:10px;
  display:flex; align-items:center; justify-content:center; background:#fafbff; padding:8px; }
.img-preview img{ max-width:100%; max-height:220px; border-radius:8px; display:block; }
.img-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* 多附件字段 */
.filesbox{ display:flex; flex-direction:column; gap:8px; }
.filesbox.dragging .files-list{ border-color:var(--primary); background:#eef4ff; }
.files-list{ list-style:none; margin:0; padding:6px; border:1px dashed var(--line);
  border-radius:10px; background:#fafbff; min-height:44px; max-height:220px; overflow:auto; }
.files-list li{ display:flex; align-items:center; gap:8px; padding:3px 4px; font-size:13px; }
.files-list li .f-ico{ flex:0 0 auto; font-size:14px; line-height:1; }
.files-list li a{ flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.files-list li.muted{ color:var(--muted); }

/* 可搜索外键 */
.fkbox{ position:relative; }

/* 字段提示 */
.field-hint{ font-size:12px; color:var(--muted); margin-top:4px; }

/* ---------- 订单新增页：四栏信息区里的表单控件 ---------- */
.kv.edit div{ align-items:center; gap:8px; padding:6px 0; }
.kv.edit div > span:first-child{ flex:0 0 auto; white-space:nowrap; }
.kv.edit input:not([type=hidden]):not([type=checkbox]),
.kv.edit select{ width:auto; flex:0 1 196px; min-width:0; padding:6px 9px; font-size:13px; }
.kv.edit .fkbox{ flex:0 1 196px; min-width:0; }
.kv.edit .fkbox input{ width:100%; }
.kv.edit .multi{ flex:0 1 auto; justify-content:flex-end; gap:12px; }
/* 阶段53：商品页「装箱数」单元格 —— 标签/输入框/散装挤在一行，灰字备注换到下面一行，
   不再被 flex 压成竖排小字 */
.kv.edit div.pack-qty-cell{ display:block; padding:6px 0; }
.pack-qty-cell .pq-line{ display:flex; align-items:center; gap:8px; }
.pack-qty-cell .pq-line > span:first-child{ flex:0 0 auto; white-space:nowrap; color:var(--muted); }
.pack-qty-cell .pq-line > input{ flex:1 1 96px; width:auto; min-width:0; }
.pack-qty-cell .pq-line .bulk-tg{ flex:0 0 auto; }
.pack-qty-cell .pack-hint{ margin-top:5px; line-height:1.55; }
.kv.edit b.money{ font-size:14px; }
.req{ color:var(--danger); font-style:normal; }

/* 明细表里勾选框居中一点 */
td .pick{ width:16px; height:16px; margin:0; accent-color:var(--primary); }

/* ---------- 列表页：操作列固定在右侧（横向滚动也能点到） ---------- */
.op-col{ position:sticky; right:0; background:#fff; z-index:1;
  box-shadow:-8px 0 10px -8px rgba(20,30,60,.16); }
thead .op-col{ background:#f7f9fd; z-index:3; }
tbody tr:hover .op-col{ background:#fafcff; }

/* 列表页审核复选框 */
.audit-cb{ width:15px; height:15px; margin:0; accent-color:var(--primary); cursor:pointer; }

/* ---------- 弹窗（添加产品） ---------- */
.modal-mask{ position:fixed; inset:0; background:rgba(16,24,40,.42);
  display:flex; align-items:center; justify-content:center; z-index:999; padding:20px; }
.modal-mask[hidden]{ display:none; }
.modal{ background:#fff; border-radius:14px; width:min(760px,100%); max-height:88vh;
  display:flex; flex-direction:column; box-shadow:0 24px 60px rgba(16,24,40,.24); overflow:hidden; }
.modal-hd{ display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--line); }
.modal-hd b{ font-size:15px; }
.modal-x{ border:0; background:transparent; font-size:18px; color:var(--muted); cursor:pointer; padding:0 4px; }
.modal-body{ padding:16px 20px; overflow:auto; }
.modal-ft{ display:flex; gap:10px; justify-content:flex-end;
  padding:14px 20px; border-top:1px solid var(--line); background:#fafbff; }
.modal-search{ display:flex; gap:10px; align-items:center; margin-bottom:12px; }
.modal-search input{ flex:1; }
.modal-search select{ width:150px; flex:0 0 150px; }
.modal-pick{ width:16px; height:16px; margin:0; accent-color:var(--primary); cursor:pointer; }
tr.picked{ background:#f2f7ff !important; }
tr.already td{ opacity:.55; }

/* 提示条：warning 类别（如重复添加被跳过） */
.flash.warning{ background:#fdf2dc; color:#8a5a10; border:1px solid #f2ddb0; }

/* ---------- 表格横向滚动：滚动条常驻且看得见 ---------- */
.table-wrap{ overflow-x:auto; max-width:100%; min-width:0; }
.table-wrap::-webkit-scrollbar{ height:12px; width:12px; }
.table-wrap::-webkit-scrollbar-track{ background:#eef2f9; border-radius:8px; }
.table-wrap::-webkit-scrollbar-thumb{ background:#c2ccdf; border-radius:8px;
  border:2px solid #eef2f9; }
.table-wrap::-webkit-scrollbar-thumb:hover{ background:#a3b1cb; }
.table-wrap{ scrollbar-color:#c2ccdf #eef2f9; }
/* 内容区不要在整页层面横向溢出，滚动交给表格自己 */
.content{ min-width:0; }

/* ---------- 表格横向滚动（强制可滚） ----------
   原来 table{width:100%} + 自动布局会让浏览器把列压进容器宽度，
   内容被挤压却不算"溢出"，因此不出现滚动条、也滚不动。
   让表格最小宽度 = 内容自然宽度，容器不够宽就一定溢出、一定可滚。 */
.table-wrap{ overflow-x:auto; overflow-y:hidden; }
.table-wrap > table{ min-width:max-content; }

/* 窄屏（或系统缩放）时收紧单元格，减少不必要的横向溢出 */
@media (max-width:1280px){
  th, td{ padding:9px 10px; font-size:13px; }
  .content{ padding:16px; }
}

/* 整页不再横向滚动：横向滚动只发生在表格内部（否则滚动条跑到页面最底部看不见） */
.content{ overflow-x:hidden; }

/* 列表里的图片缩略图 / 长文本截断 */
.thumb{ width:36px; height:36px; object-fit:cover; border-radius:6px;
  border:1px solid var(--line); vertical-align:middle; display:block; }
.clip{ display:inline-block; max-width:250px; overflow:hidden;
  text-overflow:ellipsis; white-space:nowrap; vertical-align:bottom; }

/* ---------- 客户新增/编辑页（横向填写 + 多联系人 + 查重） ---------- */
/* 四栏里带错误提示的输入项：输入框下面留一行红字 */
.kv.edit .ipt-wrap{ display:flex; flex-direction:column; flex:0 1 196px; min-width:0; }
/* 注意：上面 .kv.edit input 的 flex-basis:196px 在纵向 flex 容器里会变成「高度」，
   把输入框拉成一个高方块，这里必须显式复位 + 固定高度。 */
.kv.edit .ipt-wrap > input:not([type=hidden]){
  flex:0 0 auto; width:100%; max-width:100%; height:32px; padding:6px 9px; font-size:13px;
}
/* 出现红字提示时整行顶端对齐，避免标签被拉到中间 */
.kv.edit div.has-hint{ align-items:flex-start; }
.kv.edit div.has-hint > span:first-child{ padding-top:7px; }
.hint-bad{ display:none; font-size:11.5px; line-height:1.45; color:#c0392b;
  margin-top:3px; word-break:break-all; }
.hint-bad.on{ display:block; }
/* 重复/非法输入：整框标红 */
input.is-bad{ border-color:#e44 !important; background:#fdeaea !important; color:#b22 !important; }
/* 联系人录入行 */
.ct-row input{ width:100%; padding:6px 9px; font-size:13px; border-radius:6px; }
.ct-row td{ vertical-align:top; }
.ct-row .btn{ padding:5px 10px; }

/* ---------- 客户档案里的图片 / 商品与客户页的图片+表单并排 ---------- */
.thumb-big{ max-width:140px; max-height:100px; border-radius:8px;
  border:1px solid var(--line); display:block; }
.media-row-3{ display:grid; grid-template-columns:236px 1fr 1fr; gap:0 22px; align-items:start; }
.media-row-2{ display:grid; grid-template-columns:236px 1fr; gap:0 22px; align-items:start; }
@media(max-width:1180px){
  .media-row-3{ grid-template-columns:200px 1fr; }
}
@media(max-width:860px){
  .media-row-3, .media-row-2{ grid-template-columns:1fr; }
}

/* ---------- 订单：金额一致性 / 箱数异常 ---------- */
/* 订单总金额与明细合计不一致 */
.amt-bad{ color:#c0392b !important; }
input.is-bad{ border-color:#e44 !important; background:#fdeaea !important; color:#b22 !important; font-weight:600; }
.amt-hint{ margin-top:10px; padding:9px 12px; border-radius:8px; font-size:12.5px;
  background:#fdecea; border:1px solid #f5c6c0; color:#b3261e; line-height:1.6; }
/* 箱数除不尽：整行淡红，箱数格子颜色更深 */
tr.row-bad > td{ background:#fff4f3; }
tr.row-bad:hover > td{ background:#ffe9e7; }
td.ctn-bad{ background:#fcdcda !important; }
td.ctn-bad .ctn-val{ color:#b3261e; font-weight:700; }
.ctn-cell{ text-align:right; font-variant-numeric:tabular-nums; }
.ctn-val{ display:inline-block; padding:2px 6px; border-radius:5px; font-variant-numeric:tabular-nums; }
td.ctn-bad .ctn-val{ background:#f7c9c5; padding:2px 6px; }
/* 历史产品标记 */
.chip.h{ background:#e8f0ff; color:#2e5fd0; }


/* ---------- 按钮禁用态（订单未审核时「下单」置灰） ---------- */
.btn:disabled, .btn[disabled]{ opacity:.42; cursor:not-allowed; filter:grayscale(.6); }
.btn:disabled:hover, .btn[disabled]:hover{ background:var(--card); }

/* 阶段57：销售订单列表的「销售方」标签页 + 同订单号折叠 */
.party-tabs{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin:-2px 0 12px; }
.party-tab{ border:1px solid var(--line); background:#fff; color:#334155; border-radius:999px;
  padding:5px 14px; font-size:12.5px; cursor:pointer; line-height:1.5; }
.party-tab:hover{ border-color:var(--primary); color:var(--primary); }
.party-tab.on{ background:var(--primary); border-color:var(--primary); color:#fff; font-weight:600; }
.party-hint{ color:var(--muted); font-size:12px; margin-left:6px; }
.grp-tg{ border:1px solid var(--line); background:#eef4ff; color:var(--primary); border-radius:999px;
  font-size:11.5px; line-height:16px; padding:0 6px; margin-left:4px; cursor:pointer; }
.grp-tg:hover{ background:#dbe9ff; }
.grp-tg.on{ background:var(--primary); color:#fff; border-color:var(--primary); }
tr.ord-extra > td{ background:#fbfcfe; }
tr.ord-extra > td:first-child{ box-shadow:inset 3px 0 0 #dbe9ff; }
.place-done{ display:inline-block; background:#e8f6ee; color:#1f8a4c; border:1px solid #c9e9d6;
  border-radius:8px; padding:5px 12px; font-size:12.5px; font-weight:600; cursor:default; }

/* ---------- 下单弹窗（销售订单 → 工厂订单） ---------- */
.pl-head{ display:flex; flex-wrap:wrap; gap:6px 20px; font-size:13px; color:var(--muted);
  margin-bottom:14px; padding:10px 13px; background:#f7f9fd; border-radius:9px; line-height:1.7; }
.pl-head b{ color:var(--text); font-weight:600; }
.pl-3col{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:0 16px; margin-bottom:14px; }
.pl-3col .field label{ display:block; font-size:12.5px; color:var(--muted); margin-bottom:5px; }
.pl-3col textarea{ width:100%; padding:8px 10px; font-size:13px; line-height:1.55;
  border:1px solid var(--line); border-radius:8px; font-family:inherit; resize:vertical; }
.pl-3col textarea:focus{ outline:none; border-color:var(--primary); }
/* 阶段19-B4：行高压到最紧凑 */
.pl-table{ border-collapse:collapse; }
.pl-table th{ padding:5px 6px; font-size:12px; line-height:1.3; }
.pl-table td{ padding:3px 5px; white-space:normal; vertical-align:top; font-size:12.5px; }
.pl-table .pl-po{ font-size:11.5px; color:var(--muted); }
.pl-table .pl-qty{ text-align:right; font-variant-numeric:tabular-nums; font-weight:600; }
/* 品目编码：默认带 SKU 的单行输入框 */
.pl-code{ width:100%; padding:3px 6px; font-size:12px; line-height:1.35;
  border:1px solid var(--line); border-radius:5px; font-family:inherit; }
.pl-code:focus{ outline:none; border-color:var(--primary); }
.pl-desc{ width:100%; min-width:180px; padding:4px 7px; font-size:12px; line-height:1.45;
  border:1px solid var(--line); border-radius:5px; font-family:inherit;
  resize:vertical; height:38px; min-height:38px; }
.pl-desc:focus{ outline:none; border-color:var(--primary); }
.pl-t3{ width:100%; min-width:130px; padding:4px 7px; font-size:12px; line-height:1.45;
  border:1px solid var(--line); border-radius:5px; font-family:inherit;
  resize:vertical; height:38px; min-height:38px; }
.pl-t3:focus{ outline:none; border-color:var(--primary); }
.pl-t3[readonly]{ background:#f4f6fa; color:#5b6472; }

/* 阶段33：品目编码聚焦时浮层放大，长编码也能看全 */
.pl-table td.pl-code-cell{ position:relative; }
.pl-code:focus{ position:absolute; left:-4px; top:-4px; width:calc(100% + 8px); min-width:250px;
  z-index:40; font-size:14px; padding:9px 10px; background:#fff; border-color:var(--primary);
  border-radius:7px; box-shadow:0 8px 26px rgba(20,50,110,.28); }
/* 产品 ≤5 行时行高加大，填写位置更宽敞 */
.pl-table.pl-sparse td{ padding:9px 6px; }
.pl-table.pl-sparse .pl-code{ padding:7px 8px; font-size:12.5px; }
.pl-table.pl-sparse .pl-desc, .pl-table.pl-sparse .pl-t3{ height:64px; min-height:64px; font-size:12.5px; }
.pl-same{ text-align:center; vertical-align:middle; }
.pl-same-cb{ width:15px; height:15px; cursor:pointer; }
/* 「同上」合并出来的大格子 */
.pl-table td.pl-lead{ background:#fbfcff; vertical-align:top; }
.pl-table tr.pl-follow-row td{ background:#f7f9fd; }
/* 工厂订单状态：三个方块，只亮当前那一个 */
.fo-steps{ display:flex; align-items:center; gap:6px; }
.fo-step{ padding:5px 14px; font-size:13px; line-height:1.4; border-radius:8px;
  border:1px solid var(--line); background:var(--card); color:var(--muted);
  cursor:pointer; font-family:inherit; white-space:nowrap; }
.fo-step:hover{ border-color:var(--primary); color:var(--primary); }
.fo-step.on{ background:#16a34a; border-color:#16a34a; color:#fff; font-weight:600; }
.fo-step.on:hover{ background:#15803d; border-color:#15803d; color:#fff; }
/* 「待生产」是默认态，不参与点击（只有生产中 / 已完成 可点，再点一下退回待生产） */
.fo-step[data-st="待生产"]:not(.on){ cursor:default; }
.fo-step[data-st="待生产"]:not(.on):hover{ border-color:var(--line); color:var(--muted); }
.fo-step-arw{ color:var(--muted); font-size:14px; }
/* 列表页用的小号方块 */
.fo-steps.sm .fo-step{ padding:3px 9px; font-size:12px; border-radius:6px; }
.fo-steps.sm .fo-step-arw{ font-size:12px; }

/* ---------- 工厂订单（订货单版式，对齐 Excel） ---------- */
.fo-bar{ display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.fo-paper{ background:#fff; border:1px solid var(--line); border-radius:12px; padding:22px 24px; }
.fo-title{ text-align:center; font-size:20px; font-weight:700; letter-spacing:7px; margin-bottom:18px; }
.fo-head{ display:flex; flex-wrap:wrap; gap:2px 34px; font-size:13px; margin-bottom:1px; line-height:1.9; }
.fo-head span{ color:var(--muted); }
.fo-head b{ font-weight:600; }
.fo-table th, .fo-table td{ white-space:normal; vertical-align:top; font-size:13px; }
.fo-table td.num{ text-align:right; font-variant-numeric:tabular-nums; font-weight:600; }
.fo-img{ width:52px; height:52px; object-fit:cover; border-radius:6px;
  border:1px solid var(--line); display:block; }
/* 合并单元格：加可见边框，清楚看出哪几行被合并成一个大格 */
.fo-span{ background:#fcfdff; vertical-align:top; border:1px solid #c9d3e6; }
/* 品目编码（默认带产品 SKU，可改） */
.fo-code{ width:100%; padding:2px 5px; font-size:12px; line-height:1.4; font-family:inherit;
  border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--text); }
.fo-code:focus{ outline:none; border-color:var(--primary); }
/* 产品描述 / 整单三列：用 contenteditable div，高度随内容自然长，不出滚动条 */
.fo-desc, .fo-span-in{ width:100%; border:1px solid transparent; background:transparent;
  padding:5px 6px; font-size:12.5px; line-height:1.55; font-family:inherit;
  border-radius:6px; color:var(--text); display:block;
  white-space:pre-wrap; word-break:break-word; min-height:32px; }
.fo-span-in{ min-height:60px; }
.fo-desc:hover, .fo-span-in:hover{ border-color:var(--line); background:#fff; }
.fo-desc:focus, .fo-span-in:focus{ border-color:var(--primary); background:#fff; outline:none; }
.fo-foot{ margin-top:12px; font-size:12px; color:var(--muted); }

@media(max-width:1180px){ .pl-3col{ grid-template-columns:1fr; } }

/* 打印：只留订货单本身（工厂直接打印这张单生产） */
@media print{
  .sidebar, .topbar, .no-print, #cloud-badge, .cloud-badge, .flash{ display:none !important; }
  .layout, .main, .content{ display:block !important; overflow:visible !important;
    padding:0 !important; background:#fff !important; }
  .fo-paper{ border:none; border-radius:0; padding:0; }
  .fo-desc, .fo-span-in{ border:none !important; background:transparent !important;
    resize:none; padding:2px 0; }
  .table-wrap{ border:1px solid #999 !important; border-radius:0; overflow:visible !important; }
  .table-wrap > table{ min-width:0 !important; }
  th, td{ border-color:#bbb !important; font-size:11.5px; }
  .fo-table th, .fo-table td{ padding:6px 7px; }
}

/* 工具栏搜索按钮不换行 */
.toolbar .search button{ white-space:nowrap; flex:0 0 auto; }
.toolbar .search input{ min-width:0; }
/* 操作列按钮之间留出空隙（sticky 列里按钮挨太紧） */
td.op-col > *{ vertical-align:middle; }
td.op-col .btn{ margin-left:3px; }
.fo-table td.fo-span{ vertical-align:top; padding:6px 7px; }

/* 订货单表格：固定列宽，避免包装/定制要求被挤成一条缝 */
.table-wrap > .fo-table{ table-layout:fixed; min-width:820px; }
.fo-table th{ padding:7px 8px; font-size:12px; }
.fo-table td{ padding:6px 8px; overflow-wrap:break-word; word-break:break-word; }

/* ---------- 明细「参考价」列：按销售方显示 / 🔁 切换全部币种 ---------- */
.ref-tg{ border:1px solid var(--line); background:#fff; color:var(--muted);
  border-radius:5px; font-size:11px; line-height:1; padding:2px 5px;
  cursor:pointer; margin-left:4px; vertical-align:middle; }
.ref-tg:hover{ color:var(--primary); border-color:var(--primary); }
.ref-tg.on{ background:var(--primary); color:#fff; border-color:var(--primary); }
.ref-cell{ line-height:1.45; }
.ref-i{ display:block; font-variant-numeric:tabular-nums; white-space:nowrap; }
.ref-i.is-cur{ font-weight:700; }
.ref-cell .ref-all{ display:none; }
body.show-all-ref .ref-cell .ref-main{ display:none; }
body.show-all-ref .ref-cell .ref-all{ display:block; }

/* ---------- 新增弹窗（iframe 版本）：把填写页直接嵌进来 ---------- */
.modal-full{ width:min(1480px,96vw); height:92vh; max-height:92vh;
  display:flex; flex-direction:column; overflow:hidden; }
.modal-frame-wrap{ flex:1; min-height:0; background:#f6f7fb; }
.modal-frame-wrap iframe{ width:100%; height:100%; border:0; display:block; background:#f6f7fb; }

/* 弹窗里的填写页：不要侧边栏，内容铺满 */
body.embed-body{ background:#f6f7fb; }
.embed-content{ padding:16px 18px; overflow:auto; }
.embed-content .panel{ margin-bottom:14px; }

/* 客户页四栏：图片 / 主营产品 / 收货人 / 备注 */
.media-row-4{ display:grid; grid-template-columns:236px 1fr 1fr 1fr; gap:0 22px; align-items:start; }
@media(max-width:1280px){ .media-row-4{ grid-template-columns:200px 1fr 1fr; } }
@media(max-width:980px){ .media-row-4{ grid-template-columns:1fr 1fr; } }
@media(max-width:760px){ .media-row-4{ grid-template-columns:1fr; } }

/* 未保存离开确认弹窗里的说明文字 */
#mLeaveText{ white-space:pre-line; }

/* 详情页四栏：标签不换行；长值（销售方全名）在值里换行，不撑破版面 */
.kv > div > span:first-child{ flex:0 0 auto; white-space:nowrap; }
.kv > div > b{ text-align:right; word-break:break-word; min-width:0; }
.kv > div > b.party{ font-size:12.5px; line-height:1.4; }

/* ===================== 日期选择器（自研，企业微信风格） ===================== */
input.wb-date{ background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),
    linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 15px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
  background-size:5px 5px, 5px 5px; background-repeat:no-repeat; padding-right:28px; cursor:pointer; }
input.wb-date.is-cal-open{ border-color:var(--primary); box-shadow:0 0 0 3px rgba(46,124,246,.12); }
.wb-cal{ display:none; position:fixed; z-index:10000; width:296px; padding:10px 12px 8px;
  background:#fff; border:1px solid var(--line); border-radius:12px;
  box-shadow:0 8px 28px rgba(31,42,68,.18); font-size:13px; color:var(--text); }
.wb-cal.is-open{ display:block; }
.wb-cal-hd{ display:flex; align-items:center; gap:6px; margin-bottom:8px; }
.wb-cal-hd select{ border:1px solid var(--line); border-radius:7px; padding:3px 4px;
  font-size:12.5px; font-family:inherit; color:var(--text); background:#fff; cursor:pointer; }
.wb-cal-hd .wb-cal-y{ margin-left:auto; }
.wb-cal-nav{ width:26px; height:26px; border:1px solid var(--line); border-radius:7px;
  background:#fff; color:var(--muted); font-size:15px; line-height:1; cursor:pointer;
  font-family:inherit; }
.wb-cal-nav:first-child{ margin-right:auto; }
.wb-cal-nav:hover{ border-color:var(--primary); color:var(--primary); }
.wb-cal-wk{ display:grid; grid-template-columns:repeat(7,1fr); margin-bottom:2px; }
.wb-cal-wk span{ text-align:center; font-size:11.5px; color:var(--muted); padding:3px 0; }
.wb-cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:2px 0; }
.wb-cal-d{ width:32px; height:30px; margin:0 auto; border:0; background:transparent;
  border-radius:50%; font-size:12.5px; font-family:inherit; color:var(--text); cursor:pointer; }
.wb-cal-d.is-out{ color:#bcc3d4; }
.wb-cal-d.is-today{ color:var(--primary); font-weight:600; }
.wb-cal-d:hover{ background:var(--chip); }
.wb-cal-d.is-sel{ background:var(--primary); color:#fff; font-weight:600; }
.wb-cal-d.is-sel:hover{ background:var(--primary-d); }
.wb-cal-ft{ display:flex; align-items:center; gap:8px; margin-top:8px;
  padding-top:8px; border-top:1px solid var(--line); }
.wb-cal-today{ flex:1; height:28px; border:1px solid var(--line); border-radius:8px;
  background:#fff; color:var(--primary); font-size:12.5px; font-family:inherit; cursor:pointer; }
.wb-cal-today:hover{ background:var(--chip); }
.wb-cal-clear{ height:28px; padding:0 12px; border:1px solid var(--line); border-radius:8px;
  background:#fff; color:var(--muted); font-size:12.5px; font-family:inherit; cursor:pointer; }
.wb-cal-clear:hover{ color:var(--danger); border-color:var(--danger); }

/* ---------- 订舱数据：列表首列复选框 + 右下角固定「报关」按钮 ---------- */
td.op-col .bk-cb{ width:16px; height:16px; cursor:pointer; }
.bk-bar{ position:fixed; right:22px; bottom:22px; z-index:60; display:flex; align-items:center;
  gap:12px; padding:10px 14px; background:#fff; border:1px solid var(--line);
  border-radius:12px; box-shadow:0 8px 26px rgba(20,32,58,.18); }
.bk-bar .muted{ font-size:13px; }
.bk-bar .btn{ padding:9px 16px; }
.bk-bar .btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- 报关数据：列表双层表头（相关文件 合并成一格） ---------- */
th.cus-grp{ background:var(--primary); color:#fff; text-align:center; font-weight:600; }
table.cus-table th{ text-align:left; }
table.cus-table thead tr:last-child th{ background:#eef2fb; font-size:12.5px; }

/* ---------- 订单明细：左侧序号列 ---------- */
td.idx-cell{ text-align:center; color:var(--muted); font-size:12.5px; font-variant-numeric:tabular-nums; }
tbody tr:hover td.idx-cell{ color:var(--text); }

/* ---------- 添加产品弹窗：左上角「全选」 ---------- */
.modal-search .cb{ flex:0 0 auto; }

/* ---------- 下单到工厂：同上列顶部「全选」 ---------- */
th.pl-same-th{ line-height:1.35; }
th.pl-same-th label{ display:block; font-weight:normal; font-size:11px; color:var(--muted);
  cursor:pointer; white-space:nowrap; margin-top:3px; }
th.pl-same-th label input{ vertical-align:-2px; margin:0 2px 0 0; cursor:pointer; }

/* ---------- 阶段36：多图预览网格（客户图片 / 装柜照片） ---------- */
.img-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
.img-grid a{ display:block; border:1px solid var(--line); border-radius:8px;
  overflow:hidden; background:#fafbfd; }
.img-grid a:hover{ border-color:var(--primary); }
.img-grid img{ display:block; width:100%; height:132px; object-fit:cover; }

/* 多图上传：缩略图网格 + 拖拽/粘贴区（前后端同一套视觉） */
.imgs-wrap{ display:flex; flex-wrap:wrap; gap:10px; margin-top:8px; }
.imgs-item{ position:relative; width:112px; height:112px; border:1px solid var(--line);
  border-radius:8px; overflow:hidden; background:#fafbfd; }
.imgs-item img{ width:100%; height:100%; object-fit:cover; display:block; }
.imgs-item .imgs-del{ position:absolute; top:3px; right:3px; width:20px; height:20px;
  border-radius:50%; border:none; background:rgba(0,0,0,.55); color:#fff;
  font-size:13px; line-height:20px; text-align:center; cursor:pointer; padding:0; }
.imgs-item .imgs-del:hover{ background:var(--danger); }
.imgs-drop{ display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:4px; width:100%; padding:14px; border:1px dashed var(--line); border-radius:10px;
  background:#fafbfd; color:var(--muted); font-size:12.5px; cursor:pointer; }
.imgs-drop:hover,.imgs-drop.over{ border-color:var(--primary); color:var(--primary); }
.imgs-drop .big{ font-size:20px; }

/* ============================ 阶段38：应用内标签条 ============================ */
.wb-shell .layout{ height:100vh; overflow:hidden; }
.wb-shell .main{ height:100vh; overflow:hidden; }
.wb-shell .topbar{ flex:0 0 auto; }
.tabbar{ position:relative; flex:0 0 auto; display:flex; align-items:flex-end; gap:6px;
  padding:6px 10px 0; background:#fff; border-bottom:1px solid var(--line); min-height:42px; }
.tab-scroll{ display:flex; align-items:flex-end; gap:4px; flex:1; overflow-x:auto;
  overflow-y:hidden; scrollbar-width:thin; }
.tab-scroll::-webkit-scrollbar{ height:4px; }
.tab-scroll::-webkit-scrollbar-thumb{ background:#cfd8ee; border-radius:2px; }
.wbtab{ display:flex; align-items:center; gap:6px; max-width:190px; padding:6px 9px;
  border:1px solid var(--line); border-bottom:none; border-radius:8px 8px 0 0;
  background:#f1f4fa; color:var(--muted); font-size:12.5px; line-height:1.4;
  cursor:pointer; white-space:nowrap; user-select:none; }
.wbtab:hover{ background:#e9eefb; color:var(--text); }
.wbtab.active{ background:#fff; color:var(--text); font-weight:600;
  box-shadow:0 -2px 6px rgba(20,40,90,.06); }
.wbtab-t{ overflow:hidden; text-overflow:ellipsis; }
.wbtab-x{ flex:0 0 auto; width:17px; height:17px; display:flex; align-items:center;
  justify-content:center; border:0; border-radius:50%; background:transparent;
  color:inherit; font-size:14px; line-height:1; cursor:pointer; padding:0; }
.wbtab-x:hover{ background:rgba(0,0,0,.10); color:var(--danger); }
.tab-actions{ flex:0 0 auto; display:flex; align-items:center; padding-bottom:5px; }
.tab-btn{ border:1px solid var(--line); background:#fff; border-radius:6px;
  padding:3px 9px; font-size:12px; color:var(--muted); cursor:pointer; }
.tab-btn:hover{ border-color:var(--primary); color:var(--primary); }
.tab-menu{ position:absolute; right:10px; top:calc(100% - 2px); z-index:200;
  min-width:190px; max-height:60vh; overflow:auto; background:#fff;
  border:1px solid var(--line); border-radius:10px; padding:6px;
  box-shadow:0 10px 30px rgba(20,40,90,.16); }
.tab-menu[hidden]{ display:none !important; }
.tab-menu button{ display:block; width:100%; text-align:left; border:0; background:transparent;
  padding:8px 10px; border-radius:6px; font-size:12.5px; color:var(--text); cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tab-menu button:hover{ background:#eef3ff; color:var(--primary); }
.tab-content{ position:relative; flex:1; min-height:0; overflow:hidden; background:var(--bg); }
.tab-content iframe{ position:absolute; inset:0; width:100%; height:100%; border:0;
  background:#fff; display:block; }
/* 服务端渲染完整布局但实际在内部标签 iframe 里（表单提交 302 后）：隐藏第二套导航 */
.wb-in-tab .sidebar, .wb-in-tab .topbar{ display:none !important; }
.wb-in-tab .layout{ display:block; height:auto; }
.wb-in-tab .main{ height:auto; }
.wb-in-tab .content{ padding:16px; }
body.bare-body{ background:var(--bg); }
.bare-content{ padding:16px; overflow:auto; min-height:100vh; }
/* shell 模式：content 块只作为 block 的占位，真正内容在 iframe 里 */
.content.shell-hidden{ display:none !important; }

/* ============ 阶段39：报关相关文件（9 类单据槽位） ============ */
/* 顶行：客户/提单号/报关单号/柜号/船名航次/金额/备注 排成一行 */
.ce-row{ display:flex; align-items:flex-end; gap:10px; flex-wrap:wrap; }
.ce-f{ flex:0 0 auto; min-width:120px; }
.ce-f label{ display:block; font-size:11.5px; color:var(--muted); margin-bottom:4px; }
.ce-f input, .ce-f select{ width:100%; padding:7px 9px; border:1px solid var(--line);
  border-radius:8px; background:#fff; font-size:13px; color:var(--text); font-family:inherit; }
.ce-f-cust{ min-width:200px; }
.ce-f-wide{ min-width:190px; }
.ce-f-note{ min-width:170px; flex:1 1 170px; }
.ce-f-save{ margin-left:auto; }
.ce-ro{ padding:7px 10px; border:1px dashed var(--line); border-radius:8px;
  font-size:13px; font-weight:600; color:var(--text); background:#f7f9fd; white-space:nowrap; }

/* 相关文件卡片网格 */
.doc-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:12px; }
/* 阶段49：报关四件套（箱单/报关发票/报关单/申报要素）与清关/其他单据之间的分隔条 */
.doc-split{ grid-column:1/-1; font-size:12px; color:var(--muted); padding:6px 2px 0;
  border-top:1px dashed var(--line); margin-top:2px; }
/* 阶段51：四件套并成一张「报关资料」大卡（占满整行，里面仍是一格一份单据） */
.doc-set{ grid-column:1/-1; border:1px solid var(--line); border-radius:14px;
  background:#fbfcff; padding:10px 12px 12px; }
.doc-set-hd{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
  padding-bottom:8px; margin-bottom:10px; border-bottom:1px dashed var(--line); }
.doc-set-hd b{ font-size:13.5px; }
.doc-set-hd .muted{ font-size:12px; }
.doc-set-sum{ margin-left:auto; font-size:12px; color:var(--muted);
  background:#eef1f7; border-radius:20px; padding:2px 10px; }
.doc-set-sum.part{ background:#fff5e6; color:#b26a00; }
.doc-set-sum.ok{ background:#e6f7ed; color:var(--ok); }
.doc-set-body{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:10px; }
.doc-set-body .doc-card{ background:var(--card); }
/* 阶段52：报关资料槽位占满整行（一份文件 4 张子表） */
.doc-wide{ grid-column:1/-1; }
/* 阶段53：商品列表「出口数据」列（按出口类型分）——参考价 + 海关编码 */
.px-cell{ display:flex; flex-direction:column; gap:1px; line-height:1.35; }
.px-price{ font-size:13px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.px-hs{ font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }

/* 列表里的「报关资料」汇总列 */
.docset{ display:inline-block; min-width:38px; text-align:center; font-size:12px;
  font-weight:600; border-radius:20px; padding:2px 8px; background:#eef1f7; color:var(--muted); }
.docset.part{ background:#fff5e6; color:#b26a00; }
.docset.ok{ background:#e6f7ed; color:var(--ok); }
.doc-card{ border:1px solid var(--line); border-radius:12px; background:var(--card);
  padding:10px 12px 12px; display:flex; flex-direction:column; gap:8px; }
.doc-card.is-done{ border-color:#bfe3cd; background:#fbfefc; }
.doc-card.is-na{ opacity:.62; }
.doc-hd{ display:flex; align-items:center; gap:8px; }
.doc-title{ font-size:13.5px; font-weight:700; }
.doc-chip{ font-size:11px; padding:2px 8px; border-radius:20px; background:var(--chip);
  color:var(--primary); margin-left:auto; }
.doc-chip.ok{ background:#e6f7ed; color:var(--ok); }
.doc-chip.na{ background:#eef0f4; color:var(--muted); }
.doc-chip.wait{ background:#f3f5f9; color:var(--muted); }
.doc-main{ display:flex; gap:10px; align-items:stretch; }
.doc-files{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:6px; }
.doc-files .files-list{ list-style:none; display:flex; flex-direction:column; gap:4px; margin:0; }
.doc-files .files-list li{ display:flex; align-items:center; gap:6px; font-size:12.5px; }
.doc-files .files-list a{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.doc-del{ border:0; background:transparent; color:var(--muted); cursor:pointer;
  font-size:14px; line-height:1; padding:0 4px; border-radius:4px; }
.doc-del:hover{ color:var(--danger); background:#fdeaee; }

/* 阶段56：文件行 = 文件名（点开是预览页，不下载）+ 单独的「下载」键 */
.doc-files .files-list li > a:first-child{ flex:1 1 auto; color:var(--primary); }
.doc-files .files-list li > a:first-child:hover{ text-decoration:underline; }
.doc-files .files-list li > a.doc-dl{ flex:0 0 auto; border:1px solid var(--line); border-radius:6px;
  padding:0 8px; line-height:20px; font-size:12px; color:var(--muted); text-decoration:none;
  white-space:nowrap; }
.doc-files .files-list li > a.doc-dl:hover{ color:var(--primary); border-color:var(--primary);
  background:#f2f7ff; text-decoration:none; }
.doc-drop{ display:flex; align-items:center; justify-content:center; gap:6px;
  min-height:56px; border:1px dashed var(--line); border-radius:10px; cursor:pointer;
  color:var(--muted); font-size:12px; background:#fafbfe; text-align:center; padding:8px; }
.doc-drop:hover, .doc-drop.hot{ border-color:var(--primary); color:var(--primary); background:#f2f7ff; }
.doc-drop-ic{ font-size:16px; line-height:1; }
.doc-btns{ flex:0 0 86px; display:flex; flex-direction:column; gap:6px; justify-content:center; }
.doc-btns .btn{ width:100%; white-space:nowrap; }
.doc-btns .btn.on{ background:var(--primary); color:#fff; border-color:var(--primary); }
.doc-btns .btn[disabled]{ opacity:.45; cursor:not-allowed; }
.doc-mini{ font-size:11px; margin-left:4px; }
.doc-mini.ok{ color:var(--ok); }
.doc-mini.na{ color:var(--muted); }

/* 模板管理页 */
.tpl-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:12px; }
.tpl-card{ border:1px solid var(--line); border-radius:12px; background:var(--card); padding:12px; }
.tpl-hd{ display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.tpl-src{ font-size:12px; color:var(--muted); margin-bottom:6px; }
.tpl-src.own{ color:var(--ok); }
.tpl-name{ font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; margin-bottom:2px; }
.tpl-form{ display:flex; gap:6px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.tpl-form input[type=file]{ font-size:11.5px; max-width:190px; }
.tpl-set-form{ display:flex; gap:12px; align-items:center; flex-wrap:wrap;
  padding:12px; border:1px dashed var(--line); border-radius:10px; background:#fafbfe; }
.tpl-set-form input[type=file]{ font-size:12px; }
/* 阶段51：报关四件套并成一张「报关资料」模板卡（里面一行一份工作表） */
.tpl-set{ border:1px solid var(--line); border-radius:14px; background:#fbfcff; padding:12px 14px 12px; }
.tpl-set-hd{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
  padding-bottom:8px; margin-bottom:4px; border-bottom:1px dashed var(--line); }
.tpl-set-hd b{ font-size:13.5px; }
.tpl-set-hd .muted{ font-size:12px; }
.tpl-set-body{ display:flex; flex-direction:column; }
.tpl-row{ display:grid; grid-template-columns:104px 1fr auto; gap:10px; align-items:center;
  padding:9px 2px; border-bottom:1px solid #eef1f6; }
.tpl-row:last-child{ border-bottom:0; }
.tpl-row-name b{ font-size:13px; }
.tpl-row-meta{ min-width:0; }
.tpl-row-meta .tpl-src{ margin-bottom:2px; }
.tpl-row-meta .tpl-name{ margin-bottom:0; }
.tpl-row-act{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }

/* ============ 阶段40：装箱资料附件更新时间/未读 ============ */
.pack-when{ display:inline-flex; align-items:center; gap:4px; font-size:11.5px;
  color:var(--muted); white-space:nowrap; }
.pack-when.unread{ color:#d93025; font-weight:600; }
.pack-when.unread::before{ content:"●"; font-size:9px; line-height:1; }
.pack-when.stale{ color:#b26a00; }
.pack-read-btn{ border:0; background:transparent; color:var(--muted); cursor:pointer;
  font-size:11px; padding:0 4px; text-decoration:underline; }
.pack-read-btn:hover{ color:var(--primary); }

/* 阶段41：销售订单「已结清金额」金额完成度进度条（绿色 = 已结清 ÷ 订单总金额） */
.settle-cell{ display:flex; flex-direction:column; gap:4px; min-width:98px; }
.settle-amt{ font-variant-numeric:tabular-nums; font-weight:600; line-height:1.15; }
.settle-line{ display:flex; align-items:center; gap:6px; }
.settle-track{ position:relative; flex:1 1 auto; min-width:46px; height:6px; border-radius:999px;
  background:#e9edf5; overflow:hidden; }
.settle-track > i{ display:block; height:100%; border-radius:999px;
  background:linear-gradient(90deg,#4ec98a,var(--ok)); transition:width .25s ease; }
/* 已结清 > 订单总金额（多收）：条走满，颜色加深提示 */
.settle-track > i.over{ background:linear-gradient(90deg,var(--ok),#0e8a45); }
.settle-pct{ flex:0 0 auto; min-width:30px; text-align:right; font-size:11px;
  color:var(--ok); font-variant-numeric:tabular-nums; }
.settle-pct.zero{ color:var(--muted); }

/* 阶段43：工作台 KPI 卡片（可点开看明细，仅展示不含编辑） */
.kpi-group{ margin-bottom:20px; }
.kpi-hd{ font-size:12.5px; font-weight:600; color:var(--muted); letter-spacing:.04em;
  margin:0 0 10px 2px; }
.kpi-hd::before{ content:""; display:inline-block; width:3px; height:12px; border-radius:2px;
  background:var(--primary); margin-right:7px; vertical-align:-2px; }
.card.kpi{ position:relative; display:block; width:100%; text-align:left; font:inherit;
  cursor:pointer; appearance:none;
  transition:box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.card.kpi:hover{ box-shadow:0 4px 14px rgba(16,24,40,.10); transform:translateY(-1px); }
.card.kpi:focus-visible{ outline:2px solid var(--primary); outline-offset:2px; }
.card.kpi .k{ display:block; }
.card.kpi .v{ display:block; }
.card.kpi .arrow{ position:absolute; top:10px; right:13px; font-size:15px; color:#c5cbd8;
  transition:color .15s ease, transform .15s ease; }
.card.kpi:hover .arrow{ color:var(--primary); transform:translateX(2px); }
.kpi-sub{ display:block; margin-top:6px; font-size:11.5px; color:var(--muted); line-height:1.35; }
.kpi-note{ margin:10px 0 0; font-size:12px; color:var(--muted); }
.kpi-empty{ margin:0; padding:20px 0; text-align:center; color:var(--muted); font-size:13px; }
.kpi-more{ margin-right:auto; font-size:12px; color:var(--muted); }
#mKpi .modal-body{ max-height:64vh; }
#mKpi .modal-body table{ font-size:13px; }

/* ---------- 阶段60：财务水单分摊状态 / 附件小图 / 大图查看层 ---------- */
/* 水单列表「分摊情况」列：状态 chip + 下方剩余金额 */
.alloc-cell{ white-space:nowrap; }
.alloc-cell .alloc-left{ margin-top:3px; font-size:12px; color:var(--muted);
  font-variant-numeric:tabular-nums; }

/* 水单详情：附件缩略图条（小图 → 点开大图） */
.att-strip{ margin-top:14px; padding-top:12px; border-top:1px dashed var(--line); }
.att-label{ font-size:12.5px; color:var(--muted); margin-bottom:8px; }
.att-thumbs{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.att-thumb{ padding:0; border:1px solid var(--line); border-radius:9px; background:#fff;
  width:96px; height:96px; overflow:hidden; cursor:zoom-in; line-height:0;
  transition:box-shadow .15s ease, border-color .15s ease, transform .15s ease; }
.att-thumb:hover{ border-color:var(--primary); box-shadow:0 4px 14px rgba(16,24,40,.14);
  transform:translateY(-1px); }
.att-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.att-file{ display:inline-block; padding:6px 12px; border:1px solid var(--line);
  border-radius:8px; background:#fff; font-size:12.5px; color:var(--primary);
  text-decoration:none; }
.att-file:hover{ border-color:var(--primary); background:#f2f7ff; text-decoration:none; }

/* 表单 / 附件区的图片缩略图（上传后显示一张小图） */
.files-list .f-thumb{ width:52px; height:52px; object-fit:cover; border-radius:7px;
  border:1px solid var(--line); cursor:zoom-in; flex:0 0 auto; background:#fff; }
.files-list .f-thumb:hover{ border-color:var(--primary); box-shadow:0 2px 10px rgba(16,24,40,.14); }

/* 大图查看层：铺满屏幕，右上角 × 关闭 */
.lb-mask{ position:fixed; inset:0; z-index:9998; display:flex; align-items:center;
  justify-content:center; padding:52px 40px 40px;
  background:rgba(12,16,26,.82); backdrop-filter:blur(2px); }
.lb-mask[hidden]{ display:none; }
html.lb-on, html.lb-on body{ overflow:hidden; }
.lb-box{ position:relative; display:flex; flex-direction:column; align-items:center;
  gap:10px; max-width:100%; max-height:100%; }
.lb-img{ max-width:calc(100vw - 80px); max-height:calc(100vh - 150px);
  object-fit:contain; border-radius:8px; background:#fff; box-shadow:0 8px 40px rgba(0,0,0,.45); }
.lb-cap{ color:#e6ebf5; font-size:12.5px; }
.lb-open{ color:#9fc3ff; font-size:12px; text-decoration:none; }
.lb-open:hover{ text-decoration:underline; }
/* × 固定在视口右上角，不随图片大小移动 */
.lb-x{ position:fixed; top:14px; right:18px; width:40px; height:40px; border-radius:50%;
  border:1px solid rgba(255,255,255,.35); background:rgba(255,255,255,.12); color:#fff;
  font-size:24px; line-height:1; cursor:pointer; z-index:9999; font-family:inherit; }
.lb-x:hover{ background:rgba(255,255,255,.26); border-color:#fff; }

/* ==========================================================================
   阶段65：统一可搜索下拉（static/picker.js）
     原生 select 留在 DOM（提交/change 不变），视觉换成按钮 + 浮层
   ========================================================================== */
.pk{ position:relative; width:100%; min-width:0; }
.pk-native{ position:absolute !important; left:0; top:0; width:1px !important; height:1px !important;
  min-width:0 !important; padding:0 !important; margin:0 !important; border:0 !important;
  opacity:0 !important; pointer-events:none !important; }
.pk-btn{ width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px;
  height:36px; padding:0 11px; border:1px solid var(--line); border-radius:8px; background:#fff;
  color:var(--text); font-family:inherit; font-size:13.5px; line-height:1; cursor:pointer;
  text-align:left; transition:border-color .12s, box-shadow .12s; }
.pk-btn:hover{ border-color:#c3cfe6; }
.pk-btn:focus-visible{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(46,124,246,.14); }
.pk-open .pk-btn{ border-color:var(--primary); box-shadow:0 0 0 3px rgba(46,124,246,.14); }
.pk-btn:disabled{ background:#f5f7fb; color:var(--muted); cursor:not-allowed; }
.pk-t{ flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pk-t.ph{ color:#9aa4b8; }
.pk-ar{ flex:0 0 auto; color:var(--muted); font-size:10px; font-style:normal; }
.pk-pop{ position:fixed; z-index:9997; background:#fff; border:1px solid var(--line);
  border-radius:10px; box-shadow:0 12px 34px rgba(20,30,55,.18); padding:6px; }
.pk-q{ width:100%; height:32px; padding:0 9px; margin:0 0 6px; border:1px solid var(--line);
  border-radius:7px; font-family:inherit; font-size:13px; color:var(--text); }
.pk-q:focus{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(46,124,246,.12); }
.pk-list{ max-height:266px; overflow-y:auto; overscroll-behavior:contain; }
.pk-o{ padding:8px 10px; border-radius:7px; font-size:13.5px; color:var(--text); cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pk-o:hover,.pk-o.on{ background:#eef4ff; }
.pk-o.sel{ color:var(--primary); font-weight:600; background:#f2f7ff; }
.pk-o.dis{ color:var(--muted); cursor:not-allowed; }
.pk-empty{ padding:12px 8px; color:var(--muted); font-size:13px; text-align:center; }
/* 表格 / 紧凑区域里的下拉稍微矮一点 */
td .pk-btn, .pack-val .pk-btn, .ph-c .pk-btn{ height:32px; font-size:13px; }

/* ==========================================================================
   阶段65：统一上传区（拖拽高亮）
   ========================================================================== */
.filesbox, .imgsbox, .imgbox, .doc-drop, .dropzone{ position:relative; }
.drop-hot{ border-radius:10px; }
.drop-hot::after{ content:"放开即可上传"; position:absolute; inset:0; z-index:6;
  display:flex; align-items:center; justify-content:center;
  border:2px dashed var(--primary); border-radius:10px;
  background:rgba(46,124,246,.08); color:var(--primary);
  font-size:13px; font-weight:600; letter-spacing:.5px; pointer-events:none; }
