:root {
  --bg: #f4f6fa;
  --bg-soft: #f7f9fc;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #7a869a;
  --primary: #2f6fed;
  --primary-d: #245ad0;
  --danger: #e0483e;
  --warn: #e6a23c;
  --ok: #2e9e5b;
  --shadow: 0 2px 10px rgba(20,30,60,.06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 16px; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: #1d2433; color: #cfd6e4; display: flex; flex-direction: column; }
.brand { font-size: 18px; font-weight: 700; padding: 20px 18px; color: #fff; letter-spacing: 2px; }
.sidebar nav { flex: 1; padding-top: 6px; }
.nav-item { display: block; width: 100%; text-align: left; background: none; border: none;
  color: #cfd6e4; padding: 12px 18px; cursor: pointer; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: #262f42; }
.nav-item.active { background: #262f42; border-left-color: var(--primary); color: #fff; }
.sidebar-foot { padding: 14px 18px; }
.link-btn { background: none; border: none; color: #8b97ad; cursor: pointer; font-size: 13px; }
.link-btn:hover { color: #fff; }
/* 侧栏底部的「修改密码 / 退出登录」逐个成行，避免两个按钮挤在一行 */
.sidebar-foot .link-btn { display: block; margin-top: 6px; }

/* min-width:0 是关键：flex 项默认 min-width:auto，会被内部宽表格的 min-content 撑开，
   导致「容器内滚动条」失效、整页出现横向滚动。加上 0 让表格在自己的 .pt-wrap 里滚动。 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; margin: 0; }
.view-container { padding: 22px 24px; flex: 1; min-width: 0; }

/* 按钮 */
.btn { background: var(--primary); color: #fff; border: none; padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--primary-d); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f0f3f8; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 筛选条 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px;
  background: var(--panel); padding: 14px 16px; border-radius: 8px; box-shadow: var(--shadow); }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.toolbar input[type=text] { min-width: 200px; }

/* 表格 */
.table-wrap { background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: #f7f9fc; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f7faff; }
td:last-child, th:last-child { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nw { white-space: nowrap; }
.clickable { cursor: pointer; color: var(--primary); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; background: #eef2f8; color: #4a5a72; }
.tag.t-ok { background: #e6f6ec; color: var(--ok); }
.tag.t-warn { background: #fdf3e3; color: var(--warn); }
.tag.t-err { background: #fdecea; color: var(--danger); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* 遮罩/弹窗 */
.overlay { position: fixed; inset: 0; background: rgba(15,22,40,.45); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.login-box { background: #fff; padding: 32px; border-radius: 12px; width: 320px; text-align: center; }
.login-box input { width: 100%; padding: 10px; margin: 14px 0; border: 1px solid var(--border); border-radius: 6px; }
.login-box button { width: 100%; padding: 10px; }
.modal { background: #fff; border-radius: 12px; width: 760px; max-width: 94vw; max-height: 90vh;
  overflow: auto; padding: 22px 24px; }
.modal h2 { margin: 0 0 16px; font-size: 17px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit; }
.field textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 详情预览 */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 14px 0; }
.detail-grid .kv { display: flex; gap: 8px; font-size: 13px; }
.detail-grid .kv b { color: var(--muted); font-weight: 600; min-width: 84px; }
.preview-box { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #fafbfe; }
.preview-box iframe { width: 100%; height: 460px; border: none; border-radius: 6px; }
.preview-box img { max-width: 100%; border-radius: 6px; }

/* 看板 */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.card { background: var(--panel); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--panel); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.panel-head .muted { font-size: 12px; }
.panel-head .btn { margin-left: auto; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row .name { width: 90px; color: var(--muted); }
.bar-track { flex: 1; background: #eef2f8; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 6px; }
.bar-row .val { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }

/* 三流核对 */
.recon-row td .flag { display: inline-block; margin-right: 6px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #1d2433;
  color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 99; font-size: 13px; }
.file-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.file-tab { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; background: #fff; }
.file-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.ocr-panel { background: var(--bg-soft); border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.type-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.type-row { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfe; }
.type-row span { font-size: 14px; font-weight: 500; }

/* ---------------------------------------------------------------------------
   顶栏：主体切换 + 站内预警铃铛
   --------------------------------------------------------------------------- */
.topbar-right { display: flex; align-items: center; gap: 12px; position: relative; }
.company-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.company-pick select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  min-width: 170px; font-size: 13px; background: #fff; color: var(--text); }
.bell-btn { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  width: 36px; height: 32px; cursor: pointer; font-size: 15px; line-height: 1; }
.bell-btn:hover { background: #f0f3f8; }
.bell-badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 10px; min-width: 16px; text-align: center; }
.alert-panel { position: absolute; top: 44px; right: 0; width: 460px; max-width: 92vw; max-height: 70vh;
  overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20,30,60,.16); z-index: 40; }
.alert-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.alert-head .muted { font-size: 12px; flex: 1; }
.alert-list { padding: 6px; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.alert-item:hover { background: #f4f7fd; }
.alert-item .tag { flex: none; margin-top: 2px; }
.alert-body { min-width: 0; }
.alert-title { font-size: 13px; font-weight: 600; }
.alert-body .muted { font-size: 12px; margin-top: 2px; word-break: break-all; }

/* ---------------------------------------------------------------------------
   智能勾稽
   --------------------------------------------------------------------------- */
.score { display: inline-block; min-width: 48px; text-align: center; padding: 3px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score.s-hi { background: #e6f6ec; color: var(--ok); }
.score.s-mid { background: #fdf3e3; color: var(--warn); }
.score.s-lo { background: #eef2f8; color: var(--muted); }
td.arrow { color: var(--muted); text-align: center; width: 28px; }
td.reasons .tag { margin: 2px 4px 2px 0; }

/* ---------------------------------------------------------------------------
   公司主体
   --------------------------------------------------------------------------- */
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.co-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.co-card.off { opacity: .6; }
.co-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.co-name { font-size: 15px; font-weight: 700; }
.co-head .muted { font-size: 12px; margin-top: 3px; }
.co-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.co-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  background: var(--bg-soft); border-radius: 8px; padding: 10px 6px; }
.co-stats > div { text-align: center; }
.co-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.co-stats span { font-size: 12px; color: var(--muted); }
.co-amount { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.co-amount b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   发票中心（P2）
   --------------------------------------------------------------------------- */
.hub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--panel); padding: 6px; border-radius: 10px; box-shadow: var(--shadow); }
.hub-tab { background: none; border: none; padding: 8px 16px; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hub-tab:hover { background: #f0f3f8; color: var(--text); }
.hub-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

.hub-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.hub-actions .btn { white-space: nowrap; }
.hub-actions input[type=password], .hub-actions input[type=text] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

.hub-note { padding: 11px 14px; border-radius: 8px; font-size: 13px; line-height: 1.7;
  background: #f2f6ff; border-left: 3px solid var(--primary); }
.hub-note.ok { background: #eefaf2; border-left-color: var(--ok); }
.hub-note.warn { background: #fdf6e9; border-left-color: var(--warn); }
.hub-note .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.hub-pre { background: #f7f9fc; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-size: 12px; line-height: 1.6; max-height: 260px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; margin: 0; font-family: ui-monospace, Consolas, monospace; }

.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sk-card { border: 1px solid var(--border); border-radius: 9px; padding: 13px 15px;
  background: #fafbfe; display: flex; flex-direction: column; gap: 5px; }
.sk-card.off { opacity: .62; background: #fdf6f5; }
.sk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sk-head b { font-size: 14px; }
.sk-card .muted { font-size: 12px; word-break: break-all; }

.cards .value.v-warn { color: var(--warn); }
.whoami { font-size: 12px; color: #8b97ad; margin-bottom: 8px; line-height: 1.5; }
.whoami b { color: #fff; display: block; font-size: 13px; }
.whoami .muted { color: #8b97ad; font-size: 11px; }

.login-box input { margin: 8px 0; }
.login-box .hint { font-size: 11px; text-align: left; line-height: 1.6; }

/* 同步按钮：连接器未就绪时弱化显示 */
.btn.is-disabled { opacity: .55; border-style: dashed; }

/* ---- 合同中心：缩略图平铺 ---- */
.ct-viewbar { display: inline-flex; gap: 6px; margin-left: auto; }
.ct-viewbar .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.ct-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff;
  cursor: pointer; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.ct-tile:hover { box-shadow: 0 6px 18px rgba(47,111,237,.16); border-color: #b9cdf5; }
.ct-thumb { position: relative; aspect-ratio: 3 / 4; background: #f4f6fb center/contain no-repeat;
  display: flex; align-items: center; justify-content: center; color: #a9b4c8; font-size: 12px;
  border-bottom: 1px solid var(--border); overflow: hidden; }
.ct-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.ct-badge { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; color: #fff; background: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.22);
  max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-badge.b-ok { background: var(--ok); }
.ct-badge.b-warn { background: var(--warn); }
.ct-badge.b-danger { background: var(--danger); }
.ct-tile-meta { padding: 9px 11px 11px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.ct-tile-meta b { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-tile-meta .row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.ct-tile-meta .row .amt { color: var(--text); font-weight: 600; }

/* 合同解析结果预览 */
.pa-result { border: 1px solid var(--border); border-radius: 8px; background: #fafbfe; padding: 10px 12px; margin-top: 10px; }
.pa-result .pa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pa-result .pa-head b { font-size: 13px; }
.pa-row { display: flex; gap: 8px; font-size: 12px; padding: 2px 0; }
.pa-row .k { color: var(--muted); min-width: 78px; }


/* ==========================================================================
   工具中心 —— Invoice / 采购订单 生成器
   ========================================================================== */
.tools-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 560px; gap: 16px; align-items: start; }
.tools-left, .tools-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tools-right { position: sticky; top: 16px; }
@media (max-width: 1280px) {
  .tools-wrap { grid-template-columns: 1fr; }
  .tools-right { position: static; }
}

.card-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
  margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.card-h .muted { font-size: 11px; font-weight: 400; letter-spacing: .5px; text-transform: uppercase; }

/* 模板选择 */
.tpl-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.tpl-card { display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  background: #fafbfe; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tpl-card:hover { border-color: #c7d4ea; background: #f5f8ff; }
.tpl-card.active { border-color: var(--primary); background: #eef4ff; box-shadow: 0 0 0 1px var(--primary) inset; }
.tpl-card .tpl-ico { font-size: 18px; }
.tpl-card .tpl-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tpl-card .tpl-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* 表单字段 */
.fld { display: block; margin-bottom: 10px; }
.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fld input, .fld textarea, .fld select { width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit; background: #fff; color: var(--text); }
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.10); }
.fld textarea { resize: vertical; }
.form-grid .fld { margin-bottom: 0; }

.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.party-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fafbfe; }
.party-h { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* 明细表 */
.items-head { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 8px; }
.items-table td { padding: 4px 6px; }
.items-table td input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px;
  font-size: 13px; font-family: inherit; }
.items-table td.op { width: 40px; text-align: center; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 5px; }
.icon-btn:hover { color: var(--danger); background: #fdeeed; }

/* 键值行 */
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv-row { display: flex; gap: 8px; align-items: center; }
.kv-row .kv-k, .kv-row .kv-v { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; }
.kv-row .kv-k { flex: 0 0 190px; }
.kv-row .kv-v { flex: 1; min-width: 0; }

/* ---- 预览：复刻底版排版 ---- */
.paper-card { padding-bottom: 18px; }
.paper-shell { background: #e9edf4; border-radius: 8px; padding: 14px; overflow: auto; max-height: 76vh; }
.paper { background: #fff; width: 100%; min-height: 600px; padding: 30px 34px 40px;
  font-family: "Times New Roman", "Songti SC", SimSun, serif; color: #111; font-size: 11px; line-height: 1.35; }
.paper .pv-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.paper .pv-meta { text-align: right; font-size: 10px; margin-bottom: 12px; }
.pv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-bottom: 10px; }
.pv-party .pv-p1 { font-weight: 700; font-size: 11px; margin-bottom: 2px; }
.pv-party .pv-p2 { font-size: 10px; color: #222; }
.pv-party .pv-p3 { font-size: 10px; color: #222; margin-top: 2px; }
.pv-deadline { font-weight: 700; font-size: 11px; margin: 8px 0; }
.pv-total { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.pv-total td { padding: 4px 2px; font-size: 11px; }
.pv-total td.k { font-weight: 700; }
.pv-total td.v { text-align: right; }
.pv-items { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pv-items th { background: #111; color: #fff; font-size: 10px; text-align: left; padding: 5px 8px; font-weight: 600; }
.pv-items td { font-size: 10px; padding: 5px 8px; border-bottom: 1px solid #d9d9d9; }
.pv-items th:first-child, .pv-items td:first-child { width: 50%; }
.pv-sec { font-weight: 700; font-size: 11px; margin: 12px 0 4px; }
.pv-note { font-size: 10px; color: #222; min-height: 12px; }
.pv-kv { width: 100%; border-collapse: collapse; margin-top: 4px; }
.pv-kv td { font-size: 10px; padding: 3px 2px; vertical-align: top; }
.pv-kv td:first-child { width: 34%; color: #333; }
.pv-contact { margin-top: 16px; font-size: 10px; color: #222; }
.pv-sign { margin-top: 26px; text-align: right; font-size: 10px; }
.pv-sign div:first-child { letter-spacing: 1px; }

/* ==========================================================================
   飞书审批单视图
   ========================================================================== */
.apv-status { padding: 14px 16px; }
.apv-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.apv-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.apv-dot-ok { background: #22a06b; box-shadow: 0 0 0 3px rgba(34,160,107,.15); }
.apv-dot-err { background: var(--danger, #e5484d); box-shadow: 0 0 0 3px rgba(229,72,77,.15); }
.apv-err { margin-top: 8px; color: var(--danger, #e5484d); font-size: 12px; line-height: 1.6; }
.apv-probes { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.apv-probe { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.apv-probe .apv-probe-name { min-width: 96px; font-weight: 600; }
.apv-probe code { background: #f3f5f9; border: 1px solid var(--border, #e3e8f0); border-radius: 4px;
  padding: 1px 6px; font-size: 11px; }
.apv-ok { color: #22a06b; font-weight: 700; }
.apv-no { color: var(--danger, #e5484d); font-weight: 700; }

.apv-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.apv-toolbar .grow, .apv-link-item .grow, .apv-add-search .grow { flex: 1; }
.apv-toolbar input[type="search"], .apv-toolbar select {
  padding: 7px 10px; border: 1px solid var(--border, #e3e8f0); border-radius: 6px;
  font-size: 13px; background: #fff; color: var(--text, #1c2333); }

.apv-pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  padding-top: 12px; font-size: 12px; }
.apv-title { color: var(--primary, #2f6fed); font-weight: 600; text-decoration: none; }
.apv-title:hover { text-decoration: underline; }
.apv-serial { margin-left: 8px; font-size: 11px; }
.apv-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid transparent; margin-right: 4px; white-space: nowrap; }
.apv-t-invoice { background: #e8f1ff; color: #2f6fed; border-color: #c7dbff; }
.apv-t-contract { background: #f3ecff; color: #7c4dcc; border-color: #ddccff; }
.apv-t-payment { background: #e6f7ef; color: #1a9e6c; border-color: #bfe9d6; }
.t-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.t-ok { background: #e6f7ef; color: #1a9e6c; }
.t-warn { background: #fff5e0; color: #b7791f; }
.t-err { background: #fdeced; color: #d33941; }
.t-mut { background: #eef1f6; color: #6b7486; }

/* 审批定义配置 */
.apv-defs summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.apv-defs-body { margin-top: 10px; }
.apv-def-row { display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--border, #e3e8f0); font-size: 13px; }
.apv-def-name { font-weight: 600; min-width: 120px; }
.apv-def-code { background: #f3f5f9; border-radius: 4px; padding: 1px 6px; font-size: 11px;
  color: var(--muted, #6b7486); }
.apv-def-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.apv-def-add input { padding: 7px 10px; border: 1px solid var(--border, #e3e8f0); border-radius: 6px;
  font-size: 13px; min-width: 260px; }
.apv-def-add input#apv-def-name { min-width: 160px; }

/* 详情弹窗 */
.apv-head-ops { display: flex; gap: 8px; align-items: center; }
.apv-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 18px; background: #f7f9fc; border: 1px solid var(--border, #e3e8f0);
  border-radius: 8px; padding: 12px 14px; margin: 12px 0; font-size: 12px; }
.apv-meta-k { color: var(--muted, #6b7486); font-size: 11px; }
.apv-meta-v { margin-bottom: 6px; word-break: break-all; }
.apv-sec { border: 1px solid var(--border, #e3e8f0); border-radius: 8px;
  padding: 10px 14px; margin-top: 12px; background: #fff; }
.apv-sec > summary { cursor: pointer; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.apv-form-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.apv-form-table td { padding: 6px 8px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
.apv-form-table .apv-f-name { width: 34%; color: var(--muted, #6b7486); }
.apv-tasks { display: flex; flex-direction: column; gap: 6px; }
.apv-task { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.apv-task-node { font-weight: 600; min-width: 90px; }

/* 关联区 */
.apv-links-sec .apv-links-h { display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.apv-link-count { background: var(--primary, #2f6fed); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 8px; }
.apv-link-item { display: flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 7px 4px; border-bottom: 1px dashed var(--border, #e3e8f0); flex-wrap: wrap; }
.apv-link-item b { font-size: 13px; }
.apv-amt { color: #1a9e6c; font-weight: 600; font-size: 12px; }
.apv-link-add { margin-top: 10px; border: 1px dashed var(--primary, #2f6fed);
  border-radius: 8px; padding: 10px 12px; background: #f8fbff; }
.apv-add-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.apv-tab { border: 1px solid var(--border, #e3e8f0); background: #fff; border-radius: 6px;
  padding: 5px 14px; font-size: 12px; cursor: pointer; }
.apv-tab.active { background: var(--primary, #2f6fed); color: #fff; border-color: var(--primary, #2f6fed); }
.apv-add-search { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.apv-add-search input { flex: 1; padding: 7px 10px; border: 1px solid var(--border, #e3e8f0);
  border-radius: 6px; font-size: 13px; }
.apv-add-opts { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.apv-opt { display: flex; align-items: center; gap: 10px; font-size: 12px; padding: 7px 10px;
  border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.apv-opt:hover { background: #eef4ff; }
.apv-opt.sel { background: #e8f1ff; border-color: var(--primary, #2f6fed); }

/* ===========================================================================
 * 档案匹配（流水为主体，关联发票 / 合同 / 审批单 / 银行水单）
 * ========================================================================= */
.arc-head { margin-bottom: 14px; }
.arc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.arc-tab { border: 1px solid var(--border, #e3e8f0); background: #fff; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; color: var(--text, #1d2433); }
.arc-tab:hover { border-color: var(--primary, #2f6fed); }
.arc-tab.active { background: var(--primary, #2f6fed); color: #fff; border-color: var(--primary, #2f6fed);
  font-weight: 600; }
.arc-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted, #6b7486);
  padding: 9px 12px; background: #f7f9fc; border: 1px solid var(--border, #e3e8f0); border-radius: 8px; }
.arc-stat b { color: var(--text, #1d2433); font-size: 13px; }
.arc-stat.arc-ok b { color: #1a9e6c; }
.arc-stat.arc-warn b { color: #d98a00; }
.arc-stat.sep { border-left: 1px solid var(--border, #e3e8f0); padding-left: 14px; }
.arc-flt { flex-wrap: wrap; }
.arc-summary { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid transparent; margin-right: 3px; }
.arc-c-invoice { background: #e8f1ff; color: #2f6fed; border-color: #c7dbff; }
.arc-c-contract { background: #f3ecff; color: #7c4dcc; border-color: #ddccff; }
.arc-c-approval { background: #fff4e5; color: #c77700; border-color: #ffe0b3; }
.arc-c-payment { background: #e6f7ef; color: #1a9e6c; border-color: #bfe9d6; }
.arc-cnt { font-size: 11px; margin-left: 5px; }
.arc-amt { color: #1a9e6c; }

/* ===========================================================================
 * 审批单：定义分 tab / 列配置 / JSON 表格化 / 溢出修复
 * ========================================================================= */
.apv-deftabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.apv-deftab { border: 1px solid var(--border, #e3e8f0); background: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--text, #1d2433); }
.apv-deftab:hover { border-color: var(--primary, #2f6fed); }
.apv-deftab.active { background: var(--primary, #2f6fed); color: #fff; border-color: var(--primary, #2f6fed);
  font-weight: 600; }
.apv-deftab-n { margin-left: 6px; font-size: 11px; opacity: .75; }
.apv-sub { font-size: 11px; color: var(--muted, #6b7486); margin-top: 2px; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apv-uid { color: var(--muted, #6b7486); font-family: ui-monospace, Menlo, Consolas, monospace; }

.apv-cols { border: 1px dashed var(--primary, #2f6fed); background: #f7faff; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 12px; }
.apv-cols-h { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.apv-cols-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.apv-col-item { font-size: 12px; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.apv-col-item.fixed { opacity: .65; cursor: default; }
.apv-cols-ops { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* 表单：左侧字段名固定宽度，右侧值可换行（防止长 JSON 撑破弹窗） */
.apv-form-list { display: flex; flex-direction: column; }
.apv-form-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f0f2f6; }
.apv-form-row .apv-f-name { width: 150px; flex: none; color: var(--muted, #6b7486); font-size: 12px; }
.apv-form-row .apv-f-val { flex: 1; min-width: 0; font-size: 13px; word-break: break-word; overflow-wrap: anywhere; }

/* JSON 可视化表格 */
.apv-json-wrap { max-width: 100%; overflow-x: auto; margin: 4px 0; }
.apv-json-table { border-collapse: collapse; font-size: 11.5px; width: 100%; table-layout: auto; }
.apv-json-table td, .apv-json-table th { border: 1px solid var(--border, #e3e8f0);
  padding: 3px 6px; vertical-align: top; text-align: left;
  word-break: break-word; overflow-wrap: anywhere; max-width: 240px; }
.apv-json-table .apv-json-wrap { margin: 0; }
.apv-json-table .apv-json-table { font-size: 11px; }
.apv-json-table .apv-json-table td, .apv-json-table .apv-json-table th { max-width: 180px; padding: 2px 5px; }
.apv-json-table th { background: #f3f5f9; font-weight: 600; white-space: nowrap; }
.apv-json-table td.jk { background: #fafbfe; color: var(--muted, #6b7486); white-space: nowrap;
  font-family: ui-monospace, Menlo, Consolas, monospace; width: 1%; }
.apv-json-group { margin: 10px 0; }
.apv-json-group-t { font-size: 12px; font-weight: 600; color: var(--text, #1d2433); margin-bottom: 4px; }
.apv-jv { white-space: pre-wrap; word-break: break-word; }
.apv-break { word-break: break-all; }

/* 弹窗内表格防溢出 */
.modal .table-wrap { overflow-x: auto; }
.modal table { max-width: 100%; }
.modal td { word-break: break-word; }

/* ===========================================================================
 * 工具中心 · 工具总览（icon 卡片）
 * =========================================================================*/
.tt-head { margin-bottom: 14px; }
.tt-head h2 { margin: 0 0 2px; font-size: 19px; }
.tt-head p { margin: 0; font-size: 13px; }

.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.tt-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  text-align: left; padding: 20px 18px 16px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--panel); cursor: pointer;
  transition: .16s; box-shadow: var(--shadow); overflow: hidden;
}
.tt-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--c, var(--primary));
}
.tt-card:hover {
  transform: translateY(-2px); border-color: var(--c, var(--primary));
  box-shadow: 0 8px 24px rgba(20,30,60,.12);
}
.tt-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 24px; background: color-mix(in srgb, var(--c, #2f6fed) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--c, #2f6fed) 22%, #fff);
}
.tt-name { font-size: 15px; font-weight: 650; display: flex; align-items: baseline; gap: 8px; }
.tt-name small { font-weight: 500; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.tt-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.tt-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.tt-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft, #f7f9fc); border: 1px solid var(--border); color: var(--muted);
}
.tt-go {
  margin-top: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--c, var(--primary)); align-self: flex-start;
}

/* ===========================================================================
 * 票据生成 · 可视化创作中心
 * =========================================================================*/
.bl-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.bl-tabs { display: flex; gap: 6px; }
.bl-tab {
  padding: 7px 15px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); font-size: 13px; font-weight: 550; cursor: pointer; transition: .14s;
}
.bl-tab:hover { border-color: var(--primary); color: var(--primary); }
.bl-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.bl-langs { display: flex; align-items: center; gap: 7px; margin-left: auto; flex-wrap: wrap; }
.bl-lang {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); font-size: 11.5px; cursor: pointer; transition: .14s;
}
.bl-lang:hover { border-color: var(--primary); color: var(--primary); }
.bl-lang.on { background: #eef2ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.bl-zoom { padding: 4px 7px; border-radius: 7px; border: 1px solid var(--border); font-size: 11.5px; }

.bl-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 13px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow);
}
.bl-pick { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.bl-pick select {
  padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; min-width: 300px; max-width: 420px;
}
.bl-dirty { font-size: 12px; }
.bl-unsaved { color: var(--warn); font-weight: 600; }
.bl-saved { color: var(--ok); font-weight: 600; }

.bl-grid {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 320px;
  gap: 14px; align-items: start;
}
@media (max-width: 1400px) { .bl-grid { grid-template-columns: 214px minmax(0,1fr) 290px; } }
@media (max-width: 1150px) { .bl-grid { grid-template-columns: 1fr; } }
.bl-col { min-width: 0; }
.bl-col-canvas { position: sticky; top: 8px; }

/* 控件面板 */
.bl-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 11px; }
.bl-ctl {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); cursor: pointer; transition: .14s;
}
.bl-ctl:hover { border-color: var(--primary); background: #f5f8ff; }
.bl-ctl-i { font-size: 17px; line-height: 1.1; }
.bl-ctl-n { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.bl-ctl:hover .bl-ctl-n { color: var(--primary); }

/* 纸张表单 */
.bl-paper-form { padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.bl-f { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.bl-f input, .bl-f select, .bl-f textarea {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 12.5px; color: var(--text); background: #fff; width: 100%;
  font-family: inherit;
}
.bl-f input:focus, .bl-f select:focus, .bl-f textarea:focus {
  border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}
.bl-f textarea { resize: vertical; }
.bl-f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bl-f4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.bl-chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); cursor: pointer; }
.bl-chk input { width: auto; }
.bl-sec-t {
  font-size: 12px; font-weight: 650; color: var(--text); margin-top: 4px;
  padding-top: 8px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 12px;
}
.bl-color-row, .bl-logo-row { display: flex; align-items: center; gap: 6px; }
.bl-color-row input[type=color] { width: 42px; height: 28px; padding: 1px; flex: none; }
.bl-logo-row { flex-wrap: wrap; }
#bl-logo-name { font-size: 11px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 画布 / 纸张 */
.bl-stage { overflow: auto; max-height: 74vh; padding: 16px; background: #eef1f6; border-radius: 10px; }
.bl-paper {
  background: #fff; box-shadow: 0 3px 16px rgba(20,30,60,.16);
  border-radius: 2px; position: relative; margin: 0 auto;
  transition: width .12s;
}
.bl-node { position: relative; border: 1px dashed transparent; border-radius: 5px; padding: 1px 2px; }
.bl-node:hover { border-color: #a9c2f5; background: rgba(47,111,237,.035); }
.bl-node.sel { border-color: var(--primary); background: rgba(47,111,237,.07); }
.bl-node-bar {
  position: absolute; top: -11px; right: 2px; z-index: 5; display: none; gap: 2px;
  background: var(--primary); border-radius: 6px; padding: 1px 3px;
  box-shadow: 0 2px 6px rgba(20,30,60,.25);
}
.bl-node.sel .bl-node-bar, .bl-node:hover .bl-node-bar { display: flex; align-items: center; }
.bl-node-bar button {
  border: 0; background: transparent; color: #fff; font-size: 11px; cursor: pointer;
  padding: 1px 4px; border-radius: 4px; line-height: 1.4;
}
.bl-node-bar button:hover { background: rgba(255,255,255,.25); }
.bl-node-type {
  font-size: 10px; color: #fff; padding: 0 4px; opacity: .85; white-space: nowrap;
}
.bl-ph { color: #c3cbd8; font-style: italic; }

/* 属性面板 */
.bl-props { padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.bl-prop-head {
  display: flex; align-items: flex-start; gap: 9px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.bl-prop-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: #eef2ff; font-size: 15px; flex: none;
}
.bl-prop-head b { font-size: 13px; display: block; }
.bl-prop-head small { font-size: 11px; display: block; line-height: 1.4; }
.bl-prop-actions {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 6px; padding-top: 9px; border-top: 1px solid var(--border);
}

/* 表格 / 键值编辑器 */
.bl-tbl-ed { display: flex; flex-direction: column; gap: 5px; }
.bl-tbl-h {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px;
  font-weight: 650; color: var(--text);
}
.bl-tbl-h .btn { margin-left: auto; }
.bl-tbl-r { display: flex; gap: 4px; align-items: center; }
.bl-tbl-r input, .bl-tbl-r select {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 11.5px; min-width: 0; flex: 1;
}
.bl-tbl-r input[style] { flex: none; }
.bl-tbl-scroll { overflow-x: auto; max-height: 220px; }
table.bl-mini { border-collapse: collapse; width: 100%; font-size: 11.5px; }
table.bl-mini th, table.bl-mini td {
  border: 1px solid var(--border); padding: 2px 4px; white-space: nowrap;
}
table.bl-mini th { background: var(--bg-soft, #f7f9fc); font-weight: 600; }
table.bl-mini input {
  border: 0; background: transparent; width: 100%; min-width: 56px;
  padding: 3px 4px; font-size: 11.5px; border-radius: 4px;
}
table.bl-mini input:focus { background: #fff; outline: 1px solid var(--primary); }

/* 生成表单 */
.bl-gen {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  max-height: 52vh; overflow-y: auto; padding-right: 4px;
}
.bl-gen .bl-f:last-of-type { grid-column: 1 / -1; }

/* 邮件模板 */
.bl-em-editor { padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1150px) { .grid-2 { grid-template-columns: 1fr; } }
.bl-em-tabs { display: flex; gap: 6px; margin-top: 4px; }
.bl-em-tab {
  padding: 5px 13px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); font-size: 12px; cursor: pointer;
}
.bl-em-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.bl-em-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px;
  border-bottom: 1px solid var(--border);
}
.bl-em-item:last-child { border-bottom: 0; }
.bl-em-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bl-em-main b { font-size: 13px; }
.bl-em-main .tag { align-self: flex-start; }
.bl-em-act { display: flex; gap: 5px; flex: none; }
.bl-gen .bl-f textarea, .bl-em-editor .bl-f textarea {
  font-family: "SFMono-Regular", Consolas, "PingFang SC", monospace;
  line-height: 1.6;
}
.bl-hint {
  font-size: 11.5px; color: var(--muted); background: var(--bg-soft, #f7f9fc);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.bl-hint code {
  background: #fff; border: 1px solid var(--border); border-radius: 4px;
  padding: 0 4px; font-size: 11px;
}

/* ===========================================================================
 * 批次 D：档案中心 / 财务地图 / 客户与供应商 / 开票管理 / 权限管理
 * ======================================================================== */

/* --- 通用：视图内标签栏（档案中心 / 财务地图 / 权限管理 共用） --- */
.ds-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.ds-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-tab { border: 1px solid var(--border); background: var(--panel); color: #4a5a72;
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ds-tab:hover { border-color: var(--primary); color: var(--primary); }
.ds-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.ds-tip { font-size: 12.5px; }
.bl-sect { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 10px; }

/* --- 财务地图 --- */
.mp-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mp-bar input[type=search] { min-width: 260px; }
.mp-cat { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow);
  padding: 12px 14px 14px; margin-bottom: 14px; }
.mp-cat-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.mp-cat-ico { width: 26px; height: 26px; border-radius: 7px; color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; }
.mp-cat-n { font-size: 12px; color: var(--muted); background: var(--bg-soft);
  border-radius: 10px; padding: 1px 8px; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 10px; }
.mp-card { border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px;
  background: #fff; transition: .16s; display: flex; flex-direction: column; gap: 7px; }
.mp-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(47,111,237,.12);
  transform: translateY(-1px); }
.mp-open { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mp-ico { width: 30px; height: 30px; border-radius: 7px; overflow: hidden; flex: 0 0 30px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--bg-soft); }
.mp-ico img { width: 22px; height: 22px; object-fit: contain; }
.mp-ico i { width: 100%; height: 100%; align-items: center; justify-content: center;
  color: #fff; font-style: normal; font-weight: 700; font-size: 13px; }
.mp-info { display: flex; flex-direction: column; min-width: 0; }
.mp-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.mp-host { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; flex-wrap: wrap; }
.mp-note, .mp-acc { color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 140px; }
.mp-mini { border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 12px; padding: 0 3px; }
.mp-mini:hover { color: var(--primary); }
.mp-empty { padding: 8px 2px; font-size: 12.5px; }
.mp-form { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; }
.mp-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.mp-form input, .mp-form select, .mp-form textarea { font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); }
.mp-form-act { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* --- 客户与供应商 --- */
.pt-body { display: flex; flex-direction: column; gap: 12px; }
.pt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.pt-card { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow);
  padding: 12px 14px; border-left: 3px solid var(--primary); }
.pt-card b { display: block; font-size: 20px; font-weight: 700; }
.pt-card span { font-size: 12.5px; color: var(--muted); }
.pt-c-all { border-left-color: #2f6fed; } .pt-c-cust { border-left-color: #16a34a; }
.pt-c-supp { border-left-color: #7c3aed; } .pt-c-high { border-left-color: #e0483e; }
.pt-c-bl { border-left-color: #b91c1c; } .pt-c-un { border-left-color: #94a3b8; }
.pt-toolbar { flex-wrap: wrap; }
.pt-chkbox { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.pt-wrap { overflow-x: auto; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); }
.pt-tbl { min-width: 1080px; }
.pt-tbl td, .pt-tbl th { padding: 9px 11px; white-space: nowrap; }
.pt-name { max-width: 260px; white-space: normal; }
.pt-name a { color: var(--primary); text-decoration: none; font-weight: 600; }
.pt-sub { font-size: 11px; }
.pt-chk { width: 34px; text-align: center; }
.pt-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.pt-tag { display: inline-flex; align-items: center; gap: 4px; background: #eef2f8;
  color: #4a5a72; border-radius: 10px; padding: 1px 8px; font-size: 11.5px; }
.pt-t-cust { background: #e6f6ec; color: #2e9e5b; }
.pt-t-supp { background: #f0e9fd; color: #7c3aed; }
.pt-t-both { background: #e8f0fe; color: #245ad0; }
.pt-risk-high { background: #fdeaea; color: #c0392b; }
.pt-risk-mid { background: #fdf3e3; color: #b8821b; }
.pt-risk-low { background: #e6f6ec; color: #2e9e5b; }
.pt-risk-none { background: #eef2f8; color: #7a869a; }
.pt-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ptd-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px; margin: 4px 0 10px; }
.ptd-m { background: var(--bg-soft); border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px; }
.ptd-m span { font-size: 11.5px; color: var(--muted); }
.ptd-m b { font-size: 14px; }
.ptd-rels { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ptd-rel { background: #eef2f8; border-radius: 8px; padding: 4px 10px; font-size: 12.5px; }
.ptd-meta { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; align-items: center; }
.ptd-k { font-size: 12.5px; color: var(--muted); }
.ptd-v { font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.ptd-v input, .ptd-v select { font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; min-width: 160px; }
.ptd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ptd-f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.ptd-f input, .ptd-f select, .ptd-f textarea { font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.ptd-f-inline { flex-direction: row; align-items: center; gap: 6px; }
.ptd-f-full { grid-column: 1 / -1; }
.ptd-readonly > div { background: var(--bg-soft); border-radius: 8px; padding: 7px 10px;
  display: flex; flex-direction: column; gap: 2px; }
.ptd-readonly span { font-size: 11.5px; color: var(--muted); }
.ptd-lookups { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* --- 开票管理 --- */
.bl-body { display: flex; flex-direction: column; gap: 12px; }
.bl-cards .pt-card b { font-size: 17px; }
.bl-ops { display: flex; gap: 5px; flex-wrap: wrap; }
.bl-form { max-height: 66vh; overflow-y: auto; padding-right: 4px; }
.bl-form label { font-size: 12.5px; }

/* --- 权限管理 --- */
.pm-wrap { display: grid; grid-template-columns: 230px 1fr; gap: 14px; align-items: start; }
.pm-side { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; }
.pm-side-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--muted); padding: 2px 4px 8px; }
.pm-side-h .btn { margin-left: auto; }
.pm-role { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  border: 1px solid transparent; background: none; border-radius: 8px; padding: 8px 10px;
  cursor: pointer; font-size: 13px; color: var(--text); }
.pm-role:hover { background: var(--bg-soft); }
.pm-role.active { background: #e8f0fe; border-color: var(--primary); }
.pm-role .muted { font-size: 11.5px; }
.pm-role-n { font-size: 11px; color: var(--primary); }
.pm-main { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; }
.pm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pm-head h3 { margin: 0; font-size: 15px; }
.pm-fields { display: grid; grid-template-columns: 200px 190px 1fr; gap: 10px; margin-bottom: 10px; }
.pm-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.pm-fields input, .pm-fields select { font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 7px; color: var(--text); }
.pm-tip { background: #fdf3e3; color: #8a6a1c; border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; margin-bottom: 10px; }
.pm-matrix { display: flex; flex-direction: column; gap: 10px; }
.pm-group { border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
.pm-group-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; }
.pm-group-h .muted { font-weight: 400; font-size: 11.5px; }
.pm-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; }
.pm-perm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pm-perm code { font-size: 10.5px; color: var(--muted); background: var(--bg-soft);
  border-radius: 4px; padding: 0 4px; }

/* --- 审批单：fieldList（仿飞书明细表） --- */
.apv-fl-wrap { overflow-x: auto; }
table.apv-fl { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 12.5px; }
table.apv-fl th, table.apv-fl td { border: 1px solid #e3e8f0; padding: 6px 9px;
  text-align: left; white-space: nowrap; }
table.apv-fl thead th { background: #f7f9fc; color: #4a5a72; font-weight: 600; }
table.apv-fl tfoot td { background: #fbfcfe; font-weight: 600; }
table.apv-fl th.num, table.apv-fl td.num { text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.apv-fl-i { width: 40px; text-align: center; color: var(--muted); }
.apv-fl-tlabel { font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* ===========================================================================
 * 批次 E 追加样式：审批附件归档 / 审批详情（账户·附件·评论）/ 应收应付 / 开票识别
 * ======================================================================== */
[hidden] { display: none !important; }

/* ---- 审批附件归档（档案中心 → 📎 审批附件）---- */
.at-wrap { }
.at-tip { margin: 4px 0 14px; font-size: 12.5px; }
.at-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px; }
.at-item { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 13px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  gap: 8px; }
.at-item-h { display: flex; gap: 10px; align-items: center; min-width: 0; }
.at-thumb { width: 44px; height: 44px; border-radius: 8px; background-size: cover;
  background-position: center; border: 1px solid var(--border); flex: none; }
.at-ico { width: 44px; height: 44px; border-radius: 8px; background: var(--bg-soft);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex: none; }
.at-item-t { min-width: 0; }
.at-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-sub { font-size: 12px; margin-top: 2px; }
.at-item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.at-item-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.at-date { font-size: 11.5px; margin-top: auto; }
.tag.t-err { background: #fdecea; color: var(--danger); }

/* ---- 审批详情：账户描述列表 ---- */
.apv-acct { margin: 10px 0; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; }
.apv-acct-t { background: var(--bg-soft); padding: 8px 12px; font-weight: 600;
  font-size: 13px; border-bottom: 1px solid var(--border); }
.apv-acct-body { padding: 4px 12px 10px; }
.apv-acct-k { color: var(--muted); font-size: 12.5px; padding: 6px 0 2px; }
.apv-acct-v { font-size: 13.5px; padding: 0 0 6px; word-break: break-all;
  border-bottom: 1px dashed var(--border); }
.apv-acct-v:last-child { border-bottom: none; }
.apv-code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; }
.apv-ava { width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; flex: none; }

/* ---- 审批详情：附件卡片 ---- */
.apv-att-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.apv-att-tip { font-size: 12px; }
.apv-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px; }
.apv-file { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px; background: var(--panel); }
.apv-file-ico { width: 38px; height: 38px; border-radius: 8px; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.apv-file-thumb { width: 38px; height: 38px; border-radius: 8px; background-size: cover;
  background-position: center; border: 1px solid var(--border); flex: none; }
.apv-file-main { min-width: 0; flex: 1; }
.apv-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.apv-file-sub { font-size: 11.5px; }
.apv-file-acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.apv-file-act { font-size: 12px; }

/* ---- 审批详情：审批流评论 / 附件记录 ---- */
.apv-rec-wrap { margin-top: 8px; }
.apv-rec { border-left: 2px solid var(--border); padding: 2px 0 10px 12px; position: relative; }
.apv-rec:before { content: ""; position: absolute; left: -5px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--primary); }
.apv-rec-node { font-size: 12.5px; color: var(--muted); }
.apv-rec-t { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.apv-rec-user { font-weight: 600; font-size: 13px; }
.apv-rec-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.apv-rec-cmt { background: var(--bg-soft); border-radius: 8px; padding: 8px 10px;
  margin-top: 4px; font-size: 13px; white-space: pre-wrap; }
.apv-rec-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.apv-def-en { color: var(--muted); font-size: 11.5px; }

/* ---- 应收应付 ---- */
.ag-body { }
.ag-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 14px; }
.ag-tbl { width: 100%; min-width: 0; table-layout: auto; }
/* 覆盖 .pt-tbl 的 min-width:1080px + 全列 nowrap，让表格按容器自适应。
   策略：表头与「短列」不换行，避免「费用类 型」「审批 单」这种难看的断行；
   只放开两个长文本列（费用/事由、供应商/客户）让它换行来吸收宽度差。
   配合 .main/.view-container 的 min-width:0，窄屏时滚动条落在 .ag-wrap 内部，
   不会再撑出整页横向滚动。 */
.ag-tbl th { padding: 8px; white-space: nowrap; }
.ag-tbl td { padding: 8px; white-space: nowrap; vertical-align: middle; }
.ag-tbl td.ag-name { white-space: normal; word-break: break-word; min-width: 130px; max-width: 360px; }
.ag-tbl td.ag-vendor { white-space: normal; word-break: break-word; min-width: 100px; max-width: 240px; }
/* 操作列：允许按钮之间换行（.btn 自身 nowrap，按钮文字不会断），
   这样 1 个按钮和 3 个按钮的列宽都是「最宽的那个按钮」，不会把表格撑宽。 */
.ag-tbl td.ag-ops { white-space: normal; }
.ag-wrap { overflow-x: auto; }
.ag-name { font-weight: 600; }
.ag-days { font-variant-numeric: tabular-nums; }
.ag-over { color: var(--danger); font-weight: 600; }
.ag-soon { color: var(--warn); font-weight: 600; }
.ag-unpaid { color: var(--primary); }
.ag-nodue { color: var(--muted); }
.ag-conv { font-size: 12px; }
.ag-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-edit, .ag-del, .ag-settle, .ag-apv { font-size: 12px; }

/* ---- 开票单位粘贴识别 ---- */
.bl-parse { border: 1px solid var(--border); border-radius: 9px; background: var(--bg-soft);
  padding: 8px 11px; margin-bottom: 10px; }
.bl-parse > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.bl-parse-body { margin-top: 8px; }
.bl-parse-body textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; }
.bl-parse-act { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
