/* ============ 材料验收系统 ============ */
:root {
  --primary: #2b5cff;
  --primary-dark: #1f47cc;
  --primary-soft: #eaf0ff;
  --bg: #f2f4f9;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #7a839e;
  --border: #e5e9f2;
  --green: #16a34a;
  --green-bg: #e6f6ec;
  --amber: #c77414;
  --amber-bg: #fcf1df;
  --red: #dc2626;
  --red-bg: #fde9e9;
  --gray-bg: #eef1f6;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .05);
  --sidebar-bg: #101c3a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
button { font-family: inherit; }
a { color: var(--primary); text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #101c3a 0%, #0d1730 100%);
  color: #cdd6ec;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #3d6bff, #2b5cff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(43, 92, 255, .45);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-name { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #8fa0c7; margin-top: 1px; }

.nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: #b9c4de; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(43,92,255,.4); }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }

.conn-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #93a2c6; }
.conn-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.conn-chip.ok .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.conn-chip.ok .conn-text { color: #6ee7a0; }
.conn-chip.bad .dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.conn-chip.bad .conn-text { color: #fda4a4; }
.conn-chip.inline { background: var(--gray-bg); padding: 5px 12px; border-radius: 999px; color: var(--muted); }
.conn-chip.inline.ok { background: var(--green-bg); color: var(--green); }
.conn-chip.inline.bad { background: var(--red-bg); color: var(--red); }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(242, 244, 249, .88);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.top-date { color: var(--muted); font-size: 13px; }

.page { display: none; padding: 22px 26px 40px; flex-direction: column; gap: 18px; }
.page.active { display: flex; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted-card { color: var(--muted); }

.code-chip {
  background: var(--primary-soft); color: var(--primary);
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
}

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
/* 用 block 布局：flex 纵向会把 label 里的必填星号拆成独立一行，导致字段错位 */
.field { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="password"], .field select, .field textarea { margin-top: 6px; }
.field .req { color: var(--red); font-style: normal; }
.checkbox-field { display: flex; flex-direction: row; align-items: center; gap: 8px; padding-top: 20px; }
.checkbox-field input { width: 16px !important; height: 16px; margin-top: 0 !important; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  width: 100%;
  border: 1px solid #d8dfec;
  background: #fbfcfe;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 92, 255, .12);
  background: #fff;
}
.input { border: 1px solid #d8dfec; background: #fbfcfe; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; outline: none; }
.input.grow { flex: 1; min-width: 200px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,92,255,.12); background: #fff; }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.test-result { margin-top: 12px; font-size: 13px; }
.test-result .ok { color: var(--green); }
.test-result .err { color: var(--red); }

.help-list { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.7; }
.help-list code { background: var(--gray-bg); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: var(--gray-bg);
  color: var(--text);
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(43,92,255,.3); }
.btn.primary:hover { background: var(--primary-dark); filter: none; }
.btn.outline { background: #fff; border-color: #ccd6ea; color: var(--primary); }
.btn.outline:hover { border-color: var(--primary); background: var(--primary-soft); filter: none; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn.danger { background: #fff; border-color: #f3c6c6; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); filter: none; }
.btn.warn { background: #fff; border-color: #f0d9ad; color: #b07a1a; }
.btn.warn:hover { background: #fdf6e8; border-color: #b07a1a; filter: none; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.link { background: none; border: none; color: var(--primary); padding: 2px 6px; }
.btn.link:hover { text-decoration: underline; filter: none; background: none; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px;
  background: #f8fafd; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f7f9ff; }
.table td .sub { color: var(--muted); font-size: 12px; }

.lines-table td input { padding: 6px 8px; font-size: 13px; }
.lines-table .qty-input { text-align: right; }
.lines-table .num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.cell-muted { color: var(--muted); }
.line-idx { color: var(--muted); font-size: 12px; }
.no-lines td { text-align: center; color: var(--muted); padding: 28px 0 !important; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge.gray { background: var(--gray-bg); color: var(--muted); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }

/* ---------- 过滤条 ---------- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; gap: 14px; align-items: center;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-info .stat-label { color: var(--muted); font-size: 12.5px; }
.stat-info .stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-info .stat-sub { font-size: 12px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }

.chart { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding: 6px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 70%; max-width: 46px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #5b83ff, var(--primary));
  min-height: 4px; position: relative; transition: height .3s;
}
.chart-bar .bar-tip {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text); background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 7px; white-space: nowrap; box-shadow: var(--shadow);
}
.chart-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chart-empty { color: var(--muted); text-align: center; margin: auto; }

.status-dist { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dist-row .dist-name { width: 72px; color: var(--muted); flex-shrink: 0; }
.dist-row .dist-track { flex: 1; height: 9px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.dist-row .dist-fill { height: 100%; border-radius: 999px; }
.dist-row .dist-num { width: 40px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 页脚操作 ---------- */
.page-actions { display: flex; gap: 10px; align-items: center; }
.flex-spacer { flex: 1; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 44px 0; }
.empty-state svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 8px; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff; border-radius: 14px;
  width: min(680px, 96vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  animation: popIn .18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15.5px; }
.modal-close {
  border: none; background: var(--gray-bg); width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; font-size: 15px; color: var(--muted); line-height: 1;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 详情描述 ---------- */
.desc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; margin-bottom: 16px; }
.desc-item .dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.desc-item .dd { font-size: 13.5px; font-weight: 500; word-break: break-all; }

/* ---------- 云星空弹窗选择器 ---------- */
.pk2 .pk2-searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.pk2 .pk2-count { font-size: 12.5px; white-space: nowrap; }
.pk2 .pk2-layout { display: flex; gap: 12px; }
.pk2 .pk2-layout.no-groups .pk2-groups { display: none; }
.pk2 .pk2-groups {
  width: 120px; flex-shrink: 0; max-height: 56vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafd;
  padding: 6px;
}
.pk2 .pk2-group {
  padding: 8px 10px; border-radius: 7px; font-size: 13px; cursor: pointer;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pk2 .pk2-group:hover { background: var(--primary-soft); }
.pk2 .pk2-group.active { background: var(--primary); color: #fff; font-weight: 600; }
.pk2 .pk2-group.sub { padding-left: 22px; font-size: 12px; color: var(--muted); }
.pk2 .pk2-group.sub.active { color: #fff; }
.pk2 .pk2-listwrap { flex: 1; min-width: 0; max-height: 56vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.pk2 .pk2-table { min-width: 0; width: 100%; }
.pk2 .pk2-table thead th { position: sticky; top: 0; z-index: 2; }
.pk2 .pk2-row { cursor: pointer; }
.pk2 .pk2-row:hover { background: var(--primary-soft); }
.pk2 .pk2-more { text-align: center; padding: 10px 0; font-size: 12.5px; }
.pk2 .pk2-filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.pk2 .pk2-filterbar .pk2-f { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.pk2 .pk2-filterbar .pk2-f.grow { flex: 1; min-width: 200px; }
.pk2 .pk2-filterbar .pk2-f.grow input { flex: 1; }
.pk2 .pk2-filterbar input[type="date"],
.pk2 .pk2-filterbar input[type="text"] {
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px;
  font-size: 13px; background: #fff; color: var(--text);
}
.pk2 .pk2-filterbar .pk2-f.chk input { width: 15px; height: 15px; }
.pk2 .pk2-matline { font-size: 12.5px; line-height: 1.55; max-width: 430px; }
.pk2 .pk2-matqty { color: var(--primary); font-weight: 600; white-space: nowrap; }

/* ---------- 随货单据核验 ---------- */
.docs-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.docs-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.docs-item:hover { background: var(--primary-soft); }
.docs-item input { width: 16px; height: 16px; }

/* ---------- 验收标准 ---------- */
.desc-item .dd-wrap, .modal-body .dd { word-break: break-word; white-space: normal; }
.spec-table-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; }
.spec-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.spec-table td { border: 1px solid var(--border); padding: 4px 9px; white-space: nowrap; }
.spec-table tr:first-child td { background: #f2f6fc; font-weight: 500; position: sticky; top: 0; }
.std-detail > td { background: #fafcff; }
.std-detail .spec-table-wrap { max-height: 240px; }
.std-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.std-cat {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: #f8fafd; color: var(--text);
  white-space: nowrap; transition: all .15s;
}
.std-cat:hover { border-color: var(--primary); color: var(--primary); }
.std-cat.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.std-check { display: inline-block; margin: 2px 2px 2px 0; }

/* ---------- 验收标准维护 ---------- */
.st-docs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.std-doc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--border); background: #f8fafd; color: var(--muted);
  cursor: pointer; user-select: none; transition: all .15s;
}
.std-doc-chip:hover { border-color: var(--green); color: var(--green); }
.std-doc-chip.on { background: var(--green-bg); border-color: rgba(22, 163, 74, .45); color: var(--green); font-weight: 500; }
.std-doc-chip.custom { padding-right: 8px; }
.std-doc-chip .doc-del {
  font-style: normal; width: 16px; height: 16px; line-height: 14px; text-align: center;
  border-radius: 50%; background: rgba(220, 38, 38, .12); color: var(--red); font-size: 12px;
}
.std-doc-chip .doc-del:hover { background: var(--red); color: #fff; }

/* ---------- 参数表可编辑网格 ---------- */
.st-grid-wrap {
  margin-top: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: auto; max-height: 300px; background: #fbfcfe;
}
.st-grid-table { border-collapse: collapse; width: max-content; min-width: 100%; }
.st-grid-table th, .st-grid-table td { border: 1px solid var(--border); padding: 0; }
.st-grid-table thead th {
  background: #f2f6fc; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 4px 8px; white-space: nowrap; text-align: left;
}
.st-grid-colhead { display: flex; align-items: center; gap: 6px; min-width: 110px; }
.st-grid-colhead span { flex: 1; }
.st-del-col, .st-del-row {
  border: none; background: transparent; color: #cbd5e5;
  width: 18px; height: 18px; line-height: 16px; border-radius: 5px;
  cursor: pointer; font-size: 13px; flex-shrink: 0;
}
.st-del-col:hover, .st-del-row:hover { background: var(--red-bg); color: var(--red); }
.st-grid-table td.st-grid-rowdel { text-align: center; padding: 0 4px; background: #f8fafd; }
.st-cell {
  border: none !important; background: transparent !important;
  border-radius: 0 !important; box-shadow: none !important;
  padding: 6px 9px !important; font-size: 12.5px !important;
  min-width: 110px; outline: none;
}
.st-cell:focus { background: var(--primary-soft) !important; }
.st-grid-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 审批中心 ---------- */
.fl-node {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; background: #f8fafd;
}
.fl-node-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fl-node-seq {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.fl-node-approvers { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; position: relative; }
.fl-node-approvers .std-doc-chip { cursor: default; }
.fl-node-approvers .doc-del { cursor: pointer; }
.fl-user-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  max-height: 180px; overflow-y: auto; margin-top: 4px;
}
.fl-user-item { padding: 7px 12px; font-size: 13px; cursor: pointer; }
.fl-user-item:hover { background: var(--primary-soft); color: var(--primary); }
.fl-node-cond { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.fl-node-cond .checkbox-field { font-size: 12.5px; color: var(--muted); }
.fl-cond-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.fl-cond-row select, .fl-cond-row input { width: auto; min-width: 130px; }
.apv-log { font-size: 12.5px; line-height: 1.8; }
.apv-log b { font-weight: 600; }
.apv-logs { max-height: 150px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: #fbfcfe; }
.rec-tab i { font-style: normal; }

/* ---------- 审批中心（仿门户） ---------- */
.apv-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.apv-title { font-size: 20px; font-weight: 700; }
.apv-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.apv-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.apv-toolbar .btn.outline { background: #fff; }
.portal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.portal-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.portal-bar { width: 4px; height: 15px; border-radius: 2px; background: var(--primary); display: inline-block; }
.portal-hint { color: var(--muted); font-size: 12.5px; }
.portal-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ptab {
  padding: 10px 2px; font-size: 13.5px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.ptab i { font-style: normal; color: var(--muted); }
.ptab:hover { color: var(--text); }
.ptab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.ptab.active i { color: var(--primary); }

/* ---------- 流程设计师 ---------- */
#page-designer { padding: 14px 18px 24px; gap: 12px; }
.ds-topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 14px; flex-wrap: wrap;
}
.ds-back { color: var(--primary); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.ds-back:hover { text-decoration: underline; }
.ds-name { width: 200px; }
.ds-body { display: flex; gap: 12px; align-items: stretch; min-height: 560px; }
.ds-palette {
  width: 168px; flex-shrink: 0;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
.ds-pal-title { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.ds-pal-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 4px;
}
.ds-pal-item.addable { cursor: pointer; border: 1px dashed #ccd6ea; color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.ds-pal-item.addable:hover { background: #dfe8ff; }
.ds-pal-help { font-size: 12px; color: var(--muted); line-height: 1.7; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: #16a34a; }
.dot-blue { background: var(--primary); }
.dot-red { background: #94a3b8; }

.ds-canvas {
  flex: 1; min-width: 0; position: relative; overflow: auto;
  background: #fbfcfe;
  background-image: radial-gradient(#dfe5f0 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  height: 620px;
}
#dsEdges { position: absolute; inset: 0; pointer-events: none; }
#dsNodes { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ds-node {
  position: absolute; width: 200px; height: 64px;
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .08);
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  cursor: grab; user-select: none; z-index: 2;
}
.ds-node:active { cursor: grabbing; }
.ds-node.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 92, 255, .15), 0 4px 12px rgba(43, 92, 255, .18); }
.ds-node.type-start { border-color: #bfe8cd; background: #f2fcf5; }
.ds-node.type-end { border-color: #e2e8f0; background: #f8fafd; }
.ds-node-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.ds-node.type-start .ds-node-icon { background: #e6f6ec; color: var(--green); }
.ds-node.type-end .ds-node-icon { background: var(--gray-bg); color: var(--muted); }
.ds-node-main { flex: 1; min-width: 0; }
.ds-node-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-node-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-node-del {
  position: absolute; top: -9px; right: -9px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: #fff; color: var(--red);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .2); cursor: pointer; font-size: 12px; line-height: 18px;
}
.ds-node-del:hover { background: var(--red); color: #fff; }
.ds-edge { fill: none; stroke: #9fb0d0; stroke-width: 1.6; }
.ds-elabel { font-size: 11px; fill: #64748b; }
.ds-elabel-bg { fill: #fbfcfe; stroke: #e5e9f2; }

.ds-side {
  width: 250px; flex-shrink: 0;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; font-size: 13px; overflow-y: auto; max-height: 620px;
}
.ds-side > b { font-size: 14px; }
.ds-side-block { margin-top: 12px; }
.ds-side-block .dt { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.ds-side-block textarea { width: 100%; resize: vertical; }
.ds-stats b { color: var(--primary); margin: 0 2px; }
.ds-side-help {
  margin-top: 14px; background: var(--gray-bg); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.8;
}
.ds-users { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 附件 ---------- */
.att-list { display: flex; flex-direction: column; gap: 8px; }
.att-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; transition: background .15s;
}
.att-row:hover { background: #f8faff; }
.att-thumb {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
  object-fit: cover; border: 1px solid var(--border);
}
.att-thumb-file {
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 11px; font-weight: 600;
}
.att-info { flex: 1; min-width: 0; }
.att-name { font-size: 13.5px; font-weight: 500; word-break: break-all; }
.att-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.att-acts { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- 验收记录（增强版） ---------- */
.rec-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.rec-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: #f8fafd;
  font-size: 13px; color: var(--text); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.rec-tab i { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.rec-tab:hover { border-color: var(--primary); color: var(--primary); }
.rec-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.rec-tab.active i { color: rgba(255,255,255,.85); }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.rec-filter { align-items: center; }
.rec-filter .rec-date { width: 138px; flex-shrink: 0; }
.rec-filter .rec-quick { width: 108px; flex-shrink: 0; }
.rec-filter .rec-facet { max-width: 200px; flex-shrink: 0; }
.range-sep { color: var(--muted); font-size: 13px; margin: 0 -4px; }

.rec-table th.th-sort { cursor: pointer; user-select: none; }
.rec-table th.th-sort:hover { color: var(--primary); }
.rec-table th.th-sort.sorted { color: var(--primary); }
.rec-table .sort-arrow { display: inline-block; width: 12px; margin-left: 2px; color: var(--primary); font-weight: 700; }
.rec-table .rc-expander { text-align: center; }
.rec-table .rc-toggle { width: 26px; padding: 2px 0; font-size: 12px; }
.rec-table .cell-supplier { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-table .rec-erp { font-size: 12px; }
.rec-table .rec-erp .badge { margin: 1px 2px 1px 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

tr.rec-detail > td { background: #f8fbff; padding: 0 !important; }
.rec-detail-inner { padding: 10px 14px 12px 46px; }
.rec-detail-inner .rec-sub-table { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.rec-detail-inner .rec-sub-table th { font-size: 12px; padding: 7px 10px; }
.rec-detail-inner .rec-sub-table td { font-size: 12.5px; padding: 7px 10px; }

.rec-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.rec-foot .rec-count { font-size: 12.5px; }
.rec-foot .rec-pager { margin-top: 0; }

/* ---------- 提示 ---------- */
#toastRoot { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }.toast {
  background: #17233d; color: #fff; padding: 9px 18px; border-radius: 9px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(15,23,42,.25);
  animation: toastIn .2s ease; max-width: 70vw;
}
.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }
.toast.warn { background: #713f12; }
.toast.hide { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; }
  .brand-text, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; }
  .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .desc-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- 打印 ---------- */
@media print {
  body * { visibility: hidden; }
}

/* ============ 统一登录(2026-10-26) ============ */
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 14px; border-left: 1px solid var(--border); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #3d6bff, #2b5cff);
  color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; color: var(--text); font-weight: 500; }

.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(160deg, #16224a 0%, #101c3a 55%, #0c1428 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 94vw;
  background: var(--card); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(4, 10, 30, .5);
  padding: 36px 34px 28px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #3d6bff, #2b5cff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(43, 92, 255, .4);
}
.login-logo svg { width: 28px; height: 28px; }
.login-brand h2 { font-size: 19px; color: var(--text); }
.login-brand p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.login-field { display: block; margin-bottom: 14px; }
.login-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-field input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid #ccd6ea; border-radius: 9px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-error {
  background: var(--red-bg); color: var(--red);
  font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
}
.login-submit { width: 100%; padding: 11px 0; font-size: 15px; border-radius: 9px; }
.login-tip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ---------------- 权限树（角色编辑抽屉，2026-11-11） ---------------- */
.perm-tree {
  border: 1px solid var(--border, #e4e7ed);
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 380px;
  overflow: auto;
  background: #fbfcfe;
}
.pt-row { padding: 3px 0; }
.pt-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13.5px;
  padding: 2px 4px;
  border-radius: 4px;
}
.pt-node:hover { background: rgba(43, 92, 255, 0.06); }
.pt-node input { accent-color: var(--primary, #2b5cff); }
.pt-menu { font-weight: 600; }
.pt-kids {
  margin: 2px 0 6px 26px;
  padding-left: 10px;
  border-left: 1px dashed var(--border, #d8dee9);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pt-act { font-size: 13px; color: var(--muted, #64748b); }
