:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --muted: #8a94a6;
  --line: #e5e8ef;
  --line-2: #eef1f6;
  --primary: #2563eb;
  --primary-soft: #eaf1ff;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fff5e6;
  --purple: #7c3aed;
  --purple-soft: #f1ebff;
  --teal: #0d9488;
  --brand-red: #8f1d1d;      /* 侧边栏头尾板块底色（深红） */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
a { color: var(--primary); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: 14px; color: var(--ink); }

.layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 218px; flex: 0 0 218px; background: #101828; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
/* 侧边栏头尾两块：深红底 + 白字，格调一致 */
.brand {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 17px 16px;
  background: var(--brand-red); border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.brand-logo:not(.brand-logo-text) {
  width: 36px; height: 36px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; align-items: center; line-height: 1.3; min-width: 0; }
.brand-text strong { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: 1.6px; }
.brand-text span { color: rgba(255, 255, 255, .92); font-size: 13.5px; font-weight: 600; letter-spacing: .6px; }
/* 双公司档案 Tab */
.co-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.co-tab {
  display: flex; flex-direction: column; gap: 2px; padding: 7px 14px; border-radius: 8px;
  cursor: pointer; border: 1px solid var(--line); background: #fff; min-width: 110px;
}
.co-tab:hover { border-color: var(--primary); }
.co-tab.active { background: var(--primary); border-color: var(--primary); }
/* 公司 A 蓝 / 公司 B 紫：去掉「公司 A · 」前缀后靠底色分辨 */
.co-tab-A.active { background: var(--primary); border-color: var(--primary); }
.co-tab-B.active { background: var(--purple); border-color: var(--purple); }
.co-tab.active b, .co-tab.active .co-sub { color: #fff; }
.co-tab b { font-size: 13px; font-weight: 500; }
.co-sub { font-size: 11.5px; color: #64748b; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand-logo-text {
  width: auto; height: 32px; padding: 0 11px; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; letter-spacing: 1.6px; white-space: nowrap;
}
.login-brand .brand-logo-text { height: 40px; font-size: 15px; padding: 0 14px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; background: #101828; }
/* 侧栏滚动区：底色统一黑 + 白色滑块/箭头 */
.nav {
  scrollbar-width: thin;
  scrollbar-color: #ffffff #101828;
}
.nav::-webkit-scrollbar { width: 11px; background: #101828; }
.nav::-webkit-scrollbar-track { background: #101828; border-radius: 6px; }
.nav::-webkit-scrollbar-thumb {
  background: #ffffff; border-radius: 6px; border: 2px solid #101828; min-height: 28px;
}
.nav::-webkit-scrollbar-thumb:hover { background: #e2e8f0; }
.nav::-webkit-scrollbar-thumb:active { background: #cbd5e1; }
.nav::-webkit-scrollbar-corner { background: #101828; }
.nav::-webkit-scrollbar-button { display: block; height: 0; width: 0; }
.nav::-webkit-scrollbar-button:single-button {
  display: block; height: 14px; width: 11px; background-color: #101828;
  background-repeat: no-repeat; background-position: center center;
}
.nav::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 5.2l4-4 4 4' fill='none' stroke='%23ffffff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.nav::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1.8l4 4 4-4' fill='none' stroke='%23ffffff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.nav::-webkit-scrollbar-button:single-button:hover { background-color: #1c2739; }
.nav::-webkit-scrollbar-button:single-button:active { background-color: #263349; }
.nav-group { font-size: 11px; color: #64748b; padding: 12px 10px 6px; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; color: #cbd5e1; font-size: 13.5px; margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: #1c2739; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { width: 17px; text-align: center; opacity: .9; }
/* 板块权限：锁定 = 灰度 + 锁图标；只读 = 右上角小标记（可进入，但不能新增修改） */
.nav-item.nav-lock { color: #64748b; opacity: .55; cursor: not-allowed; }
.nav-item.nav-lock:hover { background: transparent; color: #64748b; }
.nav-item.nav-lock .ico { opacity: .5; }
.nav-lock-ico { margin-left: auto; font-size: 11px; opacity: .85; }
.nav-read-tag {
  margin-left: auto; font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(148, 163, 184, .18); color: #94a3b8; letter-spacing: .02em;
}
.nav-item.nav-read.active .nav-read-tag { background: rgba(255, 255, 255, .22); color: #fff; }
.sidebar-foot {
  padding: 12px 16px; background: var(--brand-red); text-align: center;
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.sidebar-foot .tip { font-size: 11.5px; line-height: 1.4; color: rgba(255, 255, 255, .88); margin-bottom: 3px; }
.sidebar-foot .app-ver {
  font-family: ui-monospace, Consolas, monospace; color: #fff; font-weight: 700;
  letter-spacing: .4px; margin-bottom: 8px;
}
.sidebar-foot .btn-foot {
  width: 100%; color: #fff; border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .10); font-weight: 600;
  justify-content: center; text-align: center;   /* 按钮文字左右居中 */
}
.sidebar-foot .btn-foot:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- 主区 ---------- */
/* 白底加高至顶：主区整体白底，公告栏浮起叠在上面，不遮挡正文 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 22px; background: var(--panel);
  box-shadow: 0 1px 0 var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title h1 { font-size: 19px; }
.topbar-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { padding: 18px 22px 40px; flex: 1; }

/* ---------- 顶部公告栏（所有页面置顶，浅色浮起条幅 + 横向滚动） ---------- */
.announce-bar {
  display: flex; align-items: center; gap: 10px;
  height: 34px; margin: 10px 18px 0; padding: 0 12px;
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(90deg, #fff2f2 0%, #fffafa 45%, #fff2f2 100%);
  border: 1px solid #f8d9d9; border-radius: 10px; color: var(--red); font-size: 13px;
  box-shadow: 0 6px 16px rgba(16, 24, 40, .12), 0 1px 2px rgba(16, 24, 40, .05);
  overflow: hidden;
}
.announce-bar[hidden] { display: none; }
.ann-badge {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 650; letter-spacing: .08em;
  background: var(--red); color: #fff; border-radius: 999px; padding: 2px 9px;
  box-shadow: 0 2px 6px rgba(220, 38, 38, .35);
}
.ann-window {
  flex: 1; min-width: 0; height: 100%; overflow: hidden;
  display: flex; align-items: center;
}
.ann-item {
  display: inline-flex; white-space: nowrap; transition: opacity .3s;
  will-change: transform; color: var(--red); font-weight: 500;
}
.ann-run { padding-right: 72px; }
.ann-item.ann-anim {
  animation-name: ann-scroll; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes ann-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ann-window:hover .ann-item.ann-anim { animation-play-state: paused; }
.main.has-announce .topbar { top: 34px; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink-2); padding: 7px 13px; border-radius: 8px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9d2e0; background: #fafbfe; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4fd8; border-color: #1d4fd8; }
.btn-import { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-import:hover { background: #0b7f75; border-color: #0b7f75; }
.btn-danger { color: var(--red); border-color: #f3c9c9; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-bold { font-weight: 700; letter-spacing: .2px; }
.row-actions .btn-bold { color: var(--ink); border-color: #c3cbda; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.panel-head h3 { font-size: 15px; }
.panel-head .sub { font-size: 12px; color: var(--muted); }
.panel-body { padding: 14px 16px; }
.panel-body.flush { padding: 0; }

.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: #fcfdff;
}
.toolbar .grow { flex: 1; }
.toolbar .panel-title { font-size: 13px; font-weight: 600; margin-right: 2px; }
.toolbar .checkline { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.toolbar .checkline input { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.input, .select, textarea.input {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff;
  outline: none; min-width: 0; transition: .15s;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input[type="number"] { text-align: right; }
.select { min-width: 110px; }
textarea.input { resize: vertical; min-height: 62px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.grid th {
  text-align: left; font-weight: 600; color: var(--ink-2); background: #fafbfd;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 1; font-size: 12.5px;
}
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--primary); }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tbody tr:hover { background: #fafcff; }
/* 新建 / 编辑后自动定位到该记录：跳到它所在的分页并高亮提示 */
table.grid tbody tr.row-focus td { animation: rowFocusFade 2.6s ease-out; }
@keyframes rowFocusFade {
  0%   { background: rgba(37, 99, 235, .26); }
  70%  { background: rgba(37, 99, 235, .14); }
  100% { background: transparent; }
}
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.empty { padding: 42px 12px; text-align: center; color: var(--muted); }
.empty .big { font-size: 15px; margin-bottom: 6px; color: var(--ink-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: var(--primary); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-gray { background: #f1f3f7; color: #6b7280; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- 统计卡 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; box-shadow: var(--shadow);
}
.card .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 22px; font-weight: 680; margin-top: 6px; letter-spacing: -.02em; }
.card .foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.card.accent-blue { border-left: 3px solid var(--primary); }
.card.accent-green { border-left: 3px solid var(--green); }
.card.accent-amber { border-left: 3px solid var(--amber); }
.card.accent-purple { border-left: 3px solid var(--purple); }
.card.accent-red { border-left: 3px solid var(--red); }
.card.accent-teal { border-left: 3px solid var(--teal); }

.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 数据看板：竖向板块 ---------- */
/* KPI 卡片区不是 .panel，.panel + .panel 兜不到它 → 单独补间距，让整列间距一致 */
.dash-cards { margin-bottom: 18px; }
#dashBody .panel + .panel { margin-top: 18px; }
/* 趋势图为定高，不随内容伸缩；横向铺满会显得空，限个宽度居中偏左 */
.dash-trend { max-width: 880px; }
.dash-trend .bars { height: 200px; }
/* 列表类板块高度由单据行数算好写在 inline max-height 上，超出才滚动（表头已全局吸顶） */
.dash-list { overflow: auto; }

/* ---------- 图表 ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 6px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { display: flex; align-items: flex-end; gap: 3px; height: 150px; width: 100%; justify-content: center; overflow: hidden; }
.bar { width: 16px; border-radius: 3px 3px 0 0; background: var(--primary); min-height: 2px; max-height: 100%; }
.bar.b2 { background: #93b4f8; }
.bar.b3 { background: var(--teal); }
.bar.b4 { background: var(--amber); }
.bar-label { font-size: 11.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ---------- 弹窗 ---------- */
/* 说明：登录遮罩 z-index 为 9999，弹窗与 Toast 必须高于它，否则登录页上弹出的滑块验证会被遮住 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 10050;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--panel); border-radius: 12px; width: 100%; max-width: 640px;
  box-shadow: 0 20px 48px rgba(16, 24, 40, .22); animation: pop .14s ease-out;
}
.modal.wide { max-width: 940px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 16px 18px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line-2); background: #fcfdff; border-radius: 0 0 12px 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: span 1; } }

/* 明细行编辑：列宽交给 core.js 的 colgroup 统一声明，这里只管布局与对齐 */
.lines-scroll { overflow-x: auto; }
/* 只读面板（生产用料、导入预览等）也复用 .lines-table，但它们没有 colgroup，
   固定布局会把列压成等宽，所以只对带 colgroup 的可编辑表启用 */
.lines-table.lines-edit { table-layout: fixed; }
.lines-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lines-table th { text-align: left; font-size: 12px; color: var(--ink-2); padding: 6px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lines-table th.num, .lines-table td.num { text-align: right; }
.lines-table td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.lines-table input, .lines-table select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; }
.lines-table input:focus { border-color: var(--primary); outline: none; }
.lines-table td.num input, .lines-table td input[type="number"] { text-align: right; }
/* 派生的金额 / 库存用等宽数字，位数变化时这一列不会左右跳 */
.lines-table td.num { font-variant-numeric: tabular-nums; }
.lines-table td.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lines-sum { display: flex; justify-content: flex-end; gap: 18px; padding: 10px 6px 0; font-size: 13px; }

/* ---------- 提示 ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 10100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 220px;
  animation: slide .18s ease-out; font-size: 13px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slide { from { transform: translateX(14px); opacity: 0; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--ink-2); font-size: 13.5px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
/* 公司切换 Tab：选中态用各自公司色（A 蓝 / B 紫），与列表里的公司标签同色 */
.tab-co-A.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-co-B.active { color: var(--purple); border-bottom-color: var(--purple); }

.hint { background: var(--primary-soft); border: 1px solid #d5e4ff; color: #1e40af; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- 用户资料卡 / API 密钥 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; }
.card-grid .field { margin-bottom: 0; }
.card-grid .field > label { margin-bottom: 2px; }
.card-grid .field > div { min-height: 24px; font-size: 13.5px; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line-2); font-size: 14px; font-weight: 650; }
.sec-title .grow { flex: 1; }
.code-box { background: #0f172a; color: #d7e3ff; padding: 11px 13px; border-radius: 8px; font-size: 12.5px; line-height: 1.7; overflow-x: auto; font-family: ui-monospace, Consolas, Menlo, monospace; }
.key-line { display: flex; align-items: center; gap: 8px; background: #f4f7ff; border: 1px dashed #b9cdf7; border-radius: 8px; padding: 9px 11px; }
.key-line code { flex: 1; font-size: 13px; word-break: break-all; color: #16337a; }
.warn-box { background: #fff7e6; border: 1px solid #f5d493; color: #8a5a00; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; }

/* ---------- 打印（默认 A4；标签另有专属纸张尺寸） ---------- */
@media print {
  /* 下边距加大，给落款处 40mm 公章留出盖章空间（详见 .doc-stamp 注释）
     注意：这里千万别写 @page{size:A4}——只要 @page 里出现写死的纸张尺寸，
     Chrome 打印面板就会锁死「纸张尺寸」并**隐藏「布局（竖向 / 横向）」下拉**。
     size:auto = 交给浏览器面板里的原生选项（单据 / 表单打印的 CSS 同理） */
  @page { size: auto; margin: 14mm 12mm 22mm; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .doc { width: auto; min-height: 0; padding: 0; margin: 0; }
  .doc table tr, .doc .sign, .doc .box { page-break-inside: avoid; break-inside: avoid; }
}
/* 预览容器的留白与 @page 边距保持一致；高度锁定一张 A4（含 padding），所见即所得 */
.doc { width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; padding: 13mm 13mm 21mm; color: #111; font-size: 12px; }
.doc h1 { font-size: 20px; letter-spacing: .08em; text-align: center; }
/* 表头公司信息 与 正文之间留白 */
.doc h2 { font-size: 15px; text-align: center; margin: 4mm 0 10mm; letter-spacing: .1em; }
.doc .meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 8mm; }
.doc .box { border: 1px solid #333; padding: 8px 10px; flex: 1; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc table th, .doc table td { border: 1px solid #444; padding: 5px 7px; }
.doc table th { background: #f2f2f2; }
/* 签证 / 盖章 与正文之间留白（需容纳上方 40mm 公章的顶部）；左端再缩进一档，不与正文顶格对齐 */
.doc .sign { display: flex; justify-content: space-between; margin-top: 32mm; padding-left: 10mm; font-size: 12px; }
/* 落款盖章：印章图片叠在签名线 / 公司名上 */
.doc .sign-side { flex: 1 1 0; min-width: 0; }
.doc .sign-side + .sign-side { margin-left: 14mm; }
/* 标题 → 签名线：留 16mm，使 40mm 公章顶部落在标题下方而不压到文字 */
.doc .sign-mark { position: relative; display: inline-block; margin-top: 16mm; }
.doc .sign-line { line-height: 1.4; }
/* 公司公章标准外径 40mm（有限责任公司通用规格）；
   中心压在签名线略下方并覆盖公司名，向下溢出约 16mm，由 @page 下边距 22mm 兜住 */
.doc .doc-stamp {
  position: absolute; left: 50%; top: -14mm; transform: translateX(-50%);
  width: 40mm; height: 40mm; object-fit: contain; max-width: none;
  opacity: .92; pointer-events: none;
}
.doc .foot-note { margin-top: 6mm; font-size: 11px; color: #444; }
.doc .right { text-align: right; }
.doc .center { text-align: center; }

/* ---------- 出货标签（热敏打印纸） ---------- */
.label-doc { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.label-sheet { background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.lb { box-sizing: border-box; background: #fff; color: #000; overflow: hidden; }
/* 外箱标签 100×100mm：四周留白 + 内容在中部紧凑聚拢 */
.lb-outer {
  width: 100mm; height: 100mm; padding: 7mm 6mm; border: 1px dashed #98a2b3;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 11px; line-height: 1.25;
}
.lb-outer .lb-co { font-size: 15px; font-weight: 700; text-align: center; letter-spacing: .04em; padding-bottom: 2mm; border-bottom: 1px solid #111; }
/* 中间正文块：占满剩余空间并在其中居中，行间紧凑 */
.lb-mid { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.lb-ctn { text-align: right; font-weight: 700; font-size: 12px; min-height: 4mm; margin: 2mm 0 1.5mm; }
.lb-row { display: flex; gap: 4mm; align-items: flex-start; margin-bottom: 1.3mm; }
.lb-k { flex: 0 0 24mm; color: #333; font-size: 10px; }
.lb-v { flex: 1; font-weight: 600; font-size: 12px; word-break: break-word; }
.lb-grow { flex: 0 0 auto; }
.lb-made { text-align: center; font-weight: 800; font-size: 14px; letter-spacing: .14em; border-top: 1px solid #111; padding-top: 2mm; }
/* 内标签 20×70mm：分行排版 —— 公司简称（粗体居中，与下留白）/ 产品 / 数量（左对齐常规字重） */
.lb-inner {
  display: flex; flex-direction: column; justify-content: flex-start;
  align-items: stretch; border: 1px dashed #98a2b3;
}
.lb-inner.p { width: 20mm; height: 70mm; padding: 2.5mm 1.5mm; }
.lb-inner.l { width: 70mm; height: 20mm; padding: 2mm 3mm; }
.lb-inner > div { min-width: 0; }
/* 顶部公司简称：粗体、居中，与下一行留白 */
.lb-inner .lb-co {
  width: 100%; text-align: center; font-weight: 700; font-size: 8.5px;
  line-height: 1.2; margin-bottom: 2.2mm;
  overflow-wrap: anywhere; word-break: break-word;
}
/* 产品 / 数量：左对齐、常规字重，写不下自动分行 */
.lb-inner .lb-item,
.lb-inner .lb-qty {
  width: 100%; text-align: left; font-weight: 400; line-height: 1.25;
  overflow-wrap: anywhere; word-break: break-word;
}
.lb-inner .lb-item { font-size: 8px; margin-bottom: .8mm; }
.lb-inner .lb-qty { font-size: 8px; }
.prev-view.labels { background: #e8ecf3; }
.prev-view.labels .label-doc { gap: 10px; }

.pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; padding: 10px 14px; font-size: 12.5px; color: var(--ink-2); }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 10px; cursor: pointer; min-width: 30px; }
.pager button:disabled { opacity: .5; cursor: not-allowed; }
/* 选中的行（项目管理上／下联动高亮） */
.grid tr.row-sel > td { background: #eaf3fd; }
.grid tr.row-sel:hover > td { background: #e2eefc; }

/* ---------- 登录 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2f9 0%, #e9eef8 45%, #f5f7fb 100%);
}
.login-shell { position: relative; display: flex; align-items: center; justify-content: center; padding: 0; }
.login-card {
  position: absolute; right: 26px; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 392px; max-height: calc(100% - 48px);
  background: #fff; border: 1px solid rgba(255, 255, 255, .9); border-radius: 14px;
  padding: 30px 30px 24px; overflow-y: auto;
  /* 浮高：多层阴影营造悬浮感 */
  box-shadow: 0 26px 60px rgba(15, 23, 42, .26), 0 8px 20px rgba(15, 23, 42, .12), 0 1px 3px rgba(15, 23, 42, .08);
  display: flex; flex-direction: column;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
/* 登录卡里的 LOTUS：蓝色底、白色字，文字上下左右居中（用 grid 居中，避免只靠 height 顶到上方） */
.login-brand .brand-logo:not(.brand-logo-text) { width: 40px; height: 40px; }
/* 正方形蓝底块：外框严格等宽等高（44×44），字横向压缩后居中放进框内 */
.login-brand .brand-logo-text {
  position: relative;
  width: 44px; min-width: 44px; height: 44px; padding: 0;
  border-radius: 10px; background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: .5px; line-height: 1;
  overflow: hidden; box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}
/* 文字按「自身尺寸」做居中（left/top 50% + 反向位移），
   不用 grid place-items：文字未缩放时比 44px 框宽，溢出后浏览器会改为起始边对齐，
   再叠加 scaleX 收缩就会整体偏向一边。反向位移 + 缩放都以自身中心为基准，左右必然对称。
   +.19px 用于抵消 letter-spacing 在最后一个字母后多出的空隙（0.5px 字距压缩后为 0.375px，取一半）。 */
.login-brand .brand-logo-text > span {
  position: absolute; left: 50%; top: 50%;
  transform: translate(calc(-50% + .19px), -50%) scaleX(.75);
  transform-origin: center;
  white-space: nowrap;
}
/* 表单区与「品牌区 / 底部说明」之间留出足够间距 */
.login-form { flex: 1; padding: 4px 0 6px; }
.login-form .field + .field { margin-top: 18px; }
.login-go {
  width: 100%; margin-top: 24px; height: 44px; font-size: 15.5px; font-weight: 650;
  letter-spacing: .18em; display: inline-flex; align-items: center; justify-content: center;
  /* 补偿字距导致的最后一个字后多出的空白，使文字真正视觉居中 */
  padding-left: calc(13px + .18em); text-align: center;
  border-radius: 10px; box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}
.login-go:hover { box-shadow: 0 6px 16px rgba(37, 99, 235, .34); }
.login-go:active { transform: translateY(1px); }
.login-note { font-size: 11.5px; margin-top: 24px; text-align: center; }
.login-ver { font-size: 11px; margin-top: 8px; text-align: center; font-family: ui-monospace, Consolas, monospace; opacity: .75; }

/* ---------- 登录滑块拼图验证 ---------- */
.cap-wrap { width: 300px; margin: 0 auto; }
.cap-stage { position: relative; border-radius: 8px; overflow: hidden; background: #eef2f7; }
.cap-stage canvas { display: block; }
.cap-piece { position: absolute; left: 0; top: 0; box-shadow: 0 2px 10px rgba(15, 23, 42, .35); }
.cap-track {
  position: relative; height: 40px; margin-top: 12px; border-radius: 20px;
  background: #eef1f6; border: 1px solid var(--line); overflow: visible;
}
.cap-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 20px; background: var(--primary-soft); }
.cap-knob {
  position: absolute; top: -1px; left: 0; width: 42px; height: 42px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line); display: grid; place-items: center;
  cursor: grab; color: var(--ink-2); font-size: 15px; user-select: none;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
}
.cap-knob.dragging { cursor: grabbing; border-color: var(--primary); color: var(--primary); }
.cap-tip { margin-top: 10px; font-size: 12.5px; text-align: center; color: var(--muted); }
.cap-tip.ok { color: var(--green); font-weight: 600; }
.cap-tip.err { color: var(--red); font-weight: 600; }
.cap-refresh { margin-top: 6px; font-size: 12px; text-align: center; cursor: pointer; }
.cap-refresh:hover { color: var(--primary); }
.login-tabs .ltab { padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; }
.login-tabs .ltab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.login-tabs .ltab.disabled { opacity: .45; cursor: not-allowed; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.login-hint { margin-top: 8px; font-size: 12px; color: var(--ink-2); background: #f7f9fc; border: 1px dashed var(--line); border-radius: 8px; padding: 7px 10px; text-align: center; }

/* 登录页左侧欢迎词板块 */
.login-hero {
  position: relative; width: 1176px; height: 520px; flex: 0 0 auto; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); background: #f2eee6; box-shadow: 0 10px 34px rgba(15, 23, 42, .09);
}
.login-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* 诗文区域限制在左侧 2 倍宽（图片总宽 3 倍，登录卡占右侧 1 倍）内 */
.login-hero-text {
  position: absolute; left: 0; bottom: 0; width: 66.667%; padding: 34px 0 30px;
  background: linear-gradient(to top, rgba(247, 244, 238, .97) 0%, rgba(247, 244, 238, .88) 42%, rgba(247, 244, 238, .30) 78%, rgba(247, 244, 238, 0) 100%);
}
/* 诗文字块在左侧 2 倍宽区域内居中，宽度取该区域的 60%（视觉宽度与原 784px 图一致） */
.login-quote {
  width: 60%; max-width: 470px; margin: 0 auto;
  font-family: "KaiTi", "STKaiti", "Kaiti SC", "Songti SC", serif;
  font-size: 25px; line-height: 1.62; letter-spacing: .06em; color: #16233a;
  text-align: center;
}
.login-quote-by {
  width: 60%; max-width: 470px; margin: 18px auto 0;
  font-size: 12.5px; color: #5b6a80; letter-spacing: .06em; text-align: center;
}

@media (max-width: 1300px) {
  .login-hero { width: 900px; height: 470px; }
  .login-card { right: 20px; width: 360px; padding: 26px 26px 20px; max-height: calc(100% - 40px); }
  .login-hero-text { padding: 28px 0 26px; }
  .login-quote { font-size: 22px; max-width: 400px; }
  .login-quote-by { max-width: 400px; }
}
@media (max-width: 980px) {
  .login-shell { flex-direction: column; align-items: center; gap: 0; }
  .login-hero { width: 392px; height: 172px; flex: 0 0 auto; border-radius: 16px 16px 0 0; }
  .login-hero-text { width: 100%; }
  .login-quote { font-size: 19px; max-width: 78%; }
  .login-quote-by { max-width: 78%; }
  .login-card {
    position: relative; right: auto; top: auto; transform: none;
    width: 392px; max-height: 74vh; border-radius: 0 0 16px 16px; margin-top: -1px;
  }
}

/* ---------- 账号条 ---------- */
.user-bar { display: flex; align-items: center; gap: 8px; margin-right: 6px; padding-right: 10px; border-right: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 6px; border-radius: 8px; }
.user-chip:hover { background: var(--bg); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.user-chip .u-info { display: flex; flex-direction: column; line-height: 1.25; font-size: 12.5px; }

/* ---------- 往来单位 360 档案 ---------- */
.party-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.party-due { text-align: right; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.stat-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--line-2); }

/* 交易分析里的联系人 / 地址簿 / 附件三栏 */
.party-detail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (max-width: 900px) { .party-detail { grid-template-columns: 1fr; } }
.pd-col { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--line-2); }
.pd-t { font-size: 12px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.pd-item { font-size: 12.5px; line-height: 1.5; padding: 3px 0; border-top: 1px dashed var(--line); }
.pd-item:first-of-type { border-top: 0; }
.att-link { color: var(--primary); text-decoration: none; }
.att-link:hover { text-decoration: underline; }

/* 档案编辑：多联系人 / 地址簿 */
.ct-row { display: grid; grid-template-columns: 110px 130px minmax(120px, 1fr) 100px minmax(100px, 1fr) 60px 56px; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 900px) { .ct-row { grid-template-columns: 1fr 1fr; } }
.ct-main { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.ad-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--line-2); }
.ad-row .input, .ad-row .select { margin-bottom: 6px; }
.ad-line1 { display: grid; grid-template-columns: 170px minmax(120px, 1fr) 80px 62px; gap: 6px; align-items: center; margin-bottom: 6px; }
.ad-line3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 900px) { .ad-line1 { grid-template-columns: 1fr 1fr; } .ad-line3 { grid-template-columns: 1fr; } }
.ad-en { display: flex; align-items: center; gap: 4px; font-size: 12.5px; white-space: nowrap; }
.ad-hist { margin-top: 4px; font-size: 11.5px; color: var(--ink-2); line-height: 1.6; border-top: 1px dashed var(--line); padding-top: 4px; }

/* ---------- 单证预览 ---------- */
.prev-layout { display: flex; gap: 14px; align-items: flex-start; }
.prev-form { width: 300px; flex: 0 0 300px; max-height: 62vh; overflow: auto; padding-right: 6px; }
.prev-view { flex: 1; max-height: 62vh; overflow: auto; background: #f2f4f8; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.prev-view .doc { width: auto; min-width: 640px; transform: scale(.86); transform-origin: top left; margin-bottom: -12%; }
@media (max-width: 1000px) { .prev-layout { flex-direction: column; } .prev-form { width: 100%; flex: none; } }
.prev-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.prev-group-t { font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; }
.prev-group .field { margin-bottom: 8px; }
.prev-group .field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.warn-box { margin-top: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; }

/* ---------- 公司 Logo ---------- */
.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.logo-box { width: 92px; height: 92px; flex: 0 0 92px; border: 1px dashed var(--line); border-radius: 10px; background: var(--line-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-ph { color: var(--muted); font-size: 12px; }
/* 公司 Logo 与印章（系统设置 → 公司信息，合并为一个板块） */
.media-sec { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--line-2); }
.media-sec-t { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.media-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .media-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.media-cell { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.media-t { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.media-box { background: #fff; }
.media-ops { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.media-note { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.35; }

/* ---------- 公司信息：分区分色（不同底色区分各板块） ---------- */
.co-sec {
  margin-bottom: 14px; border: 1px solid var(--cs-bd, var(--line));
  border-radius: 10px; background: #fff; overflow: hidden;
}
.co-sec-h {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  background: var(--cs-bg, var(--line-2)); border-bottom: 1px solid var(--cs-bd, var(--line));
  color: var(--cs-fg, var(--ink)); font-size: 13px; font-weight: 650; letter-spacing: .3px;
}
.co-sec-n {
  flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--cs-fg, var(--ink));
  color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
}
.co-sec-x { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.co-sec-b { padding: 12px 14px; }
.co-sec:last-child { margin-bottom: 0; }
.cs-media  { --cs-bg: #f1f5f9; --cs-bd: #cbd5e1; --cs-fg: #334155; }
.cs-base   { --cs-bg: #eff6ff; --cs-bd: #bfdbfe; --cs-fg: #1d4ed8; }
.cs-bank   { --cs-bg: #fffbeb; --cs-bd: #fde68a; --cs-fg: #b45309; }
.cs-cert   { --cs-bg: #f0fdf4; --cs-bd: #bbf7d0; --cs-fg: #15803d; }
.cs-attach { --cs-bg: #f5f3ff; --cs-bd: #ddd6fe; --cs-fg: #6d28d9; }
/* 分区内的小表格（银行账号 / 认证证书） */
.co-mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.co-mini th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.co-mini td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.co-mini input, .co-mini select {
  width: 100%; min-width: 64px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 12.5px;
}
.co-mini input:focus, .co-mini select:focus { border-color: var(--primary); outline: none; }
.co-mini td.co-mini-ops { white-space: nowrap; }
.co-empty { padding: 12px 4px; color: var(--muted); font-size: 12.5px; }
.co-file { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.co-file-name { font-size: 12px; color: var(--ink-2); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; }
.doc-logo { max-height: 56px; max-width: 130px; object-fit: contain; }

/* ---------- 单证抬头（含 Logo） ---------- */
.doc .doc-head { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8mm; }
.doc .doc-head-t { text-align: left; }
.doc .doc-head h1 { text-align: left; margin: 0 0 2px; }
.doc .doc-noline { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6mm; }

/* ---------- 单据附件（客户原单据） ---------- */
.att-drop {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--line-2); transition: background .15s, border-color .15s;
}
.att-drop.over { background: var(--primary-soft); border-color: var(--primary); }
.att-prog { min-height: 20px; margin-top: 8px; font-size: 12.5px; color: var(--primary); }
.att-list { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.att-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.att-thumb {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--line-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb span { font-size: 10.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .04em; }
.att-main { flex: 1; min-width: 0; cursor: pointer; }
.att-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name:hover { color: var(--primary); }
.att-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.att-prev {
  background: var(--line-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; text-align: center; max-height: 66vh; overflow: auto;
}
.att-prev img { max-width: 100%; max-height: 60vh; object-fit: contain; background: #fff; }
.att-prev iframe { width: 100%; height: 62vh; border: 0; background: #fff; }
.att-prev-other { padding: 40px 10px; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- 粘贴识别（客户 / 供应商新建·编辑表单） ---------- */
.paste-box {
  border: 1px dashed #b9cdf5; background: var(--primary-soft); border-radius: 8px;
  padding: 9px 11px 10px; margin-bottom: 2px;
}
.paste-box .pb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.paste-box .pb-head > b { font-size: 13px; color: #1e40af; }
.paste-box .pb-head > .muted { font-size: 12px; flex: 1; min-width: 0; }
.paste-box .pb-body { margin-top: 8px; }
.paste-box .pb-folded { display: none; }
.paste-box textarea {
  width: 100%; resize: vertical; min-height: 62px; background: #fff;
  font-size: 12.5px; line-height: 1.5;
}
.paste-box .pb-acts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.paste-box .pb-acts [data-sum] { font-size: 12px; }
.paste-box .pb-hits { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.paste-box .pb-hits .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 同名预警 / 重复确认弹窗（客户 / 供应商建档） ---------- */
.paste-box .pb-dup {
  margin-top: 7px; padding: 7px 9px; border-radius: 8px; line-height: 1.6;
  border: 1px solid #f3d19a; background: #fff8ec; color: #8a5a00; font-size: 12.2px;
}
.paste-box .pb-dup b { color: #b45309; }
.dup-tip {
  font-size: 13px; line-height: 1.7; color: #8a5a00; margin-bottom: 10px;
  border: 1px solid #f3d19a; background: #fff8ec; border-radius: 8px; padding: 8px 10px;
}
.dup-tip + table.grid th { white-space: nowrap; }

/* ---------- 导入建单：解析预览弹窗 ---------- */
.imp-head { font-size: 13px; line-height: 1.7; margin-bottom: 12px; }
.imp-warn {
  margin-top: 7px; padding: 7px 9px; border-radius: 8px; line-height: 1.7;
  border: 1px solid #f3d19a; background: #fff8ec; color: #8a5a00; font-size: 12.2px;
}
.imp-sec { margin-top: 14px; }
.imp-sec-t { font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.imp-party {
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 12.8px; line-height: 1.9;
}
.imp-p-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.imp-k { color: var(--muted); min-width: 40px; }
.imp-cb { display: inline-flex; align-items: center; gap: 4px; font-size: 12.3px; cursor: pointer; }
.imp-cb input { margin: 0; cursor: pointer; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.imp-table th, .imp-table td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; vertical-align: top; }
.imp-table th { background: var(--soft, #f6f7f9); font-weight: 600; white-space: nowrap; }
.imp-table td.num, .imp-table th.num { text-align: right; white-space: nowrap; }
.imp-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, .02); }

/* ---------- 表单顶部「粘贴 / 上传识别」通用块 ---------- */
.paste-box .pb-foot { margin-top: 6px; font-size: 12.3px; line-height: 1.6; }
.imp-tabs { display: flex; gap: 6px; margin: 8px 0 2px; }
.imp-tab {
  padding: 3px 11px; font-size: 12.5px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.imp-tab:hover { border-color: #c9d2e0; }
.imp-tab.on { background: var(--primary-soft); border-color: #b9cdfb; color: #1d4fd8; font-weight: 600; }
.imp-drop {
  border: 1.5px dashed #c9d2e0; border-radius: 9px; padding: 14px 12px; text-align: center;
  background: #fbfcfe; font-size: 12.8px; line-height: 1.9; color: var(--ink-2); cursor: pointer;
}
.imp-drop:hover, .imp-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.imp-list { margin-top: 9px; }
.imp-list .imp-sec-t { margin-bottom: 6px; }
/* 清空按钮：公共区，粘贴 / 上传两个页签共用 */
.imp-clear { border-top: 1px dashed var(--line, #e3e8f0); padding-top: 8px; }

/* ---------- 权限矩阵编辑（角色 / 个人例外共用） ---------- */
.pe-wrap { max-height: 58vh; overflow: auto; }
.pe-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line, #e3e8f0);
}
.pe-bar .grow { flex: 1; }
.pe-group {
  margin: 12px 0 5px; font-weight: 600; font-size: 12.5px; color: #334155;
  border-bottom: 1px solid #e5e9f0; padding-bottom: 4px;
}
.pe-row {
  display: grid; grid-template-columns: 210px 240px 1fr; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px; border-left: 2px solid transparent;
}
.pe-row:hover { background: #f8fafc; }
.pe-row.is-exc { font-weight: 500; }
.pe-row.exc-loose { background: #EAF3DE; border-left-color: #639922; }
.pe-row.exc-loose .pe-chg { color: #27500A; font-weight: 600; }
.pe-row.exc-tight { background: #FCEBEB; border-left-color: #A32D2D; }
.pe-row.exc-tight .pe-chg { color: #501313; font-weight: 600; }
.pe-name { font-size: 13px; }
.pe-guard {
  margin-left: 6px; font-size: 10.5px; color: #A32D2D; background: #FCEBEB;
  padding: 1px 5px; border-radius: 4px; font-weight: 400;
}
.pe-chg { font-size: 11.5px; color: var(--ink-2, #64748b); }
.pe-ctl { display: flex; gap: 5px; align-items: center; }
.pe-pill {
  padding: 3px 10px; border-radius: 6px; border: 1px solid #d5dae3; background: #fff;
  color: #5f6b7a; font-size: 12px; cursor: pointer; user-select: none;
}
.pe-pill:hover { border-color: #a9b6cb; }
.pe-pill.on { background: #185FA5; border-color: #185FA5; color: #fff; font-weight: 600; }
.pe-pill.lk.on { background: #94a3b8; border-color: #94a3b8; }
.pe-pill[data-na] { opacity: .38; cursor: not-allowed; }
.pe-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; }
.pe-in { padding: 3px 6px; font-size: 12.5px; max-width: 190px; }
.pe-cos { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pe-row.hidden-row { display: none; }
.exc-demo-loose { color: #27500A; background: #EAF3DE; padding: 0 5px; border-radius: 4px; }
.exc-demo-tight { color: #501313; background: #FCEBEB; padding: 0 5px; border-radius: 4px; }

/* ---------- 角色权限卡片 ---------- */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.role-card {
  border: 1px solid var(--line, #e3e8f0); border-radius: 10px; padding: 12px 14px;
  background: #fff; display: flex; flex-direction: column; gap: 7px;
}
.role-card:hover { border-color: #c9d2e0; box-shadow: 0 1px 6px rgba(15, 23, 42, .06); }
.rc-head { display: flex; align-items: center; gap: 7px; font-size: 14.5px; }
.rc-head .muted { font-size: 11.5px; margin-left: auto; }
.rc-desc { font-size: 12.3px; color: var(--ink-2, #64748b); line-height: 1.6; min-height: 34px; }
.rc-sum { font-size: 12.2px; color: #334155; display: flex; flex-direction: column; gap: 3px; }
.rc-sum .rc-k { display: inline-block; width: 34px; color: var(--ink-2, #64748b); }
.rc-acts { display: flex; gap: 6px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line, #e3e8f0); }

/* ---------- 打印预览窗：A4 内容放在灰底上居中过目 ---------- */
.pf-prev { background: #e9edf2; border-radius: 8px; padding: 14px; max-height: 68vh; overflow: auto; }
.pf-prev-fr { display: block; width: 100%; height: 64vh; border: 0; background: #fff; box-shadow: 0 2px 12px rgba(15, 23, 42, .18); }

/* ---------- 表单弹窗功能块分组：小标题 + 浅色底区分 ---------- */
.form-sec { border: 1px solid var(--line, #e3e8f0); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.form-sec .form-grid { padding: 12px 14px 4px; }
.form-sec-t { padding: 7px 14px; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.sec-blue   { background: #f6f9fe; } .sec-blue   > .form-sec-t { background: #e7f0fc; color: #2456a6; }
.sec-green  { background: #f5fbf6; } .sec-green  > .form-sec-t { background: #e2f4e6; color: #1f7a37; }
.sec-amber  { background: #fdfaf3; } .sec-amber  > .form-sec-t { background: #f9efdb; color: #8a6116; }
.sec-purple { background: #faf9fe; } .sec-purple > .form-sec-t { background: #efe9fa; color: #5b3d99; }
.sec-gray   { background: #f7f8fa; } .sec-gray   > .form-sec-t { background: #eceef2; color: #475569; }

/* ---------- 公司下拉行（代付款公司 / 货代公司）：多行、可增删 ---------- */
.co-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 6px; align-items: center; margin-bottom: 6px; }
.co-new { display: grid; grid-template-columns: minmax(160px, 1.6fr) 120px 110px 130px minmax(120px, 1fr); gap: 6px; align-items: center;
  margin: 2px 0 8px; padding: 8px 10px; border: 1px dashed var(--brand, #2f6fed); border-radius: 8px; background: var(--line-2, #f5f7fa); }
@media (max-width: 900px) { .co-new { grid-template-columns: 1fr 1fr; } }

/* ---------- 项目管理：项目 / 任务树形表格（项目 → 里程碑 → 子任务） ---------- */
.pj-row { cursor: pointer; }
.pj-row td { vertical-align: middle; }
.pj-row.pj-proj > td { background: var(--primary-soft, #eaf1ff); }
.pj-row.pj-ms > td { background: #fbfcfe; }
.pj-row:hover > td { background: var(--line-2, #eef1f6); }
.pj-caret { display: inline-block; width: 15px; margin-right: 2px; color: var(--muted, #8a94a6); font-size: 12px; }
.pj-row.pj-sub .mono { color: var(--ink-2, #4b5563); }