:root {
  --brand: #1e5eff;
  --brand-dark: #1546c9;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e3e8f0;
  --text: #1c2331;
  --muted: #77839a;
  --ok: #12a150;
  --warn: #e8901a;
  --danger: #e5484d;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 8px 24px rgba(20, 30, 60, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 15% 0%, #24407a 0%, transparent 55%),
              radial-gradient(1000px 700px at 100% 100%, #0f6bb0 0%, transparent 50%),
              linear-gradient(135deg, #15254a 0%, #12305d 50%, #0d3f6e 100%);
}
.login-card {
  width: 360px; max-width: 100%; background: #fff; border-radius: 18px; padding: 34px 30px 28px;
  box-shadow: 0 24px 70px rgba(0, 10, 40, .45); position: relative;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #2f74ff, #1642b8);
  box-shadow: 0 10px 24px rgba(30, 94, 255, .4);
}
.login-card h1 { margin: 0 0 3px; font-size: 20px; letter-spacing: .5px; }
.login-card p.sub { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .3px; }

.lg-inp { position: relative; margin-bottom: 13px; }
.lg-inp .lg-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #9aa6bd; display: flex; pointer-events: none;
}
.login-card .lg-inp input {
  width: 100%; height: 46px; border: 1px solid var(--border); border-radius: 11px;
  padding: 0 16px 0 46px; background: #f7f9fc; transition: border-color .15s, background .15s, box-shadow .15s;
}
.field-edit .lg-inp input { padding-left: 16px; }
.lg-inp input:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 94, 255, .12);
}
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #9aa6bd; cursor: pointer; padding: 6px; display: flex; border-radius: 8px;
}
.pw-toggle:hover { color: var(--brand); }
.pw-toggle.on { color: var(--brand); }

.remember-row {
  display: flex; align-items: center; gap: 6px; margin: 2px 2px 16px; font-size: 12.5px; color: var(--muted);
  flex-wrap: wrap;
}
.remember-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand); }
.remember-row .bio-opt { display: flex; align-items: center; gap: 6px; margin-left: auto; cursor: pointer; }

.lg-submit {
  width: 100%; height: 46px; border-radius: 11px; font-size: 15px; letter-spacing: 4px;
  background: linear-gradient(135deg, #2f74ff, #1949c9); border: none;
  box-shadow: 0 8px 20px rgba(30, 94, 255, .32);
}
.lg-submit:hover { filter: brightness(1.05); }

.bio-btn {
  width: 100%; height: 44px; margin-top: 12px; border-radius: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); color: var(--brand); font-size: 14px;
}
.bio-btn:hover { border-color: var(--brand); background: #f5f8ff; }

.login-tip {
  margin-top: 18px; padding: 10px 12px; background: #f4f7ff; border-radius: 8px;
  color: #4a5a7a; font-size: 12px; line-height: 1.8;
}
.server-gear {
  display: flex; align-items: center; gap: 5px; margin: 16px auto 0; padding: 4px 8px;
  background: none; border: none; color: #9aa6bd; font-size: 12px; cursor: pointer; border-radius: 8px;
}
.server-gear:hover { color: var(--brand); }
.field-edit { margin-bottom: 13px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: #16233c; color: #c6d0e2;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo {
  padding: 18px 20px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08); letter-spacing: .5px;
}
.sidebar .logo small { display: block; font-weight: 400; font-size: 11px; color: #7e8ca8; letter-spacing: 0; margin-top: 2px; }
.nav-group { padding: 14px 0 4px 20px; font-size: 11px; color: #6b7a99; letter-spacing: 1px; }
.sidebar a.nav-item {
  display: block; padding: 9px 20px; color: #c6d0e2; font-size: 14px; border-left: 3px solid transparent;
}
.sidebar a.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar a.nav-item.active { background: rgba(30, 94, 255, .18); color: #fff; border-left-color: var(--brand); }
.sidebar a.nav-item .nav-ico { display: inline-block; width: 1.35em; margin-right: 9px; text-align: center; font-size: 15px; opacity: .92; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-size: 15px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.content { padding: 20px 22px 40px; flex: 1; }

/* ---------- 通用组件 ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 16px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text); padding: 6px 14px;
  border-radius: 6px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #b9c5da; background: #f7f9fc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #f3c9ca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 2px 6px; font-size: 13px; }
.btn-link.danger { color: var(--danger); }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30, 94, 255, .12); }
input:disabled, select:disabled { background: #f5f7fa; color: #99a3b5; }
label.field-label { display: block; font-size: 13px; color: #4a5568; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input.inline-search { width: 210px; }
.panel-head .toolbar { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th { background: #f7f9fc; color: #556; font-weight: 600; white-space: nowrap; }
table.data tbody tr:hover { background: #f9fbff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.ops { white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.nowrap { white-space: nowrap; }
.tag { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2f8; color: #566; }
.tag.ok { background: #e6f7ee; color: var(--ok); }
.tag.warn { background: #fef4e6; color: var(--warn); }
.tag.danger { background: #fdecec; color: var(--danger); }
.tag.info { background: #e8efff; color: var(--brand); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .stat-ico { font-size: 15px; line-height: 1; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.money { color: var(--brand); }
/* 环形统计图 */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 6px 4px; }
.donut { flex: none; }
.donut-top { font-size: 30px; font-weight: 800; fill: var(--text, #0f172a); }
.donut-sub { font-size: 12px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.lg-item b { margin-left: auto; color: var(--text, #0f172a); font-variant-numeric: tabular-nums; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
@media (max-width: 820px) { .donut-wrap { justify-content: center; gap: 18px; } .donut-legend { min-width: 140px; } }
/* 图表网格 */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.chart-grid .panel { margin: 0; }
/* 竖向柱状趋势 */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 8px 2px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 11px; color: var(--muted); margin-bottom: 4px; height: 14px; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 60%; max-width: 34px; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #5b8cff, var(--brand, #2563eb)); transition: height .4s ease; min-height: 2px; }
.bar-lbl { font-size: 12px; color: var(--muted); margin-top: 6px; }
/* 横向条形（Top） */
.hbars { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.hbar { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-name { color: var(--text, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: var(--line, #eef1f5); border-radius: 6px; height: 14px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #34d399, #16a34a); transition: width .4s ease; }
.hbar-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 列表分页条 */
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 13px; margin-right: auto; }
.btn.sm { padding: 4px 12px; font-size: 13px; }
.btn.sm:disabled { opacity: .45; cursor: not-allowed; }
/* 进度条（采购到货） */
.prog { position: relative; background: var(--line, #eef1f5); border-radius: 6px; height: 18px; overflow: hidden; min-width: 90px; }
.prog-fill { height: 100%; background: linear-gradient(90deg, #5b8cff, #2563eb); border-radius: 6px 0 0 6px; transition: width .4s ease; }
.prog-fill.done { background: linear-gradient(90deg, #34d399, #16a34a); border-radius: 6px; }
.prog-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text, #0f172a); font-variant-numeric: tabular-nums; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow: auto;
}
.modal {
  background: #fff; border-radius: 10px; width: 520px; max-width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.modal.wide { width: 1040px; max-width: 96vw; }
/* 单据详情表：数字列右对齐不换行；名称/规格给足宽度，避免逐字换行 */
.modal-body table.data td { vertical-align: middle; }
.modal-body table.data td.num { white-space: nowrap; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-body { padding: 18px; max-height: 62vh; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

#toast-root { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; }
.toast {
  margin-bottom: 8px; padding: 9px 18px; border-radius: 6px; background: #2b3648; color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; animation: pop .2s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 图片上传 ---------- */
.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.img-slot {
  position: relative; height: 108px; border: 1px dashed #c8d2e2; border-radius: 8px;
  background: #fafbfd; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.img-slot:hover { border-color: var(--brand); background: #f5f8ff; }
.img-slot.filled { border-style: solid; border-color: var(--border); background: #fff; }
.img-slot img { width: 100%; height: 100%; object-fit: contain; }
.img-slot .img-add { color: #9aa6ba; font-size: 22px; text-align: center; line-height: 1.2; }
.img-slot .img-add em { display: block; font-size: 12px; font-style: normal; margin-top: 2px; }
.img-slot .img-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; line-height: 1;
  border: none; border-radius: 50%; background: rgba(20, 26, 38, .6); color: #fff;
  cursor: pointer; font-size: 12px; padding: 0;
}
.img-slot .img-del:hover { background: var(--danger); }
.img-slot.loading::after {
  content: '上传中…'; position: absolute; inset: 0; background: rgba(255, 255, 255, .82);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--brand);
}
.img-viewer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.img-viewer img { width: 100%; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.thumb-cell { display: flex; align-items: center; gap: 4px; }
.thumb {
  width: 34px; height: 34px; object-fit: cover; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; background: #fff;
}
.thumb:hover { border-color: var(--brand); }
.thumb-more { font-size: 11px; color: var(--muted); }
.no-img { color: #c3cad6; font-size: 12px; }

/* ---------- 左侧分类树 ---------- */
.tree-layout { display: grid; grid-template-columns: 216px 1fr; gap: 16px; align-items: start; }
.tree-main { min-width: 0; }
.tree-panel { padding: 0 0 10px; position: sticky; top: 72px; }
.tree-head {
  padding: 12px 14px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.tree-node {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 14px; cursor: pointer; border-left: 3px solid transparent; user-select: none;
}
.tree-node:hover { background: #f5f8ff; }
.tree-node.active { background: #eef3ff; border-left-color: var(--brand); color: var(--brand); font-weight: 600; }
.tree-node.root { font-weight: 600; }
.tree-node.child { padding-left: 34px; }
.tree-node .caret {
  display: inline-block; width: 16px; color: var(--muted); font-size: 11px; cursor: pointer;
}
.tree-node.active .caret { color: var(--brand); }
.tree-count { color: #98a2b3; font-size: 12px; font-variant-numeric: tabular-nums; }
.tree-node.active .tree-count { color: var(--brand); }

/* ---------- 选配界面 ---------- */
.config-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.model-card {
  border: 2px solid var(--border); border-radius: 8px; padding: 12px 14px; cursor: pointer; background: #fff;
}
.model-card:hover { border-color: #aebdd9; }
.model-card.active { border-color: var(--brand); background: #f5f8ff; }
.model-card .name { font-weight: 600; }
.model-card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.model-card .price { margin-top: 6px; color: var(--brand); font-weight: 600; }
/* 选配向导筛选栏 + 库存标注 */
.cfg-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ff-tabs, .plat-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ff-tab, .plat-tab {
  padding: 5px 12px; border: 1px solid var(--border); background: #fff; border-radius: 16px;
  cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap;
}
.ff-tab i { font-style: normal; color: var(--muted); margin-left: 5px; font-size: 12px; }
.ff-tab.active, .plat-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ff-tab.active i { color: #dbe6ff; }
.cfg-filter select, .cpu-range select { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: #fff; }
.cfg-filter .ck { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.cpu-filter { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; padding: 8px; background: #f6f8fc; border-radius: 8px; }
.cpu-filter .gen-tabs { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.plat-tab.sm { padding: 3px 10px; font-size: 12px; }
.cpu-range { display: flex; gap: 8px; }
.stk-badge {
  display: inline-block; align-self: flex-start; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; background: #e7f7ee; color: #12a150; border: 1px solid #b9e6cc; vertical-align: middle; font-weight: 600;
}
/* 直接配置卡片 + 推荐机型 */
.model-card.direct { border-style: dashed; background: #fafcff; }
.model-card.direct .price { color: var(--muted); font-weight: 500; }
.reco-bar { background: #f2f7ff; border: 1px solid #d6e4ff; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.reco-cards { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.reco-card {
  flex: 1 1 200px; text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px;
}
.reco-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(30,94,255,.12); }
.reco-card b { font-size: 13px; }
.reco-card span { font-size: 12px; color: var(--muted); }
.reco-card i { font-style: normal; color: var(--brand); font-size: 12px; font-weight: 600; }
/* AI 图片导入 */
.ai-drop { border: 1.5px dashed var(--border); border-radius: 10px; padding: 14px; cursor: pointer; background: #fafcff; }
.ai-thumbs { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.ai-thumb { position: relative; }
.ai-thumb img { height: 88px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.ai-thumb button { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--danger); color: #fff; cursor: pointer; line-height: 1; }
.ai-tbl input.ai-in, .ai-tbl select.ai-cat { width: 100%; height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; }
.ai-tbl td { vertical-align: middle; }
/* 企业微信配置 */
.wc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-weight: 600; }
.wc-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.wc-url { display: flex; align-items: center; gap: 8px; }
.wc-url code { flex: 1; background: #f4f7ff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; word-break: break-all; }
.wc-reply { margin-top: 12px; background: #f6f8fc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; min-height: 20px; font: 13px/1.7 "Microsoft YaHei", sans-serif; }
.wc-status { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: #f6f8fc; border: 1px solid var(--border); color: #555; }
.wc-status.ok { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.wc-status.warn { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.wc-status.err { background: #fef3f2; border-color: #fecdca; color: #b42318; }

/* 第三方登录按钮（登录页） */
.social-login { margin-top: 16px; }
.social-sep { display: flex; align-items: center; text-align: center; color: #9aa4b2; font-size: 12px; margin-bottom: 12px; }
.social-sep::before, .social-sep::after { content: ''; flex: 1; height: 1px; background: var(--border, #e5e7eb); }
.social-sep span { padding: 0 12px; }
.social-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.social-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--border, #e5e7eb); border-radius: 22px; background: #fff; color: #333; font-size: 13px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.social-btn:hover { border-color: var(--brand, #2563eb); box-shadow: 0 2px 8px rgba(37,99,235,.12); }
.social-btn .si { font-size: 16px; line-height: 1; font-weight: 700; }

/* 审批流拖拽设计器（Drawflow） */
.af-designer { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.af-toolbar { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--border, #e5e7eb); background: #f7f9fc; }
.af-design-main { display: flex; }
.af-canvas { flex: 1 1 auto; min-width: 0; height: 320px; background: #fbfcfe; position: relative; }
.af-edit { flex: 0 0 232px; width: 232px; height: 320px; box-sizing: border-box; border-left: 1px solid var(--border, #e5e7eb); padding: 10px; background: #fff; overflow: auto; }
.af-edit .field { margin-bottom: 8px; }
.af-fnode { padding: 8px 10px; font-size: 12px; line-height: 1.35; }
.af-fnode-start { color: #067647; font-weight: 700; }
.af-fnode-end { color: #2563eb; font-weight: 700; }
.af-fnode-appr { min-width: 118px; }
.af-fnode-cond { min-width: 118px; }
.af-fnode-cond .af-fnode-l { color: #b45309; }
.drawflow .drawflow-node.af-dfnode-cond { border-color: #f59e0b; background: #fffbeb; }
.af-fnode-t { font-size: 10px; color: #8a94a6; }
.af-fnode-l { font-weight: 600; color: #1f2937; }
/* 覆盖 Drawflow 默认节点外观，贴合主题 */
.drawflow .drawflow-node.af-dfnode { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 0; min-height: 0; width: auto; }
.drawflow .drawflow-node.af-dfnode.selected { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.drawflow .drawflow-node .input, .drawflow .drawflow-node .output { background: #2563eb; }

/* 机器人配置卡片 */
.bot-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel, #fff); margin-bottom: 12px; }
.bot-card:last-child { margin-bottom: 0; }
.bot-main { flex: 1; min-width: 0; }
.bot-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bot-ico { font-size: 18px; }
.bot-name .tag { font-weight: 500; }
.bot-name .tag.ok { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.bot-cb { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; }
.bot-cb-label { color: #667; }
.bot-cb code { background: #f6f8fc; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; word-break: break-all; }
.bot-ops { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.bot-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; margin: 0; }
.bot-switch input { width: 16px; height: 16px; accent-color: var(--brand); }
@media (max-width: 640px) { .bot-card { flex-direction: column; align-items: stretch; } .bot-ops { justify-content: flex-end; } }

/* 表格「自定义列」工具条与选择器 */
.table-bar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: #667; }
.cols-picker { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.col-opt { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.col-opt:last-child { border-bottom: 0; }
.col-opt label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.col-move { display: flex; gap: 10px; }
.col-move .btn-link { font-size: 16px; line-height: 1; }

/* 服务器内部仿真 / 多视角 */
.viz-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.viz-tab { padding: 6px 14px; border: 1px solid var(--border); background: #f6f8fc; border-radius: 8px; cursor: pointer; font-size: 13px; }
.viz-tab.active { background: var(--brand, #2563eb); color: #fff; border-color: var(--brand, #2563eb); }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #667; margin-bottom: 8px; }
.viz-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.viz-stage { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.viz-cap { font-size: 13px; color: #475569; background: #f6f8fc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.viz-img { width: 100%; text-align: center; }
.viz-img img { max-width: 100%; max-height: 56vh; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; object-fit: contain; }
.viz-ph { width: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #64748b; border: 2px dashed var(--border); border-radius: 12px; background: #fafbfe; text-align: center; padding: 24px; }
.viz-ph-ico { font-size: 40px; opacity: .5; }
.viz-ph code { background: #eef2f7; padding: 2px 6px; border-radius: 5px; font-size: 12px; }
.viz-spin { width: 100%; text-align: center; }
.viz-spin img { max-width: 100%; max-height: 54vh; border-radius: 10px; border: 1px solid var(--border); cursor: grab; user-select: none; -webkit-user-drag: none; }
.viz-zoom { position: fixed; inset: 0; background: rgba(15,23,42,.9); z-index: 9999; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.viz-zoom img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
.viz-zoom-x { position: absolute; top: 18px; right: 26px; color: #fff; font-size: 26px; cursor: pointer; }
.viz-svg { width: 100%; height: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
/* CSS 伪3D 机箱 */
.cube-wrap { padding: 40px 0 10px; perspective: 1200px; }
.cube { position: relative; margin: 40px auto; transform-style: preserve-3d; transition: transform .05s linear; cursor: grab; }
.cube:active { cursor: grabbing; }
.cube-face { position: absolute; box-sizing: border-box; border: 1px solid #1e293b; background: rgba(51,65,85,.92); color: #e2e8f0; display: flex; align-items: center; justify-content: center; }
.cf-front { width: var(--w); height: var(--h); transform: translateZ(calc(var(--d) / 2)); background: linear-gradient(#475569,#334155); }
.cf-back { width: var(--w); height: var(--h); transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.cf-right { width: var(--d); height: var(--h); left: calc(var(--w) / 2 - var(--d) / 2); transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.cf-left { width: var(--d); height: var(--h); left: calc(var(--w) / 2 - var(--d) / 2); transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.cf-top { width: var(--w); height: var(--d); top: calc(var(--h) / 2 - var(--d) / 2); transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); background: linear-gradient(#3b4a5f,#2b3a4f); }
.cf-bottom { width: var(--w); height: var(--d); top: calc(var(--h) / 2 - var(--d) / 2); transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }
.cf-title { font-size: 12px; padding: 6px; text-align: center; }
.cf-bays { position: absolute; bottom: 8px; left: 8px; right: 8px; display: flex; gap: 3px; flex-wrap: wrap; }
.cf-bays span { width: 10px; height: 22px; background: #64748b; border-radius: 2px; }
.cf-bays span.on { background: #0891b2; }

.cat-block { border-bottom: 1px solid var(--border); padding: 12px 0; }
.cat-block:last-child { border-bottom: none; }
.cat-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.cat-title .limit { font-weight: 400; font-size: 12px; color: var(--muted); }
.opt-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px;
}
.opt-row:hover { background: #f7f9fc; }
.opt-row.chosen { background: #f2f6ff; }
.opt-row .opt-name { flex: 1; min-width: 0; }
.opt-row .opt-name b { font-weight: 600; }
.opt-row .opt-name span { display: block; font-size: 12px; color: var(--muted); }
.opt-row .opt-name .stk-badge { display: inline-block; }  /* 徽标不被上面的 span 规则拉成整行 */
.opt-row .opt-price { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.opt-row input[type=number] { width: 68px; }
.qty-cell { width: 76px; }

.summary { position: sticky; top: 72px; }
.summary .line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.summary .line.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; font-size: 16px; font-weight: 700; }
.summary .line.total .v { color: var(--brand); }
.err-box { background: #fdecec; border: 1px solid #f6c9ca; color: #a12; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
.err-box ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- 报价单打印 ---------- */
.quote-doc {
  background: #fff; padding: 34px 40px; border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 900px; margin: 0 auto; box-shadow: var(--shadow);
}
.quote-doc h1 { text-align: center; font-size: 24px; letter-spacing: 4px; margin: 0 0 6px; }
.quote-doc .doc-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.quote-doc .doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; font-size: 13px; margin-bottom: 14px; }
.quote-doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 6px; }
.quote-doc th, .quote-doc td { border: 1px solid #b9c3d3; padding: 5px 7px; }
.quote-doc th { background: #eef2f8; text-align: center; }
.quote-doc td.num { text-align: right; font-variant-numeric: tabular-nums; }
.quote-doc td.center { text-align: center; }
.quote-doc .group-head { background: #f6f8fc; font-weight: 600; }
.quote-doc .totals { margin-top: 12px; display: flex; justify-content: flex-end; }
.quote-doc .totals table { width: 320px; }
.quote-doc .footer-note { margin-top: 18px; font-size: 12.5px; white-space: pre-wrap; line-height: 1.9; }
.quote-doc .sign { margin-top: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: 13px; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  .quote-doc { border: none; box-shadow: none; max-width: none; padding: 0; }
  @page { size: A4; margin: 14mm 12mm; }
}

@media (max-width: 1100px) {
  .config-layout { grid-template-columns: 1fr; }
  .tree-layout { grid-template-columns: 1fr; }
  .tree-panel { position: static; }
  .grid3, .grid2 { grid-template-columns: 1fr; }
}

/* ---------- AI 智能选配 ---------- */
.drop-zone {
  border: 2px dashed #c2cee2; border-radius: 10px; padding: 26px 18px; text-align: center;
  cursor: pointer; background: #fafbfe; transition: .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--brand); background: #f2f6ff; }
.drop-zone .dz-icon { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.drop-zone .dz-hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; line-height: 1.8; }

.file-rows { margin-top: 12px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; background: #fff;
}
.file-row.failed { border-color: #f3c9ca; background: #fef7f7; }
.file-row .file-ico { font-size: 18px; }
.file-row .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fkind { color: var(--muted); font-size: 12px; }

.warn-box {
  background: #fff8ec; border: 1px solid #f5dbb0; color: #8a5b12; border-radius: 6px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 10px;
}
.warn-box ul, .err-box ul { margin: 4px 0 0; padding-left: 18px; }

.ai-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: #4a5568; margin-bottom: 8px; }
.ai-summary {
  background: #f2f6ff; border-left: 3px solid var(--brand); padding: 8px 12px;
  border-radius: 0 6px 6px 0; margin-bottom: 12px; font-size: 13.5px;
}
.ai-config { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; overflow: hidden; }
.ai-config-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: #f7f9fc; border-bottom: 1px solid var(--border); font-size: 14px;
}
.ai-config-meta { padding: 8px 12px 0; color: var(--muted); font-size: 12.5px; }
.ai-config-note { padding: 4px 12px 8px; font-size: 13px; color: #4a5568; }
.ai-config table.data th { background: #fbfcfe; }
.ai-cost { padding: 8px 12px; font-size: 13px; color: var(--ok); border-top: 1px solid var(--border); }
.ai-total { text-align: right; font-size: 16px; padding-top: 6px; }
.ai-total b { color: var(--brand); }

.sidebar .ver { margin-top: auto; padding: 12px 20px; color: #5c6a86; font-size: 11px; }

.ver-warn {
  background: #fff4e0; border-bottom: 1px solid #f0d3a0; color: #8a5b12;
  padding: 9px 22px; font-size: 13px; line-height: 1.7; position: relative;
}
.ver-warn b { color: #b8500f; }
.ver-warn .close { position: absolute; right: 16px; top: 8px; cursor: pointer; color: #b08040; }

/* 汉堡按钮：桌面隐藏，窄屏显示 */
.nav-toggle { display: none; background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: #253044; padding: 4px 8px; }

/* ---------- 移动端 / App 适配（窄屏 & iOS 安全区） ---------- */
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .nav-toggle { display: inline-flex; align-items: center; }
  /* 侧栏改为左侧抽屉：默认收起，点 ☰ 滑出 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 80%; max-width: 290px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 100;
    padding-top: env(safe-area-inset-top, 0);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 6px 0 30px rgba(0,0,0,.45); }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
  .topbar { padding: 0 8px; height: 52px; }
  .topbar .user { gap: 8px; }
  .topbar .user > span { display: none; }        /* 窄屏隐藏角色/姓名文字，留头像与按钮 */
  .content { padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0)); }
  .grid2, .grid3 { grid-template-columns: 1fr; }  /* 表单单列 */
  .config-layout, .tree-layout { display: block; }
  .panel-body { padding: 12px; }
  /* 数据表横向滚动，避免撑破屏幕（含弹窗内表格） */
  .panel-body > table.data, #list > table.data, #doc-wrap,
  .modal-body table.data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal { width: 94vw; max-width: 94vw; }
  .modal-body { overflow-x: auto; }
  /* 表单控件字号 ≥16px，避免 iOS/WebView 聚焦时自动放大页面 */
  input, select, textarea { font-size: 16px; }
  /* 行内操作按钮加大点击区，达到 44px 触控标准 */
  .btn-link { padding: 10px 10px; font-size: 14px; display: inline-block; min-height: 40px; line-height: 20px; }
  td .btn-link { white-space: nowrap; }
}

/* ---------- 选配向导 ---------- */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.wizard-steps .wz {
  flex: 1; min-width: 110px; padding: 10px 12px; border: 1px solid var(--border);
  background: #fff; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 14px;
}
.wizard-steps .wz b { color: #b9c2d0; margin-right: 4px; }
.wizard-steps .wz.active { border-color: var(--brand); color: var(--brand); background: #f2f6ff; font-weight: 600; }
.wizard-steps .wz.active b { color: var(--brand); }
.wz-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; }

/* ---------- 悬浮快捷导航 ---------- */
.fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%; background: var(--brand); color: #fff;
  border: none; font-size: 22px; line-height: 52px; text-align: center; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.28); z-index: 60;
}
.fab:hover { background: var(--brand-dark); }
.fab-menu {
  position: fixed; right: 20px; bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; z-index: 60; min-width: 190px;
}
.fab-menu .fab-title { padding: 6px 12px; font-size: 12px; color: var(--muted); }
.fab-menu a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; color: #253044; text-decoration: none; border-radius: 6px; font-size: 14px; }
.fab-menu a:hover { background: #f2f6ff; color: var(--brand); }
.fab-menu a .k { color: #9aa7bd; font-size: 12px; }

/* ---------- 选配：配件按类别分页 ---------- */
.cat-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 8px; margin: -6px -2px 6px;
  -webkit-overflow-scrolling: touch; position: sticky; top: 0; z-index: 3;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.cat-chip.miss { border-color: #f3b0b2; color: var(--danger); background: #fff6f6; }
.miss-bar { margin: 0 0 8px; padding: 7px 10px; background: #fdecec; border: 1px solid #f3c9ca; border-radius: 6px; font-size: 12.5px; color: var(--danger); }
.miss-bar a { color: var(--danger); text-decoration: underline; cursor: pointer; margin: 0 1px; }
.cat-chip {
  flex: 0 0 auto; padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 16px;
  font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; position: relative;
}
.cat-chip.active { border-color: var(--brand); color: var(--brand); background: #f2f6ff; font-weight: 600; }
.cat-chip.has { border-color: #8fc7a6; color: #12a150; }
.cat-chip.has.active { border-color: var(--brand); color: var(--brand); }
.cat-chip .cnt { display: inline-block; margin-left: 5px; min-width: 16px; padding: 0 4px; height: 16px; line-height: 16px; text-align: center; font-size: 11px; color: #fff; background: #12a150; border-radius: 8px; }
.cat-chip .req { display: inline-block; margin-left: 5px; color: #e5484d; font-weight: 700; }
.cat-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* ---------------- 可搜索下拉（searchSelect / enhanceSelects） ---------------- */
.ss-wrap { position: relative; }
.ss-input { width: 100%; box-sizing: border-box; }
.ss-dd {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 2px;
  background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 260px; overflow-y: auto;
}
.ss-opt { padding: 7px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-opt:hover, .ss-opt.active { background: #eef4ff; }
.ss-empty { padding: 8px 10px; font-size: 12px; color: #9aa4b2; }
@media (prefers-color-scheme: dark) {
  .ss-dd { background: #1f2430; border-color: #333b49; }
  .ss-opt:hover, .ss-opt.active { background: #2a3446; }
}

/* ---------------- 系统 Logo（登录页 + 侧栏，深色侧栏用白色底板承托） ---------------- */
.login-logo.has-img { width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; padding: 0; }
.login-logo.has-img img { max-height: 54px; max-width: 232px; width: auto; height: auto; object-fit: contain; display: block; }
.sidebar .logo.with-logo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sidebar .logo .logo-chip { background: #fff; border-radius: 8px; padding: 4px 7px; display: inline-flex; align-items: center; flex: 0 0 auto; }
.sidebar .logo .logo-chip img { height: 26px; width: auto; max-width: 120px; display: block; object-fit: contain; }

/* ---------------- 列表多选批量删除 ---------------- */
.table-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.table-bar .tb-selall { display:inline-flex; align-items:center; gap:5px; font-size:13px; color:var(--muted,#5c6b86); cursor:pointer; user-select:none; }
.btn.danger { background:#e5484d; border-color:#e5484d; color:#fff; }
.btn.danger:hover:not(:disabled) { background:#d13b40; }
.btn.danger:disabled { background:#eeb3b5; border-color:#eeb3b5; color:#fff; cursor:default; }
table.data td .rowsel, table.data th input { cursor:pointer; }
