/* ═══════════════════════════════════════════════════════════════════
   ds.css · 跟单台共用界面设计基础(V20261106pof2 起)
   ───────────────────────────────────────────────────────────────────
   老板 11-06:「重点长期使用的功能都需要醒目的设计」「参考大厂的建议和基础设施」。
   做法照大厂设计体系:一套设计变量(颜色 / 圆角 / 间距 / 控件高度 / 焦点环)
   + 几个共用部件,页面只挑部件拼,不再每处手写一份样式。

   第一层 · 共用部件(任何页面都能用,类名 ds-*):
     .ds-step     步骤标题(圆号 + 标题 + 灰字提示)      ①②③ 分步的表单
     .ds-more     「更多」次要操作行(灰色小链接)          把不常用的操作收起来
     .ds-disclosure  可展开区(details/summary)            可选填的整块(如议价)
     .ds-idle     主按钮「还没准备好」的视觉(仍可点)
   第二层 · 开采购单(只在 .pof2 里生效,不碰别的页面)

   规矩:
   · 颜色只用下面的变量;页面里的 var(--bg-card) / var(--border) 等沿用主样式
   · 要盖过行内 style 的地方才用 !important,每处都注明原因
   · 改了这个文件:index.html 里引用它的 ?v= 跟着换(sw-po.js 按版本号缓存)
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ds-primary: #2563eb;
  --ds-primary-strong: #1d4ed8;
  --ds-primary-weak: rgba(37, 99, 235, 0.07);
  --ds-primary-line: rgba(37, 99, 235, 0.35);
  --ds-ok: #15803d;
  --ds-warn: #b45309;
  --ds-warn-weak: rgba(245, 158, 11, 0.10);
  --ds-danger: #dc2626;
  --ds-r-sm: 6px;
  --ds-r-md: 10px;
  --ds-r-lg: 14px;
  --ds-ctl-h: 40px;      /* 普通输入框高度 */
  --ds-ctl-h-lg: 44px;   /* 主输入(数量 / 单价 / 供应商)和主按钮 —— 手指、鼠标都好点 */
  --ds-focus: 0 0 0 3px rgba(37, 99, 235, 0.22);
  --ds-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── 共用部件 · 步骤标题 ───────────────────────────────────────── */
.ds-step { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 10px; min-width: 0; }
.ds-step-no {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ds-primary); color: #fff; font-size: 13px; font-weight: 800; line-height: 24px; text-align: center;
}
.ds-step-t { font-size: 15px; font-weight: 800; color: var(--text-primary, #0f172a); letter-spacing: 0.2px; }
.ds-step-hint { font-size: 12px; font-weight: 400; color: var(--text-tertiary, #94a3b8); }
.ds-step-req { color: var(--ds-danger); font-weight: 700; }

/* ── 共用部件 · 「更多」次要操作行 ─────────────────────────────── */
.ds-more {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--border-subtle, #e5e7eb);
  font-size: 11.5px; color: var(--text-tertiary, #94a3b8); line-height: 1.6;
}
.ds-more-lbl {
  font-size: 10.5px; font-weight: 700; color: var(--text-tertiary, #94a3b8);
  border: 1px solid var(--border, #e5e7eb); border-radius: 999px; padding: 0 8px; line-height: 17px;
}
/* 行内 style 给每个链接写死了颜色(蓝 / 紫),这里统一成次要灰字,!important 才盖得过 */
.ds-more a { color: var(--text-secondary, #64748b) !important; font-weight: 500 !important; text-decoration: none; }
.ds-more a:hover { color: var(--ds-primary) !important; text-decoration: underline; }

/* ── 共用部件 · 可展开区 ──────────────────────────────────────── */
.ds-disclosure > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 9px 0 1px; font-size: 12.5px; font-weight: 700; color: var(--text-secondary, #64748b); user-select: none;
}
.ds-disclosure > summary::-webkit-details-marker { display: none; }
.ds-disclosure > summary::after { content: '展开 ▾'; margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--ds-primary); }
.ds-disclosure[open] > summary::after { content: '收起 ▴'; }
.ds-disclosure-hint { font-size: 11.5px; font-weight: 400; color: var(--text-tertiary, #94a3b8); }
.ds-disclosure-val { font-size: 12px; font-weight: 800; color: var(--ds-ok); }

/* ── 共用部件 · 主按钮还没准备好(只是变淡,照样能点,点了照原逻辑提示缺什么) ── */
.ds-idle { opacity: 0.55; }

/* ═══ 第二层 · 开采购单(.pof2) ═══════════════════════════════════ */

/* ① 供应商 */
.pof2 .pof-sup {
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--ds-r-md); padding: 12px 14px 12px; margin-bottom: 12px;
}
.pof2 .pof-sup #poFormSupplierInput {
  height: var(--ds-ctl-h-lg); padding: 0 12px; font-size: 14.5px; font-weight: 600;
  border: 1.5px solid var(--border, #e5e7eb); border-radius: 8px; box-sizing: border-box;
}
.pof2 .pof-sup .supplier-picker > .btn { height: var(--ds-ctl-h-lg); padding: 0 14px; border-radius: 8px; }

/* ② 选款 —— 不再有第二层滚动(老板规矩:禁止双层滑动):整个弹窗只有一个滚动区,
      右栏 sticky 常驻,往下翻产品时合计和确认按钮一直看得到 */
.pof2 .po-lines-scroll { max-height: none; min-height: 0; overflow: visible; }
.pof2 .po-lines-card { background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: var(--ds-r-md); overflow: hidden; }
.pof2 .po-li-head {
  display: grid; gap: 12px; padding: 8px 12px; background: var(--bg-elevated, #f8fafc);
  font-size: 12px; font-weight: 700; color: var(--text-secondary, #64748b);
  border-bottom: 1px solid var(--border-subtle, #eef2f7);
}
.pof2 .po-li-row { padding: 14px 12px; }
.pof2 .po-li-row.checked { background: var(--ds-primary-weak); box-shadow: inset 4px 0 0 var(--ds-primary); }
.pof2 .po-li-row.assigned { opacity: 0.55; }
.pof2 .po-li-row > input[type="checkbox"] {
  width: 22px; height: 22px; margin: 0; cursor: pointer; accent-color: var(--ds-primary); justify-self: center;
}
.pof2 .po-li-row > input[type="checkbox"]:disabled { cursor: not-allowed; }

/* 数量 / 单价:大输入框(主样式给的是 12px 小字,这里放大) */
.pof2 .li-qty input[type="number"] { height: var(--ds-ctl-h-lg); border-radius: 8px; border-width: 1.5px; }
.pof2 .li-price input[type="number"] {
  height: var(--ds-ctl-h-lg); padding: 0 10px; font-size: 17px; font-weight: 700; text-align: center;
  border: 1.5px solid var(--border, #e5e7eb); border-radius: 8px; font-variant-numeric: tabular-nums;
}
/* 勾上了但单价还空着 → 黄框提醒(纯样式,不拦保存) */
.pof2 .po-li-row.checked .li-price input[type="number"]:placeholder-shown { border-color: #f59e0b; background: var(--ds-warn-weak) !important; }
.pof2 .li-sub {
  text-align: right; font-family: var(--ds-mono); font-size: 15px; font-weight: 800;
  color: var(--text-primary, #0f172a); font-variant-numeric: tabular-nums;
}
.pof2 .li-sub.empty { font-weight: 400; color: var(--text-tertiary, #94a3b8); }

/* 规格盒(尺寸 / 颜色 / 包装)沿用 V20260718-specui 的醒目框,只统一圆角 */
.pof2 .li-spec { border-radius: var(--ds-r-md) !important; }

/* 统一焦点环(键盘 / 鼠标都看得出现在在填哪个框) */
.pof2 input:focus-visible, .pof2 select:focus-visible, .pof2 textarea:focus-visible {
  outline: none; border-color: var(--ds-primary) !important; box-shadow: var(--ds-focus);
}

/* ③ 下单信息(右栏) */
.pof2 .po-col-side { gap: 10px; }
.pof2 .pof-sum {
  background: var(--bg-card, #fff); border: 1.5px solid var(--ds-primary-line);
  border-radius: var(--ds-r-md); padding: 12px 14px;
}
.pof2 .pof-sum-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.pof2 .pof-total { font-family: var(--ds-mono); font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text-primary, #0f172a); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pof2 .pof-total small { font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary, #64748b); margin-right: 6px; }
.pof2 .pof-bg-body { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--ds-primary-line); }

/* 订单备注条(弹窗顶部,客户留言):加左色条,更醒目 */
#poFormBody .po-cust-note { border-left: 4px solid #d97706; font-size: 13px; }

/* 确认按钮(弹窗底部,不随内容滚走):大、明确写着下给谁 */
#poFormModal #poFormSaveBtn { min-height: var(--ds-ctl-h-lg); padding: 0 26px; font-size: 15px; font-weight: 800; border-radius: var(--ds-r-md); }

/* 弹窗宽度:主样式里 V20260718-onepage 写的是「#poFormModal .modal」,可弹窗里那层叫 .modal-content,
   这条从来没生效过,弹窗一直是行内的 1180px —— 双栏 + 六列产品行挤得产品名只剩两百来像素。
   这里按当时的设计改成 1300px(小屏自动缩到 97% 宽);行内 max-width 要 !important 才盖得过 */
#poFormModal .modal-content { width: min(1300px, 97vw); max-width: 97vw !important; }

/* 桌面:产品行网格(手机 / 窄屏沿用主样式 ≤1024px 的三列规则) */
@media (min-width: 1025px) {
  .pof2 .po-li-row, .pof2 .po-li-head { grid-template-columns: 34px 84px minmax(0, 1fr) 112px 132px 96px; gap: 12px; }
  .pof2 .po-li-row .li-img, .pof2 .po-li-row .li-noimg { width: 84px; height: 84px; }
}
/* 窄屏:产品行按主样式换成三列堆叠,表头对不上列 → 收起 */
@media (max-width: 1024px) {
  .pof2 .po-li-head { display: none; }
}

/* ── 共用部件 · 可排序表头(V20261106rcvage 起,收货台「状态」先用)──
   <button class="ds-sort [on]" aria-sort="none|ascending|descending">列名 <span class="ar">⇅ | ▼ … | ▲ …</span></button>
   点一下切排序;当前在排的列整颗变蓝。排序状态由各页面自己存(本机 localStorage,每人记住) */
.ds-sort {
  all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; margin: -2px -7px; border-radius: var(--ds-r-sm); font: inherit; color: inherit; white-space: nowrap;
}
.ds-sort:hover { background: var(--ds-primary-weak); color: var(--ds-primary); }
.ds-sort .ar { font-size: 11px; font-weight: 700; color: var(--text-tertiary, #94a3b8); }
.ds-sort.on { color: var(--ds-primary); font-weight: 800; background: var(--ds-primary-weak); }
.ds-sort.on .ar { color: var(--ds-primary); }
.ds-sort:focus-visible { box-shadow: var(--ds-focus); }
