/* ============ 中州智汇 设计系统 ============ */
:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --teal: #0d9488;
  --teal-bg: #f0fdfa;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 8px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 216px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
.num { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5d9e0; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b8bec8; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
#app { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.logo {
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
  height: 58px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  object-fit: contain;
}
.logo-text { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.logo-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-group-title {
  font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .6px;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; color: var(--text-2); font-size: 13.5px; cursor: pointer;
  transition: background .13s, color .13s; position: relative; user-select: none;
}
.nav-item:hover { background: #f3f4f6; color: var(--text); }
.nav-item.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--brand); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center;
  padding: 0 5px; font-weight: 600;
}
.nav-badge.gray { background: var(--border-strong); color: var(--text-2); }

.sidebar-foot {
  padding: 10px; border-top: 1px solid var(--border); display: flex;
  align-items: center; gap: 9px; flex-shrink: 0;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* 顶栏用户芯片 */
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-chip-role { font-size: 11px; color: var(--text-3); background: #fff; border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.text-green { color: #16a34a; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 16px; flex-shrink: 0;
}
.page-title { font-size: 16.5px; font-weight: 650; }
.page-desc { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.content { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: all .13s; white-space: nowrap;
}
.btn:hover { border-color: #9ca3af; color: var(--text); background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #f3f4f6; border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-title { font-size: 14.5px; font-weight: 640; }
.card-title-sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 2px; }
.card-body { padding: 16px; }
.card-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }

/* ============ KPI ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand);
}
.kpi.green::after { background: var(--success); }
.kpi.red::after { background: var(--danger); }
.kpi.orange::after { background: var(--warning); }
.kpi.purple::after { background: var(--purple); }
.kpi.teal::after { background: var(--teal); }
.kpi-label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.kpi-value { font-size: 23px; font-weight: 680; margin-top: 7px; letter-spacing: -.4px; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-foot { font-size: 12px; color: var(--text-3); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.kpi-trend { font-weight: 600; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.tbl { font-size: 13.5px; }
.tbl thead th {
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12.5px;
  color: var(--text-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl tbody td { padding: 11px 12px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.tbl-link { color: var(--brand); font-weight: 550; cursor: pointer; }
.tbl-link:hover { text-decoration: underline; }
.tbl-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tbl-empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.tbl-empty svg { width: 44px; height: 44px; opacity: .3; margin-bottom: 10px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .35; transition: opacity .13s; }
tr:hover .row-actions { opacity: 1; }

/* ============ 标签 ============ */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 20px; font-size: 12px; font-weight: 550; line-height: 19px; white-space: nowrap;
}
.tag-gray { background: #f3f4f6; color: #4b5563; }
.tag-blue { background: var(--brand-50); color: var(--brand-600); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-orange { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--danger-bg); color: var(--danger); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-teal { background: var(--teal-bg); color: var(--teal); }
.tag-cyan { background: #ecfeff; color: #0891b2; }
.tag-pink { background: #fdf2f8; color: #db2777; }
.tag-indigo { background: #eef2ff; color: #4f46e5; }
.tag-yellow { background: #fefce8; color: #ca8a04; }
.tag-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.level-badge {
  width: 21px; height: 21px; border-radius: 5px; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #fff;
}
.level-A { background: #dc2626; } .level-B { background: #ea580c; }
.level-C { background: #2563eb; } .level-D { background: #9ca3af; }

/* ============ 表单 ============ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field label {
  display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 550;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); transition: border-color .13s, box-shadow .13s;
  font-size: 13.5px;
}
.textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; line-height: 1.6; font-family: inherit; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.input::placeholder, .textarea::placeholder { color: #b6bcc6; }
.select { appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 15px; }

/* ============ 可搜索下拉 combobox ============ */
.search-select { position: relative; width: 100%; }
.search-select .ss-input {
  width: 100%; height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; cursor: pointer;
  color: var(--text-2); transition: border-color .13s, box-shadow .13s;
}
.search-select .ss-input.placeholder { color: #b6bcc6; }
.search-select .ss-input.open, .search-select .ss-input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.search-select .ss-arrow { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; display: flex; }
.search-select .ss-arrow svg { width: 15px; height: 15px; }
.search-select .ss-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.search-select .ss-search { position: relative; padding: 7px; border-bottom: 1px solid var(--border); }
.search-select .ss-search-input {
  width: 100%; height: 30px; padding: 0 10px 0 30px; border: 1px solid var(--border-strong);
  border-radius: 6px; font-size: 13px; background: var(--bg); color: var(--text-2);
}
.search-select .ss-search-input:focus { outline: none; border-color: var(--brand); }
.search-select .ss-search-ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); display: flex; pointer-events: none; }
.search-select .ss-search-ico svg { width: 14px; height: 14px; }
.search-select .ss-options { max-height: 240px; overflow-y: auto; padding: 4px; }
.search-select .ss-option { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.search-select .ss-option:hover { background: var(--bg); }
.search-select .ss-option.active { background: rgba(37, 99, 235, .08); color: var(--brand); }
.search-select .ss-opt-sub { font-size: 11.5px; color: var(--text-3); }
.search-select .ss-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #cbd0d8; border-radius: 21px;
  transition: .18s; cursor: pointer;
}
.switch span::before {
  content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(17px); }

/* ============ 筛选栏 ============ */
.filters {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
}
.filters .input, .filters .select { height: 34px; width: auto; min-width: 128px; }
.filters .search { min-width: 230px; position: relative; }
.filters .search .input { padding-left: 32px; width: 100%; }
.filters .search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.filters .spacer { flex: 1; }
.filters .search.ex .input { padding-left: 46px; }
.filters .search.ex .ex-tag {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--text-3); pointer-events: none; font-weight: 500;
}

/* ============ 发票表单（增值税专票模板） ============ */
.inv-form { display: block; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 14px; }
.inv-party { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fafbfc; }
.inv-party-title { font-weight: 640; font-size: 13.5px; margin-bottom: 8px; color: var(--brand); }
.inv-items { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.inv-items-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 600; font-size: 13.5px; }
.inv-items-tbl td, .inv-items-tbl th { padding: 6px 8px; vertical-align: middle; }
.inv-items-tbl .inv-i-amount, .inv-items-tbl .inv-i-tax { white-space: nowrap; min-width: 86px; }
.inv-total-cn { margin-top: 10px; font-size: 13.5px; text-align: right; color: var(--text); }
.inv-total-cn b { color: var(--brand); }

/* ============ 发票纸张（预览 / 下载图片） ============ */
.invoice-paper { background: #fff; border: 2px solid #d23b3b; border-radius: 6px; padding: 18px 20px; color: #222; font-size: 13px; }
.inv-paper-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #d23b3b; padding-bottom: 10px; margin-bottom: 10px; }
.inv-paper-title { font-size: 22px; font-weight: 800; color: #d23b3b; letter-spacing: 2px; }
.inv-paper-meta { font-size: 12px; color: #444; text-align: right; line-height: 1.7; }
.inv-paper-meta span { font-weight: 600; }
.inv-paper-tbl { width: 100%; border-collapse: collapse; }
.inv-paper-tbl th, .inv-paper-tbl td { border: 1px solid #e3a3a3; padding: 7px 9px; vertical-align: top; text-align: left; line-height: 1.6; }
.inv-paper-tbl th { background: #fdeaea; font-weight: 600; color: #b12b2b; width: 84px; white-space: nowrap; }
.inv-w-party { width: 64px; }
.inv-w-goods { width: 120px; vertical-align: top; }
.inv-party-cell { width: 40%; }
.inv-paper-goods { width: 100%; border-collapse: collapse; margin: -1px; }
.inv-paper-goods th, .inv-paper-goods td { border: 1px solid #e3a3a3; padding: 4px 6px; font-size: 12px; }
.inv-paper-goods th { background: #fff5f5; font-weight: 600; color: #b12b2b; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 9px 15px; font-size: 13.5px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .13s; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-count {
  background: #f3f4f6; color: var(--text-2); font-size: 11px; padding: 1px 6px;
  border-radius: 10px; font-weight: 600;
}
.tab.active .tab-count { background: var(--brand-100); color: var(--brand-600); }
.tab-count.danger { background: #fee2e2; color: #dc2626; }
.tab.active .tab-count.danger { background: #fee2e2; color: #dc2626; }

/* ============ 下拉选项管理 ============ */
.opt-groups { display: flex; flex-direction: column; gap: 8px; }
.opt-group-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.opt-group-name { font-weight: 600; font-size: 13.5px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.opt-item { display: flex; gap: 8px; align-items: center; }
.opt-item .input-sm { flex: 1; }
.input-sm { height: 30px; padding: 4px 9px; font-size: 13px; }

.role-list { display: flex; flex-direction: column; gap: 8px; }
.role-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.role-row .role-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.role-row .role-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }

/* ============ 模态框 / 抽屉 ============ */
.overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; max-height: 88vh; display: flex; flex-direction: column;
  animation: popIn .18s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(8px); } }
.modal.lg { max-width: 880px; }
.modal.xl { max-width: 1080px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.modal-title { font-size: 15.5px; font-weight: 640; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 9px; flex-shrink: 0; background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}
.modal-close {
  margin-left: auto; width: 28px; height: 28px; border-radius: 6px; display: grid;
  place-items: center; color: var(--text-3);
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }

.drawer-wrap { position: fixed; inset: 0; z-index: 900; animation: fadeIn .16s; }
.drawer-mask { position: absolute; inset: 0; background: rgba(17, 24, 39, .4); }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(960px, 88vw);
  background: var(--bg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .6; } }
.drawer-head {
  padding: 15px 22px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

/* 居中弹出模式：与右侧抽屉共用 DOM 结构，仅定位与动画不同（详情页用 placement:'center'） */
.drawer-wrap.center { display: flex; align-items: center; justify-content: center; padding: 24px; }
.drawer-wrap.center .drawer {
  position: relative; right: auto; top: auto; bottom: auto;
  width: min(1080px, 92vw); height: auto; max-height: 88vh;
  border-radius: 12px; overflow: hidden;
  animation: popIn .18s cubic-bezier(.2,.9,.3,1.1);
}
.drawer-wrap.center .drawer-head { border-radius: 12px 12px 0 0; }
.drawer-wrap.center .drawer-body { padding: 18px 22px 22px; }
@media (max-width: 720px) {
  .drawer-wrap.center { padding: 12px; }
  .drawer-wrap.center .drawer { width: 96vw; max-height: 92vh; }
}

/* ============ Toast ============ */
.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; box-shadow: var(--shadow-lg); font-size: 13.5px;
  display: flex; align-items: center; gap: 9px; min-width: 240px; max-width: 460px;
  animation: toastIn .22s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } }
.toast.out { animation: toastOut .2s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--brand); }

/* ============ 详情展示 ============ */
.desc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.desc-item { background: var(--surface); padding: 11px 14px; }
.desc-label { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.desc-value { font-size: 13.5px; font-weight: 500; word-break: break-all; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--brand);
}
.tl-item.gray::before { border-color: var(--border-strong); }
.tl-item.green::before { border-color: var(--success); }
.tl-item.red::before { border-color: var(--danger); }
.tl-title { font-size: 13.5px; font-weight: 550; }
.tl-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tl-body { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.6; }

/* ============ 进度条 ============ */
.progress { height: 6px; background: #eceef1; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 4px; transition: width .35s ease; }
.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--warning); }
.progress-bar.red { background: var(--danger); }
.progress-mini { height: 4px; }

/* ============ 看板 ============ */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { min-width: 258px; width: 258px; flex-shrink: 0; background: #eef0f4; border-radius: var(--radius); padding: 10px; }
.kanban-head { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; padding: 0 2px; }
.kanban-title { font-size: 13px; font-weight: 640; }
.kanban-amount { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.kanban-card {
  background: var(--surface); border-radius: 8px; padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); cursor: pointer; transition: .13s; box-shadow: var(--shadow-sm);
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--brand-100); }
.kanban-card:last-child { margin-bottom: 0; }
.kanban-wrap { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-body { display: flex; flex-direction: column; }
.kanban-card-top { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.kanban-card-name { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.kanban-card-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.kanban-card-foot { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.kanban-empty { font-size: 12.5px; color: var(--text-3); text-align: center; padding: 16px 0; }
.kanban-col.col-won { background: #e7f6ec; }
.kanban-col.col-lost { background: #f1eeec; }
.kanban-col.col-won .kanban-head .tag { background: #d3f0db; color: #15803d; }

/* ============ 跟进动态 Feed ============ */
.feed-item { display: flex; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--surface-2); }
.feed-avatar { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-size: 15px; color: #fff; }
.feed-main { flex: 1; min-width: 0; }
.feed-head { display: flex; align-items: center; gap: 8px; }
.feed-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.feed-content { font-size: 13px; color: var(--text-2); margin-top: 7px; line-height: 1.7; white-space: pre-wrap; }
.feed-opp {
  font-size: 13.5px; font-weight: 600; color: var(--brand);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; flex-wrap: wrap; }

/* ============ 账龄堆叠条 ============ */
.stack-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: #eceef1; }
.stack-seg { height: 100%; }
.stack-seg + .stack-seg { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .5); }

/* ============ 图表 ============ */
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.chart-tip {
  position: fixed; background: rgba(17,24,39,.92); color: #fff; padding: 7px 11px; border-radius: 6px;
  font-size: 12.5px; pointer-events: none; z-index: 1500; white-space: nowrap; line-height: 1.65;
  box-shadow: var(--shadow-lg);
}

/* ============ 工具类 ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.flex { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.text-3 { color: var(--text-3); } .text-2 { color: var(--text-2); }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }
.fw-6 { font-weight: 600; }
.c-red { color: var(--danger); } .c-green { color: var(--success); }
.c-orange { color: var(--warning); } .c-brand { color: var(--brand); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.section-title { font-size: 13px; font-weight: 640; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }

.pagination { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pagination .ml-auto { display: flex; gap: 6px; align-items: center; }

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.65;
  display: flex; gap: 9px; align-items: flex-start;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--brand-50); color: #1e40af; }
.alert-warn { background: var(--warning-bg); color: #92400e; }
.alert-danger { background: var(--danger-bg); color: #991b1b; }
.alert-success { background: var(--success-bg); color: #166534; }

.msg-preview {
  background: #f6f7f9; border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px;
  font-size: 13px; line-height: 1.85; white-space: pre-wrap; word-break: break-word;
  font-family: "SF Mono", "Cascadia Mono", Consolas, "PingFang SC", monospace;
  max-height: 320px; overflow-y: auto;
}
.wechat-card {
  background: #fff; border-radius: 8px; padding: 13px 15px; max-width: 340px;
  box-shadow: 0 1px 5px rgba(0,0,0,.09); font-size: 13.5px; line-height: 1.75;
  border: 1px solid #e8eaed;
}
.wechat-card .wc-title { font-weight: 620; margin-bottom: 6px; color: #1f2329; }
.wechat-card .wc-line { color: #5e6673; font-size: 12.5px; }
.wechat-card .wc-line b { color: #1f2329; font-weight: 550; }
.wechat-card .wc-quote {
  border-left: 3px solid #d9dce1; padding-left: 8px; margin-top: 8px;
  color: #8a9099; font-size: 12px;
}
.wechat-bg {
  background: #f0f2f5; border-radius: 10px; padding: 16px; display: flex; gap: 9px; align-items: flex-start;
}
.wechat-avatar {
  width: 34px; height: 34px; border-radius: 5px; background: #07c160; color: #fff;
  display: grid; place-items: center; font-size: 15px; flex-shrink: 0;
}

.skeleton {
  background: linear-gradient(90deg, #f0f1f3 25%, #e6e8ea 37%, #f0f1f3 63%);
  background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 5px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (max-width: 1180px) {
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .field.span-2, .field.span-3 { grid-column: span 1; }
  .content { padding: 14px; }
}

/* ============ 图标尺寸安全网（修复流程页图标过大 BUG） ============ */
.section-title svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn svg, .btn-sm svg, .btn-xs svg { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -2px; }

/* ============ 附件上传组件 ============ */
.att-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.att-dropzone:hover { border-color: var(--brand); background: var(--brand-50); }
.att-dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.att-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; }
.att-upload-ico { color: var(--brand); margin-bottom: 2px; }
.att-upload-ico svg { width: 26px; height: 26px; }
.link-btn { border: none; background: none; color: var(--brand); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

.att-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.att-list:empty { margin-top: 0; }
.att-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; background: #fff;
}
.att-item .att-ico {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--text-2);
  background: #f1f3f5;
}
.att-item .att-ico svg { width: 19px; height: 19px; }
.att-item .att-thumb {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0;
  object-fit: cover; background: #f1f3f5; border: 1px solid var(--border);
}
.att-ico-pdf { color: #d63a3a; background: #fdecec; }
.att-ico-doc, .att-ico-docx { color: #2b6fd6; background: #eaf1fc; }
.att-ico-xls, .att-ico-xlsx { color: #1f9d55; background: #e9f6ee; }
.att-ico-ppt, .att-ico-pptx { color: #d98a1e; background: #fdf2e3; }
.att-meta { min-width: 0; flex: 1; }
.att-name { font-size: 13px; color: var(--text-1); font-weight: 540; }
.att-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.att-item.att-uploading { opacity: .85; }
.att-item .att-spin {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: attspin .7s linear infinite;
}
@keyframes attspin { to { transform: rotate(360deg); } }
.att-item .row-actions { opacity: 1; }

/* ============ 人事中心图标 ============ */
.hr-card { border-top: 3px solid var(--hr-fg); }
.hr-card .kpi-label { font-weight: 540; color: var(--text-1); }
.hr-tile {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--hr-bg, #f1f3f5); color: var(--hr-fg, var(--text-2));
}
.hr-tile svg { width: 22px; height: 22px; }
.hr-tile-lg { width: 48px; height: 48px; border-radius: 13px; margin: 0 auto 8px; }
.hr-tile-lg svg { width: 26px; height: 26px; }
.hr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 540; white-space: nowrap;
  background: var(--hr-bg, #f3f4f6); color: var(--hr-fg, var(--text-2));
}
.hr-chip svg { width: 15px; height: 15px; }

/* 主题色（与 .tag-* 同套色板） */
.hr-theme-blue   { --hr-fg: var(--brand-600); --hr-bg: var(--brand-50); }
.hr-theme-purple { --hr-fg: var(--purple);    --hr-bg: var(--purple-bg); }
.hr-theme-orange { --hr-fg: var(--warning);   --hr-bg: var(--warning-bg); }
.hr-theme-teal   { --hr-fg: var(--teal);      --hr-bg: var(--teal-bg); }
.hr-theme-green  { --hr-fg: var(--success);   --hr-bg: var(--success-bg); }
.hr-theme-pink   { --hr-fg: #db2777;          --hr-bg: #fdf2f8; }
.hr-theme-gray   { --hr-fg: #4b5563;          --hr-bg: #f3f4f6; }

/* ============ 审批流程模板编辑器 ============ */
.muted { color: var(--text-3); }
.sm { font-size: 12.5px; }
.input.sm, .select.sm { height: 32px; padding: 0 8px; font-size: 12.5px; }
.fg-label { font-size: 13px; color: var(--text-2); align-self: center; }
.block-title { font-size: 13px; font-weight: 600; color: var(--text-1); margin: 6px 0 10px; padding-left: 8px; border-left: 3px solid var(--brand-500); }
.step-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-2, #f8fafc); border: 1px solid var(--line-2, #eef0f3); border-radius: 9px; margin-bottom: 8px; }
.step-idx { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-500); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-row .input.sm { width: 160px; }
.step-row .select.sm { width: 110px; }
.av-box { display: inline-flex; align-items: center; min-width: 80px; }
.step-btns { margin-left: auto; display: flex; gap: 4px; }
.step-btns .btn-xs { min-width: 26px; }
.field-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-2, #f8fafc); border: 1px solid var(--line-2, #eef0f3); border-radius: 9px; margin-bottom: 8px; }
.field-row .input.sm { width: 130px; }
.field-row .select.sm { width: 96px; }
.chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.chk input { width: 15px; height: 15px; }


