:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text: #1e293b;
  --text-2: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --amber: #b45309;
  --green: #15803d;
  --blue: #1d4ed8;
  --purple: #7c3aed;
  --teal: #0f766e;
  --red: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px;
  background: linear-gradient(180deg, #0f172a 0%, #111c34 55%, #0b1222 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20;
  box-shadow: 1px 0 0 rgba(15,23,42,.06);
}
.main { flex: 1; margin-left: 236px; padding: 24px 28px 60px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.brand-logo.lg { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; margin: 0 auto 12px; }
.brand-text { font-weight: 600; font-size: 15px; color: #f1f5f9; line-height: 1.35; }
.brand-sub { display: block; font-size: 10.5px; font-weight: 400; color: #64748b; letter-spacing: .5px; margin-top: 1px; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.35) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 13.5px; transition: all .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59,130,246,.32), rgba(59,130,246,.08));
  color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #3b82f6;
}
.nav-item.active svg { color: #60a5fa; }
.nav-group-label {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 4px;
  color: #94a3b8; font-size: 13px; font-weight: 600; letter-spacing: .5px;
}
.nav-group-label.on { color: #e2e8f0; }
.nav-group-label svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item.nav-sub { padding: 7px 12px 7px 26px; font-size: 13px; gap: 8px; }
.nav-item.nav-sub svg { width: 16px; height: 16px; }
/* 菜单徽标：待办数字提醒（询价管理等） */
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #d93025; color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; animation: navBadgePulse 2.4s ease-in-out infinite;
}
@keyframes navBadgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217,48,37,.45); } 50% { box-shadow: 0 0 0 4px rgba(217,48,37,0); } }
/* 模块分组头：可点击折叠 */
.nav-module-label {
  display: flex; align-items: center; gap: 7px; margin-top: 7px; padding: 9px 12px;
  color: #64748b; font-size: 11.5px; font-weight: 700; letter-spacing: 1.5px;
  border-top: 1px solid rgba(255,255,255,.07); border-radius: 8px;
  cursor: pointer; user-select: none; transition: color .15s, background .15s;
}
.nav-module-label:hover { color: #cbd5e1; background: rgba(148,163,184,.08); }
.nav-module-label:first-child { border-top: none; margin-top: 0; }
.nav-module-label .chev { width: 14px; height: 14px; flex-shrink: 0; opacity: .75; transition: transform .18s ease; }
.nav-module-label.open .chev { transform: rotate(90deg); }
.nav-module-label.on { color: #7dd3fc; }
.nav-module-label.on .chev { opacity: 1; }
/* 分组内容容器：默认收起，label.open 时展开 */
.nav-group { display: none; flex-direction: column; gap: 2px; }
.nav-module-label.open + .nav-group { display: flex; animation: navIn .18s ease; }
@keyframes navIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.logout-form { margin-top: 2px; }
.logout-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border: none;
  background: transparent; color: #cbd5e1; font-size: 13.5px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.logout-btn svg { width: 18px; height: 18px; }
.logout-btn:hover { background: rgba(220, 38, 38, .15); color: #fca5a5; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.page-title { font-size: 21px; font-weight: 700; }
.page-actions { display: flex; gap: 8px; }

/* ---------- 面板 / 卡片 ---------- */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.link { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  border-left: 4px solid var(--primary);
}
.stat-card.warn { border-left-color: var(--amber); }
.stat-label { color: var(--text-2); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-2); }
.stat-sub a { color: var(--amber); }

/* ---------- 工作台模块分区标题 ---------- */
.module-sec { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.module-sec:first-of-type { margin-top: 0; }
.module-sec-tag { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--text-2); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 4px 14px; white-space: nowrap; }
.module-sec-line { flex: 1; height: 1px; background: var(--border); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .main { margin-left: 0; padding: 16px; } .sidebar { display: none; } }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; color: var(--text-2); font-weight: 500; font-size: 12.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .num.strong { font-weight: 600; }
.table .sub { color: var(--text-2); font-size: 12px; }
.table .empty { text-align: center; color: var(--text-2); padding: 30px 0; }
.th-ops, .ops { white-space: nowrap; }
.cell-content { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-tip { color: var(--text-2); font-size: 13px; }
.sum-tip b { color: var(--text); font-size: 15px; }

.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv th { text-align: left; color: var(--text-2); font-weight: 500; width: 110px; padding: 8px 10px; white-space: nowrap; }
.kv td { padding: 8px 10px; border-bottom: 1px dashed var(--border); }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-lg { padding: 5px 16px; font-size: 14px; }
.st-amber { background: #fef3c7; color: var(--amber); }
.st-blue { background: #dbeafe; color: var(--blue); }
.st-green { background: #dcfce7; color: var(--green); }
.st-red { background: #fee2e2; color: var(--red); }
.st-purple { background: #ede9fe; color: var(--purple); }
.st-teal { background: #ccfbf1; color: var(--teal); }
.st-orange { background: #ffedd5; color: #c2410c; }
.st-gray { background: #f1f5f9; color: var(--text-2); }
.btn-badge { border: none; cursor: pointer; font-family: inherit; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  color: var(--text); font-size: 13.5px; cursor: pointer; transition: all .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-ghost { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger-ghost:hover { background: #fee2e2; }
.btn-xs { padding: 3px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; padding: 10px; }
.inline-form { display: inline-block; margin: 0 3px; }
.right { margin-left: auto; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--text-2); }
.field i { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea, .input-inline, .filter-form input, .filter-form select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--text); outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input-inline:focus, .filter-form input:focus, .filter-form select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-vertical .field input { width: 100%; }
.panel-form { max-width: 780px; }
.panel-form-wide { max-width: 100%; }
.select-xs { padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border); font-size: 12.5px; font-family: inherit; background: #fff; color: var(--text); }
.input-inline { padding: 7px 12px; margin-right: 8px; min-width: 200px; }

/* ---------- 筛选 ---------- */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-form input[type="text"] { width: 240px; }
.filter-sep { color: var(--text-2); }

/* ---------- 详情 ---------- */
.detail-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.detail-no { font-size: 22px; font-weight: 700; }
.detail-meta { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 18px; background: var(--panel); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.step { display: flex; align-items: center; flex: 1; position: relative; }
.step-dot { width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; border: 3px solid #fff; box-shadow: 0 0 0 2px #e2e8f0; flex-shrink: 0; }
.step-label { margin-left: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.step.done .step-dot { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.step.done .step-label { color: var(--green); font-weight: 500; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 10px; left: 20px; right: 0; height: 2px; background: #e2e8f0; }
.step.done:not(:last-child)::after { background: var(--green); }

.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.audit-reject { display: flex; gap: 8px; align-items: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--green); }
.tip { color: var(--text-2); font-size: 12.5px; }

/* ---------- 开票 PDF ---------- */
.pdf-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.pdf-info { min-width: 0; }
.pdf-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-actions { display: flex; gap: 8px; flex-shrink: 0; }
.input-file { font-size: 13px; max-width: 260px; }
.pdf-upload-form { margin-top: 4px; }
.pdf-upload-form .tip { margin-left: 2px; }

/* ---------- 提示 ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.flash-success { background: #dcfce7; color: var(--green); border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: var(--red); border: 1px solid #fecaca; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { font-size: 20px; margin-bottom: 4px; }
.login-brand p { color: var(--text-2); font-size: 13px; }
.login-form .field input { width: 100%; padding: 11px 12px; }

/* ---------- 错误页 ---------- */
.error-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-card { text-align: center; }
.error-code { font-size: 64px; font-weight: 800; color: var(--primary); }
.error-msg { color: var(--text-2); margin: 8px 0 20px; }

/* ---------- 弹窗 ---------- */
.modal { border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 400px; max-width: 92vw; }
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-body { padding: 24px 26px; }
.modal-body h3 { margin-bottom: 16px; }
.modal-body .tip { margin-bottom: 10px; }

.row-self { background: #eff6ff; }

/* ---------- 批量导入 ---------- */
.panel-body { padding: 16px 20px 20px; }
.panel-body .tip { margin-bottom: 14px; line-height: 1.7; }
.file-pick { display: block; margin-bottom: 14px; }
.file-pick input[type="file"] { display: none; }
.file-pick-box { display: flex; align-items: center; justify-content: center; padding: 26px 16px; border: 2px dashed var(--border); border-radius: 10px; color: var(--text-2); font-size: 14px; cursor: pointer; transition: border-color .15s, color .15s; text-align: center; }
.file-pick-box:hover { border-color: var(--primary); color: var(--primary); }
.import-tips { margin: 0; padding-left: 18px; line-height: 2.1; color: var(--text-1); font-size: 13.5px; }
.import-tips code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.import-result { margin-top: 16px; }
.import-result .stats { margin-bottom: 4px; }
.import-result .table { margin-bottom: 12px; }
.stat-num.green { color: var(--green); }
.stat-num.amber { color: var(--amber); }

/* ---------- 发票选择器 ---------- */
.inv-pick-row { padding: 8px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.inv-pick-row select, .inv-pick-row input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.inv-pick-row select:focus, .inv-pick-row input:focus { border-color: var(--primary); outline: none; }
.btn-sm { font-size: 12px; padding: 5px 12px; }

/* ---------- 类目管理 ---------- */
.cat-group { border-bottom: 1px solid var(--border); }
.cat-group:last-child { border-bottom: none; }
.cat-l1 { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--text); background: #f8fafc; user-select: none; }
.cat-l1:hover { background: #f1f5f9; }
.cat-arrow { width: 16px; height: 16px; transition: transform .15s; flex-shrink: 0; }
.cat-group.collapsed .cat-arrow { transform: rotate(-90deg); }
.cat-group.collapsed .cat-l2-wrap { display: none; }
.cat-l1-name { flex: 1; }
.cat-l1-count { font-size: 12px; font-weight: 400; color: var(--text-2); background: #e2e8f0; padding: 2px 8px; border-radius: 10px; }
.cat-l2-wrap { padding: 4px 16px 12px 40px; }
.cat-l2-section { margin-top: 8px; }
.cat-l2-head { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 0; border-bottom: 1px dashed var(--border); margin-bottom: 6px; }
.cat-l3-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-l3-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.cat-l3-name { color: var(--text); }
.cat-used { font-size: 11px; color: var(--teal); background: #ccfbf1; padding: 1px 6px; border-radius: 8px; }
a.cat-used { text-decoration: none; cursor: pointer; display: inline-block; }
a.cat-used:hover { background: #a7f3e0; }
a.cat-drill { color: var(--teal); text-decoration: none; border-bottom: 1px dashed #99f6e4; cursor: pointer; }
a.cat-drill:hover { color: #0d9488; border-bottom-style: solid; }
a.cat-drill .drill-arrow { font-size: 10px; margin-left: 3px; opacity: .7; }
.cat-op { padding: 2px 8px !important; font-size: 11px !important; }

/* ---------- 模态框 ---------- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: var(--panel); border-radius: var(--radius); padding: 24px; width: 440px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(15,23,42,.2); }
.modal-box h3 { margin: 0 0 16px; font-size: 17px; }
.modal-box .form-group { margin-bottom: 14px; }
.modal-box .form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.modal-box .form-group input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.modal-box .form-group input:focus { border-color: var(--primary); outline: none; }

/* ---------- 入库表单 ---------- */
.inv-info-card { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.inv-info-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.inv-info-row:last-child { border-bottom: none; }
.inv-info-row .label { color: var(--text-2); font-size: 13px; }
.inv-info-row .val { font-size: 14px; }
.cat-select-row { display: flex; gap: 8px; }
.cat-select-row select { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.cat-select-row select:focus { border-color: var(--primary); outline: none; }

/* ---------- 类目标签 ---------- */
.cat-tag { display: inline-block; font-size: 12px; color: var(--primary); background: #eff6ff; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.stock-group-head td { background: #f0f5ff; border-top: 2px solid var(--primary); padding: 10px 16px; }
.stock-group-head .sg-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.stock-group-head .sg-stats { float: right; font-size: 12px; font-weight: 400; color: var(--text-2); }
.empty-state { background: var(--panel); border-radius: var(--radius); }
.inv-no-link { color: var(--primary); font-weight: 500; }
.inv-no-link:hover { text-decoration: underline; }
/* 商品明细子行（始终可见，紧凑横排） */
.inv-items-sub > td { padding: 0 !important; border-bottom: 1px solid var(--border) !important; }
.inv-items-inline { display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 7px 16px 8px; background: #f8fafc; }
.inv-items-inline.empty { display: none; }
.item-inline { display: inline-flex; align-items: baseline; gap: 4px; font-size: 12.5px; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; line-height: 1.5; }
.item-inline .item-name { color: var(--text); font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-inline .item-meta { color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.item-inline .item-cat { color: var(--teal); font-size: 11px; background: rgba(0,150,136,.08); border: 1px solid rgba(0,150,136,.25); border-radius: 3px; padding: 0 5px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.item-inline .item-cat-edit { font-size: 11px; color: var(--primary); background: #eff6ff; border: 1px solid #dbeafe; border-radius: 3px; padding: 0 6px; text-decoration: none; white-space: nowrap; }
.item-inline .item-cat-edit:hover { background: #dbeafe; }
.cat-tag + .item-cat-edit, td .item-cat-edit { font-size: 11px; color: var(--primary); background: #eff6ff; border: 1px solid #dbeafe; border-radius: 3px; padding: 0 6px; cursor: pointer; white-space: nowrap; vertical-align: middle; }
.cat-tag + .item-cat-edit:hover, td .item-cat-edit:hover { background: #dbeafe; }
.item-inline .item-meta.price { color: var(--teal); }
.item-more-inline { font-size: 12px; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; background: #eff6ff; border: 1px solid #dbeafe; white-space: nowrap; }
.item-more-inline:hover { background: #dbeafe; }
.inv-items-inline .item-extra { display: none; }
.inv-items-inline.expanded .item-extra { display: inline-flex; }
.inv-items-inline.expanded .item-more-inline { display: none; }

/* AI 比对度标签（未认证清单商品） */
.ai-score { font-size: 10.5px; border-radius: 3px; padding: 0 4px; white-space: nowrap; vertical-align: middle; line-height: 1.6; }
.ai-hi { color: #0f766e; background: rgba(13,148,136,.1); border: 1px solid rgba(13,148,136,.35); }
.ai-mid { color: #1d4ed8; background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.35); }
.ai-low { color: #b45309; background: rgba(245,158,11,.13); border: 1px solid rgba(245,158,11,.45); }
.ai-none { color: #b91c1c; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.35); }
.ai-warn { color: #c2410c; background: #fff7ed; border-color: #fdba74; box-shadow: 0 0 0 1px #fdba74; font-weight: 600; }
.ai-hint { font-size: 12px; color: var(--text-2); padding: 8px 16px; border-bottom: 1px dashed var(--border); line-height: 1.8; }
.ai-hint b { color: var(--text); }

/* 类目下钻页商品元信息（名称旁的数量×单价） */
.catd-item-meta { color: var(--text-2); font-size: 11.5px; white-space: nowrap; margin-left: 2px; }
.catd-item-meta.price { color: var(--teal); }

/* 旧样式保留兼容 */
.inv-toggle { display: none; }
.items-cell { max-width: 280px; }
.item-tag { font-size: 12px; color: var(--text); background: #f0f5ff; padding: 2px 8px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.item-more { font-size: 12px; color: var(--primary); cursor: pointer; display: inline-block; padding: 2px 4px; }
.item-more:hover { text-decoration: underline; }
.inv-items-row > td { padding: 0 !important; background: #f8fafc; }
.items-expand { padding: 8px 16px 12px; }
.items-sub-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.items-sub-table thead th { text-align: left; padding: 6px 10px; color: var(--text-2); font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
.items-sub-table tbody td { padding: 6px 10px; border-bottom: 1px solid #eef2f6; }
.items-sub-table tbody tr:last-child td { border-bottom: none; }
.inv-info-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px 24px; padding: 16px; }
.inv-info-grid .info-item { display: flex; flex-direction: column; gap: 4px; }
.inv-info-grid .info-item.span-2 { grid-column: span 2; }
.inv-info-grid .info-item label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.inv-info-grid .info-item span { font-size: 14px; color: var(--text); }
.inv-amount-bar { display: flex; gap: 12px; padding: 16px; border-top: 1px solid var(--border); }
.inv-amount-bar .amt-box { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; background: #f8fafc; border-radius: 8px; }
.inv-amount-bar .amt-box-primary { background: #eff6ff; }
.inv-amount-bar .amt-box-success { background: #f0fdf4; }
.inv-amount-bar .amt-label { font-size: 12px; color: var(--text-2); }
.inv-amount-bar .amt-val { font-size: 18px; color: var(--text); }
.inv-amount-bar .amt-box-primary .amt-val { color: var(--primary); }
.inv-amount-bar .amt-box-success .amt-val { color: var(--green); }
.table .total-row td { background: #f8fafc; font-weight: 700; border-top: 2px solid var(--border); }
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px 24px; padding: 16px; }
.detail-info-grid .info-item { display: flex; flex-direction: column; gap: 2px; }
.detail-info-grid .info-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.detail-info-grid .info-val { font-size: 14px; color: var(--text); word-break: break-all; }

/* 开票申请商品明细表格 */
.app-items-table { margin-bottom: 8px; min-width: 1100px; table-layout: fixed; }
.app-items-table th { font-size: 12px; white-space: nowrap; }
.app-items-table td { padding: 6px; vertical-align: middle; }
.app-items-table input[type="text"],
.app-items-table input[type="number"],
.app-items-table select {
  font-size: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px;
  box-sizing: border-box; width: 100%; color: var(--text);
}
/* 隐藏 number 输入框的上下箭头，腾出空间显示内容 */
.app-items-table input[type="number"]::-webkit-inner-spin-button,
.app-items-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.app-items-table input[type="number"] { -moz-appearance: textfield; }
.app-items-table input:focus,
.app-items-table select:focus { border-color: var(--primary); outline: none; }
.app-items-table .row-num { text-align: center; color: var(--text-2); font-size: 12px; }
.app-items-table .item-row:hover { background: #f8fafc; }
.app-items-table tfoot .total-row td { font-size: 14px; }
.badge-info { background: #eff6ff; color: #2563eb; }
.badge-success { background: #f0fdf4; color: #16a34a; }
.badge-primary { background: #eef2ff; color: #4f46e5; }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* 开票申请：商品行类型（库存商品 / 服务类） */
.item-type-select { padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text); background: #fff; }
.link-disabled { cursor: not-allowed; }
.link-service-badge { display: inline-block; font-size: 12px; color: var(--text-2); background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 6px; padding: 4px 10px; white-space: nowrap; }

/* 关联发票搜索弹窗 */
.link-tab {
  padding: 8px 16px; border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text-2); font-family: inherit;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.link-tab:hover { color: var(--text); }
.link-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* AI 类目智能比对 */
.ai-suggest-box { margin-top: 20px; padding: 16px 20px; border: 1px solid #d4e4f7; border-radius: 8px; background: linear-gradient(135deg, #f0f7ff 0%, #f8fbff 100%); }
.ai-suggest-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ai-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }
.ai-title { font-size: 15px; font-weight: 600; color: var(--text); }
.ai-confidence { font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.ai-conf-high { background: #e8f8ee; color: #16a34a; }
.ai-conf-mid { background: #fff8e6; color: #d97706; }
.ai-conf-low { background: #fee2e2; color: #dc2626; }
.ai-match-type { font-size: 12px; color: var(--text-2); padding: 2px 8px; background: #f0f5ff; border-radius: 4px; }
.ai-suggested-cat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-cat-label { font-size: 13px; color: var(--text-2); }
.ai-cat-path { font-size: 15px; font-weight: 600; color: var(--primary); }
.ai-accept-btn { margin-left: 4px; }
.ai-section-label { font-size: 12px; color: var(--text-2); margin: 8px 0 6px; }
.ai-item-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-item-tag { font-size: 12px; padding: 3px 8px; border-radius: 4px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-item-high { background: #e8f8ee; color: #16a34a; }
.ai-item-mid { background: #fff8e6; color: #d97706; }
.ai-item-low { background: #fef3f3; color: #dc2626; }
.ai-item-unmatched { background: #f5f5f5; color: #999; }
.ai-alt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-alt-btn { font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text-2); cursor: pointer; transition: all .15s; font-family: inherit; }
.ai-alt-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f7ff; }
.ai-no-match { font-size: 13px; color: var(--text-2); padding: 8px 0; }
.ai-loading-hint { margin-top: 20px; padding: 12px 16px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.stock-items-preview { margin-top: 20px; }
.stock-items-preview h4 { font-size: 14px; margin-bottom: 8px; color: var(--text); }

.link-result-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.link-result-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.link-result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.link-result-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 600; color: var(--text); }
.link-items-list { margin-top: 6px; }
.link-item-row {
  display: flex; align-items: baseline; gap: 8px; padding: 3px 0;
  font-size: 12.5px; border-bottom: 1px dashed #eef2f6;
}
.link-item-row:last-child { border-bottom: none; }
.link-item-name { flex: 1; color: var(--text); }
.link-item-meta { color: var(--text-2); white-space: nowrap; }
.link-item-amt { color: var(--teal); font-weight: 500; white-space: nowrap; }

/* 关联显示区（表格行内） */
.link-cell { min-width: 180px; }
.link-display { cursor: pointer; min-height: 28px; display: flex; align-items: center; }
.link-display:hover .link-placeholder { color: var(--primary); border-color: var(--primary); }
.link-placeholder { font-size: 12px; color: var(--text-2); border: 1px dashed var(--border); border-radius: 6px; padding: 3px 10px; width: 100%; text-align: center; }
.link-selected { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: #f0f5ff; border-radius: 6px; padding: 4px 8px; }
.link-selected-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 500; }
.link-selected-name { font-size: 11px; color: var(--text-2); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-unlink { font-size: 11px !important; padding: 1px 6px !important; margin-left: auto; }
