/* ==========================================================================
   云智 ERP · 样式表
   设计基线：正文 13.5px / 控件高 32px / 间距刻度 4·6·8·10·12·14 / 圆角 6~10px
   组织顺序：变量 → 骨架与导航 → 卡片与标题 → 工具条与控件 → 表格 →
             状态与提示 → 浮层（抽屉 / 弹窗 / 悬停）→ 单据版式 → 窄屏
   ========================================================================== */

:root {
  /* 颜色 */
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e4e9f0;
  --line-2: #d3dbe6;
  --ink: #1f2d3d;
  --ink-2: #445266;
  --muted: #6b7a8d;
  --brand: #1f4e79;
  --brand-2: #2e75b6;
  --brand-soft: #eef5fc;
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --warn: #b45309;
  --warn-soft: #fdf4e5;
  --err: #b91c1c;
  --err-soft: #fdecec;
  /* 字号 */
  --fs-h1: 19px;
  --fs-h2: 14.5px;
  --fs-body: 13.5px;
  --fs-tbl: 13px;
  --fs-sm: 12.5px;
  --fs-xs: 12px;
  /* 尺度 */
  --lh: 1.65;
  --h: 32px;
  --h-sm: 26px;
  --r: 6px;
  --r-lg: 10px;
  --sh: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-body)/var(--lh) "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid #9cc4e8; outline-offset: 1px; }

/* ---------------------------------------------------------------- 骨架与导航 */
.app { display: flex; min-height: 100vh; }
.side {
  width: 200px; flex: 0 0 200px; background: #12263a; color: #c8d6e5;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 18px 16px 12px; font-size: 16px; font-weight: 700;
  color: #fff; letter-spacing: .8px; line-height: 1.4;
}
.brand small {
  display: block; margin-top: 3px; font-size: 11px; font-weight: 400;
  color: #8ba3bb; letter-spacing: .5px;
}
/* Shared navigation for ERP pages. */
.side-company { padding: 0 16px 12px; color: #c8d6e5; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.side-expiry { margin-bottom: 6px; color: #c8d6e5; font-size: 12px; overflow-wrap: anywhere; }
nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; }
nav button, nav a {
  text-align: left; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r);
  background: transparent; color: #b9c9d9; font: inherit; font-size: var(--fs-body);
  cursor: pointer; transition: background .12s, color .12s;
}
nav a { text-decoration: none; display: flex; align-items: center; }
nav button:hover, nav a:hover { background: #1b3550; color: #fff; }
nav button.on, nav a.on {
  background: #20456b; color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-2);
}
.side .foot {
  margin-top: auto; padding: 12px 16px; font-size: 11px; color: #7d93a9;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
main { flex: 1; min-width: 0; padding: 18px 22px 48px; }

/* 页头：滚动时留在顶部，长表格里标题与状态始终可见 */
.top {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: -18px 0 12px; padding: 14px 0 11px;
  background: rgba(244, 246, 249, .95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: var(--fs-h1); font-weight: 600; margin: 0; letter-spacing: .3px; }
#status { font-size: var(--fs-sm); color: var(--muted); }

/* ---------------------------------------------------------------- 卡片与标题 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--sh);
}
.card h2 {
  font-size: var(--fs-h2); font-weight: 600; margin: 0 0 10px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.5;
}
.card h2 .muted { font-weight: 400; font-size: var(--fs-sm); }
.card h2.h2-row { flex-wrap: nowrap; }
.card h2.h2-row .btn { margin-left: auto; height: var(--h-sm); padding: 0 12px; font-size: var(--fs-sm); }
.card h3.sub { font-size: var(--fs-body); font-weight: 600; margin: 16px 0 8px; color: var(--ink-2); }
.card h3.sub .muted { font-weight: 400; font-size: var(--fs-sm); }

.grid { display: grid; gap: 12px; }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 14px; box-shadow: var(--sh);
}
.kpi .n {
  font-size: 21px; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.kpi .l { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- 概览
   四块：业务规模（合同 / 分配表两组并排）· 待出运 · 账务提醒 · 最近操作 */
.ov-row { display: flex; gap: 16px; flex-wrap: wrap; }
.ov-group { flex: 1 1 320px; min-width: 0; }
.ov-group-h { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.ov-win { margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }
.ov-win select { height: var(--h-sm); }
/* 待处理错误收成标题右侧的胶囊：点开还是原来的校验项清单 */
.chip {
  margin-left: auto; height: var(--h-sm); padding: 0 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--muted); font-size: var(--fs-sm); font-family: inherit;
}
.chip:hover { border-color: var(--brand-2); color: var(--ink-2); }
.chip.warn { color: #b45309; border-color: #f3d9a4; background: #fff8e1; font-weight: 600; }

/* ---------------------------------------------------------------- 工具条与控件
   功能按钮集中在一行：含按钮的行不换行，宽度不够时整行横向滚动，
   主操作靠右（各查询栏里给主按钮加了 margin-left:auto）。 */
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row > label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--muted); white-space: nowrap;
}
@supports selector(:has(*)) {
  /* 查询条件里的文本输入吃掉剩余空间：窗口宽它就长，挤的时候先缩它，
     这样固定宽度的日期框和按钮不会被挤出可视区。剩下的放不下时整行自然换行，
     任何宽度下都不会有按钮被藏在横向滚动条后面 */
  .row:has(> .btn) > input[type=text] { flex: 1 1 140px; min-width: 118px; }
}

/* 柜号关键字搜索：输入框 + 浮在下方的候选列表（报关单据页用）。
   列表绝对定位挂在 label 上，不占工具条高度，也不会把按钮挤下去。 */
.ct-pick { position: relative; }
.ct-pick > input[type=text] { min-width: 232px; padding-right: 26px; }
.ct-list {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 60;
  min-width: 100%; max-height: 264px; overflow: auto; padding: 4px;
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .14); white-space: normal;
}
.ct-list button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; padding: 7px 9px; border: 0; border-radius: var(--r);
  background: none; font: inherit; font-size: var(--fs-body); color: var(--ink);
  text-align: left; cursor: pointer;
}
.ct-list button.on, .ct-list button:hover { background: var(--brand-soft); }
.ct-list .ct-no { font-weight: 600; font-variant-numeric: tabular-nums; }
.ct-list .ct-meta { font-size: var(--fs-sm); color: var(--muted); }
.ct-list .ct-empty { padding: 8px 9px; font-size: var(--fs-sm); color: var(--muted); }

input[type=text], input[type=date], input[type=month], select {
  height: var(--h); padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  font: inherit; font-size: var(--fs-body); color: var(--ink); background: #fff;
  min-width: 0; transition: border-color .12s, box-shadow .12s;
}
input[type=text] { min-width: 140px; }
/* 日期框要显式给宽：min-width 小于其固有宽度时不起作用 */
input[type=date], input[type=month] { width: 126px; }
select { min-width: 120px; padding-right: 4px; cursor: pointer; }
input[type=text]:hover, input[type=date]:hover, input[type=month]:hover, select:hover {
  border-color: #b9c6d6;
}
input[type=text]:focus, input[type=date]:focus, input[type=month]:focus, select:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46, 117, 182, .14); outline: none;
}
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand-2); cursor: pointer; margin: 0; }

button.btn {
  height: var(--h); padding: 0 13px; border-radius: var(--r); border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-size: var(--fs-body);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
button.btn:hover:not(:disabled) { background: #1a4166; border-color: #1a4166; }
button.btn.ghost { background: #fff; color: var(--brand); border-color: var(--line-2); }
button.btn.ghost:hover:not(:disabled) { background: var(--brand-soft); border-color: #b7cfe8; }
/* 批量删除：与普通按钮区分开，避免和「查询」这类安全操作混在一起误点 */
button.btn.warndel { background: #fff; color: var(--err); border-color: #efc9c9; }
button.btn.warndel:hover:not(:disabled) { background: var(--err-soft); border-color: #e3a8a8; }
button.btn.mini { height: var(--h-sm); padding: 0 9px; font-size: var(--fs-sm); border-radius: 5px; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }

label.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.chk-line {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; cursor: pointer;
}

/* 使用说明：默认收起，点开才展开。十几行说明文字不再把页面撑乱 */
details.help { margin-top: 8px; }
details.help > summary {
  display: inline-flex; align-items: center; gap: 6px; list-style: none;
  font-size: var(--fs-sm); color: var(--brand-2); cursor: pointer;
  padding: 2px 0; user-select: none;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary::before {
  content: "?"; display: inline-grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-2);
  font-size: 10.5px; font-weight: 700; line-height: 1;
}
details.help > summary:hover { color: var(--brand); }
details.help[open] > summary { color: var(--brand); font-weight: 600; }
details.help > .drag-note { margin-top: 6px; padding-left: 21px; }
.drag-note { font-size: var(--fs-sm); line-height: 1.7; color: var(--muted); margin-top: 8px; }

/* 价格表高级筛选条：四个维度下拉 + 重置，与关键字、未定价可叠加 */
.row.adv {
  margin-top: 10px; padding: 8px 10px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: var(--r);
}
.row.adv .adv-tip { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.row.adv select { height: 28px; min-width: 128px; font-size: var(--fs-sm); }
.row.adv .btn { height: 28px; padding: 0 11px; font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- 表格
   表头吸顶，单元格左右留白 10px，数字列右对齐并用等宽数字。 */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-tbl); }
th, td {
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
thead th {
  background: #f4f7fb; color: #3d4f63; font-weight: 600; font-size: var(--fs-sm);
  white-space: nowrap; border-bottom: 1px solid var(--line-2); letter-spacing: .2px;
}
th { cursor: default; user-select: none; }
th.sort { cursor: pointer; }
th.sort:hover { background: #e9eff7; color: var(--brand); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { white-space: nowrap; }
tbody tr:hover td { background: #f7fafd; }
tfoot td { font-weight: 700; background: #eef4fb; border-top: 1px solid var(--line-2); }

.scroll { overflow: auto; max-height: 62vh; }
/* 台账拆成上下两块后各自限高，两块都能在一屏内看到 */
.scroll.half { max-height: 38vh; }
.scroll thead th { position: sticky; top: 0; z-index: 2; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb {
  background: #c9d5e3; border-radius: 6px; border: 2px solid #fff;
}
.scroll::-webkit-scrollbar-thumb:hover { background: #a9bbd0; }
.scroll::-webkit-scrollbar-track { background: #f6f9fc; }

td.auto { color: var(--muted); }
td.mono { font-family: Consolas, ui-monospace, monospace; font-size: var(--fs-xs); color: var(--muted); }

/* 出运台帐的勾选列：居中、指针可点，窄屏也够大 */
td input.pick, th.pick { width: 15px; height: 15px; cursor: pointer; }
td input.pick { display: block; margin: 0 auto; }
th.sel { width: 38px; cursor: default; text-align: center; background: #f4f7fb; }
th.sel input.pick { display: block; margin: 0 auto; }
#files-table th.sel { width: 38px; cursor: default; text-align: center; background: #f4f7fb; }
#files-table th.sel input.pick { display: block; margin: 0 auto; }

/* 表头筛选：右侧小图标，点开才出现输入框（宽表不用常驻一行输入框） */
.th-top { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.th-lab { overflow: hidden; text-overflow: ellipsis; }
.th-fb {
  flex: 0 0 auto; width: 15px; height: 15px; padding: 0; line-height: 13px;
  border: 0; border-radius: 3px; background: transparent; color: #9db0c6;
  font-size: 9px; cursor: pointer;
}
.th-fb:hover { background: #dbe6f3; color: var(--brand); }
.th-fb.on { background: var(--brand); color: #fff; }
.th-fi {
  display: block; width: 112px; max-width: 100%; margin-top: 3px;
  height: 21px; padding: 0 6px; font-size: var(--fs-xs); font-weight: 400;
  border: 1px solid #b9c8db; border-radius: 4px; background: #fff; color: var(--ink);
}
.th-fi:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(31,78,121,.14); }

/* 表格内就地编辑：输入框铺满单元格，改过的格子标黄 */
input.cell-in {
  height: var(--h-sm); padding: 0 7px; border: 1px solid var(--line-2); border-radius: 5px;
  font: inherit; font-size: var(--fs-sm); background: #fff; width: 128px; min-width: 0;
  text-align: right; transition: border-color .12s, box-shadow .12s;
}
input.cell-in.txt { text-align: left; }
input.cell-in.dirty { border-color: #E0A32E; background: #FFF8E1; }
input.cell-in:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(46, 117, 182, .14); outline: none;
}
/* 价格表「品牌」列的下拉：表格内就地改，宽度收窄免得把列撑开 */
select.cell-sel { height: var(--h-sm); min-width: 0; width: 112px; padding: 0 4px; font-size: var(--fs-xs); }
/* 单据表格里的下拉（货名 / 商品编号）：与同一行的输入框同高 */
select.cell-in { height: var(--h-sm); min-width: 0; padding: 0 4px; font-size: var(--fs-sm); }
/* 价格表的采购单价 / 销售单价：表格内就地改价。改过的格子标黄，未保存一眼能看出来 */
input.cell-num {
  height: var(--h-sm); min-width: 0; width: 96px; padding: 0 7px;
  font: inherit; font-size: var(--fs-xs); text-align: right;
  font-variant-numeric: tabular-nums; border: 1px solid var(--line-2); border-radius: 5px;
  transition: border-color .12s, box-shadow .12s;
}
input.cell-num.dirty { border-color: #E0A32E; background: #FFF8E1; }
input.cell-num:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(46, 117, 182, .14); outline: none;
}
td.num input.cell-num { margin-left: auto; display: block; }
/* 应收应付款：日期与备注也在格子里改，样式跟金额格一致，只是不对齐右边 */
input.cell-date, input.cell-text {
  height: var(--h-sm); min-width: 0; padding: 0 7px;
  font: inherit; font-size: var(--fs-xs);
  border: 1px solid var(--line-2); border-radius: 5px;
  transition: border-color .12s, box-shadow .12s;
}
input.cell-date { width: 132px; }
input.cell-text { width: 100%; min-width: 120px; }
input.cell-date.dirty, input.cell-text.dirty {
  border-color: #E0A32E; background: #FFF8E1;
}
input.cell-date:focus, input.cell-text:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(46, 117, 182, .14); outline: none;
}
/* 对账单预览：工厂单价与分配表采购单价不一致的那一格标黄底虚线，
   悬停能看到分配表的价与差额（生成前的确认弹窗会列出同一批 SKU） */
.price-off {
  color: var(--warn); font-weight: 600;
  border-bottom: 1px dashed currentColor; cursor: help;
}

/* ---------------------------------------------------------------- 状态、文件与提示 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: var(--fs-xs); line-height: 1.7; font-weight: 500; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.muted { color: var(--muted); }
.hide { display: none !important; }
.warn-line { color: var(--warn); }

.checks { list-style: none; padding: 0; margin: 10px 0 0; max-height: 240px; overflow: auto; }
.checks li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-sm); }
.checks li:last-child { border-bottom: 0; }

.files { display: flex; flex-direction: column; gap: 6px; }
.files a { color: var(--brand-2); text-decoration: none; font-size: var(--fs-body); }
.files a:hover { color: var(--brand); text-decoration: underline; }
/* 打包下载：按钮样式，与逐个下载的链接区分开；靠左不拉伸整行 */
.files a.dl-all {
  align-self: flex-start; margin: 4px 0 6px; padding: 7px 14px;
  border-radius: var(--r); background: var(--brand); color: #fff;
  font-weight: 600; font-size: var(--fs-tbl);
}
.files a.dl-all:hover { text-decoration: none; background: #1a4166; }

.drop {
  border: 1.5px dashed #bfcbd9; border-radius: var(--r-lg); padding: 22px 18px;
  text-align: center; color: var(--muted); background: #fbfdff; cursor: pointer;
  font-size: var(--fs-sm); line-height: 1.8;
  transition: border-color .12s, background .12s, color .12s;
}
.drop:hover { border-color: var(--brand-2); background: #f5faff; }
.drop.hi { border-color: var(--brand-2); background: #eef6ff; color: var(--brand); }

/* 多文件上传的逐份结果：一份一行，失败标红，成功标绿，附一份汇总头 */
.multi-report {
  margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fcfdfe; overflow: hidden;
}
.multi-report .mr-head {
  padding: 7px 12px; background: #f4f7fb; border-bottom: 1px solid var(--line);
  font-size: var(--fs-tbl); font-weight: 600; color: var(--ink-2);
}
.multi-report .mr-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 12px; font-size: var(--fs-sm); line-height: 1.6;
  border-bottom: 1px dashed #eef1f5;
}
.multi-report .mr-row:last-child { border-bottom: 0; }
.multi-report .mr-tag {
  flex: none; min-width: 34px; text-align: center; padding: 1px 7px;
  border-radius: 10px; font-size: 12px; font-weight: 600;
}
.multi-report .mr-row.ok .mr-tag { background: #e7f5ec; color: #1a7f37; }
.multi-report .mr-row.bad .mr-tag { background: #fdeaea; color: #b91c1c; }
.multi-report .mr-name { flex: none; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-report .mr-msg { flex: 1 1 auto; color: var(--muted); word-break: break-word; }
.multi-report .mr-row.bad .mr-msg { color: #b91c1c; }
.multi-report .mr-note { padding: 7px 12px; border-top: 1px solid var(--line); }

/* 合同台账的采购单号：点开看这份购销合同的源文件预览（新窗口、只读） */
.po-link {
  color: var(--brand-2); font-weight: 600; text-decoration: none;
  border-bottom: 1px dashed rgba(46, 117, 182, .5); cursor: pointer;
}
.po-link:hover { color: var(--brand); border-bottom-style: solid; }
/* 合同台账：上传按钮推到查询栏最右侧，拖拽时整张查询卡片高亮 */
#contract-upload { margin-left: auto; }
#ledger-bar.hi { border-color: var(--brand-2); background: #eef6ff; }
#ledger-bar.hi #contract-upload { box-shadow: 0 0 0 3px rgba(46, 117, 182, .25); }
/* 分配表及箱贴：同样把上传分配表的按钮推到查询栏最右侧 */
#fenpei-upload { margin-left: auto; }
#ship-bar.hi { border-color: var(--brand-2); background: #eef6ff; }
#ship-bar.hi #fenpei-upload { box-shadow: 0 0 0 3px rgba(46, 117, 182, .25); }

/* 按交货期间筛选时，落在区间内的交期行标黄，与同一合同的其余交期区分 */
tbody tr.hit td { background: #fff8e1; }
tbody tr.hit:hover td { background: #fff2cc; }
/* 对账差异行标黄、缺价行标红，与出运跟踪表的命中行同一套提示色 */
tbody tr.diff td { background: #fff8e1; }
tbody tr.noprice td { background: var(--err-soft); }

/* 台账上下两块：签订时间与交货日期保持单行，窄屏下不折行 */
#ledger-pos-table td:nth-child(2), #ledger-date-table td:nth-child(1),
#ledger-date-table td:nth-child(2) { white-space: nowrap; }
/* 交货期间（起~止）整体不折行 */
.span-note { white-space: nowrap; }

/* ---------------------------------------------------------------- 浮层：抽屉 / 弹窗 / 悬停 */
.mask { position: fixed; inset: 0; background: rgba(18, 38, 58, .38); z-index: 60; border: 0; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw);
  background: #fff; z-index: 61; display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(18, 38, 58, .18);
}
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: var(--fs-h2); margin: 0; }
.drawer-head h2 .muted { font-weight: 400; font-size: var(--fs-sm); }
.drawer-head .btn { margin-left: auto; }
.drawer-bar { padding: 10px 16px; border-bottom: 1px solid var(--line); background: #f7f9fc; }
.drawer-bar input[type=text] { min-width: 150px; height: 28px; padding: 0 8px; font-size: var(--fs-sm); }
.drawer-bar input[type=date] { min-width: 0; width: 142px; height: 28px; padding: 0 8px; font-size: var(--fs-sm); }
.drawer-body { flex: 1; overflow: auto; padding: 8px 16px 20px; }

.modal {
  position: fixed; z-index: 71; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: #fff; border-radius: var(--r-lg); box-shadow: 0 18px 48px rgba(18, 38, 58, .28);
}
#dlg-mask { z-index: 70; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: var(--fs-h2); margin: 0; }
.modal-head .btn { margin-left: auto; }
.modal-body { flex: 1; overflow: auto; padding: 12px 16px; }
.modal-body .dlg-note { margin: 0 0 10px; font-size: var(--fs-body); line-height: 1.7; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line); background: #f7f9fc;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
/* 差异清单：款号用等宽字体，数字右对齐，一眼看出差在哪 */
.mini-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.mini-table th, .mini-table td {
  border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap;
}
.mini-table th { background: #f2f6fb; font-weight: 600; color: #36506b; }
.mini-table td.mono { font-family: Consolas, ui-monospace, monospace; }
.mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table td.up { color: #c2410c; }
.mini-table td.down { color: #0f766e; }

/* 校验项弹层：比确认框宽，列表要能放下「单据 / 问题 / 示例」三列 */
.modal.ck { width: min(1040px, 96vw); }
#ck-mask { z-index: 72; }
#ck { z-index: 73; }
.ck-bar { gap: 8px; margin-bottom: 4px; }
.ck-bar input[type=text] { flex: 1 1 160px; min-width: 120px; }
.ck-bar select { flex: 0 0 auto; }
.ck-chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap;
}
.ck-wrap { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ck-wrap .mini-table { border-collapse: separate; border-spacing: 0; }
.ck-wrap .mini-table th { position: sticky; top: 0; z-index: 1; }
.ck-wrap .mini-table td { white-space: normal; }
.ck-wrap .mini-table td.ex { color: var(--ink-2); font-size: var(--fs-sm); }
.badge {
  display: inline-block; padding: 0 7px; height: 20px; line-height: 20px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.err { background: #fee2e2; color: #b91c1c; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.info { background: #e0f2fe; color: #075985; }
.badge.known { background: #e8eef6; color: #475569; }
.badge.open { background: #fff7ed; color: #c2410c; }
.kpi.act { cursor: pointer; text-align: left; }
.kpi.act:hover { border-color: var(--brand-2); }
.kpi .sub { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }

/* 悬停提示：挂在 body 上 fixed 定位，不受 .scroll 裁剪 */
[data-tip] { cursor: help; }
.tip {
  position: fixed; z-index: 50; display: none; pointer-events: none;
  padding: 7px 10px; border-radius: var(--r); background: #1f2937; color: #fff;
  font-size: var(--fs-xs); line-height: 1.7; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .22);
}
.tip.on { display: block; }
.tip-h { font-weight: 600; }

/* 价格历史记录：按 SKU 分组，一版一行（档位 / 价格 / 变化 / 来源 / 时间 / 当前或历史） */
.hist-empty { padding: 18px 0; text-align: center; }
.hist-group { border-bottom: 1px solid var(--line); padding: 10px 0 6px; }
.hist-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  position: sticky; top: -8px; background: #fff; padding: 4px 0;
}
.hist-sku {
  font-family: Consolas, ui-monospace, monospace; font-size: var(--fs-sm);
  font-weight: 600; color: var(--brand);
}
.hist-prod { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row {
  display: grid; grid-template-columns: 56px 96px 72px 72px 1fr 44px;
  align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r);
  font-size: var(--fs-sm);
}
.hist-row.cur { background: var(--brand-soft); }
.hist-scope { color: var(--muted); }
.hist-price { text-align: right; font-variant-numeric: tabular-nums; }
.hist-delta { text-align: right; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.hist-delta.up { color: var(--err); }
.hist-delta.down { color: var(--ok); }
.hist-src {
  font-size: 11.5px; color: var(--brand); background: #eef4fb;
  border-radius: 10px; padding: 1px 8px; justify-self: start;
}
.hist-time { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 财务管理页签 */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; width: fit-content;
  background: #f1f4f9; border: 1px solid var(--line); border-radius: 9px; padding: 3px;
}
.tabs .tab {
  border: 0; background: transparent; color: var(--ink-2);
  height: 30px; padding: 0 16px; border-radius: 7px;
  font: inherit; font-size: var(--fs-body); cursor: pointer;
  transition: background .12s, color .12s;
}
.tabs .tab:hover:not(.on) { background: #e6ecf6; color: var(--brand); }
.tabs .tab.on {
  background: #fff; color: var(--brand); font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .10);
}

/* ---------------------------------------------------------------- 报关单据（单据版式）
   表格一律细黑边、无斑马纹，标签格浅灰；和报关单据的观感一致。 */
.doc-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.doc-head h2 { margin: 0 0 4px; }
.doc { margin-top: 10px; overflow-x: auto; }
.doc + .doc { margin-top: 14px; }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--fs-tbl); }
.doc-kv th, .doc-kv td, .doc-tbl th, .doc-tbl td {
  border: 1px solid #b9c2cc; padding: 6px 9px; vertical-align: middle;
}
.doc-kv th {
  background: #f2f4f7; font-weight: 600; color: #374151;
  text-align: left; white-space: nowrap; width: 1%;
}
.doc-kv td { color: var(--ink); }
.doc-tbl th {
  background: #eef2f7; font-weight: 600; color: #24384f;
  text-align: center; white-space: nowrap;
}
.doc-tbl td { white-space: nowrap; }
.doc-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* 报关单据的出口明细表是就地可改的：格子里的输入框铺满单元格，不再限宽 */
.doc-tbl.edit td { padding: 3px 5px; }
.doc-tbl.edit input.cell-in, .doc-tbl.edit select.cell-in {
  width: 100%; min-width: 64px; box-sizing: border-box; padding: 0 5px;
}
.doc-tbl.edit td.num input.cell-in { text-align: right; }
.doc-tbl.edit select.cell-in { text-align: left; }
.doc-tbl tfoot td { font-weight: 700; background: #fbfcfe; border-top: 2px solid #8a97a6; }
.doc-tbl tbody tr:hover td { background: #f7fbff; }
.sku-cell { border-bottom: 1px dashed #9bb0c6; cursor: help; }

/* ---------------------------------------------------------------- 出运跟踪表
   两页都有手填列，输入框铺满单元格、按内容收窄，一屏能看全整行。 */
#t-main-table input.cell-in, #t-detail-table input.cell-in {
  width: 100%; min-width: 84px; box-sizing: border-box;
}
#t-main-table input.cell-in.txt, #t-detail-table input.cell-in.txt {
  min-width: 132px; text-align: left;
}
#t-main-table input.cell-in[type=month], #t-detail-table input.cell-in[type=month] {
  min-width: 116px; text-align: center;
}
#t-main-table td, #t-detail-table td { padding: 4px 6px; }
#t-main-table td.auto, #t-detail-table td.auto { color: var(--ink); }
/* 柜号：总表第 4 列（前面多了下单日期）、明细表第 3 列。
   明细表是「11827-TL」这种带连字符的值，列窄了会在连字符处折成两行 */
#t-main-table td:nth-child(5), #t-detail-table td:nth-child(4) {
  white-space: nowrap; min-width: 104px;
}
/* 勾选列：只在页面用，不进导出。表头是全选框，所以不能像可排序表头那样给指针 */
#t-main-table th.sel, #t-detail-table th.sel {
  width: 38px; cursor: default; text-align: center; background: #f4f7fb;
}
#t-main-table th.sel input.pick, #t-detail-table th.sel input.pick {
  display: block; margin: 0 auto;
}

/* ------------------------------------------------ 工厂出库单（单据版式）
   照打印出来的出库单排：标题居中、表头四行、表格式商品行、合计、备注、右侧工厂。
   宽度按 A4 竖版留白收窄，打印或另存 PDF 时版面对得上。 */
.out-doc {
  margin: 14px auto 6px; max-width: 720px; padding: 22px 26px 26px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  box-shadow: var(--sh);
}
.out-doc .out-title {
  text-align: center; font-size: 19px; font-weight: 700;
  letter-spacing: 4px; margin-bottom: 14px;
}
.out-doc .out-head { display: grid; gap: 6px; margin-bottom: 12px; }
.out-doc .out-hrow { display: flex; align-items: center; gap: 8px; }
.out-doc .out-hlabel { flex: 0 0 78px; font-size: var(--fs-body); color: var(--ink); }
.out-doc input.out-in {
  flex: 1 1 auto; min-width: 90px; height: 28px; padding: 0 7px;
  font: inherit; font-size: var(--fs-body);
  border: 1px solid #d7dee7; border-radius: 5px; background: #fcfdff;
}
.out-doc input.out-in:focus { border-color: var(--brand-2); background: #fff; outline: none; }
.out-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.out-table th, .out-table td {
  border: 1px solid #333; padding: 5px 7px; font-size: var(--fs-body);
}
.out-table th { background: #f2f5fa; font-weight: 600; text-align: center; }
.out-table td.num { text-align: right; }
.out-table th.num { text-align: center; }
.out-table td input.out-in {
  width: 100%; border: none; background: transparent; padding: 2px 3px;
  font: inherit; font-size: var(--fs-body);
}
.out-table td input.out-in:focus { background: #fffbe9; outline: none; }
.out-table td input.out-in.num { text-align: right; }
.out-table tfoot td { font-weight: 600; background: #f7f9fc; }
.out-doc .out-note { margin-top: 10px; font-size: var(--fs-sm); color: var(--muted); }
.out-doc .out-factory {
  margin-top: 26px; display: flex; align-items: center; gap: 6px;
  justify-content: flex-end; font-size: var(--fs-body);
}
.out-doc .out-factory input.out-in {
  width: 320px; height: 28px; padding: 0 7px; font-size: var(--fs-body);
  border: 1px solid #d7dee7; border-radius: 5px; background: #fcfdff;
}

/* ------------------------------------------------ 工厂合同（照模板版式）
   外框复用 .out-doc / .out-table，这里只补合同独有的部分：黄色的可变量、
   条款正文、大写金额行、左右两栏落款。 */
.fc-doc { max-width: 860px; }
.fc-doc .fc-pair { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.fc-doc .fc-pair + .fc-pair { margin-top: 4px; }
.fc-doc .fc-label { flex: 0 0 auto; font-size: var(--fs-body); color: var(--ink); }
.fc-doc .fc-val { font-size: var(--fs-body); color: var(--ink); }
/* 抬头右栏：签约地点在上、签订时间在下 */
.fc-doc .fc-stack { display: inline-flex; flex-direction: column; gap: 4px; }
.fc-doc .fc-pair-in { display: flex; align-items: center; gap: 8px; }
.fc-doc input.fc-in, .fc-doc select.fc-in {
  height: var(--h-sm); padding: 0 6px; font: inherit; font-size: var(--fs-tbl);
  border: 1px solid #e2c67a; border-radius: 4px; background: #fff8e1;
}
.fc-doc input.fc-in:focus, .fc-doc select.fc-in:focus {
  border-color: var(--brand-2); background: #fffbe9; outline: none;
}
.fc-doc input.fc-in.fc-no { width: 220px; }
.fc-doc .fc-text { font-size: 12.8px; line-height: 1.8; color: var(--ink); margin: 2px 0; }
.fc-doc .fc-clause { font-size: 12.6px; line-height: 1.75; color: var(--ink); margin: 2px 0; }
.fc-doc .fc-upper { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: var(--fs-body); }
.fc-doc .fc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-top: 22px; }
.fc-doc .fc-sign .fc-srow { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-tbl); }
.fc-doc .fc-sign .fc-slabel { flex: 0 0 auto; color: var(--ink); }
.fc-doc .fc-sign .fc-sval { flex: 1 1 auto; border-bottom: 1px solid #dfe4ea; min-height: 18px; }
.fc-table td input.fc-in, .fc-table td select.fc-in {
  width: 100%; height: auto; border: none; background: #fff8e1;
  padding: 3px 3px; font-size: var(--fs-tbl);
}
.fc-table td input.fc-in.num { text-align: right; }
.fc-table td.fc-calc { text-align: right; color: var(--muted); }
/* 工厂金额：¥ 在输入框外，数值本身不带符号 */
.fc-table td .fc-money { display: inline-flex; align-items: center; gap: 2px; width: 100%; }
.fc-table td .fc-cur { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--muted); }

/* ---------------------------------------------------------------- 窄屏
   车间、仓库常用手机或平板查看，窄屏时侧栏改为顶部横向导航。 */
@media (max-width: 900px) {
  main { padding: 14px 14px 40px; }
  .top { margin: -14px 0 10px; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side {
    width: auto; flex: none; height: auto; position: static; flex-direction: column;
  }
  .brand { padding: 13px 15px 6px; font-size: 15px; }
  nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; gap: 4px; }
  nav button, nav a { white-space: nowrap; padding: 0 12px; height: 32px; }
  nav button.on, nav a.on { box-shadow: inset 0 -3px 0 var(--brand-2); }
  .side .foot { display: block; padding: 8px 16px; }
  .top h1 { font-size: 17px; }
  .scroll { max-height: none; }
  .scroll thead th { position: static; }
  table { font-size: var(--fs-sm); }
  th, td { padding: 6px 7px; }
  .card { padding: 12px 12px; }
  .out-doc { padding: 16px 14px 18px; }
  .doc-tbl td, .doc-tbl th { padding: 5px 6px; }
}
/* 窗口很窄时（如只开了半个屏）抽屉只有一百多像素宽，六列网格会把价格、
   涨跌、来源挤到看不见，改成换行排列，每一项都还在。 */
@media (max-width: 560px) {
  .hist-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
  .hist-row .hist-time { flex-basis: 100%; }
  .hist-row .hist-price, .hist-row .hist-delta { text-align: left; }
}
/* ---------------------------------------------------------------- 登录页
   独立页面：左侧品牌、右侧表单，窄屏自动堆叠。只依赖 style.css 里的令牌。 */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(1100px 520px at 18% -10%, #e8f1fb 0%, transparent 62%),
    radial-gradient(900px 460px at 100% 0%, #eef3fa 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 348px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 28px 26px; box-shadow: 0 10px 30px rgba(16, 24, 40, .08);
}
.login-brand {
  font-size: 21px; font-weight: 700; letter-spacing: .5px; color: var(--brand);
  margin-bottom: 22px; line-height: 1.3;
}
.login-brand small {
  display: block; font-size: var(--fs-sm); font-weight: 400;
  color: var(--muted); letter-spacing: .2px; margin-top: 3px;
}
.login-field { display: block; margin-bottom: 14px; }
.login-field span {
  display: block; font-size: var(--fs-sm); color: var(--ink-2);
  margin-bottom: 6px; font-weight: 600;
}
.login-field input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  font: inherit; font-size: var(--fs-body); color: var(--ink); background: #fff;
}
.login-field input:focus { border-color: var(--brand-2); background: #fbfdff; }
.login-err {
  min-height: 20px; font-size: var(--fs-sm); color: var(--err);
  opacity: 0; transition: opacity .15s;
}
.login-err.on { opacity: 1; }
.login-btn { width: 100%; height: 38px; margin-top: 4px; font-size: var(--fs-body); }
.login-foot {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--muted); text-align: center; line-height: 1.6;
}

/* ---------------------------------------------------------------- 顶栏用户 */
.who {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); color: var(--muted);
}
.who-name { color: var(--ink); font-weight: 600; }
.who-role {
  background: var(--brand-soft); color: var(--brand);
  border-radius: 10px; padding: 1px 9px; font-size: var(--fs-xs);
}

/* ---------------------------------------------------------------- 长列表分页 */
.pager {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 2px 2px; border-top: 1px solid var(--line); margin-top: 8px;
}
.pager .pager-at { font-size: var(--fs-sm); color: var(--muted); }
.pager select.mini {
  height: var(--h-sm); padding: 0 6px; font-size: var(--fs-sm);
  border: 1px solid var(--line-2); border-radius: var(--r); background: #fff;
}

/* 可折叠的卡片：收起后只留标题 */
.card.folded .scroll { display: none; }
.card.folded h2 { margin-bottom: 0; }

/* 用户管理：一格里放几个小按钮，窄屏自动换行 */
.ops { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ops select.mini {
  height: var(--h-sm); padding: 0 6px; font-size: var(--fs-sm);
  border: 1px solid var(--line-2); border-radius: var(--r); background: #fff;
}

/* ---------------------------------------------------------------- 打印
   单据（报关单据 / 出库单 / 采购合同）打印时只留单据本体：
   把节点克隆到 #print-area，正文其余部分整块隐藏，避免侧栏和按钮占掉边上。
   浏览器打印对话框里选「另存为 PDF」即得到 PDF。 */
#print-area { display: none; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block !important; }
  body.printing #print-area .print-title {
    font-size: 15px; font-weight: 700; color: #000;
    margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #999;
  }
  body.printing #print-area .out-doc,
  body.printing #print-area .doc {
    border: 0 !important; box-shadow: none !important;
    border-radius: 0 !important; padding: 0 !important;
    background: #fff !important; max-width: none !important; margin: 0 !important;
  }
  body.printing #print-area .out-doc h2,
  body.printing #print-area .doc h2 { color: #000 !important; }
  body.printing #print-area table { width: 100% !important; }
  body.printing #print-area th,
  body.printing #print-area td { border-color: #333 !important; }
  body.printing #print-area input,
  body.printing #print-area select {
    border: 0 !important; background: #fff !important; color: #000 !important;
    -webkit-appearance: none; appearance: none; padding: 0 !important;
  }
  body.printing #print-area .fc-in, 
  body.printing #print-area .doc-in { border-bottom: 0 !important; }
  body.printing #print-area .tag { display: none !important; }
  body.printing #print-area a { color: #000 !important; text-decoration: none !important; }
  /* 表格行不要被跨页切断 */
  body.printing #print-area tr { break-inside: avoid; page-break-inside: avoid; }
  /* 打印时不带「列显示」入口与它的菜单 */
  #col-btn, .col-menu { display: none !important; }
  /* 打印时隐藏表头筛选用的小图标与输入框 */
  .th-fb, .th-fi { display: none !important; }
}

/* ---------------------------------------------------------------- 列显示菜单 */
/* Mobile overrides are screen-only so Excel/PDF preview printing is unchanged. */
@media screen and (max-width: 760px) {
  .app, .side, main, main section, .card { min-width: 0; max-width: 100%; }
  .app { min-height: 100dvh; }
  .side nav { flex-wrap: wrap; overflow: visible; }
  .side nav a, .side nav button { min-height: 44px; height: auto; flex-shrink: 0; }
  .top { position: static; }
  .top > *, .who { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .who { flex-wrap: wrap; }
  .card h2.h2-row { flex-wrap: wrap; }
  .row > *, .ct-pick { max-width: 100%; }
  .row > label { flex-wrap: wrap; white-space: normal; }
  .ct-pick > input[type=text] { min-width: 0; width: 100%; }
  .row input, .row select, .row.adv select, .drawer-bar input,
  .login-card input, input.cell-in, select.cell-in, textarea {
    font-size: 16px; min-height: 44px;
  }
  .btn, .btn.mini, .row.adv .btn, .chip, .tab, .login-btn { min-height: 44px; height: auto; }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
  .kpi .n { overflow-wrap: anywhere; }
  .scroll, .doc, .out-doc, .ck-wrap { max-width: 100%; overflow-x: auto; }
  .fc-doc .fc-sign { grid-template-columns: 1fr; }
  .drawer { width: 100%; max-height: 100dvh; }
  .drawer-head, .modal-head, .modal-foot { flex-wrap: wrap; }
  .drawer-body, .modal-body { min-height: 0; }
  .modal, .modal.ck { width: calc(100vw - 16px); max-height: 90dvh; }
  .modal-foot { gap: 8px; padding: 10px; }
  .modal-foot .btn { flex: 1 1 auto; }
  .col-menu { min-width: 0 !important; max-width: calc(100vw - 16px) !important; left: 8px !important; right: 8px !important; max-height: 70dvh; }
  .cm-item { min-height: 44px; white-space: normal; }
  .login-page { padding: 16px; min-height: 100dvh; }
  .login-card { padding: 24px 20px; }
}

/* ---------------------------------------------------------------- 列显示菜单 */
#col-btn { flex: 0 0 auto; }
.col-menu {
  position: fixed; z-index: 60;
  min-width: 250px; max-width: 380px; max-height: 72vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(20, 40, 70, .16); padding: 11px 13px;
}
.cm-head {
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
  margin-bottom: 9px;
}
.cm-grp + .cm-grp { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }
.cm-title { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 7px; }
.cm-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--ink); line-height: 1.3;
  background: var(--brand-soft); border-radius: 999px; padding: 3px 10px;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.cm-item input { margin: 0; cursor: pointer; }
.cm-item.off { background: #eef1f5; color: var(--muted); }
.cm-item input:disabled { cursor: not-allowed; }
.cm-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
}
