/* ==========================================================================
   区域营养管理系统 · 原型样式
   设计语言对齐「智慧慢病管理平台」：主色 #0078d4、白卡片 + 8px 圆角 + 轻投影
   ========================================================================== */

:root {
  --primary: #0078d4;
  --primary-dark: #005cad;
  --primary-light: #e8f3fb;
  --primary-light-2: #c6e1f5;

  --success: #2ea121;
  --success-bg: #eef8ec;
  --warning: #e6a23c;
  --warning-bg: #fdf6ec;
  --danger: #f04b4b;
  --danger-bg: #fef0f0;
  --purple: #7b5bd6;
  --purple-bg: #f3f0fc;
  --cyan: #13a8a8;
  --cyan-bg: #e8f7f7;

  --bg: #f2f3f5;
  --card: #ffffff;
  --text-1: #1f2733;
  --text-2: #5b6577;
  --text-3: #8b95a5;
  --text-4: #b4bccc;
  --border: #ebeef5;
  --border-2: #dcdfe6;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(16, 31, 54, .04), 0 6px 16px -8px rgba(16, 31, 54, .12);
  --shadow-float: 0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05);
  --sidebar-w: 208px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d8e0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #bcc3ce; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 骨架 ---------- */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 16px 0 18px;
  color: #fff;
  background: linear-gradient(90deg, #0a84e0 0%, var(--primary) 45%, #0068bb 100%);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .25);
}
.brand-logo svg { width: 17px; height: 17px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: .4px; }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, .7); letter-spacing: .6px; }

.top-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .25); margin: 0 16px; }

.org-switch {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.org-switch:hover { background: rgba(255, 255, 255, .26); }
.org-switch svg { width: 13px; height: 13px; opacity: .8; }

.top-search {
  margin-left: auto; position: relative;
  flex: 0 0 208px; width: 208px;
}
.top-search input {
  width: 100%; height: 30px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .16);
  color: #fff; padding: 0 12px 0 32px; font-size: 12.5px; outline: none;
}
.top-search input::placeholder { color: rgba(255, 255, 255, .72); }
.top-search input:focus { background: rgba(255, 255, 255, .26); border-color: rgba(255, 255, 255, .5); }
.top-search svg { position: absolute; left: 10px; top: 8px; width: 14px; height: 14px; color: rgba(255, 255, 255, .8); }

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: 10px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: transparent; color: rgba(255, 255, 255, .9);
  display: grid; place-items: center; cursor: pointer; position: relative;
}
.icon-btn:hover { background: rgba(255, 255, 255, .16); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 5px; right: 6px; width: 6px; height: 6px;
  background: #ff5b5b; border-radius: 50%; border: 1px solid #0a7cd2;
}

.user-chip { display: flex; align-items: center; gap: 8px; margin-left: 6px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .22); cursor: pointer; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: var(--primary); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.user-chip .name { font-size: 13px; }
.user-chip .role { font-size: 11px; color: rgba(255, 255, 255, .65); line-height: 1.2; }

.layout { flex: 1 1 auto; display: flex; padding: 8px; gap: 8px; overflow: hidden; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 14px 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-head .t { font-size: 12px; color: var(--text-3); letter-spacing: 1px; font-weight: 600; }
.sidebar-head .collapse { cursor: pointer; color: var(--text-4); display: grid; place-items: center; }
.sidebar-head .collapse:hover { color: var(--primary); }

.menu { flex: 1; overflow-y: auto; padding: 2px 8px 16px; }
.menu-group { margin-bottom: 2px; }
.menu-group-title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; border-radius: 6px; user-select: none;
}
.menu-group-title:hover { background: #f6f8fb; }
.menu-group-title .mg-icon { width: 15px; height: 15px; color: var(--text-3); display: grid; place-items: center; }
.menu-group-title .mg-icon svg { width: 15px; height: 15px; }
.menu-group-title .arrow { margin-left: auto; width: 12px; height: 12px; color: var(--text-4); transition: transform .2s; }
.menu-group.open .menu-group-title .arrow { transform: rotate(90deg); }
.menu-group.active .menu-group-title { color: var(--primary); }
.menu-group.active .menu-group-title .mg-icon { color: var(--primary); }

.menu-items { overflow: hidden; }
.menu-group:not(.open) .menu-items { display: none; }

.menu-item {
  display: flex; align-items: center; gap: 8px;
  height: 33px; padding: 0 10px 0 20px; margin: 1px 0;
  border-radius: 6px; font-size: 13.2px; color: var(--text-2);
  cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.menu-item .dot { display: none; }
.menu-item:hover { background: var(--primary-light); color: var(--primary); }
.menu-item:hover .dot { background: var(--primary); }
.menu-item.on {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 4px 10px -3px rgba(0, 120, 212, .45);
}
.menu-item.on .dot { background: #fff; }
.menu-item .count {
  margin-left: auto; font-size: 11px; padding: 0 6px; height: 17px; line-height: 17px;
  border-radius: 9px; background: var(--danger-bg); color: var(--danger); font-weight: 600;
}
.menu-item.on .count { background: rgba(255, 255, 255, .22); color: #fff; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-3);
}
.sidebar-foot .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(46, 161, 33, .14); }

/* ---------- 主区域 ---------- */
.main {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.tabsbar {
  flex: 0 0 auto; height: 40px;
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabsbar::-webkit-scrollbar { display: none; }

.tab {
  display: flex; align-items: center; gap: 6px;
  height: 27px; padding: 0 10px;
  font-size: 12.5px; color: var(--text-2);
  border-radius: 5px; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
}
.tab:hover { color: var(--primary); background: var(--primary-light); }
.tab.on {
  color: var(--primary); background: #fff; font-weight: 600;
  border-color: var(--primary-light-2);
}
.tab .x { width: 12px; height: 12px; color: var(--text-4); opacity: .8; }
.tab .x:hover { color: var(--danger); }
.tab .pin { width: 11px; height: 11px; color: var(--text-4); }

.content { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; background: #f7f8fa; }

.page { padding: 16px 18px 24px; min-height: 100%; }

.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.page-head .ph-main { flex: 1; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.page-title .code { font-size: 12px; font-weight: 500; color: var(--text-3); background: #fff; border: 1px solid var(--border); padding: 1px 7px; border-radius: 4px; }
.page-desc { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.page-head .ph-actions { display: flex; gap: 8px; flex: 0 0 auto; padding-top: 3px; }

.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.crumb b { color: var(--text-2); font-weight: 500; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head .ch-title { font-size: 14px; font-weight: 600; }
.card-head .ch-sub { font-size: 12px; color: var(--text-3); }
.card-head .ch-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ---------- 筛选 ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.field { display: flex; align-items: center; gap: 8px; }
.field > label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.field.grow { flex: 1 1 220px; min-width: 200px; }
.field.grow .search-input { flex: 1; display: block; }
.search-input { position: relative; }
.search-input .input { padding-left: 30px; }
.search-input svg { position: absolute; left: 9px; top: 9px; width: 14px; height: 14px; color: var(--text-4); }

.input, .select, .textarea {
  height: 32px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-1);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input[readonly], .textarea[readonly] { background: #f7f9fc; color: var(--text-2); cursor: default; }
.input:disabled, .select:disabled, .textarea:disabled { background: #f4f6fa; color: var(--text-4); cursor: not-allowed; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, .1);
}
.select { padding-right: 26px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8b1c0' stroke-width='2.4'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 13px;
}
.input.w-sm, .select.w-sm { width: 132px; }
.input.w-md, .select.w-md { width: 180px; }
.textarea { height: auto; min-height: 68px; padding: 8px 10px; resize: vertical; line-height: 1.6; }

.seg { display: inline-flex; background: #f2f4f8; padding: 2px; border-radius: 6px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2);
  height: 26px; padding: 0 12px; border-radius: 4px; font-size: 12.5px; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 31, 54, .1); }

/* ---------- 分类树下拉筛选 ---------- */
.ts { position: relative; }
.ts-btn {
  display: flex; align-items: center; gap: 6px;
  width: 180px; height: 32px; padding: 0 10px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff;
  font-family: inherit; font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ts-btn:hover { border-color: var(--primary); }
.ts.on .ts-btn { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .1); }
.ts-txt { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-txt.is-picked { color: var(--text-1); font-weight: 500; }
.ts-arrow { flex: 0 0 auto; display: flex; color: var(--text-4); }
.ts-arrow svg { width: 13px; height: 13px; transform: rotate(90deg); transition: transform .15s; }
.ts.on .ts-arrow svg { transform: rotate(-90deg); }

.ts-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  width: 272px; padding: 6px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(20, 40, 80, .16);
}
.ts-head { padding: 1px 1px 6px; border-bottom: 1px solid var(--border); }
.ts-search { position: relative; display: block; }
.ts-search svg { position: absolute; left: 8px; top: 8px; width: 13px; height: 13px; color: var(--text-4); }
.ts-search input {
  width: 100%; height: 28px; padding: 0 8px 0 26px;
  border: 1px solid var(--border-2); border-radius: 6px;
  font-family: inherit; font-size: 12.5px; color: var(--text-1); outline: none;
}
.ts-search input::placeholder { color: var(--text-4); }
.ts-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .1); }
.ts-body { max-height: 288px; overflow-y: auto; padding: 4px 0; }
.ts-row {
  display: flex; align-items: center; gap: 2px;
  height: 28px; padding: 0 6px; border-radius: 5px;
  font-size: 12.8px; color: var(--text-1); cursor: pointer;
}
.ts-row:hover { background: #f2f7fd; }
.ts-row.on { background: #e8f3fd; color: var(--primary); font-weight: 600; }
.ts-row--all { border-bottom: 1px dashed var(--border); border-radius: 5px 5px 0 0; margin-bottom: 2px; }
.ts-ind { flex: 0 0 auto; }
.ts-caret {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; color: var(--text-4);
}
.ts-caret svg { width: 11px; height: 11px; transform: rotate(90deg); transition: transform .12s; }
.ts-caret.on svg { transform: rotate(-90deg); }
.ts-caret.ghost { visibility: hidden; }
.ts-caret:hover { background: #e2ecf9; color: var(--text-2); }
.ts-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-cnt {
  flex: 0 0 auto; min-width: 18px; padding: 0 5px; line-height: 16px; text-align: center;
  font-size: 11.2px; color: var(--text-3); background: #f2f4f8; border-radius: 9px;
}
.ts-row.on .ts-cnt { background: #d7e9fb; color: var(--primary); }
.ts-off { margin-left: 4px; padding: 0 4px; font-size: 10px; color: #c07d1b; background: #fdf3e2; border-radius: 3px; }
.ts-empty { padding: 20px 0; text-align: center; font-size: 12.5px; color: var(--text-4); }
.ts-foot { border-top: 1px solid var(--border); padding: 6px 4px 1px; font-size: 11.4px; color: var(--text-4); line-height: 1.5; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  font-size: 13px; color: var(--text-2);
  background: #fff; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { color: var(--primary); border-color: var(--primary-light-2); background: #f5faff; }
.btn svg { width: 14px; height: 14px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--primary); padding: 0 8px; }
.btn--ghost:hover { background: var(--primary-light); }
.btn--sm { height: 27px; padding: 0 10px; font-size: 12.5px; }
.btn--danger:hover { color: var(--danger); border-color: #f7c9c9; background: var(--danger-bg); }

.link-btn { color: var(--primary); cursor: pointer; font-size: 12.8px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.warn { color: var(--warning); font-weight: 600; }
.link-sep { color: var(--border-2); margin: 0 6px; }

/* 行内多操作：两行排布，避免把表格撑宽；不可用操作置灰并给 title 说明 */
.ops { display: flex; flex-direction: column; gap: 3px; }
.ops-row { white-space: nowrap; }
.ops .link-sep { margin: 0 4px; }
.link-btn.is-off { color: #b9c0cc; cursor: not-allowed; }
.link-btn.is-off:hover { text-decoration: none; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl thead th {
  background: #f7f9fc;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: #f6fbff; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tbl .mono { font-family: "SF Mono", Consolas, "Roboto Mono", monospace; font-size: 12.2px; letter-spacing: -.2px; }
table.tbl td .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
table.tbl .cell-main { display: flex; align-items: center; gap: 9px; }
/* 列较多的列表用紧凑内边距，避免 1280 下出现横向滚动 */
table.tbl.dense thead th, table.tbl.dense tbody td { padding-left: 9px; padding-right: 9px; }

/* ---------------- 商品分类树 ---------------- */
.cat-cell { display: flex; align-items: center; gap: 6px; }
.cat-caret {
  width: 16px; height: 16px; flex: 0 0 auto; border-radius: 4px;
  display: grid; place-items: center; color: var(--text-3); cursor: pointer; transition: .15s;
}
.cat-caret svg { width: 12px; height: 12px; transition: transform .15s; }
.cat-caret.on svg { transform: rotate(90deg); }
.cat-caret:hover { background: var(--primary-light); color: var(--primary); }
.cat-caret.ghost { visibility: hidden; cursor: default; }
.cat-nm { font-weight: 600; }
.cat-cnt {
  font-size: 11px; font-weight: 600; color: var(--primary);
  background: var(--primary-light); border-radius: 9px; padding: 0 6px; line-height: 16px;
}
.cat-path { font-family: Consolas, monospace; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.thumb {
  width: 30px; height: 30px; border-radius: 6px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--primary-light); color: var(--primary);
}
.thumb.g { background: var(--success-bg); color: var(--success); }
.thumb.o { background: var(--warning-bg); color: var(--warning); }
.thumb.p { background: var(--purple-bg); color: var(--purple); }
.thumb.c { background: var(--cyan-bg); color: var(--cyan); }

.empty { padding: 52px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.empty svg { width: 44px; height: 44px; color: #dde3ec; margin-bottom: 8px; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-3);
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 27px; height: 27px; padding: 0 7px;
  border: 1px solid var(--border); background: #fff; border-radius: 4px;
  color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.pager button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary-light-2); }
.pager button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager button:disabled { color: var(--text-4); cursor: not-allowed; background: #fafafa; }
.pager .go { display: flex; align-items: center; gap: 5px; margin-left: 6px; color: var(--text-3); }
.pager .go input { width: 40px; height: 27px; text-align: center; border: 1px solid var(--border-2); border-radius: 4px; font-size: 12.5px; outline: none; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  height: 21px; padding: 0 7px;
  font-size: 11.8px; border-radius: 3px; white-space: nowrap;
  background: #f4f4f5; color: var(--text-2);
  border: 1px solid transparent;
}
.tag--blue { background: var(--primary-light); color: var(--primary); }
.tag--green { background: var(--success-bg); color: var(--success); }
.tag--orange { background: var(--warning-bg); color: #c07d1b; }
.tag--red { background: var(--danger-bg); color: var(--danger); }
.tag--purple { background: var(--purple-bg); color: var(--purple); }
.tag--cyan { background: var(--cyan-bg); color: var(--cyan); }
.tag--line { background: #fff; border-color: var(--border-2); color: var(--text-2); }
.tag .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi {
  background: #fff; border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; background: var(--primary-light); color: var(--primary);
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-icon.g { background: var(--success-bg); color: var(--success); }
.kpi-icon.o { background: var(--warning-bg); color: #d38c1e; }
.kpi-icon.r { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.p { background: var(--purple-bg); color: var(--purple); }
.kpi-label { font-size: 12.5px; color: var(--text-3); }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; margin-top: 9px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.kpi-foot { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 11.8px; color: var(--text-3); }
/* 可点击跳转的统计卡（工作台 → 门诊处方管理） */
.kpi--link { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi--link:hover { box-shadow: 0 4px 14px rgba(0, 120, 212, .16); transform: translateY(-1px); }
.kpi--link .kpi-label:after {
  content: "›"; margin-left: 4px; color: #b4bccc; font-size: 13px;
}
.kpi--link:hover .kpi-label:after { color: var(--primary); }
.trend-up { color: var(--danger); font-weight: 600; }
.trend-down { color: var(--success); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }
.grid-2e { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ---------- 描述列表 ---------- */
.desc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.desc.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.desc.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.desc-item { background: #fff; padding: 10px 12px; min-width: 0; }
.desc-item .k { font-size: 11.8px; color: var(--text-3); margin-bottom: 3px; }
.desc-item .v { font-size: 13px; color: var(--text-1); word-break: break-all; }
.desc-item .v.strong { font-weight: 600; }
.desc-item .v.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12.3px; }

/* ---------- 抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(16, 27, 44, .42);
  opacity: 0; pointer-events: none; transition: opacity .24s; z-index: 100;
}
.drawer-mask.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 720px; max-width: 92vw;
  background: var(--bg);
  box-shadow: -8px 0 34px rgba(16, 27, 44, .16);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.3, .8, .3, 1);
  z-index: 101; display: flex; flex-direction: column;
}
.drawer.on { transform: translateX(0); }
.drawer-head {
  flex: 0 0 auto; padding: 15px 18px;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head .dt { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.drawer-head .ds { font-size: 12.2px; color: var(--text-3); margin-top: 4px; }
.drawer-head .close {
  margin-left: auto; width: 28px; height: 28px; border: 0; background: #f4f6f9;
  border-radius: 6px; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
}
.drawer-head .close:hover { background: var(--danger-bg); color: var(--danger); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px; }
.drawer-foot {
  flex: 0 0 auto; padding: 11px 18px; background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---------- 页签 ---------- */
.uitabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); background: #fff; padding: 0 6px; border-radius: 8px 8px 0 0; }
.uitab {
  padding: 10px 14px; font-size: 13px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.uitab:hover { color: var(--primary); }
.uitab.on { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.uitab .n { font-size: 11px; color: var(--text-3); margin-left: 4px; }

/* ---------- 时间线 ---------- */
.timeline { padding: 4px 0 0 4px; }
.tl-item { position: relative; padding: 0 0 18px 20px; border-left: 1px solid var(--border-2); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item:before {
  content: ""; position: absolute; left: -4.5px; top: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
  border: 2px solid var(--border-2);
}
.tl-item.on:before { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .12); }
.tl-item .tl-t { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tl-item .tl-d { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.tl-item .tl-time { font-size: 11.5px; color: var(--text-4); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- 进度条 ---------- */
.bar { height: 6px; border-radius: 3px; background: #eef1f6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.bar > i.g { background: var(--success); }
.bar > i.o { background: var(--warning); }
.bar > i.r { background: var(--danger); }

/* ---------- 提示条 ---------- */
.strip {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 13px; border-radius: 6px; font-size: 12.8px;
  background: var(--primary-light); color: #16588f; margin-bottom: 12px;
  border: 1px solid #d3e8f8;
}
.strip svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.strip.warn { background: var(--warning-bg); color: #9a6614; border-color: #f6e3c8; }
.strip.danger { background: var(--danger-bg); color: #a83838; border-color: #f8d7d7; }
.strip b { font-weight: 700; }

/* ---------- 列表行 ---------- */
.mini-list .row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px dashed var(--border);
}
.mini-list .row:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-list .row:first-child { padding-top: 0; }
.mini-list .t { font-size: 13px; font-weight: 500; }
.mini-list .s { font-size: 11.8px; color: var(--text-3); margin-top: 2px; }
.mini-list .r { margin-left: auto; text-align: right; }

/* ---------- 弹窗 ---------- */
.dialog-mask {
  position: fixed; inset: 0; background: rgba(16, 27, 44, .42);
  display: none; place-items: center; z-index: 110; padding: 20px;
}
.dialog-mask.on { display: grid; }
.dialog {
  width: 640px; max-width: 100%; max-height: 88vh;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-float);
  display: flex; flex-direction: column; overflow: hidden;
}
.dialog-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.dialog-head .dt { font-size: 15px; font-weight: 700; }
.dialog-head .close { margin-left: auto; cursor: pointer; color: var(--text-3); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; }
.dialog-head .close:hover { background: #f4f6f9; }
.dialog-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dialog-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.fg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid.fg3 .form-item { gap: 4px; }
.form-grid.fg3 .form-item > label { font-size: 12px; }
.form-grid.fg3 .form-item .input,
.form-grid.fg3 .form-item .select { height: 30px; font-size: 12.5px; }
.form-grid.fg3 .form-item .hint { font-size: 10.5px; line-height: 1.35; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid > .fgroup { display: contents; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item > label { font-size: 12.5px; color: var(--text-2); }
.form-item > label .req { color: var(--danger); margin-right: 2px; }
.form-item .input, .form-item .select, .form-item .textarea { width: 100%; }
.form-item .hint { font-size: 11.5px; color: var(--text-4); }

/* ---------- 弹窗内页签（商品新增/编辑：商品主档 / 营养品属性） ---------- */
.dialog:has(.dlg-tabs-body) { max-height: 94vh; }
.dialog-body.dlg-tabs-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; flex: 1 1 auto; min-height: 0; }
.dlg-tabs-body .uitabs { flex: 0 0 auto; border-radius: 0; padding: 0 14px; background: #fbfcfe; }
.dlg-tabs-body .uitab.na { color: var(--text-4); }
.dlg-tabs-body .uitab.na::after { content: '（不适用）'; font-size: 11px; }
.dlg-tab-panel { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 18px; min-height: 420px; }
.dlg-tab-panel .form-grid { gap: 12px 16px; }
.dlg-tab-panel .form-grid.fg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 14px; }
.dlg-tab-panel .form-grid.fg3 .form-item { gap: 4px; }
.dlg-tab-panel .form-grid.fg3 .form-item > label { font-size: 12px; }
.dlg-tab-panel .form-grid.fg3 .input,
.dlg-tab-panel .form-grid.fg3 .select { height: 30px; font-size: 12.5px; }
.dlg-tab-panel .form-grid.fg3 .textarea { font-size: 12.5px; }
.dlg-tab-panel .form-grid.fg3 .hint { font-size: 10.5px; line-height: 1.35; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 6px; box-shadow: var(--shadow-float);
  font-size: 13px; color: var(--text-1);
  animation: toastIn .22s ease;
}
.toast svg { width: 15px; height: 15px; color: var(--success); }
.toast.err svg { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 其他 ---------- */
.split-line { height: 1px; background: var(--border); margin: 14px 0; }
.h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.h4:before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); display: inline-block; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.text-r { text-align: right; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.warehouse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.wh-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; cursor: pointer; transition: .18s; position: relative; overflow: hidden;
}
.wh-card:hover { border-color: var(--primary-light-2); box-shadow: 0 6px 18px -6px rgba(0, 120, 212, .28); transform: translateY(-1px); }
.wh-card.on { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 120, 212, .12); }
.wh-card .top { display: flex; align-items: flex-start; gap: 10px; }
.wh-card .nm { font-size: 13.8px; font-weight: 600; }
.wh-card .cd { font-size: 11.5px; color: var(--text-3); font-family: Consolas, monospace; margin-top: 2px; }
.wh-card .ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); flex: 0 0 auto; }
.wh-card .ic svg { width: 17px; height: 17px; }
.wh-card .meta { display: flex; gap: 16px; margin-top: 13px; }
.wh-card .meta .m { font-size: 11.5px; color: var(--text-3); }
.wh-card .meta .m b { display: block; font-size: 15px; color: var(--text-1); font-weight: 700; margin-top: 1px; font-variant-numeric: tabular-nums; }
.wh-card .foot { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; align-items: center; gap: 6px; font-size: 11.8px; color: var(--text-3); }

.nutrient-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eef1f6; }
.nutrient-bar span { display: block; height: 100%; }

/* ---------------- 多份扫描件上传控件 ---------------- */
.uploader { border: 1px solid var(--border); border-radius: 8px; padding: 9px; background: #fbfcfe; }
.up-drop {
  border: 1px dashed #c9d5e6; border-radius: 7px; background: #fff;
  padding: 13px 10px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.up-drop:hover, .up-drop.on { border-color: var(--primary); background: #f4f9ff; }
.up-drop svg { color: var(--primary); }
.uploader.full .up-drop { opacity: .55; }
.up-title { font-size: 12.8px; font-weight: 600; margin-top: 4px; color: var(--text-1); }
.up-hint { font-size: 11.4px; color: var(--text-3); margin-top: 3px; }
.up-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.up-empty { font-size: 11.8px; color: var(--text-3); text-align: center; padding: 3px 0; }
.up-item { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.up-thumb { width: 26px; height: 26px; border-radius: 5px; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.up-thumb.pdf { background: var(--danger-bg); color: var(--danger); }
.up-thumb.xls { background: var(--success-bg); color: var(--success); }
.up-name { flex: 1; min-width: 0; font-size: 12.4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1); }
.up-size { font-size: 11.4px; color: var(--text-3); white-space: nowrap; }
.up-del { width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; color: var(--text-3); cursor: pointer; flex: 0 0 auto; }
.up-del:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Excel 导入弹窗 ---------------- */
.imp-tpl {
  display: flex; gap: 10px; align-items: center; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
.imp-tpl .ic {
  width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--success-bg); color: var(--success);
}
.imp-tpl .tx { flex: 1; min-width: 0; }
.imp-tpl .t { font-size: 13px; font-weight: 600; color: var(--text-1); }
.imp-tpl .s { font-size: 11.6px; color: var(--text-3); margin-top: 3px; line-height: 1.55; }
.imp-seg { display: flex; gap: 6px; }

/* ---------------- 扫描件查看（多份切换） ---------------- */
.scan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.scan-main { position: relative; background: #f4f6fa; border: 1px solid var(--border); border-radius: 8px; height: 360px; overflow: hidden; }
.scan-main img { position: absolute; inset: 14px; margin: auto; max-width: calc(100% - 28px); max-height: calc(100% - 28px); display: block; box-shadow: 0 3px 14px rgba(16, 42, 76, .14); }
.scan-cap { padding: 6px 2px 0; font-size: 11.8px; color: var(--text-2); }
.scan-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 1px 2px; }
.scan-thumb { flex: 0 0 auto; width: 98px; border: 2px solid transparent; border-radius: 7px; overflow: hidden; cursor: pointer; background: #fff; transition: border-color .15s; }
.scan-thumb img { width: 100%; height: 72px; object-fit: contain; display: block; background: #f4f6fa; }
.scan-thumb .cap { font-size: 10.6px; color: var(--text-2); padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-thumb:hover { border-color: var(--primary-light-2); }
.scan-thumb.on { border-color: var(--primary); }
.scan-thumb.on .cap { color: var(--primary); font-weight: 600; }

/* ---------------- 资质审核 ---------------- */
.audit-scans { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; }
.audit-scan { flex: 0 0 auto; width: 88px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.audit-scan img { width: 100%; height: 66px; object-fit: contain; display: block; background: #f4f6fa; }
.audit-scan .cap { font-size: 10.5px; color: var(--text-2); padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-choose { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.audit-opt {
  display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; transition: .15s;
}
.audit-opt .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #eef1f6; color: var(--text-3); flex: 0 0 auto; margin-top: 1px; transition: .15s; }
.audit-opt .t { font-size: 13px; font-weight: 600; color: var(--text-1); }
.audit-opt .s { font-size: 11.6px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.audit-opt:hover { border-color: var(--primary-light-2); }
.audit-opt.on { border-color: var(--primary); background: #f4f9ff; box-shadow: 0 0 0 2px rgba(0, 120, 212, .1); }
.audit-opt.on .ic { background: var(--primary); color: #fff; }
.audit-opt[data-audit="REJECTED"].on { border-color: var(--danger); background: #fef7f7; box-shadow: 0 0 0 2px rgba(240, 75, 75, .1); }
.audit-opt[data-audit="REJECTED"].on .ic { background: var(--danger); color: #fff; }
.audit-opt[data-audit="REJECTED"].on .t { color: var(--danger); }


@media (max-width: 1399px) {
  .top-search { display: none; }
  .top-actions { margin-left: auto; }
}
@media (max-width: 1200px) {
  .org-switch { max-width: 260px; overflow: hidden; }
  .org-switch span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2e, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .desc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desc.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 成分配置弹窗（营养成分维护） ---------- */
.nut-edit td { padding: 5px 6px; vertical-align: middle; }
.nut-edit .input, .nut-edit .select { height: 28px; font-size: 12.5px; padding: 0 6px; border-radius: 5px; }
.nut-edit .select { padding-right: 20px; background-position: right 4px center; background-size: 11px; }
.nut-edit .input[disabled] { background: #f4f6fa; color: #b9c0cc; border-style: dashed; }
.nut-edit .nut-nm { font-weight: 600; font-size: 12.5px; }
.nut-add { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e3e9f2; }
.nut-edit-scroll { max-height: 34vh; overflow: auto; }
.dialog-body.dlg-flex { display: flex; flex-direction: column; gap: 14px; overflow: hidden; min-height: 0; }
.dlg-flex > .nut-edit-scroll { flex: 1 1 auto; min-height: 104px; max-height: none; }
.dlg-flex > .cfg-block, .dlg-flex > .nut-add { flex: 0 0 auto; }
.cfg-block { border: 1px solid var(--border); border-radius: 8px; background: #fafbfd; padding: 12px 14px 14px; }
.cfg-hd { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-1); margin-bottom: 12px; }
.cfg-hd .sub { font-weight: 400; font-size: 11.5px; color: var(--text-4); }
.cfg-hd .sub.warn { color: var(--warning); font-weight: 600; }
.cfg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.cfg-grid .wide { grid-column: span 2; }
.cfg-grid .form-item { gap: 5px; min-width: 0; }
.cfg-grid .input, .cfg-grid .select { height: 30px; font-size: 12.5px; }
.cfg-grid .lbl-note { margin-left: 6px; color: var(--text-4); font-size: 11px; }
.cfg-pair { display: flex; gap: 6px; }
.cfg-pair .input { width: 74px; flex: none; }
.cfg-pair .select { flex: 1; min-width: 0; }
.nut-edit-scroll thead th { position: sticky; top: 0; z-index: 1; background: #f7f9fc; }

/* ---------- 报表：销售统计 ---------- */
.rep-metrics {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card);
  margin-bottom: 12px; overflow: hidden;
}
.rep-metrics .m { padding: 12px 14px; border-right: 1px solid var(--border); min-width: 0; }
.rep-metrics .m:last-child { border-right: 0; }
.rep-metrics .m .l { font-size: 11.5px; color: var(--text-3); }
.rep-metrics .m .v { font-size: 16.5px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rep-metrics .m .d { font-size: 11.5px; color: var(--text-4); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 维度排名：名称 + 进度条 + 金额 + 占比，单行栅格，任意卡片宽度都稳定 */
.rep-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 0.8fr) 76px 44px;
  align-items: center; gap: 9px; padding: 5px 0;
}
.rep-row + .rep-row { border-top: 1px dashed #f2f5f9; }
.rep-row .nm { font-size: 12.5px; color: var(--text-1); }
.rep-row .bw { height: 6px; border-radius: 3px; background: #eef1f6; overflow: hidden; }
.rep-row .bw > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #4cb2ed, var(--primary)); }
.rep-row .vl { font-size: 12.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rep-row .pct { font-size: 11.5px; color: var(--text-4); text-align: right; font-variant-numeric: tabular-nums; }

.rep-more { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 11.8px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.rep-more .link-btn { margin-left: auto; font-size: 12px; }
.empty-hint { padding: 18px 0; text-align: center; color: var(--text-4); font-size: 12.5px; }

@media (max-width: 1280px) {
  .rep-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rep-metrics .m:nth-child(3n) { border-right: 0; }
  .rep-metrics .m:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

/* 报表页：中等屏幕下三个维度卡保持两列，避免纵向过长 */
@media (max-width: 1280px) {
  .rep-dims { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 960px) {
  .rep-dims { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ==========================================================================
   订单操作弹窗：退款 / 换货（明细选择）· 打印（内容选择 + 预览）
   ========================================================================== */

.chk { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; vertical-align: -2px; }
.chk:disabled { cursor: not-allowed; }

/* ---------- 单据摘要条 ---------- */
.od-bar {
  display: flex; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fafbfd; margin-bottom: 14px; overflow: hidden;
}
.od-bar .it { padding: 9px 13px; border-right: 1px solid var(--border); min-width: 0; }
.od-bar .it:last-child { border-right: 0; }
.od-bar .it.grow { flex: 1 1 auto; }
.od-bar .k { font-size: 11.5px; color: var(--text-3); }
.od-bar .v {
  font-size: 12.8px; font-weight: 600; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.od-bar .v.strong { color: var(--primary); font-size: 14px; }

/* ---------- 明细选择表 ---------- */
.pick-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pick-wrap .table-scroll { max-height: 33vh; overflow: auto; }
.pick-wrap table.tbl thead th { background: #f7f9fc; position: sticky; top: 0; z-index: 1; }
.pick-wrap table.tbl tbody td { padding-top: 7px; padding-bottom: 7px; vertical-align: middle; }
.pick-wrap table.tbl tbody tr.off { background: #fafbfd; }
.pick-wrap table.tbl tbody tr.off td { color: var(--text-4); }
.pick-wrap table.tbl tbody tr.off .sub { color: var(--text-4); }
.pick-wrap .pk-nm { font-size: 12.8px; font-weight: 600; line-height: 1.4; }
.pick-wrap .input.sm, .pick-wrap .select.sm { height: 28px; font-size: 12.4px; padding: 0 7px; border-radius: 5px; }
.pick-wrap .input.sm { text-align: right; font-variant-numeric: tabular-nums; }
.pick-wrap .input.sm:disabled { background: #f4f6fa; color: var(--text-4); border-style: dashed; }
.pick-wrap .input.sm.bad { border-color: var(--danger); background: #fff7f7; }
.pick-wrap td .input, .pick-wrap td .select { width: 100%; }

.pick-sum {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 13px; background: #f7f9fc; border-top: 1px solid var(--border);
  font-size: 12.4px; color: var(--text-2);
}
.pick-sum .sp { flex: 1 1 auto; }
.pick-sum .grp { display: flex; align-items: center; gap: 6px; }
.pick-sum .grp + .grp { padding-left: 11px; border-left: 1px solid var(--border-2); }
.pick-sum .dot { color: var(--text-4); }
.pick-sum b { font-variant-numeric: tabular-nums; color: var(--text-1); }
.pick-sum .amt { font-size: 15px; font-weight: 700; color: var(--primary); }
.pick-sum .amt.over { color: var(--danger); }
.pick-sum .dd { color: var(--text-3); }
.pick-sum .dd b { color: var(--text-2); }

/* ---------- 打印弹窗：左设置 / 右预览 ---------- */
.prt {
  display: grid; grid-template-columns: 316px minmax(0, 1fr); gap: 14px;
  height: min(600px, 64vh); min-height: 400px;
}
.prt-side { display: flex; flex-direction: column; gap: 12px; overflow: auto; padding-right: 2px; }
.prt-side .cfg-block { margin: 0; }
.prt-side .form-grid { gap: 10px; }
.prt-side .form-item > label { font-size: 12px; }
.prt-side .input, .prt-side .select { height: 30px; font-size: 12.5px; }

.doc-opt {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff;
  transition: .15s;
}
.doc-opt + .doc-opt { margin-top: 6px; }
.doc-opt:hover { border-color: var(--primary-light-2); }
.doc-opt .chk { margin-top: 1px; flex: 0 0 auto; }
.doc-opt .t { font-size: 12.6px; font-weight: 600; color: var(--text-1); line-height: 1.3; }
.doc-opt .s { font-size: 11px; color: var(--text-3); margin-top: 1px; line-height: 1.45; }
.doc-opt.on { border-color: var(--primary); background: #f4f9ff; box-shadow: 0 0 0 2px rgba(0, 120, 212, .08); }

.prt-pv {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #eef1f6; overflow: hidden;
}
.pv-head {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px;
  background: #fff; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text-1); flex: 0 0 auto;
}
.pv-head svg { width: 14px; height: 14px; color: var(--text-3); }
.pv-head .sub { margin-left: auto; font-weight: 400; font-size: 11.5px; color: var(--text-4); }
.pv-scroll {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.pv-empty { color: var(--text-3); font-size: 12.5px; padding: 60px 0; text-align: center; }
.pv-note {
  font-size: 11.5px; color: var(--text-3); background: #fff; padding: 4px 12px;
  border-radius: 20px; box-shadow: 0 1px 4px rgba(16, 31, 54, .08); flex: 0 0 auto;
}

/* ---------- 纸张 ---------- */
.pv-page {
  background: #fff; width: 100%; max-width: 430px; flex: 0 0 auto;
  box-shadow: 0 2px 10px rgba(16, 31, 54, .14);
  padding: 17px 18px 14px; color: #1b2436; font-size: 11px; line-height: 1.55;
}
.pv-scroll[data-paper-size="A4"] .pv-page { max-width: 470px; }
.pv-page .doc-hd {
  display: flex; align-items: flex-start; gap: 10px;
  border-bottom: 1.5px solid #1b2436; padding-bottom: 7px; margin-bottom: 9px;
}
.pv-page .doc-hd .org { font-size: 11.5px; font-weight: 600; color: #3d485c; }
.pv-page .doc-hd .nm { font-size: 16px; font-weight: 700; letter-spacing: 2px; margin-top: 2px; }
.pv-page .doc-hd .rt { margin-left: auto; text-align: right; font-size: 9.8px; color: #5b6577; line-height: 1.5; }
.pv-page .doc-hd .rt b { color: #1b2436; font-size: 10.4px; }

.pv-kv {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 10px; font-size: 10.2px; margin-bottom: 8px;
}
.pv-kv .k { color: #6b7688; margin-right: 4px; }
.pv-kv .v { font-weight: 600; }
.pv-kv .wide { grid-column: span 2; }
.pv-kv .all { grid-column: 1 / -1; }

.pv-tbl { width: 100%; border-collapse: collapse; font-size: 10px; }
.pv-tbl th, .pv-tbl td { padding: 3.5px 3px; border-bottom: 1px solid #e2e7ef; text-align: left; vertical-align: top; }
.pv-tbl thead th {
  border-top: 1px solid #1b2436; border-bottom: 1px solid #1b2436;
  background: #f4f6fa; font-weight: 600; white-space: nowrap;
}
.pv-tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-tbl tfoot td { border-bottom: 0; border-top: 1px solid #1b2436; font-weight: 700; }
.pv-box { display: inline-block; width: 11px; height: 11px; border: 1px solid #8b95a5; vertical-align: -1px; }

.pv-total { display: flex; justify-content: flex-end; gap: 14px; font-size: 10.6px; padding: 6px 0 2px; }
.pv-total .l { color: #5b6577; }
.pv-total .v { font-size: 13px; font-weight: 700; }

.pv-sign { display: flex; gap: 14px; margin-top: 10px; font-size: 9.8px; color: #3d485c; }
.pv-sign .s { flex: 1 1 auto; border-bottom: 1px solid #c9d1de; padding-bottom: 12px; }

.barcode {
  height: 24px; margin-top: 10px;
  background: repeating-linear-gradient(90deg, #1b2436 0 1.2px, #fff 1.2px 3.2px, #1b2436 3.2px 4px, #fff 4px 6.6px, #1b2436 6.6px 7.2px, #fff 7.2px 10px);
}
.bc-txt { text-align: center; font-size: 9px; letter-spacing: 2px; color: #3d485c; margin-top: 3px; font-family: Consolas, monospace; }

/* 包装标签 */
.pv-lbl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 430px; }
.pv-lbl .lb {
  background: #fff; border: 1px dashed #b9c0cc; padding: 7px 8px 6px;
  font-size: 9px; line-height: 1.45; color: #1b2436; box-shadow: 0 1px 4px rgba(16, 31, 54, .08);
}
.pv-lbl .lb .lb-t { font-size: 10.4px; font-weight: 700; line-height: 1.3; margin-bottom: 3px; }
.pv-lbl .lb .lb-r { display: flex; justify-content: space-between; gap: 6px; }
.pv-lbl .lb .lb-r span:first-child { color: #6b7688; }
.pv-lbl .lb .lb-r b { font-weight: 600; }
.pv-lbl .lb .barcode { height: 17px; margin-top: 4px; }
.pv-lbl .lb .lb-c { font-size: 7.6px; text-align: center; color: #5b6577; letter-spacing: .5px; margin-top: 1px; }

/* 指导单 */
.pv-guide .g-h { font-size: 10.6px; font-weight: 700; margin: 9px 0 4px; padding-left: 6px; border-left: 2.5px solid var(--primary); }
.pv-guide .g-p { font-size: 10px; color: #3d485c; line-height: 1.65; }
.pv-guide ol { margin: 3px 0 0; padding-left: 15px; font-size: 10px; line-height: 1.7; color: #3d485c; }
.pv-guide .g-note { margin-top: 8px; padding: 6px 8px; border: 1px dashed #c9d1de; font-size: 9.4px; color: #5b6577; line-height: 1.6; }

@media (max-width: 1100px) {
  .prt { grid-template-columns: 272px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .prt { grid-template-columns: minmax(0, 1fr); height: auto; }
  .prt-pv { height: 420px; }
}

/* ==========================================================================
   商品规则 7.4：准入矩阵 / 临床匹配 / 权重排序
   ========================================================================== */

/* 准入：机构覆盖条 */
.org-bars { display: flex; flex-direction: column; gap: 9px; }
.org-bar { display: grid; grid-template-columns: 138px minmax(0, 1fr) 122px; align-items: center; gap: 12px; }
.ob-name { font-size: 12.6px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-num { font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.ob-num b { color: var(--text-1); font-weight: 600; }

/* 采购 / 销售 开关状态 */
.perm { display: flex; gap: 6px; font-size: 12px; line-height: 1.65; }
.perm > span { color: var(--text-4); }
.perm b { font-weight: 600; }
.perm b.ok { color: var(--success); }
.perm b.no { color: #98a5b6; }

/* 小标签 */
.chip-sm {
  display: inline-block; padding: 1px 6px; border-radius: 4px; background: #f2f5f9;
  color: var(--text-2); font-size: 11.2px; line-height: 1.75; margin-right: 4px; white-space: nowrap;
}
.chip-sm:last-child { margin-right: 0; }
.chip-sm b { font-weight: 600; }
.chip-sm.blue { background: #eaf3fd; color: #1769b4; }
.chip-sm.green { background: var(--success-bg); color: #2b8a1f; }
.chip-sm.red { background: var(--danger-bg); color: #c93b3b; }
.chip-sm.orange { background: var(--warning-bg); color: #a4701b; }
.chip-sm.purple { background: var(--purple-bg); color: #6849c0; }
.chip-sm.mut { background: transparent; color: var(--text-4); padding-left: 0; padding-right: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.mut { color: var(--text-4); }

/* 可点击的多选 chip */
.chip-set { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border-2); background: #fff; color: var(--text-2);
  font-size: 12.2px; padding: 3px 9px; border-radius: 5px; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--primary-light-2); color: var(--primary); }
.chip.on { border-color: var(--primary); background: #eaf4fe; color: var(--primary-dark); font-weight: 600; }
.chip.sm { font-size: 11.4px; padding: 2px 7px; }
.chip.green.on { border-color: #a7d8a1; background: var(--success-bg); color: #2b8a1f; }
.chip.red.on { border-color: #f2b6b6; background: var(--danger-bg); color: #c93b3b; }

/* 规则分组 */
.rule-grp { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; background: #fff; }
.rule-grp .rg-head { display: flex; align-items: baseline; gap: 10px; padding: 9px 14px; background: #f8fafd; border-bottom: 1px solid var(--border); }
.rg-t { font-size: 13px; font-weight: 600; }
.rg-s { font-size: 11.5px; color: var(--text-3); }
.rg-body { padding: 3px 14px; }
.rule-line { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.rule-line:last-child { border-bottom: 0; }
.rl-k { font-size: 12.3px; color: var(--text-3); padding-top: 2px; }
.rl-v { font-size: 12.6px; color: var(--text-1); min-width: 0; }
.row-inline { display: flex; align-items: center; gap: 8px; }

/* 顶部摘要条 */
.rules-bar { display: flex; flex-wrap: wrap; gap: 10px 0; }
.rb-it { display: flex; flex-direction: column; gap: 2px; padding-right: 24px; margin-right: 24px; border-right: 1px solid var(--border); }
.rb-it:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.rb-it .k { font-size: 11.5px; color: var(--text-3); }
.rb-it .v { font-size: 13.2px; font-weight: 600; }
.rb-it .v i { display: block; font-style: normal; font-weight: 400; font-size: 11.2px; color: var(--text-4); margin-top: 1px; }

/* 匹配试算 */
.trial-form { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 4px 0 12px; }
.trial-form .select, .trial-form .input { height: 30px; font-size: 12.5px; }
.trial-form .chip-set { max-width: 100%; }
.trial-res { display: flex; gap: 9px; padding: 10px 12px; border-radius: 7px; align-items: flex-start; }
.trial-res svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.trial-res.ok { background: var(--success-bg); color: #2b7a1f; border: 1px solid #d6ecd2; }
.trial-res.no { background: var(--danger-bg); color: #b93b3b; border: 1px solid #f6d5d5; }
.trial-res b { font-size: 13px; }
.tr-s { font-size: 11.6px; opacity: .86; margin-top: 2px; }
.trial-list { margin-top: 8px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.trial-row {
  display: grid; grid-template-columns: 18px 88px minmax(0, 1fr); gap: 8px;
  align-items: center; padding: 6px 10px; font-size: 12.2px; border-bottom: 1px solid var(--border);
}
.trial-row:last-child { border-bottom: 0; }
.trial-row.no { background: #fffafa; }
.tr-i { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.trial-row.ok .tr-i { background: var(--success-bg); color: var(--success); }
.trial-row.no .tr-i { background: var(--danger-bg); color: var(--danger); }
.tr-k { color: var(--text-3); }
.tr-v { color: var(--text-1); }

/* 疾病范围两行 */
.dis-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dis-line + .dis-line { margin-top: 4px; }
.dk { font-size: 10.5px; padding: 0 4px; border-radius: 3px; flex: 0 0 auto; line-height: 1.7; }
.dk.ok { background: #eaf3fd; color: #1769b4; }
.dk.no { background: var(--danger-bg); color: #c93b3b; }

/* 权重堆叠条 */
.wstack { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #eef1f6; }
.wstack .ws { height: 100%; }
.ws0 { background: #0078d4; }
.ws1 { background: #13a8a8; }
.ws2 { background: #7b5bd6; }
.ws3 { background: #e6a23c; }

/* 排序预览 */
.rank-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.rh-t { font-size: 14px; font-weight: 700; }
.rh-s { font-size: 12px; color: var(--text-3); }
.rank-tbl td { vertical-align: middle; }
.rank-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: #f1f4f9; color: var(--text-2); font-size: 11.5px; font-weight: 700; }
.rank-no.top { background: var(--primary); color: #fff; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-4); }

/* 权重编辑 */
.wrow { display: grid; grid-template-columns: 70px minmax(0, 1fr) 68px; align-items: center; gap: 12px; padding: 7px 0; }
.wr-l { font-size: 12.4px; color: var(--text-2); }
.wrange { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: #e6ebf2; outline: none; }
.wrange::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .22); cursor: pointer;
}
.num-in { width: 68px; height: 28px; text-align: right; font-size: 12.5px; padding: 0 7px; }

/* 贡献明细 */
.contrib { display: flex; flex-direction: column; gap: 9px; }
.ct-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 46px 86px; align-items: center; gap: 10px; }
.ct-l { font-size: 12.3px; color: var(--text-2); }
.ct-w { font-size: 12.5px; font-weight: 600; text-align: right; }
.ct-d { font-size: 11.4px; text-align: right; }
.formula { margin-top: 12px; padding: 9px 12px; background: #f7f9fc; border-radius: 6px; font-size: 12.4px; color: var(--text-2); }
.formula b { color: var(--primary); font-size: 13.5px; }

/* 权重配置：机构 → 科室 → 商品 三级选择 */
.scope-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 150px);
  gap: 14px; align-items: end;
}
.sc-lv { min-width: 0; }
.sc-lv > label { display: flex; align-items: center; gap: 6px; font-size: 11.8px; color: var(--text-3); margin-bottom: 5px; }
.sc-lv > label .req { color: var(--danger); }
.sc-no {
  display: inline-grid; place-items: center; width: 15px; height: 15px; flex: 0 0 auto;
  border-radius: 50%; background: #e8eef7; color: #5a6b82; font-size: 10px; font-weight: 700; line-height: 1;
}
.sc-lv .select { width: 100%; height: 32px; }
.sc-path { text-align: right; padding-bottom: 2px; }
.sc-crumb { margin-top: 6px; font-size: 12.2px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-crumb .ar { color: var(--text-4); margin: 0 4px; }
.sc-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.sc-chips > .lb { font-size: 11.6px; color: var(--text-4); margin-right: 2px; }
.sc-chips > .lb.sc-st { margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--border); }
.dchip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border: 1px solid var(--border-2); border-radius: 13px; background: #fff;
  font-size: 12px; color: var(--text-2); cursor: pointer; transition: .15s; white-space: nowrap;
}
.dchip:hover { border-color: var(--primary-light-2); color: var(--primary); }
.dchip b { font-weight: 600; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.dchip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.dchip.on b { color: #fff; opacity: .85; }
.dchip.add { border-style: dashed; color: var(--text-3); }
.dchip.add:hover { color: var(--primary); border-color: var(--primary-light-2); }

/* 权重编辑：三级选择 */
.sc-edit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 11px 0 3px; }
.cover-warn {
  display: flex; gap: 7px; align-items: flex-start; margin-top: 10px; padding: 9px 11px;
  background: var(--warning-bg); border: 1px solid #f5e2c0; border-radius: 6px;
  font-size: 12.2px; color: #8a6015; line-height: 1.65;
}
.cover-warn svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.cover-ok { display: flex; gap: 7px; align-items: flex-start; margin-top: 10px; font-size: 12.2px; color: var(--text-3); line-height: 1.65; }
.cover-ok svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: var(--success); }

.score-line { display: grid; grid-template-columns: 152px repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; padding: 10px 0 4px; }
.sl-item .k { font-size: 11.6px; color: var(--text-3); margin-bottom: 4px; }
.sl-item .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.sl-item.hl .v { color: var(--primary); }
.sl-item .input { height: 30px; }
.dims-line { margin-top: 6px; font-size: 11.8px; color: var(--text-4); }

/* 添加商品弹窗 */
.pk-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pk-bar .search-input { flex: 1 1 auto; }
.pk-bar .input { height: 30px; }
.pk-list { max-height: 372px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; }
.pk-row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.pk-row:last-child { border-bottom: 0; }
.pk-row:hover { background: #f8fafd; }
.pk-row .sub { font-size: 11.5px; }
.pk-n { min-width: 0; }
.pk-n > div:first-child { font-size: 12.8px; color: var(--text-1); }
.pk-b { display: flex; gap: 4px; flex: 0 0 auto; }

/* 代码 / 行内说明 */
.json {
  display: inline-block; font-family: Consolas, "SF Mono", monospace; font-size: 11.3px;
  background: #f6f8fb; border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; color: #3d485c; word-break: break-all; line-height: 1.6;
}
code.inline { font-family: Consolas, "SF Mono", monospace; font-size: 11.8px; background: #eef2f7; padding: 1px 5px; border-radius: 3px; color: #1769b4; }
.hint-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); }
.hint-inline svg { width: 13px; height: 13px; }
.desc-item .sub { font-size: 11.4px; color: var(--text-3); margin-top: 1px; }

/* ICD 搜索多选 */
.icd-pick { min-width: 0; }
.icd-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  min-height: 38px; padding: 5px 8px; background: #fff;
  border: 1px solid var(--border-2); border-radius: 6px; cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.icd-box.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .1); }
.icd-tag {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  padding: 2px 3px 2px 7px; border-radius: 4px;
  background: #eaf3fd; color: #1769b4; font-size: 11.8px; line-height: 1.65;
}
.icd-tag b { font-weight: 400; }
.icd-tag i {
  font-style: normal; cursor: pointer; width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; color: #7aa3cd; font-size: 12px;
}
.icd-tag i:hover { background: #d5e6f8; color: #1769b4; }
.icd-tag.red { background: var(--danger-bg); color: #c93b3b; }
.icd-tag.red i { color: #dda0a0; }
.icd-tag.red i:hover { background: #f8dada; color: #c93b3b; }
.icd-input {
  flex: 1 1 140px; min-width: 110px; height: 24px; border: 0; outline: none;
  background: transparent; font-size: 12.5px; color: var(--text-1); font-family: inherit;
}
.icd-input::placeholder { color: var(--text-4); }
.icd-menu {
  margin-top: 6px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; box-shadow: var(--shadow-float);
  max-height: 208px; overflow-y: auto;
}
.icd-menu[hidden] { display: none; }
.icd-hd {
  position: sticky; top: 0; z-index: 1;
  padding: 6px 10px; font-size: 11.3px; color: var(--text-3);
  background: #f8fafd; border-bottom: 1px solid var(--border);
}
.icd-opt {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: center;
  width: 100%; padding: 6px 10px; border: 0; border-bottom: 1px solid #f1f4f8;
  background: #fff; font-size: 12.4px; text-align: left; cursor: pointer;
}
.icd-opt:last-child { border-bottom: 0; }
.icd-opt:hover, .icd-opt.act { background: #f2f8ff; }
.icd-opt .c { font-family: Consolas, "SF Mono", monospace; font-size: 11.8px; color: #1769b4; }
.icd-opt .n { color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icd-opt mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.icd-empty { padding: 12px 10px; font-size: 12px; color: var(--text-3); text-align: center; }

/* 临床匹配：条件文本 / 表达式树 / 试算赋值 */
.cond-t {
  font-size: 11.9px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-all;
}
.cond-txt { font-size: 12.6px; color: var(--text-1); font-weight: 600; margin-bottom: 6px; line-height: 1.55; }
.cond-txt.red { color: #c93b3b; }

.expr-node { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 2px 0; }
.en-badge {
  align-self: start; margin-top: 4px; width: 22px; height: 20px; border-radius: 4px;
  display: grid; place-items: center; font-size: 11.4px; font-weight: 700;
}
.en-badge.and { background: #eaf3fd; color: #1769b4; }
.en-badge.or { background: var(--warning-bg); color: #a4701b; }
.en-kids { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.expr-leaf {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 5px 9px; background: #f8fafd; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12.4px;
}
.el-n { font-weight: 600; color: var(--text-1); }
.el-o { color: var(--text-3); font-size: 12px; }
.el-v { color: var(--primary-dark); font-weight: 600; }
.el-c { margin-left: auto; font-family: Consolas, "SF Mono", monospace; font-size: 10.8px; color: var(--text-4); }

.json-box { margin-top: 2px; }
.json-box summary { cursor: pointer; font-size: 12.2px; color: var(--primary); }
.json-box pre {
  margin-top: 7px; padding: 10px 12px; background: #f7f9fc; border: 1px solid var(--border);
  border-radius: 6px; font-size: 11.4px; line-height: 1.62; max-height: 260px; overflow: auto;
  color: #3d485c; font-family: Consolas, "SF Mono", monospace;
}

.trial-sub { margin: 12px 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.tt-hd { margin: 8px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; gap: 8px; }
.tt-hd span { font-size: 11.4px; font-weight: 400; color: var(--text-4); }
.tt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.tt-it {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 6px 9px; border: 1px dashed var(--border); border-radius: 6px;
}
.tt-k b { display: block; font-size: 12.3px; font-weight: 600; }
.tt-k span { font-size: 10.7px; color: var(--text-4); }
.tt-it .select, .tt-it .input { height: 28px; font-size: 12.2px; }
.tt-it .select.w-md, .tt-it .input.w-md { width: 148px; }
.tt-it .input.w-sm { width: 88px; }

/* 表达式构建器 */
.eb-head { display: flex; align-items: center; gap: 9px; padding: 4px 0 9px; flex-wrap: wrap; }
.eb-k { font-size: 12.3px; color: var(--text-3); }
.eb-tip { font-size: 11.4px; color: var(--text-4); }
.eb-hd-act { margin-left: auto; display: flex; gap: 6px; }
.seg.seg-sm button { height: 22px; padding: 0 9px; font-size: 12px; }
.eb-rows { display: flex; flex-direction: column; gap: 7px; }
.eb-row {
  display: grid; grid-template-columns: 20px minmax(0, 1.05fr) 92px minmax(0, 1.5fr) 22px;
  align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff;
}
.eb-no { font-size: 11.4px; color: var(--text-4); text-align: center; }
.eb-row .select, .eb-row .input { height: 28px; font-size: 12.3px; }
.eb-op { width: 100%; min-width: 0; padding-right: 20px; background-position: right 4px center; background-size: 11px; }
.eb-val { min-width: 0; }
.eb-val .select, .eb-val .input { width: 100%; }
.eb-num { display: flex; align-items: center; gap: 6px; }
.eb-num .input { width: 100px; }
.eb-unit { font-size: 11.6px; color: var(--text-4); white-space: nowrap; }
.eb-range { display: flex; align-items: center; gap: 5px; }
.eb-range .input { width: 80px; }
.eb-chips { max-height: 82px; overflow-y: auto; }
.eb-del {
  width: 20px; height: 20px; border: 0; background: transparent; color: var(--text-4);
  cursor: pointer; border-radius: 4px; font-size: 15px; line-height: 1; padding: 0;
}
.eb-del:hover { background: var(--danger-bg); color: var(--danger); }
.eb-group { border: 1px solid var(--border-2); border-radius: 8px; background: #fbfcfe; padding: 8px; }
.eg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.eg-t { font-size: 12px; font-weight: 600; color: var(--text-2); }
.eg-body { display: flex; flex-direction: column; gap: 6px; }
.eb-add { margin-top: 7px; }
.eb-empty {
  padding: 12px; text-align: center; font-size: 12px; color: var(--text-4);
  border: 1px dashed var(--border); border-radius: 7px;
}
.eb-text { margin-top: 9px; font-size: 11.8px; color: var(--text-3); line-height: 1.6; }
.eb-text b { color: var(--text-1); font-weight: 600; }
.peri-row { grid-template-columns: 118px 96px 96px minmax(0, 1fr) 22px; }
.eb-arrow { font-size: 11.6px; color: var(--text-4); white-space: nowrap; }
.peri-pv {
  font-size: 11.8px; color: #a4701b; display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.peri-pv::before { content: "→"; color: var(--text-4); flex: 0 0 auto; }
.peri-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 8px; }
.peri-quick { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.peri-quick .mut { font-size: 11.6px; }
.dk.wa { background: var(--warning-bg); color: #a4701b; }

/* 健康画像标签选择器 */
.tp-wrap { position: relative; min-width: 0; }
.tp-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  padding: 3px 8px; border: 1px solid var(--border-2); border-radius: 6px;
  background: #fff; cursor: pointer; text-align: left;
}
.tp-btn:hover { border-color: var(--primary-light-2); }
.tp-btn .tp-n { font-size: 12.4px; color: var(--text-1); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-btn i { font-style: normal; font-family: Consolas, "SF Mono", monospace; font-size: 10.5px; color: var(--text-4); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-menu {
  position: absolute; z-index: 1200; left: 0; top: calc(100% + 4px); width: 358px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-float); overflow: hidden;
}
.tp-menu.is-fixed { position: fixed; top: auto; left: auto; }
.tp-search { padding: 7px; border-bottom: 1px solid var(--border); background: #f8fafd; }
.tp-search .input { height: 28px; font-size: 12.3px; }
.tp-list { max-height: 238px; overflow-y: auto; }
.tp-hd { position: sticky; top: 0; z-index: 1; padding: 5px 9px; font-size: 11px; color: var(--text-3); background: #f8fafd; border-bottom: 1px solid var(--border); }
.tp-opt {
  display: grid; grid-template-columns: 66px minmax(0, 1fr) 116px; gap: 7px; align-items: center;
  width: 100%; padding: 5px 9px; border: 0; border-bottom: 1px solid #f4f6fa;
  background: #fff; text-align: left; cursor: pointer; font-size: 12.2px;
}
.tp-opt:hover { background: #f2f8ff; }
.tp-s { font-size: 10.8px; color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-n2 { color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-c { font-family: Consolas, "SF Mono", monospace; font-size: 10.4px; color: #1769b4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--text-4); }

@media (max-width: 1280px) {
  .org-bar { grid-template-columns: 112px minmax(0, 1fr) 104px; }
  .rule-line { grid-template-columns: 84px minmax(0, 1fr); }
  .eb-row { grid-template-columns: 18px minmax(0, 1fr) 84px minmax(0, 1.3fr) 20px; }
  .peri-row { grid-template-columns: 104px 82px 82px minmax(0, 1fr) 20px; }
  .scope-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .sc-path { grid-column: 1 / -1; text-align: left; display: flex; align-items: center; gap: 8px; padding-bottom: 0; }
  .sc-crumb { margin-top: 0; }
  .score-line { grid-template-columns: 132px repeat(3, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 960px) {
  .org-bar { grid-template-columns: 96px minmax(0, 1fr) 92px; gap: 8px; }
  .trial-form .field { flex: 1 1 46%; }
  .ct-row { grid-template-columns: 64px minmax(0, 1fr) 40px; }
  .ct-d { display: none; }
  .tt-grid { grid-template-columns: minmax(0, 1fr); }
  .eb-row { grid-template-columns: 16px minmax(0, 1fr) 20px; row-gap: 6px; }
  .eb-row .eb-op, .eb-row .eb-val { grid-column: 2 / 3; }
  .eb-row .eb-del { grid-column: 3 / 4; grid-row: 1 / 2; }
  .peri-row { grid-template-columns: minmax(0, 1fr) 76px 76px 20px; row-gap: 6px; }
  .peri-row .peri-pv { grid-column: 1 / 4; grid-row: 2 / 3; }
  .peri-row .eb-del { grid-column: 4 / 5; grid-row: 1 / 2; }
  .scope-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sc-lv:first-child { grid-column: 1 / -1; }
  .sc-edit { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .score-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 10px; }
  .sl-item.hl { grid-column: 1 / -1; }
  .pk-row { grid-template-columns: 16px minmax(0, 1fr); row-gap: 4px; }
  .pk-b { grid-column: 2 / 3; }
}

/* ==========================================================================
   订单制作 / 状态日志 / 操作日志
   ========================================================================== */
/* ---------- 制作看板 ---------- */
.kb { display: grid; grid-template-columns: repeat(6, minmax(132px, 1fr)); gap: 10px; }
/* 机器作业看板：固定四档（待制作 / 制作中 / 完成 / 停止） */
.kb.kb-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kb-col { background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; min-width: 0; }
.kb-hd {
  display: flex; align-items: center; gap: 6px; padding: 9px 10px;
  font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--border);
}
.kb-hd .n {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-3);
  background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 0 7px; line-height: 1.7;
}
.kb-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kb-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 9px; cursor: pointer; }
.kb-card:hover { border-color: var(--primary); box-shadow: 0 3px 10px rgba(0, 120, 212, .12); }
.kb-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kb-no { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--text-2); }
.kb-sku { font-size: 12.2px; font-weight: 600; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-row { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.kb-prog { height: 4px; background: #eef1f6; border-radius: 2px; overflow: hidden; margin-top: 4px; }
.kb-prog i { display: block; height: 100%; background: var(--primary); }
.kb-prog i.g { background: var(--success); }
.kb-prog i.r { background: var(--danger); }
.kb-empty { padding: 16px 6px; text-align: center; font-size: 11.5px; color: #b4bccc; }
.kb-more { font-size: 11px; color: var(--text-3); text-align: center; }

/* 机器作业看板：四列等高，按配置条数截断（每档最多 N 条），超出列内滚动 */
.kb.kb-4 .kb-col { min-height: 232px; }
.kb.kb-4 .kb-body { flex: 1 1 auto; min-height: 0; max-height: 690px; overflow-y: auto; overscroll-behavior: contain; }
.kb.kb-4 .kb-body > * { flex: 0 0 auto; }
.kb.kb-4 .kb-body::-webkit-scrollbar { width: 6px; }
/* 每档展示数量配置（卡片头右侧的下拉） */
.kb-head .ch-title { flex: 0 0 auto; white-space: nowrap; }
.kb-head .ch-actions { flex: 0 0 auto; white-space: nowrap; }
.kb-limit { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.kb-limit select {
  height: 26px; padding: 0 4px 0 6px; border: 1px solid var(--border-2); border-radius: 6px;
  background: #fff; color: var(--text-1); font-size: 12px; line-height: 1; cursor: pointer;
}
.kb-limit select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 120, 212, .12); }
.kb-hd .n em { font-style: normal; font-weight: 500; color: #9aa4b6; }
/* 窄屏：副标题让位，操作区整体换到第二行，避免标题被压成两行 */
@media (max-width: 1460px) {
  .kb-head { flex-wrap: wrap; row-gap: 6px; }
  .kb-head .ch-sub { order: 3; flex: 1 1 100%; }
}
/* 排队序号：待制作档为蓝色实心（可插队重排），其他档为灰色次序 */
.kb-seq {
  flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 700; line-height: 1; color: var(--text-3); background: #eef1f6;
}
.kb-seq--q { color: #fff; background: var(--primary); }
.kb-card--head { border-color: #bcd9f2; box-shadow: inset 3px 0 0 var(--primary); }
.kb-card--head:hover { border-color: var(--primary); }
.kb-no { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-act {
  display: flex; align-items: center; gap: 6px; margin-top: 7px; padding-top: 6px;
  border-top: 1px dashed var(--border); font-size: 11px;
}
.kb-flag { margin-left: auto; font-size: 10.5px; color: var(--text-3); }
.kb-flag--on { margin-left: 0; color: var(--success); font-weight: 600; }
/* 列底：被截断的条数提示（常驻列底，不随列体滚动） */
.kb-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 8px 8px; font-size: 11px; color: var(--text-3);
  border-top: 1px dashed var(--border); flex: 0 0 auto;
}

/* ---------- 制作流程步骤条 ---------- */
.steps { display: flex; padding: 2px 0 0; }
.step { flex: 1; position: relative; text-align: center; padding-top: 24px; min-width: 0; }
.step:before { content: ""; position: absolute; top: 7px; left: 50%; width: 100%; height: 2px; background: #e6eaf1; }
.step:last-child:before { display: none; }
.step .dot {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 2px solid #d8dee9; z-index: 1; box-sizing: border-box;
}
.step.on .dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .12); }
.step .lb { font-size: 12px; font-weight: 600; color: var(--text-2); }
.step.on .lb { color: var(--primary); }
.step .tm { font-size: 11px; color: var(--text-4); margin-top: 2px; }

/* ---------- 状态迁移单元格 ---------- */
.mv { display: flex; align-items: center; gap: 5px; }
.mv-ar { color: #c3cbd8; display: inline-flex; }

/* ---------- 状态流转说明 ---------- */
.flow-doc { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.fd-node { display: inline-flex; }
.fd-ar { color: #c3cbd8; display: inline-flex; }

/* ---------- 订单详情抬头 · 收单快照元信息 ---------- */
.hdr-meta {
  display: flex; flex-wrap: wrap; gap: 5px 18px;
  margin-top: 11px; padding-top: 9px; border-top: 1px dashed var(--border);
}
.hdr-meta > span { font-size: 12px; color: var(--text-2); }
.hdr-meta > span i { font-style: normal; color: var(--text-3); margin-right: 5px; }
.hdr-meta > span em {
  font-style: normal; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.6px; letter-spacing: -.2px;
}
@media (max-width: 960px) {
  .hdr-meta { gap: 4px 12px; }
  .hdr-meta > span { font-size: 11.5px; }
}

@media (max-width: 1100px) {
  .kb { grid-template-columns: repeat(6, 150px); overflow-x: auto; padding-bottom: 4px; }
  .kb .kb-body { padding: 6px; }
}
@media (max-width: 960px) {
  .step .tm { display: none; }
  .step .lb { font-size: 11px; }
}

/* ---------- 制作任务分配弹窗：信息块密集，收紧留白并放开高度 ---------- */
.dialog.dlg-tall { max-height: 96vh; }
.dialog-body.dlg-tight { padding: 14px 16px 16px; }
.dialog-body.dlg-tight .cfg-block { padding: 10px 12px 12px; }
.dialog-body.dlg-tight .cfg-hd { margin-bottom: 8px; }
.dialog-body.dlg-tight .h4 { margin-bottom: 8px; }
.dialog-body.dlg-tight .tbl th, .dialog-body.dlg-tight .tbl td { padding: 5px 8px; }
.dialog-body.dlg-tight .desc-item { padding: 6px 10px; }

/* ---------- 顶栏扫码识别弹窗 ---------- */
.scan-stage {
  position: relative; padding: 14px 16px 12px; border-radius: 10px;
  background: linear-gradient(180deg, #f7fafe 0%, #eef4fc 100%);
  border: 1px solid var(--border); text-align: center;
}
.scan-frame {
  position: relative; height: 84px; max-width: 320px; margin: 0 auto 9px;
  background: #fff; border: 1px dashed var(--border-2); border-radius: 8px; overflow: hidden;
}
.scan-bars {
  position: absolute; inset: 12px 20px; opacity: .82;
  background: repeating-linear-gradient(90deg, #1b2436 0 1.6px, #fff 1.6px 4.2px, #1b2436 4.2px 5.4px, #fff 5.4px 9px);
  transition: opacity .3s;
}
.scan-laser {
  position: absolute; left: 0; right: 0; top: 10px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  box-shadow: 0 0 10px rgba(0, 120, 212, .6);
  animation: scanMove 1.15s ease-in-out infinite alternate;
}
@keyframes scanMove { from { top: 10px; } to { top: calc(100% - 12px); } }
.scan-tip { font-size: 12.5px; color: var(--text-3); }
.scan-tip.on { color: var(--success); font-weight: 600; }
.scan-code {
  margin-top: 5px; font-size: 14px; font-weight: 700; letter-spacing: 1.6px; color: var(--text-1);
}
.scan-manual { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.scan-manual .search-input { flex: 1 1 auto; }
.scan-manual .btn { flex: 0 0 auto; }
.scan-hit {
  margin-top: 12px; padding: 10px 12px 4px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff;
}
.scan-hit .desc { margin-top: 8px; }

/* ---------- 列表页内页签（如：机器作业看板 / 机器作业列表） ---------- */
.uitabs.tabs-page {
  margin-bottom: 12px; padding: 0 4px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card);
}
.uitabs.tabs-page .uitab { padding: 10px 16px; }

/* ---------- 工作台：两列分组面板，卡片紧凑排布 ---------- */
.wb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.wb-sec {
  position: relative;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 12px 14px 13px; min-width: 0;
}
.wb-sec--wide { grid-column: 1 / -1; }
.wb-sec-hd { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; min-width: 0; }
.wb-sec-title {
  position: relative; flex: 0 0 auto; max-width: 46%; padding-left: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-sec-title:before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 11px; border-radius: 2px; background: var(--primary);
}
/* 标题行右侧：板块快捷入口，整体靠右、入口贴最右 */
.wb-sec-acts {
  margin-left: auto; flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: flex-end;
  flex-wrap: wrap; gap: 8px;
}
/* 面板内 2×2；整行面板（订单制作过程）一行四张，保证卡片宽度与其它面板一致 */
.kpi-grid.kpi-grid--sm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 0; }
.wb-sec--wide .kpi-grid.kpi-grid--sm { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi--sm {
  padding: 10px 12px; border-radius: 8px;
  background: #f9fbfe; border: 1px solid var(--border); box-shadow: none;
}
.kpi--sm:hover { background: #f4f9ff; }
.kpi--sm .kpi-icon { width: 24px; height: 24px; border-radius: 6px; }
.kpi--sm .kpi-icon svg { width: 13px; height: 13px; }
.kpi--sm .kpi-label { font-size: 11.8px; }
.kpi--sm .kpi-value { font-size: 19px; margin-top: 5px; }
.kpi--sm .kpi-value small { font-size: 11px; }
.kpi--sm .kpi-foot { display: block; margin-top: 4px; font-size: 11px; line-height: 1.35; }
@media (max-width: 1080px) {
  .wb-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   工作台配置：模块内组件网格 / 组件库 / 拖拽配置态
   ========================================================================== */
.wb-body {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; align-items: start;
}
.wb-sec--wide .wb-body { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wb-w { position: relative; min-width: 0; }
.wb-w--full { grid-column: 1 / -1; }

/* 模块空态 */
.wb-empty {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 72px; padding: 8px; border: 1px dashed #c9d6e5; border-radius: 8px;
  background: #fbfdff; color: var(--text-3); font-size: 12px;
}
.wb-empty svg { width: 14px; height: 14px; }
.wb-empty--all { min-height: 160px; font-size: 13px; }

/* 待办清单 / 快捷入口 / 便签（共用浅底面板） */
.wb-list {
  padding: 10px 12px; border-radius: 8px;
  background: #f9fbfe; border: 1px solid var(--border);
}
.wb-list-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.wb-list-title { font-size: 12px; font-weight: 600; color: var(--text-1); white-space: nowrap; }
.wb-list-more { margin-left: auto; flex: 0 0 auto; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.wb-list-rows { display: flex; flex-direction: column; gap: 1px; }
.wb-li {
  display: flex; align-items: center; gap: 8px; padding: 5px 4px;
  border-radius: 6px; font-size: 12px; cursor: pointer; min-width: 0;
}
.wb-li:hover { background: #eef6ff; }
.wb-li-t { flex: 0 0 auto; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11.5px; color: var(--text-1); }
.wb-li-s { flex: 1 1 auto; min-width: 0; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-li .tag { flex: 0 0 auto; }
.wb-li-empty { display: flex; align-items: center; gap: 6px; padding: 6px 2px; font-size: 12px; color: var(--text-3); }
.wb-li-empty svg { width: 13px; height: 13px; color: var(--success, #12a150); }

.wb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  font-size: 12px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.wb-chip:hover { border-color: var(--primary); color: var(--primary); background: #f4f9ff; }

/* 板块级快捷入口（在「新增 / 编辑板块」里勾选）：排在板块标题行最右侧 */
.wb-sec-links { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; min-width: 0; }
.wb-sec-links .wb-chip {
  height: 22px; padding: 0 8px; font-size: 11px; white-space: nowrap;
}
.wb-sec-links .wb-chip svg { width: 11px; height: 11px; }

.wb-note-hint { margin-left: auto; font-size: 11px; color: var(--text-3); }
.wb-note-ta {
  width: 100%; min-height: 62px; resize: vertical; display: block;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 12px; line-height: 1.5; color: var(--text-2);
  background: #fff; outline: none;
}
.wb-note-ta:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 120, 212, .1); }
.wb-note-ta::placeholder { color: #a8b1bf; }

/* ---------- 配置模式 ---------- */
.wb-config .content { padding-right: 320px; }
/* 板块工具条浮在卡片外侧上方，靠行距与顶部内边距留出空间 */
.wb-config .wb-grid { row-gap: 42px; padding-top: 30px; }

.wb-cfgbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 9px 12px; border-radius: 8px;
  background: #eef6ff; border: 1px solid #c6e0f7;
}
.wb-cfgbar-l { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.wb-cfgbar-l b { color: var(--text-1); white-space: nowrap; }
.wb-cfgbar-l svg { width: 15px; height: 15px; color: var(--primary); flex: 0 0 auto; }
.wb-cfgbar-r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wb-cfg-user { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.wb-user { width: 168px; height: 28px; font-size: 12px; padding: 0 6px; }

.wb-sec--cfg { border: 1px dashed #9dc4e8; background: #fcfdff; }
.wb-sec--cfg.drop-on {
  border-color: var(--primary); background: #f2f8ff;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, .12);
}
.wb-sec--cfg .kpi--link { cursor: grab; }
.wb-sec--cfg .wb-w { overflow: visible; }
.wb-sec--cfg .wb-w:hover { outline: 1px dashed #9dc4e8; outline-offset: 1px; border-radius: 8px; }
.wb-w.dragging { opacity: .4; }
.wb-sec--off { opacity: .5; }
.wb-sec--off .wb-sec-title { text-decoration: line-through; }

/* 板块工具条：浮在板块卡片外侧上方，不占用板块内部空间 */
.wb-cfg-tools {
  position: absolute; right: 2px; bottom: calc(100% + 8px); z-index: 3;
  display: flex; align-items: center; gap: 4px;
}
.wb-tool {
  width: 24px; height: 24px; padding: 0; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.wb-tool:hover { border-color: var(--primary); color: var(--primary); background: #f4f9ff; }
.wb-tool svg { width: 13px; height: 13px; }
.wb-sec--off .wb-tool[data-sec-eye] { border-color: var(--primary); color: var(--primary); }

.wb-w-del {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid #d6dee8; background: #fff; color: #8794a5;
  font-size: 12px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s;
}
.wb-sec--cfg .wb-w:hover .wb-w-del { opacity: 1; }
.wb-w-del:hover { color: #e5484d; border-color: #f0b4b6; }

/* ---------- 组件库 ---------- */
.wb-lib {
  position: fixed; top: calc(var(--topbar-h) + 10px); right: 12px; bottom: 12px;
  width: 296px; z-index: 40; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 40, 72, .16); overflow: hidden;
}
.wb-lib.drop-remove {
  border-color: #e5484d;
  box-shadow: 0 0 0 2px rgba(229, 72, 77, .16), 0 12px 32px rgba(16, 40, 72, .16);
}
.wb-lib-hd { display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px 9px; border-bottom: 1px solid var(--border); }
.wb-lib-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.wb-lib-sub { margin-top: 2px; font-size: 11px; color: var(--text-3); line-height: 1.4; }
.wb-lib-x {
  margin-left: auto; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer;
}
.wb-lib-x:hover { background: #f1f4f8; color: var(--text-1); }
.wb-lib-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px 10px; }
.wb-lib-grp { margin: 10px 2px 5px; font-size: 11px; color: var(--text-3); letter-spacing: .3px; }
.wb-lib-grp:first-child { margin-top: 6px; }
.wb-lib-item {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff;
  font-size: 12px; color: var(--text-2); cursor: grab;
}
.wb-lib-item:hover { border-color: var(--primary); background: #f6fbff; }
.wb-lib-item.dragging { opacity: .45; }
.wb-lib-item.used { cursor: default; background: #f7f9fc; color: var(--text-3); border-style: dashed; }
.wb-lib-item.used:hover { border-color: var(--border); background: #f7f9fc; }
.wb-lib-ico {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 5px;
  background: #eef6ff; color: var(--primary); display: grid; place-items: center;
}
.wb-lib-ico svg { width: 12px; height: 12px; }
.wb-lib-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-lib-tag { flex: 0 0 auto; font-size: 10.5px; color: var(--text-3); }
.wb-lib-foot { flex: 0 0 auto; padding: 8px 12px; border-top: 1px solid var(--border); background: #fafcff; font-size: 11px; color: var(--text-3); text-align: center; }

/* 配置态内容区变窄，模块改单列更利于拖放 */
@media (max-width: 1500px) {
  .wb-config .wb-grid { grid-template-columns: minmax(0, 1fr); }
  .wb-config .wb-sec--wide { grid-column: auto; }
}
/* ---------- 工作台板块：拖拽把手 / 删除 / 换位指示线 ---------- */
.wb-grip {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  color: var(--text-3); cursor: grab; flex: 0 0 auto;
}
.wb-grip:hover { background: #eef3fa; color: var(--text-2); }
.wb-grip:active { cursor: grabbing; }
.wb-grip svg { width: 13px; height: 13px; }
.wb-tool--danger { margin-left: 2px; }
.wb-tool--danger:hover { border-color: #f0b4b6; color: #e5484d; background: #fff5f5; }

.wb-sec.dragging { opacity: .45; }
.wb-sec.drop-before, .wb-sec.drop-after { position: relative; }
.wb-sec.drop-before:after, .wb-sec.drop-after:after {
  content: ""; position: absolute; left: 2px; right: 2px; height: 3px;
  border-radius: 2px; background: var(--primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .14);
}
.wb-sec.drop-before:after { top: -7px; }
.wb-sec.drop-after:after { bottom: -7px; }

/* 板块新增 / 编辑弹窗 */
.wb-dlg { display: flex; flex-direction: column; gap: 13px; font-size: 12.8px; color: var(--text-2); line-height: 1.55; }
.wb-dlg-row { display: flex; align-items: center; gap: 10px; }
.wb-dlg-row > span { flex: 0 0 62px; font-size: 12.5px; color: var(--text-2); }
.wb-dlg-row .input { flex: 1 1 auto; height: 30px; }
.wb-dlg-seg { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.wb-dlg-seg label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* 板块弹窗里的快捷入口勾选（胶囊多选） */
.wb-dlg-row--top { align-items: flex-start; }
.wb-dlg-row--top > span { padding-top: 4px; }
.wb-dlg-links { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.wb-dlg-link {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; font-size: 12px; color: var(--text-2);
  cursor: pointer; user-select: none; transition: border-color .12s, background .12s, color .12s;
}
.wb-dlg-link input { display: none; }
.wb-dlg-link svg { width: 12px; height: 12px; }
.wb-dlg-link:hover { border-color: var(--primary); color: var(--primary); }
.wb-dlg-link.on { border-color: var(--primary); background: #eaf4ff; color: var(--primary); font-weight: 600; }

/* ---------- 扫码识别结果确认条（识别后不自动跳转，等用户确认） ---------- */
.scan-confirm {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 11px; border-radius: 8px;
  background: var(--success-bg); border: 1px solid #cfe8c8;
}
.scan-confirm-ico {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--success);
  border: 1px solid #cfe8c8;
}
.scan-confirm-ico svg { width: 13px; height: 13px; }
.scan-confirm-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12px; line-height: 1.45; }
.scan-confirm-txt b { font-size: 12.5px; color: #1f6b18; }
.scan-confirm-txt span { color: #4b7a45; }

/* ---------- 扫码识别头部 ---------- */
.scan-hit-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .scan-hit-hd { gap: 6px; }
}

/* ---------- 识别态：压缩扫描框，给结果腾空间 ---------- */
.scan-stage.is-hit { padding: 8px 14px 8px; }
.scan-stage.is-hit .scan-frame { height: 50px; margin-bottom: 6px; }
.scan-stage.is-hit .scan-code { margin-top: 2px; font-size: 13px; }

/* 确认提示条：弹窗内容超高时贴在滚动区底部，避免被裁切 */
#scan-act { position: sticky; bottom: 0; z-index: 1; }
#scan-act:empty { display: none; }
#scan-act .scan-confirm { box-shadow: 0 -6px 12px rgba(16, 42, 76, .06); }
