/**
 * 公共组件样式库（样板间）
 * 新页面优先使用本文件中的类名；现有页面逐步迁移，勿在本文件外重复定义同名基础组件。
 */

:root {
  --brand: #165DFF;
  /* 表头主题接外观设置；未注入时以下为默认值 */
  --th-bg: #eef3fa;
  --th-text: #1e293b;
  --th-divider: #dbe4f3;
}

/* ========== ① 按钮 ========== */
.common-lib .btn,
.btn-common {
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  line-height: 1.3;
  box-sizing: border-box;
  text-decoration: none;
}
.common-lib .btn-primary,
.btn-common-primary { background: var(--brand); color: #fff; }
.common-lib .btn-default,
.btn-common-default { background: #fff; color: #475569; border: 0.5px solid #cbd5e1; }
.common-lib .btn-success,
.btn-common-success { background: #16a34a; color: #fff; }
.common-lib .btn-danger,
.btn-common-danger { background: #ef4444; color: #fff; }
.common-lib .btn-sm,
.btn-common-sm { padding: 6px 14px; font-size: 12px; border-radius: 7px; }

/* 无前缀别名：供新页直接使用（加载顺序在 index 内联样式之前，现有页以内联为准） */
.btn { border: none; border-radius: 8px; padding: 9px 20px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; line-height: 1.3; box-sizing: border-box; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-default { background: #fff; color: #475569; border: 0.5px solid #cbd5e1; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 7px; }

/* ========== ② 查询栏 ========== */
.filter-bar {
  background: #fff;
  border: 0.5px solid #e3e8ef;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px 20px;
  flex-wrap: wrap;
}
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item .k,
.filter-item label { font-size: 13px; color: #5f6b7a; white-space: nowrap; margin: 0; }
.filter-item label .req { color: #ef4444; margin-right: 2px; }
.ctrl,
.form-input,
.form-select {
  font-size: 13px;
  padding: 7px 10px;
  border: 0.5px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
  min-width: 0;
}
.form-select { cursor: pointer; }
.ctrl:focus,
.form-input:focus,
.form-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.12); }
.filter-bar + .info-bar { margin-top: 8px; }
.filter-bar + .requisition-out-detail-block,
.info-bar + .requisition-out-detail-block { margin-top: 10px; }

/* ========== ⑩ 入库/出库明细流式页（外采入库、分批次入库等同款布局） ========== */
.ext-purchase-page.requisition-out-page--flow,
.pr-order-receive-detail-shell.stock-in-receive-flow {
  padding: 12px 14px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}
.ext-purchase-page .filter-bar-ext-supplier { flex: 0 0 220px; min-width: 200px; }
.ext-purchase-page .filter-bar-ext-supplier .form-select { width: 100%; }
.ext-purchase-page .filter-bar-ext-date { flex: 0 0 150px; }
.ext-purchase-page .filter-bar-ext-date .form-input { width: 100%; }
.ext-purchase-page .filter-bar-ext-shop { flex: 0 0 160px; min-width: 140px; }
.ext-purchase-page .filter-bar-ext-shop .form-select { width: 100%; }
.ext-purchase-page .filter-bar-ext-note { flex: 2 1 320px; min-width: 240px; }
.ext-purchase-page .filter-bar-ext-note .form-input { width: 100%; }
.ext-purchase-page .pr-req-table-wrap,
.pr-order-receive-detail-shell.stock-in-receive-flow .pr-req-table-wrap {
  width: 100%;
  min-width: 0;
  flex: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
}
.ext-purchase-page .data-table.pr-req-table,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table,
.pr-order-receive-page .data-table.pr-order-receive-list-table,
.pr-order-receive-detail-shell .data-table.pr-order-view-detail-table,
.pr-order-receive-detail-shell .data-table.pr-order-batch-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  white-space: nowrap;
  border-collapse: collapse;
}
/* 采购入库列表/详情：紧凑行高（与食材档案、领用出库明细一致） */
.pr-order-receive-page .data-table.pr-order-receive-list-table th,
.pr-order-receive-page .data-table.pr-order-receive-list-table td,
.pr-order-receive-detail-shell .data-table.pr-order-view-detail-table th,
.pr-order-receive-detail-shell .data-table.pr-order-view-detail-table td,
.pr-order-receive-detail-shell .data-table.pr-order-batch-table th,
.pr-order-receive-detail-shell .data-table.pr-order-batch-table td,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table th,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table td,
.ext-purchase-page .data-table.pr-req-table th,
.ext-purchase-page .data-table.pr-req-table td {
  padding: 5px 8px;
  line-height: 1.3;
}
.pr-order-receive-page .data-table.pr-order-receive-list-table thead th,
.pr-order-receive-detail-shell .data-table.pr-order-view-detail-table thead th,
.pr-order-receive-detail-shell .data-table.pr-order-batch-table thead th,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table thead th,
.ext-purchase-page .data-table.pr-req-table thead th {
  padding: 5px 8px;
  font-weight: 500;
}
.ext-purchase-page .data-table.pr-req-table td.pr-info-cell,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table td.pr-info-cell { text-align: left; }
.ext-purchase-page .data-table.pr-req-table td.amount,
.ext-purchase-page .data-table.pr-req-table td.pr-total,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table td.amount,
.pr-order-receive-detail-shell.stock-in-receive-flow .data-table.pr-req-table td.pr-total,
.pr-order-receive-detail-shell .data-table.pr-recv-amt-col,
.pr-order-receive-detail-shell .data-table.pr-recv-price-col,
.pr-order-receive-detail-shell .data-table .recv-line-amt-col,
.pr-order-receive-detail-shell .data-table .recv-price-col { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.requisition-out-detail-block > .requisition-out-submit-row {
  flex-shrink: 0;
  margin-top: 20px;
  padding-bottom: 4px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: static;
}
.requisition-out-detail-block > .requisition-out-row-actions + .requisition-out-submit-row { margin-top: 12px; }
.pr-order-receive-page .filter-bar .stock-in-list-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ========== ③ 列表表格 ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #d8e0ea;
  font-size: 13px;
  table-layout: fixed;
}
.data-table thead th {
  background: var(--th-bg);
  color: var(--th-text);
  font-weight: 600;
  padding: 12px 8px;
  border-bottom: 2px solid var(--th-divider);
  border-right: 1px solid rgba(255, 255, 255, 0.35);
  text-align: center;
  white-space: nowrap;
}
.data-table thead th:last-child { border-right: none; }
.data-table th,
.data-table td { border-right: 1px solid #e8edf3; }
.data-table th:last-child,
.data-table td:last-child { border-right: none; }
.data-table td {
  padding: 11px 8px;
  color: #334155;
  text-align: center;
}
.data-table tbody td { border-bottom: 1px solid #e2e8f0; }
.data-table tbody tr:nth-child(odd) { background: #ffffff; }
.data-table tbody tr:nth-child(even) { background: #f4f7fb; }
.data-table tbody tr:hover { background: #eaf2ff; }
.data-table thead th { position: relative; }
.data-table .col-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 7;
}
.data-table .col-resize-handle:hover { background: rgba(22, 93, 255, 0.1); }

/* ========== ④ 状态徽标 ========== */
.badge { padding: 3px 12px; border-radius: 12px; font-size: 12px; display: inline-block; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.badge-pending { background: #dbeafe; color: #2563eb; }
.badge-pass { background: #ecfdf5; color: #16a34a; }
.badge-reject { background: #fef2f2; color: #ef4444; }
.badge-nostock { background: #f1f5f9; color: #64748b; }
.badge-partial { background: #fff7ed; color: #c2630c; }
.badge-instock { background: #ecfdf5; color: #16a34a; }

/* ========== ⑤ 单号胶囊 ========== */
.doc-no {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: #f1f5f9;
  border: 0.5px solid #e2e8f0;
  border-radius: 7px;
  padding: 4px 12px;
  color: #1e293b;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  display: inline-block;
  line-height: 1.4;
}

/* ========== ⑥ 详情头 ========== */
.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 2px;
}
.detail-head .title { font-size: 17px; font-weight: 700; color: #1e293b; margin: 0; }
.detail-head .st { margin-left: auto; }

/* ========== ⑦ 信息栏 ========== */
.info-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 50px;
  font-size: 13px;
  color: #5f6b7a;
}
.info-bar b { color: #1e293b; margin-left: 10px; font-weight: 600; }

/* ========== ⑧ 单据打印模板 .print-doc ========== */
.print-doc {
  font-family: "PingFang SC", "Microsoft Yahei", Arial, sans-serif;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  box-sizing: border-box;
  max-width: 277mm;
  margin: 0 auto;
  padding: 14mm 16mm;
}
.print-doc--landscape { max-width: 277mm; min-height: 190mm; }
.print-doc-header { text-align: center; margin-bottom: 12px; }
.print-doc-title { font-size: 20px; font-weight: 700; color: #1e293b; letter-spacing: 0.5px; }
.print-doc-title-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.print-doc-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
}
.print-doc-meta-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
}
.print-doc-base { font-weight: 600; color: #1e293b; }
.print-doc-no { font-family: ui-monospace, Menlo, Consolas, monospace; color: #334155; }
.print-doc-info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 13px;
}
.print-doc-info-table th,
.print-doc-info-table td {
  border: 0.5px solid #94a3b8;
  padding: 8px 10px;
  text-align: left;
}
.print-doc-info-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  width: 12%;
  white-space: nowrap;
}
.print-doc-info-table td { color: #1e293b; font-weight: 500; }
.print-doc-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 12.5px;
  table-layout: fixed;
}
.print-doc-data-table th,
.print-doc-data-table td {
  border: 0.5px solid #94a3b8;
  padding: 7px 8px;
  text-align: center;
  color: #334155;
}
.print-doc-data-table thead th {
  background: #eef2f7 !important;
  color: #1e293b !important;
  font-weight: 600;
  border-bottom: 0.5px solid #94a3b8 !important;
}
.print-doc-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.print-doc-data-table .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.print-doc-total-row td {
  background: #f1f5f9 !important;
  font-weight: 700;
  border-top: 2px solid #94a3b8 !important;
}
.print-doc-total-row .amount { text-align: right; color: #1e293b; }
.print-doc-sig-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 22px;
  font-size: 13px;
  color: #475569;
}
.print-doc-sig-line {
  display: inline-block;
  min-width: 100px;
  border-bottom: 1px solid #64748b;
  vertical-align: bottom;
  margin-left: 6px;
}
.print-doc-footnote {
  margin-top: 14px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* ========== ⑨ 列表页骨架 ========== */
.page-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.page-shell-head { flex-shrink: 0; }
.page-shell-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.page-shell-foot { flex-shrink: 0; }
.page-shell-body .data-table { width: 100%; min-width: 0; table-layout: fixed; }
.page-shell-body .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--th-divider);
}

/* ========== ⑪ 库存盘点 ========== */
.stock-check-page.list-page-shell { padding: 12px 14px; }
.stock-check-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}
.stock-check-page-title { margin: 0; font-size: 17px; font-weight: 700; color: #1e293b; }
.stock-check-filter-bar .stock-check-filter-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stock-check-list-table th:last-child,
.stock-check-list-table td.stock-check-actions-cell { text-align: center; }
.stock-check-form { display: flex; flex-direction: column; gap: 14px; }
.stock-check-form-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 10px 12px;
}
.stock-check-form-label {
  text-align: right;
  font-size: 13px;
  color: #5f6b7a;
  white-space: nowrap;
}
.stock-check-form-label .req { color: #ef4444; margin-right: 2px; }
.stock-check-form-row .form-select,
.stock-check-form-row .form-input { width: 100%; min-width: 0; }
.stock-check-entry-table th.text-left,
.stock-check-entry-table td.text-left { text-align: left; }
.stock-check-entry-table th.text-right,
.stock-check-entry-table td.text-right { text-align: right; }
.stock-check-entry-table .stock-check-book-qty {
  background: #f1f5f9;
  color: #64748b;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stock-check-actual-input {
  width: 100%;
  max-width: 120px;
  margin-left: auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stock-check-diff-pos { color: #16a34a; font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-check-diff-neg { color: #ef4444; font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-check-diff-zero { color: #94a3b8; font-variant-numeric: tabular-nums; }
.stock-check-note-cell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-check-note-input { width: 100%; min-width: 0; box-sizing: border-box; }
.stock-check-entry-page .data-table.stock-check-entry-table th,
.stock-check-entry-page .data-table.stock-check-entry-table td {
  padding: 5px 8px;
  line-height: 1.3;
}

/* ========== 菜谱与排餐：紧凑业务维护页 ========== */
.recipe-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 0.5px solid #e3e8ef;
  border-radius: 8px;
}
.recipe-mini-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.recipe-mini-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 0.5px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.recipe-mini-stat strong {
  color: #165dff;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.recipe-compact-filter {
  padding: 8px 10px;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.recipe-compact-filter .form-input,
.recipe-compact-filter .form-select {
  height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.recipe-dish-cell {
  padding: 2px 0;
}
.recipe-dish-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eff6ff;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #2563eb;
  font-weight: 700;
  flex: 0 0 auto;
}
.recipe-dish-name {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-mgmt-page .recipe-compact-filter + .table-box {
  margin-top: 0;
}
@media (max-width: 1100px) {
  .recipe-page-head { align-items: flex-start; flex-direction: column; }
}

.reception-ai-page{padding-bottom:16px;}
.reception-ai-filter .form-input,
.reception-ai-filter .form-select{height:34px;}
.reception-ai-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  align-items:start;
}
.reception-ai-card{
  background:#fff;
  border:1px solid #dbe5f5;
  border-radius:8px;
  overflow:hidden;
  box-shadow:0 2px 8px rgba(15,23,42,.05);
}
.reception-ai-card-head{
  min-height:58px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  padding:10px 12px;
  background:#f8fafc;
  border-bottom:1px solid #dbe5f5;
}
.reception-ai-card-head b{
  display:block;
  color:#0f172a;
  font-size:15px;
  line-height:22px;
}
.reception-ai-card-head .mini-note{
  display:block;
  margin-top:3px;
  line-height:18px;
}
.reception-ai-card .data-table th,
.reception-ai-card .data-table td{
  text-align:center;
}
.reception-ai-table{
  width:100%;
  table-layout:fixed;
  font-size:13px;
}
.reception-ai-table th{
  white-space:nowrap;
}
.reception-ai-table td{
  padding:7px 6px;
  line-height:18px;
  vertical-align:middle;
  word-break:normal;
  overflow-wrap:break-word;
}
.reception-ai-dish-name{
  text-align:left!important;
  font-weight:700;
  color:#0f172a;
}
.reception-ai-dish-pick{
  width:100%;
  min-height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border:1px solid transparent;
  border-radius:6px;
  background:#fff;
  color:#0f172a;
  cursor:pointer;
}
.reception-ai-dish-pick:hover{
  border-color:#2563eb;
  background:#eff6ff;
}
.reception-ai-dish-text{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:700;
  text-align:center;
}
.reception-ai-dish-text.empty{
  color:#94a3b8;
  font-weight:400;
}
.reception-ai-dish-action{
  flex-shrink:0;
  color:#2563eb;
  font-size:12px;
  font-weight:700;
}
.reception-ai-dish-select{
  height:30px;
  min-height:30px;
  width:100%;
  font-weight:700;
  color:#0f172a;
  background:#fff;
}
.reception-ai-table .badge{
  white-space:nowrap;
}
.modal-box:has(.reception-ai-picker-modal){
  width:920px;
  max-width:96vw;
  overflow:hidden;
}
.reception-ai-picker-modal{
  max-height:68vh;
  overflow:auto;
}
.reception-ai-picker-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:12px;
}
.reception-ai-picker-title{
  font-size:15px;
  font-weight:700;
  color:#0f172a;
  line-height:24px;
}
.reception-ai-picker-tabs{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  flex-wrap:wrap;
}
.reception-ai-picker-tab{
  height:30px;
  padding:0 14px;
  border:1px solid #cbd5e1;
  border-radius:6px;
  background:#fff;
  color:#334155;
  font-weight:600;
  cursor:pointer;
}
.reception-ai-picker-tab:hover{
  border-color:#2563eb;
  color:#2563eb;
  background:#eff6ff;
}
.reception-ai-picker-tab.active{
  border-color:#2563eb;
  background:#2563eb;
  color:#fff;
}
.reception-ai-picker-list{
  margin-top:12px;
  max-height:390px;
  overflow:auto;
  border:1px solid #dbe5f5;
  border-radius:8px;
}
.reception-ai-picker-list table{
  margin:0;
}
.reception-ai-picker-list tbody tr{
  cursor:pointer;
}
.reception-ai-picker-list tbody tr:hover{
  background:#eff6ff;
}
.reception-ai-picker-list tbody tr.active{
  background:#dbeafe;
  color:#1d4ed8;
}
@media (max-width:1500px){
  .reception-ai-grid{grid-template-columns:1fr;}
}
