/* 采购页（工作 → 采购，S16 装配、P1 业务闭环 SPA 层）专用样式 · 自然白底抗疲劳科学排版 V2。
 *
 * 设计准则（Natural White-First & Anti-Fatigue Scientific Typography）：
 *   1. 95%+ 纯白主画布（#ffffff）+ 微暖灰细边框（#e5e7eb）+ 极轻环境阴影，彻底消除大面积灰块造成的视觉压抑与审美疲劳。
 *   2. 科学色彩阶梯：深岩灰主标题（#1e293b）、舒适阅读正文（#334155）、柔和石板灰说明（#64748b）；
 *      状态色采用低饱和莫兰迪色系——沉稳灰蓝主强调（#3b5978）、鼠尾草绿完成态（#2d6a4f）、暖米金待办态（#9a6700）。
 *   3. 科学排版与等宽数字对齐：拉大区块呼吸感间距（20px–24px），表格与指标全面启用 tabular-nums 等宽数字对齐，
 *      三级折叠树（供应商卡片 → 产品汇总 → SKU 规格组 → 店铺明细）层次清晰、久看不累。
 *   4. 严守 CSP style-src 'self'：零内联 style、零外部 url() 引用。
 */

.field textarea {
  width: 100%;
  min-height: calc(var(--control-h) * 1.8);
  padding: 10px 14px;
  font-size: var(--fs-body);
  line-height: 1.65;
  font-family: inherit;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #1e293b;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea:focus {
  outline: 2px solid rgba(59, 89, 120, 0.16);
  border-color: #3b5978;
}

/* 采购模块主工作台容器：自然纯白主导、宽松纵向节奏 */
.proc-workbench {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1480px;
  color: #334155;
  padding-bottom: 24px;
}

.proc-workbench .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}

.proc-workbench .section {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.025);
}

.proc-workbench .section-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.proc-workbench .section-title {
  color: #1e293b;
  letter-spacing: -0.01em;
}

.proc-workbench .section-sub {
  color: #64748b;
  line-height: 1.6;
}

/* 顶部四步科学作业流指引条（4-Step Scientific Workflow Ribbon） */
.proc-workflow-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.proc-workflow-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #edf0f3;
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.proc-workflow-step:hover {
  background: #fafbfc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.proc-workflow-step.is-active {
  background: #ffffff;
  border: 1.5px solid #3b5978;
  box-shadow: 0 2px 8px rgba(59, 89, 120, 0.07);
}

.proc-workflow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.proc-workflow-step.is-active .proc-workflow-num {
  background: #3b5978;
  color: #ffffff;
}

.proc-workflow-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.proc-workflow-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #1e293b;
}

.proc-workflow-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

/* 顶部跨模块协同与日历筛选纯白工具卡 */
.proc-toolbar-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
  padding: 18px 22px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.proc-plan-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.proc-plan-pills-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-right: 4px;
}

.proc-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.proc-pill-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.proc-pill-btn.is-active {
  background: #f0f4f8;
  border-color: #3b5978;
  color: #1e293b;
  font-weight: 600;
}

/* 本页新增的控件行（筛选条、批量操作条、工厂检索条）：叠加在既有 .actions 之上，排成一行、
 * 自动换行、按基线对齐（.field 自带 label，末端对齐比顶端对齐更整齐）。 */
.proc-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.proc-actions-row .field {
  margin-bottom: 0;
}

/* 采购概览 6 指标卡：纯白卡片 + 等宽数字 + 柔和重点色标 */
.proc-workbench .grid {
  gap: 14px;
}

.proc-workbench .card.metric {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.015);
}

.proc-workbench .metric-label {
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.proc-workbench .metric-value {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

/* 数据源与快照状态科学整合条（替代原本杂乱堆叠的多行灰字） */
.proc-meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 18px;
  margin: 12px 0 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #3b5978;
  border-radius: 10px;
}

.proc-meta-strip-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.proc-meta-strip .proc-summary {
  margin: 0;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.55;
}

.proc-meta-strip .section-note {
  margin: 0;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.5;
}

/* 汇总指标高亮横幅 */
.proc-demand-summary-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.proc-demand-summary-bar .proc-summary {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}

/* 登记表单：宽屏两栏，窄屏自动收成一栏；备注、可供 SKU、1688 链接这类长内容字段跨两栏。 */
.proc-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px 20px;
  align-items: start;
  margin-top: 8px;
}
.proc-form-grid .field {
  margin-bottom: 0;
}
.proc-form-grid .form-error,
.proc-form-grid .form-actions,
.proc-field-wide {
  grid-column: 1 / -1;
}

/* 1688 外链按钮：箭头提示"这会离开控制台，在新标签打开"，不依赖颜色单独传达。 */
.proc-external {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #3b5978;
}
.proc-external:hover {
  background: #f0f4f8;
  border-color: #3b5978;
}
.proc-external::after {
  content: " ↗";
}

.proc-summary {
  margin: 0 0 var(--space-3);
  color: #475569;
  font-size: var(--fs-body);
  line-height: 1.6;
}

/* PROC-1: disable one screen's editable fields while a mutation awaits recovery. */
.proc-edit-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.proc-supplier-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}
.proc-supplier-picker [hidden] {
  display: none;
}

/* PROC-1b: one compact demand row per SKU, with comfortable white-first breathing room. */
.proc-demand-sheet {
  max-height: 680px;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.proc-demand-table {
  table-layout: fixed;
  min-width: 1160px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  font-variant-numeric: tabular-nums;
}
.proc-demand-table th, .proc-demand-table td {
  height: 36px;
  padding: 10px 12px;
  white-space: nowrap;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.proc-demand-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafbfc;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #e2e8f0;
}
.proc-demand-table th:nth-child(1) { width: 76px; }
.proc-demand-table th:nth-child(2) { width: 270px; }
.proc-demand-table th:nth-child(3) { width: 150px; }
.proc-demand-table th:nth-child(4) { width: 146px; }
.proc-demand-table th:nth-child(5) { width: 76px; }
.proc-demand-table th:nth-child(6) { width: 140px; }
.proc-demand-table th:nth-child(7) { width: 150px; }
.proc-demand-table th:nth-child(8) { width: 160px; }
.proc-demand-table .proc-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 18px;
}
.proc-demand-table .proc-product-caption {
  color: var(--text-3);
  font-size: var(--fs-helper);
  line-height: 15px;
  margin-top: 2px;
}
.proc-demand-table input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  accent-color: #3b5978;
  cursor: pointer;
}
.proc-demand-orders a {
  color: #3b5978;
  font-weight: 500;
  text-decoration: none;
}
.proc-demand-orders a:hover {
  text-decoration: underline;
}
.proc-demand-orders a + a::before {
  content: "、";
  color: #94a3b8;
}
.proc-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.proc-sort:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.proc-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.proc-more summary {
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}
.proc-more summary:hover {
  background: #f8fafc;
  color: #1e293b;
}
.proc-more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

/* Group rows retain original store demands as independently selectable details. */
.proc-demand-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.proc-demand-expand:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
.proc-demand-expand::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.proc-demand-expand[aria-expanded="true"] {
  background: #f0f4f8;
  border-color: #3b5978;
  color: #3b5978;
}
.proc-demand-expand[aria-expanded="true"]::before {
  transform: rotate(45deg);
}
.proc-demand-expand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 三级折叠行（产品汇总 → SKU规格组 → 店铺明细）科学白底渐变层次 */
.proc-demand-product {
  background: #ffffff;
}
.proc-demand-product:hover {
  background: #fafbfc;
}
.proc-demand-product td:nth-child(2) {
  font-weight: var(--fw-semibold);
  color: #1e293b;
}
.proc-demand-group {
  background: #fcfcfd;
}
.proc-demand-group:hover {
  background: #f8fafc;
}
.proc-demand-group td:nth-child(2) {
  padding-left: 22px;
  color: #334155;
}
.proc-demand-detail {
  background: #f8fafc;
}
.proc-demand-detail:hover {
  background: #f1f5f9;
}
.proc-demand-detail td:first-child {
  padding-left: 26px;
}
.proc-demand-detail td:nth-child(2) {
  padding-left: 34px;
  color: #475569;
}
.proc-demand-quantity .proc-cell-text {
  font-size: var(--fs-helper);
  font-variant-numeric: tabular-nums;
}

/* Supplier totals and product rows stay visible; SKU and store details expand on request. */
.proc-supplier-section {
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
  overflow: hidden;
}
.proc-supplier-section .proc-demand-sheet {
  border: 0;
  border-radius: 0;
}
.proc-supplier-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #edf0f3;
  border-left: 3.5px solid #2d6a4f;
}
.proc-supplier-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.proc-supplier-head .proc-summary {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.proc-supplier-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: #1e293b;
}

[data-procurement-demand-summary],
.proc-supplier-head .proc-summary,
.proc-demand-product .proc-demand-quantity > span {
  color: #1e293b;
  font-weight: var(--fw-semibold);
}

/* 采购单详情：5 步科学状态流转进度条（Lifecycle Stepper） */
.proc-po-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.proc-po-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #edf0f3;
  background: #ffffff;
  color: #64748b;
  font-size: 13px;
}

.proc-po-step.is-done {
  background: #f4f9f5;
  border-color: #cce3d4;
  color: #2d6a4f;
}

.proc-po-step.is-current {
  background: #f0f4f8;
  border: 1.5px solid #3b5978;
  color: #1e293b;
  font-weight: 600;
}

.proc-po-step.is-cancelled {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.proc-po-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.proc-po-step.is-done .proc-po-step-dot {
  background: #2d6a4f;
  color: #ffffff;
}

.proc-po-step.is-current .proc-po-step-dot {
  background: #3b5978;
  color: #ffffff;
}

/* 合作工厂与 SKU 映射快捷检索词胶囊栏 */
.proc-quick-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.proc-quick-chips-label {
  font-size: 12.5px;
  color: #64748b;
}

@media (max-width: 960px) {
  .proc-workflow-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .proc-po-stepper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .proc-workflow-ribbon {
    grid-template-columns: 1fr;
  }
}
