/* ════════════════════════════════════════════════════════════════════════
   办公管理 · 物料管理（web/osm.css）
   只给 web/osm.js 用。**优先复用平台已有的类**（.kpi / .kpi-grid / .mod /
   .bchtable / .inp / .tag / .segbtn / .empty / .dim）—— 别自造一套皮，
   否则跟全站不是一个味儿（老板 2026-10-24 报"界面太丑"）。
   下面只补平台没有的几件：页签栏的横向滚动保护、两行式列表行、
   柜位格子、趋势柱。颜色一律用令牌（--x），明暗主题自动跟随。
   ════════════════════════════════════════════════════════════════════════ */

/* 总览的竖条与图表用**浅蓝**（老板 2026-10-26：不要深蓝）。
   这是物料页自己的令牌，不动全站 `--btn-blue` —— 按钮、物品表链接仍走全站色。 */
:root { --osm-blue: #4D9FE8; --osm-blue-soft: rgba(77, 159, 232, .14); }

/* ---- 页内页签栏（按钮沿用平台 .segbtn）----
   ⚠️ 平台 .ig-bar 是 flex-wrap：容器一窄，按钮会被压成**竖排**（老板截图
   就是这样，中文挤成一列）。这里改成 nowrap + 横向滚动，窄屏也不会变形。 */
.osm-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden; padding: 2px 0 8px;
  scrollbar-width: thin; }
.osm-tabs::-webkit-scrollbar { height: 6px; }
.osm-tabs::-webkit-scrollbar-thumb { background: var(--track); }
.osm-tabs .segbtn { flex: 0 0 auto; white-space: nowrap; }

/* ---- KPI 卡片（复用平台 .kpi / .kpi-grid）----
   样张：每颗**左侧一道竖条**（蓝；已丢失那颗转红），读数与副说明同一行。 */
.osm-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px; }
.osm-kpi { cursor: pointer; border-left: 3px solid var(--osm-blue); }
.osm-kpi:hover { border-color: var(--hover-bd); border-left-color: var(--osm-blue);
  background: var(--hover); }
.osm-kpi.bad { border-left-color: var(--fail); }
.osm-kpi.bad:hover { border-left-color: var(--fail); }
.osm-kpi .lbl { font: 600 10px var(--ff-display); letter-spacing: .12em;
  text-transform: uppercase; color: var(--fg-faint); }
.osm-kpi .val { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.osm-kpi .val .v { font-family: var(--mono); font-size: 30px; font-weight: 500;
  letter-spacing: -.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.osm-kpi.bad .val .v { color: var(--fail); }
.osm-ks { color: var(--fg-faint); font-size: 11px; }
@media (max-width: 900px) { .osm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.osm-kpi-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.osm-kpi-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- 区块卡（复用平台 .mod）---- */
.osm-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin-bottom: 10px; }
.osm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; }
@media (max-width: 1100px) {
  .osm-grid3, .osm-grid2 { grid-template-columns: 1fr; }
}
.osm-mod { padding: 10px 12px 12px; }
.osm-mod-h { display: flex; align-items: baseline; gap: 8px; padding-bottom: 7px;
  margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.osm-mod-h b { font-weight: 600; font-size: 13px; }
.osm-mod-h .dim { font-size: 11px; }
.osm-mod-ops { margin-left: auto; display: flex; gap: 6px; flex: none; }
.osm-mod-b { min-width: 0; }
.osm-more { padding: 6px 0 0; font-size: 11px; }

/* ---- 两行式列表行（预警 / 最近操作 / 弹窗里的物品清单）---- */
.osm-rowline { display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.osm-rowline:last-child { border-bottom: 0; }
.osm-rowline:hover .osm-rl-name { color: var(--accent); }
.osm-rl-1 { display: flex; align-items: center; gap: 6px; flex: 1 1 auto;
  min-width: 0; }
.osm-rl-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.osm-rl-2 { display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  font-size: 11px; color: var(--fg-faint); white-space: nowrap; }

/* ---- 种类分布 / 柜使用率横条 ---- */
/* 种类分布与柜使用率共用同一套「名称 | 条 | 数字」三列网格。
   ⚠️ .osm-cabrow 以前只有 cursor，没拿到这套网格 —— 那根条没有宽度，
   三行柜子就只剩文字（样张里是要画条的）。 */
.osm-catrow, .osm-cabrow { display: grid; grid-template-columns: 88px 1fr auto;
  align-items: center; gap: 10px; padding: 3px 0; cursor: pointer; }
.osm-catrow:hover .osm-catname { color: var(--accent); text-decoration: underline; }
.osm-catname { font-size: 12px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.osm-catbar { position: relative; height: 9px; background: var(--track); }
.osm-catbar i { position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--osm-blue); }
/* 在外那一段仍单独画（信息有用），但改淡蓝并**叠在主条尾部** ——
   以前它写死 right:0，等于钉在轨道最右端，跟主条之间空一段，看着像另一根条。 */
.osm-catbar i.out { background: var(--osm-blue); opacity: .38; }
.osm-catbar i.ok { background: var(--pass); }
.osm-catbar i.warn { background: var(--warn); }
.osm-catbar i.bad { background: var(--fail); }
.osm-catnum { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.osm-catnum i { font-style: normal; }
.osm-catnum b { font-weight: 600; color: var(--fg); }

/* 「最近操作」的动作图标：带底色的小方块 + 白色描线符号（样张口径）。
   底色走全站那套语义色：pass 绿 / warn 橙 / fail 红 / info 蓝。 */
.osm-ai { width: 26px; height: 26px; flex: none; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 5px;
  background: var(--card-alt); color: var(--fg-dim); }
.osm-ai svg { width: 15px; height: 15px; }
.osm-ai.pass { background: var(--pass); color: #fff; }
.osm-ai.warn { background: var(--warn); color: #fff; }
.osm-ai.fail { background: var(--fail); color: #fff; }
.osm-ai.info { background: var(--osm-blue); color: #fff; }
.osm-act { font-size: 12px; color: var(--fg-dim); flex: none; }
.osm-zero { color: var(--fail); }

/* ---- 7 天趋势：平滑折线 + 面积 + 数据点（样张口径，不再是七根柱子）----
   线/面在一张拉满的 SVG 里；圆点与数值是绝对定位的 HTML，横向拉伸时字不会变形。 */
.osm-trend2 { position: relative; height: 138px; margin: 2px 0 0; }
.osm-tsvg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.osm-tarea { fill: var(--osm-blue); opacity: .14; stroke: none; }
.osm-tline { fill: none; stroke: var(--osm-blue); stroke-width: 2;
  vector-effect: non-scaling-stroke; stroke-linecap: round; }
.osm-tp { position: absolute; width: 7px; height: 7px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--osm-blue); border: 2px solid var(--card);
  box-sizing: content-box; }
.osm-tp b { position: absolute; left: 50%; bottom: 11px; transform: translateX(-50%);
  font: 600 11px var(--mono); color: var(--fg-dim); }
.osm-txl { position: absolute; left: 0; right: 0; bottom: 0; display: flex;
  justify-content: space-between; font-size: 10px; color: var(--fg-faint); }
.osm-tsub { margin-top: 26px; font-size: 11px; text-align: center; }

/* ---- 工具栏 / 筛选行 ----
   老板 2026-10-26 的样张：筛选这一排**自己一块面板**，与下面的列表之间留出空隙
   （以前它是裸的一行，贴着列表边框分不清边界）。 */
.osm-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); }
.osm-bar .btn { margin-left: auto; }

/* 物品页：老板 2026-11-27 要求「筛选」贴着「全部物品」右侧，且不要被两个
   auto 外边距挤到中间。桌面用 flex 顺序把按钮排在 type 下拉之后；
   手机上 .osm-frest 整体进弹层，这条不生效，仍是 搜索 / 筛选 / 新增。 */
@media (min-width: 481px) {
  .osm-bar-items [data-of="type"] { order: 5; }
  .osm-bar-items .osm-fbtn { order: 6; margin-left: 0; }
  .osm-bar-items [data-oact="item-add"] { order: 7; margin-left: auto; }
  /* 输入框 / 下拉默认吃全站的 --tap:44px，和 32px 的按钮齐不平；
     这一条把它们统一压到 32，文字仍垂直居中。 */
  .osm-bar-items .osm-bkw,
  .osm-bar-items .osm-frest .inp {
    height: 32px !important;
    min-height: 32px !important;
    box-sizing: border-box !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

/* ---- 物品柜格子 ---- */
.osm-legend { display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--fg-faint); margin-bottom: 8px; }
.osm-legend-dot { width: 9px; height: 9px; display: inline-block;
  border: 1px solid var(--border); }
.osm-legend-dot.osm-free { background: var(--card); }
.osm-legend-dot.osm-used { background: var(--accent-soft); border-color: var(--accent-bd); }
.osm-cabgrid { display: grid; gap: 5px; }
.osm-slot { border: 1px solid var(--border); padding: 5px 3px; text-align: center;
  cursor: pointer; min-height: 40px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; background: var(--card); }
.osm-slot:hover { border-color: var(--hover-bd); background: var(--hover); }
.osm-slot.used { background: var(--accent-soft); border-color: var(--accent-bd); }
.osm-slotno { font-family: var(--mono); font-size: 10px; color: var(--fg-dim); }
/* 纯序号（只给手机用：手机上格子只有 ~80px 宽，"A-1" 会被拆成竖排一列字）。
   ⚠️ 默认必须藏起来，否则桌面每格多出一行数字（2026-11-07 桌面截图抓到）。 */
.osm-slotidx { display: none; }
.osm-slotn { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.osm-cabrow { cursor: pointer; }

/* ---- 部门卡 ---- */
.osm-depts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 12px; }
@media (max-width: 1100px) { .osm-depts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.osm-dept { cursor: pointer; }
.osm-dept:hover { border-color: var(--hover-bd); background: var(--hover); }
.osm-deptn { display: flex; gap: 16px; font-size: 11px; color: var(--fg-dim); }
.osm-deptn b { font-family: var(--mono); font-size: 15px; }

/* ---- 表格 ---- */
.osm-twrap { border: 1px solid var(--border); background: var(--card);
  overflow-x: auto; }
.osm-table { width: 100%; }
.osm-table th { text-align: left; user-select: none; white-space: nowrap; }
.osm-table th.osm-th { cursor: pointer; }
.osm-table th.osm-th.on { color: var(--accent); }
.osm-table tbody tr:hover td { background: var(--hover); }
.osm-code { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
.osm-strong { font-weight: 600; }
.osm-link { color: var(--accent); text-decoration: none; cursor: pointer; }
.osm-link:hover { text-decoration: underline; }
/* 物品表里以前 责任人/当前所属/位置 三列都挂了链接色（= 本皮肤 accent 橙），
   一行扫过去整片橙。**正文列**（责任人 / 当前所属 / 位置）回归正文色，
   悬停才给强调色。
   老板 2026-10-26 再定：**物品名与操作列也不要橙色** —— 这两处改走全站那颗蓝
   `--btn-blue`（与样张一致，也仍与"按钮蓝"同一语义），不再吃 `--accent`。 */
.osm-table td .osm-link:not(.osm-strong) { color: var(--fg); }
.osm-table td .osm-link:not(.osm-strong):hover { color: var(--accent); }
.osm-table .osm-link.osm-strong { color: var(--btn-blue); }
/* ⚠️ 必须带 .osm-table 前缀抬权重：style.css 里 `html:not([data-theme="dark"]) .linkbtn`
   是 (0,2,1)，只写 `.osm-ops .linkbtn` (0,2,0) 在浅色档会被它压回橙色。
   顺手去掉下划线 —— 样张里这一列是干净的纯文字。 */
.osm-table .osm-ops .linkbtn { color: var(--btn-blue); text-decoration: none; }
.osm-table .osm-ops .linkbtn:hover { text-decoration: underline; }
.osm-table th.osm-th.on { color: var(--fg); font-weight: 600; }
/* 行距拉高（老板：一行贴一行看不清）；所有列统一垂直居中 ——
   数量那格以前把「在外 N」排成第二行，会把时间/操作两列顶得不在一条线上。 */
.osm-table td { padding: 11px 9px; vertical-align: middle; }
.osm-out { margin-left: 6px; color: var(--warn); }
/* 状态/数量/时间这些短字段不许竖着折行（"在/库" 拆两行最显乱） */
.osm-nowrap { white-space: nowrap; }
.osm-lost { color: var(--fail); font-weight: 500; }
.osm-cfs { display: flex; flex-wrap: wrap; gap: 1px 10px; margin-top: 2px; }
.osm-cf { font-size: 11px; color: var(--fg-faint); white-space: nowrap; }
.osm-clip { max-width: 190px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.osm-btn-sm { padding: 2px 8px; font-size: 12px; min-height: 0; }
/* 操作列（老板样张标题就是"纯文字操作"）：整列都是文字链，中间画一道竖线分隔，
   不再排一列方块按钮；一行排齐不换行（一换行整列变两排，行高就高低不齐了）。 */
.osm-ops { display: flex; align-items: center; justify-content: flex-start;
  gap: 0; flex-wrap: nowrap; }
.osm-ops .linkbtn { font-size: 12px; white-space: nowrap; }
.osm-ops .linkbtn + .linkbtn { margin-left: 8px; }
.osm-ops .linkbtn + .linkbtn::before { content: "|"; position: absolute;
  left: -5px; color: var(--border); }
/* 操作列**只占内容那么宽**（width:1% 是收缩列的老写法）：
   以前表格自动布局把这一列撑到 ~295px，内容又靠右对齐，于是每行左边空出一截，
   5 个动作的行和 4 个动作的行起点还差 32px —— 老板圈的"最后一列和前面不对齐"就是这个。
   现在这一列紧贴「添加时间」，动作从左往右排，各行起点对齐。 */
.osm-table th.osm-th-ops { text-align: left; width: 1%; }
.osm-table td.u-ops.osm-ops { text-align: left; }
/* 物品名称列收窄一点（老板：以前这一列把右边几列挤得太窄），
   编号那列给个下限，免得编号在中间断成两行。 */
.osm-table th.osm-th-name { width: 20%; min-width: 150px; }
.osm-table th.osm-th-code { width: 112px; }
.osm-pgon { border-color: var(--accent-bd); color: var(--accent); }
.osm-pager { display: flex; align-items: center; gap: 6px; padding: 8px 2px;
  flex-wrap: wrap; font-size: 12px; }

/* ---- 表单（弹窗内）---- */
.osm-row { display: flex; gap: 10px; }
.osm-row .osm-col { flex: 1; min-width: 0; }
@media (max-width: 640px) { .osm-row { flex-direction: column; gap: 0; } }
.osm-fg { margin-bottom: 9px; }
.osm-lb { display: block; font-size: 12px; color: var(--fg-dim); margin-bottom: 3px; }
.osm-req { color: var(--fail); font-weight: 400; }
.osm-fg .inp, .osm-col .inp, .osm-col select, .osm-col textarea { width: 100%;
  box-sizing: border-box; }
.osm-static { border: 1px solid var(--border); background: var(--card-alt);
  padding: 6px 8px; font-size: 12px; color: var(--fg-dim); min-height: 34px;
  box-sizing: border-box; }
.osm-hint { margin-top: 3px; font-size: 11px; }
/* 摆放位置那一格（2026-10-27 老板要编辑功能能改位置）：物品柜 / 柜位两颗下拉并排、
   各占一半，下面仍是位置文本框。⚠️ 选择器要多一层 `.osm-col`：上面那条
   `.osm-col select { width:100% }` 是两级，写 `.osm-locpick select` 打不过它，
   两颗下拉会各撑满一行。 */
.osm-locpick { display: flex; gap: 6px; margin-bottom: 6px; }
.osm-col .osm-locpick select { flex: 1 1 0; width: auto; min-width: 0; }
.osm-hint.osm-hint-warn { color: var(--warn); }
.osm-note { font-size: 12px; padding: 7px 9px; margin: 0 0 10px;
  border: 1px solid var(--border); background: var(--card-alt); }
.osm-note.osm-ok { color: var(--pass); border-color: var(--pass-bd);
  background: rgba(21, 128, 61, .06); }
.osm-note.osm-info { color: var(--accent); border-color: var(--accent-bd);
  background: var(--accent-soft); }
.osm-note.osm-warn { color: var(--warn); border-color: var(--warn-bd);
  background: var(--warn-bg); }
.osm-note.osm-bad { color: var(--fail); border-color: var(--danger-bd);
  background: var(--danger-bg); }
.osm-sep { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
.osm-sep > span.dim { display: block; margin-bottom: 7px; font-size: 11px; }
.osm-danger-zone { border-top: 1px solid var(--border); margin-top: 12px;
  padding-top: 9px; }
.osm-danger-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.osm-fieldrow { border: 1px solid var(--border); padding: 9px; margin-bottom: 9px; }
.osm-fieldrow-del { font-size: 12px; }
.osm-btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- 详情弹窗 ---- */
.osm-dhead { display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.osm-drow { display: grid; grid-template-columns: 92px 1fr; gap: 10px;
  padding: 3px 0; font-size: 13px; }
.osm-dk { color: var(--fg-faint); font-size: 12px; }
.osm-tl-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.osm-tl-row:last-child { border-bottom: 0; }

/* ════════════════════════════════════════════════════════════════════════
   物品详情 / 编辑弹窗（老板 2026-10-28 样张）
   版式：标题=物品名 + 状态徽章，下面一行编号；一块浅底摘要（数量 / 在外
   所属人）；两列信息栅格；分区标题前一道蓝竖条；全周期记录走圆点时间线。
   颜色只用令牌，徽章沿用平台 .tag（状态语义色不动）。
   ════════════════════════════════════════════════════════════════════════ */
.sheet.osm-sheet-wide { width: 680px; }
.sheet.osm-sheet-wide .md-body { max-height: calc(100vh - 140px); }
.osm-dlg b { color: inherit; }        /* .md-body b 默认是失败红，这里全部改回正文色 */
.osm-dlg .dim { color: var(--fg-faint); }

/* 头部：主行（名称 + 徽章）与副行（编号） */
.modal-h.osm-dh { display: block; padding: 16px 20px 12px; position: relative; }
.osm-dh-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-right: 36px; min-height: 26px; }
.osm-dh-t { font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--fg); }
.osm-dh-sub { margin-top: 3px; font-size: 12px; color: var(--fg-faint); }
.modal-h .osm-dh-sub-in { margin-left: 8px; font-size: 12px; color: var(--fg-faint); }
.modal-h.osm-dh .modal-x { position: absolute; right: 10px; top: 10px;
  margin-left: 0; }

/* 摘要框（当前数量 / 在外所属人） */
.osm-dsum2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card-alt);
  padding: 12px 16px; margin: 2px 0 16px; }
.osm-dk2 { display: block; font-size: 12px; color: var(--fg-faint);
  margin-bottom: 4px; }
.osm-dv2 { font-size: 13px; color: var(--fg); overflow-wrap: anywhere; }
.osm-dv2 b { font-weight: 700; }

/* 两列信息栅格 */
.osm-dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; }
.osm-df { min-width: 0; }
.osm-df.osm-full { grid-column: 1 / -1; }

/* 分区标题：蓝竖条 + 粗体 */
.osm-dsec { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.osm-dsec::before { content: ""; flex: none; width: 3px; height: 14px;
  border-radius: 1px; background: var(--btn-blue); }
.osm-dsec b { font: 700 13.5px/1.3 var(--ff-ui); color: var(--fg); }

/* 全周期记录时间线：圆点 + 竖线 + 虚分隔 */
.osm-tl2-it { position: relative; padding: 0 0 14px 18px; }
.osm-tl2-it + .osm-tl2-it { margin-top: 2px; padding-top: 12px;
  border-top: 1px dotted var(--border); }
.osm-tl2-it::before { content: ""; position: absolute; left: 0; top: 4px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--track-none); }
.osm-tl2-it::after { content: ""; position: absolute; left: 4px; top: 17px;
  bottom: -18px; width: 1px; background: var(--border); }
.osm-tl2-it:last-child { padding-bottom: 0; }
.osm-tl2-it:last-child::after { display: none; }
.osm-tl2-it.is-info::before { background: #1677ff; }
.osm-tl2-it.is-pass::before { background: var(--pass); }
.osm-tl2-it.is-warn::before { background: var(--warn); }
.osm-tl2-it.is-fail::before { background: var(--fail); }
.osm-tl2-h { display: flex; align-items: baseline; gap: 8px; }
.osm-tl2-h b { font-size: 12.5px; font-weight: 600; }
.osm-tl2-t { margin-left: auto; font-size: 11.5px; color: var(--fg-faint); }
.osm-tl2-b { margin-top: 5px; font-size: 12.5px; color: var(--fg-dim);
  display: flex; flex-direction: column; gap: 2px; }
.osm-tl2-b .k { color: var(--fg-faint); }

/* 编辑表单：两列栅格（详情同款分工，标签在上、控件占满一格） */
.osm-fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.osm-fgrid > .osm-fg, .osm-fgrid > .osm-full { min-width: 0; }
.osm-fgrid > .osm-fg { margin-bottom: 0; }
.osm-fgrid > .osm-full { grid-column: 1 / -1; }
.osm-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  min-height: 34px; }
@media (max-width: 640px) {
  .osm-dsum2, .osm-dgrid, .osm-fgrid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════════════
   「筛选收成一行」两件共享件 —— 必须写在下面 480 块**外面**
   （2026-11-07 老板：手机版避免整页筛选）。
     · `.osm-frest` 装那几颗下拉/输入框：桌面 `display:contents`，
       这层 div 在布局上"不存在"，父级 flex 的排布与加它之前一模一样；
     · `.osm-fbtn`「筛选」按钮：桌面 `display:none`，只有 ≤480 才露出来。
   弹层里那份（`.osm-fsheet .osm-frest`）要竖排 —— 它是被 JS **整体搬**进弹层的
   （不是复制），所以这里只改排布，值/事件全都跟着节点走。 */
.osm-frest { display: contents; }
.osm-fbtn { display: none; }
/* 物料自己的隐藏类。⚠️ 平台没有全局 `.hidden`（只有 `.modal.hidden` 那种组合），
   直接写 class="hidden" 是不生效的 —— 第一版就踩了这个，白排了一条空栏。
   ⚠️ 必须带 `#osm-body` 前缀：上面 `#osm-body .osm-bar{display:flex}` 是 ID 级，
   光写 `.osm-bar.osm-hide` 压不过它（第二版又踩了一次）。 */
#osm-body .osm-bar.osm-hide { display: none; }
/* 部门 chip 是手机专用件：桌面仍然是那 5 张部门统计卡（字数多、能点进部门详情）。
   ⚠️ 默认必须藏起来 —— 只在 480 块里写 `display:flex` 的话，桌面会多出一整排
   chip，跟部门卡重复（2026-11-07 桌面截图抓到）。 */
.osm-dchips { display: none; }
.osm-fsheet .osm-frest { display: flex; flex-direction: column; gap: 10px; }
/* `!important`：那几颗 `.inp` 上挂着行内 `style="width:130px"`（桌面用），
   进了弹层要整行宽，只有行内值压得住。作用域只在弹层里，不外溢。 */
.osm-fsheet .osm-frest .inp,
.osm-fsheet .osm-frest select { width: 100% !important; min-width: 0 !important; }
.osm-fsheet { padding: 2px 0; }
.osm-fsheet-foot { display: flex; gap: 8px; margin-top: 14px; }
.osm-fsheet-foot .btn { flex: 1 1 0; height: 38px; }

/* ════════════════════════════════════════════════════════════════════════
   手机版（≤480）—— 老板 2026-11-07 拍板的一整套
   四句话：**以查询为主**（列表往前挪）/ **不整页筛选**（收成一行 + 弹层）/
   **单卡别太大**（物品 ≈96 / 记录 ≈62 / 人员 ≈72）/ **信息可省**（低频字段点开）。

   ⚠️ 三条规矩：
     ① 每条规则都关在 `@media (max-width:480px)` 里 —— 桌面一个字不动；
     ② 选择器一律以 `#osm-body` 开头（那是这七个页面的容器），不会漏到平台
        其它页面上去 —— 平台那套通用 `.card-on-mobile` 被仪表盘、向量管理、
        缺陷表各自复用过，裸写 `table.card-on-mobile` 会连坐；
     ③ 行内的网格位置全部用 `grid-row/grid-column` 显式点死，不靠 `order`
        —— 平台通用那套按 2 列自动流排，字段少的行会自己往上窜。
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ---------- 惯用件 ---------- */
  .osm-twrap-cards { border: 0; background: transparent; overflow: visible; }
  .osm-twrap-cards table { overflow: visible; }
  .osm-pager { gap: 4px; font-size: 11px; padding: 6px 2px; flex-wrap: wrap; }
  .osm-pager .btn { padding: 3px 8px; }

  /* ---------- ① 筛选栏：一条细线（搜索 + 筛选 + 新增） ---------- */
  #osm-body .osm-bar {
    display: flex; flex-wrap: nowrap; align-items: center;
    gap: 6px; padding: 6px 8px; margin-bottom: 8px; border-radius: 9px;
  }
  #osm-body .osm-bar .osm-bhint { display: none; }
  /* ⚠️ 这一条是整个"不整页筛选"的开关：`.osm-frest` 在桌面是 display:contents，
     手机上必须显式藏掉，否则那五颗下拉会跟着 bar 一起铺在页面上
     （第一版漏了这条，实测筛选栏还是 5 行）。点「筛选」时它被 JS 搬进弹层，
     那时选择器不再命中这里 → 由 `.osm-fsheet .osm-frest` 接管成竖排。 */
  #osm-body .osm-bar .osm-frest { display: none; }
  /* `.inp` 是 content-box：只写 height:30px 实测出来 44px（30 + 上下 padding + 边框），
     必须连 box-sizing 一起写死。 */
  #osm-body .osm-bar .osm-bkw {
    flex: 1 1 0; width: auto;
    /* 行内 style 里挂着 `min-width:200px`（桌面用），320 宽的机器上
       200+筛选+新增 会顶出去 —— 这里只能 !important 才盖得住行内值。 */
    min-width: 0 !important;
    /* ⚠️ `.inp` 带 `min-height: var(--tap)`（44px 的触控高度）：只写 height:30px
       实测出来还是 44px（min-height 压过 height），必须一起改。 */
    min-height: 30px;
    box-sizing: border-box; height: 30px; padding: 2px 8px; font-size: 13px;
  }
  #osm-body .osm-bar > .btn { margin-left: 0; flex: 0 0 auto;
    height: 30px; min-height: 0; padding: 0 10px; font-size: 12px; }
  #osm-body .osm-bar .osm-fbtn { display: inline-flex; align-items: center; gap: 4px; }
  #osm-body .osm-fn {
    font-style: normal; font-family: var(--mono); font-size: 10px; font-weight: 600;
    min-width: 15px; height: 15px; line-height: 15px; text-align: center;
    border-radius: 8px; padding: 0 4px;
    background: var(--accent); color: var(--accent-fg, #fff);
  }

  /* ---------- ② 三张卡共用：行 = 网格，字段名内联小字 ---------- */
  /* 平台通用那套是「2 列网格 + 字段名在上 + 标题/关键字段各占整行」，
     一张卡 6~7 行、300+px。这里逐页换成 2~3 行的紧凑网格，
     字段名收成 10px 内联前缀（"位置: A-5"），不再各占一行。 */
  #osm-body table.osm-table.card-on-mobile tr[data-oexp] {
    display: grid; align-items: baseline;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    column-gap: 8px; row-gap: 1px;
    padding: 8px 11px; margin-bottom: 7px;
    border-radius: 9px;
  }
  #osm-body table.osm-table.card-on-mobile tr[data-oexp] td {
    min-width: 0; padding: 0; border: 0; background: transparent;
    white-space: normal; overflow: hidden; text-overflow: ellipsis;
  }
  #osm-body table.osm-table.card-on-mobile tr[data-oexp] td::before {
    display: inline; font-size: 10px; line-height: 1;
    margin: 0 3px 0 0; color: var(--fg-faint); order: -1;
  }
  /* 展开指示箭头：桌面不显示（那几格本来就一直露着） */
  .osm-xp { display: none; }
  #osm-body table.osm-table.card-on-mobile tr[data-oexp] .osm-xp {
    display: inline-block; margin-left: 5px; font-style: normal;
    font-size: 11px; color: var(--fg-faint); transition: transform .15s;
  }
  #osm-body .osm-xp::before { content: '⌄'; }
  #osm-body table.osm-table.card-on-mobile tr[data-oexp].on .osm-xp {
    transform: rotate(180deg); color: var(--accent);
  }

  /* ---- ②-a 物品卡：名称+状态 / 编号+种类 / 位置+责任人+数量 / 操作 ---- */
  #osm-body td.osm-c-name {
    grid-column: 1 / 3; grid-row: 1; font-size: 14.5px; font-weight: 600; line-height: 1.3;
  }
  #osm-body td.osm-c-name::before { content: none; }
  #osm-body td.osm-c-status {
    grid-column: 3; grid-row: 1; justify-self: end; align-self: center;
  }
  #osm-body td.osm-c-status::before { content: none; }
  #osm-body td.osm-c-code { grid-column: 1; grid-row: 2; font-family: var(--mono); font-size: 11.5px; }
  #osm-body td.osm-c-code::before { content: none; }
  #osm-body td.osm-c-cat { grid-column: 2 / 4; grid-row: 2; font-size: 11.5px; }
  #osm-body td.osm-c-loc { grid-column: 1; grid-row: 3; font-size: 11.5px; }
  #osm-body td.osm-c-resp { grid-column: 2; grid-row: 3; font-size: 11.5px; }
  #osm-body td.osm-c-qty {
    grid-column: 3; grid-row: 3; justify-self: end; font-size: 11.5px;
  }
  #osm-body td.osm-c-holder { grid-column: 1 / -1; grid-row: 4; font-size: 11.5px; }
  #osm-body td.osm-c-time { grid-column: 1 / -1; grid-row: 5; font-size: 10.5px; }
  #osm-body td.osm-c-time::before { content: none; }
  #osm-body td.osm-ops { grid-column: 1 / -1; grid-row: 6; justify-self: stretch; }
  /* 收起时藏掉的低频字段（老板拍板的"点开展开"） */
  #osm-body tr[data-oexp]:not(.on) td.osm-c-holder,
  #osm-body tr[data-oexp]:not(.on) td.osm-c-time,
  #osm-body tr[data-oexp]:not(.on) .osm-cfs { display: none; }

  /* ---- ②-b 操作记录：一行式（动作 + 物品名 / 人 + 时间） ---- */
  #osm-body table.osm-table.osm-recs.card-on-mobile tr[data-oexp] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    padding: 7px 11px; margin-bottom: 6px;
  }
  #osm-body td.osm-r-name { grid-column: 1 / 3; grid-row: 1; font-size: 13.5px; line-height: 1.3; }
  #osm-body td.osm-r-name::before { content: none; }
  #osm-body td.osm-r-act { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; }
  #osm-body td.osm-r-act::before { content: none; }
  #osm-body td.osm-r-by { grid-column: 1; grid-row: 2; font-size: 11.5px; }
  #osm-body td.osm-r-by::before { content: '操作'; }
  #osm-body td.osm-r-rel { grid-column: 2; grid-row: 2; font-size: 11.5px; }
  #osm-body td.osm-r-rel::before { content: '→'; margin-right: 5px; font-size: 11px; color: var(--fg-faint); }
  /* 没有相关人员时连箭头一起收掉 —— 否则读出来是 "→ -"，像个残缺的句子 */
  #osm-body td.osm-r-rel.osm-r-none { display: none; }
  #osm-body td.osm-r-time {
    grid-column: 3; grid-row: 2; justify-self: end;
    font-family: var(--mono); font-size: 10px; color: var(--fg-faint); white-space: nowrap;
  }
  #osm-body td.osm-r-from,
  #osm-body td.osm-r-to { grid-column: 1 / -1; font-size: 11.5px; }
  #osm-body td.osm-r-from { grid-row: 3; }
  #osm-body td.osm-r-to { grid-row: 4; }
  #osm-body td.osm-r-note { grid-column: 1 / -1; grid-row: 5; font-size: 11.5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  #osm-body tr[data-oexp]:not(.on) td.osm-r-from,
  #osm-body tr[data-oexp]:not(.on) td.osm-r-to,
  #osm-body tr[data-oexp]:not(.on) td.osm-r-note { display: none; }

  /* ---- ②-c 人员卡：姓名 + 部门 / 编号 + 电话 / 持有 / 操作 ---- */
  #osm-body table.osm-table.osm-ptbl.card-on-mobile tr[data-oexp] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    padding: 8px 11px; margin-bottom: 7px;
  }
  #osm-body td.osm-p-name { grid-column: 1 / 3; grid-row: 1; font-size: 14.5px; font-weight: 600; }
  #osm-body td.osm-p-name::before { content: none; }
  #osm-body td.osm-p-dept {
    grid-column: 3; grid-row: 1; justify-self: end; font-size: 11px;
    padding: 1px 7px; border-radius: 10px; max-width: 110px;
    background: var(--card-alt); border: 1px solid var(--border);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #osm-body td.osm-p-dept::before { content: none; }
  /* 编号/电话这两格分占 1 列与剩下的 2 列 —— 只给 auto 一列的话，
     电话会被部门 chip 的 34px 卡死成 5px（实测），整串号码读不出来。 */
  #osm-body td.osm-p-no { grid-column: 1; grid-row: 2; font-family: var(--mono); font-size: 11.5px; }
  #osm-body td.osm-p-no::before { content: none; }
  #osm-body td.osm-p-phone { grid-column: 2 / 4; grid-row: 2; justify-self: end; font-size: 11.5px; }
  #osm-body td.osm-p-phone::before { content: none; }
  #osm-body td.osm-p-owned { grid-column: 1 / 3; grid-row: 3; font-size: 11.5px; }
  #osm-body td.osm-p-owned::before { content: '负责'; }
  #osm-body td.osm-p-borrowed { grid-column: 3; grid-row: 3; justify-self: end; font-size: 11.5px; }
  #osm-body td.osm-p-borrowed::before { content: none; }
  #osm-body td.osm-p-recs { grid-column: 1 / -1; grid-row: 4; font-size: 11.5px; }
  #osm-body td.osm-p-recs::before { content: '记录'; }
  #osm-body td.osm-p-notes { grid-column: 1 / -1; grid-row: 5; font-size: 11.5px; }
  #osm-body td.osm-p-time { grid-column: 1 / -1; grid-row: 6; font-size: 10.5px; }
  #osm-body td.osm-p-time::before { content: none; }
  #osm-body td.osm-p-ops { grid-column: 1 / -1; grid-row: 7; justify-self: stretch; }
  #osm-body tr[data-oexp]:not(.on) td.osm-p-recs,
  #osm-body tr[data-oexp]:not(.on) td.osm-p-owned,
  #osm-body tr[data-oexp]:not(.on) td.osm-p-borrowed,
  #osm-body tr[data-oexp]:not(.on) td.osm-p-notes,
  #osm-body tr[data-oexp]:not(.on) td.osm-p-time { display: none; }

  /* ---- ②-d 种类卡：图标是装饰，手机上省掉一行 ---- */
  #osm-body td.osm-a-icon { display: none; }

  /* 操作那排：纯文字按钮，一行放不下就折行，别再各占一格 */
  #osm-body table.osm-table.card-on-mobile td.card-ops,
  #osm-body table.osm-table.card-on-mobile td.osm-ops {
    display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
    padding-top: 4px; margin-top: 2px; border-top: 1px solid var(--border);
  }
  #osm-body table.osm-table.card-on-mobile td.card-ops::before { content: none; }
  #osm-body .osm-op { font-size: 11.5px; }

  /* ---------- ③ 人员页部门：一行 chip（兼作筛选） ---------- */
  #osm-body .osm-depts { display: none; }
  #osm-body .osm-dchips {
    display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  #osm-body .osm-dchips::-webkit-scrollbar { display: none; }
  #osm-body .osm-dchip {
    flex: 0 0 auto; height: 28px; padding: 0 11px; border-radius: 14px;
    font-size: 12px; white-space: nowrap; cursor: pointer;
    background: var(--card); color: var(--fg-dim);
    border: 1px solid var(--border);
  }
  #osm-body .osm-dchip i {
    font-style: normal; font-family: var(--mono); font-size: 10.5px;
    margin-left: 3px; color: var(--fg-faint);
  }
  #osm-body .osm-dchip.on {
    background: var(--accent-soft); border-color: var(--accent-bd);
    color: var(--accent); font-weight: 600;
  }
  #osm-body .osm-dchip.on i { color: var(--accent); }

  /* ---------- ④ 总览：4 格 KPI + 一行小字 ---------- */
  #osm-body .osm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* 物品柜页是三格 —— 2 列排下来第三格独占半行、右边空一块，干脆一排三格 */
  #osm-body .osm-kpi-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #osm-body .osm-kpi { padding: 9px 11px 10px; }
  #osm-body .osm-kpi .val { flex-wrap: wrap; gap: 2px 6px; }
  #osm-body .osm-kpi .val .v { font-size: 22px; }
  #osm-body .osm-kpi .lbl { font-size: 9.5px; }
  #osm-body .osm-kpi .osm-ks { font-size: 9.5px; line-height: 1.2; }
  #osm-body .osm-kmini {
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    padding: 7px 11px; margin: -2px 0 10px;
    font-size: 11.5px; color: var(--fg-dim);
  }
  #osm-body .osm-kmini b { font-family: var(--mono); font-size: 12.5px; color: var(--fg); }
  #osm-body .osm-grid3, #osm-body .osm-grid2 { grid-template-columns: 1fr; gap: 10px; }

  /* ---------- ⑤ 物品柜：格子改成 4 列，只露序号 + 件数 ---------- */
  /* 柜子的列数是行内 style（`repeat(N,1fr)`），手机上必须 !important 才盖得住：
     实测 B 柜按 10 列排下来每格只剩 30px，"B-35" 直接被拆成竖排一列字。 */
  #osm-body .osm-cabgrid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 5px;
  }
  #osm-body .osm-slot { min-height: 34px; padding: 3px 2px; gap: 0; border-radius: 6px; }
  #osm-body .osm-slotno { display: none; }
  #osm-body .osm-slotidx {
    display: block;
    font-family: var(--mono); font-size: 11px; color: var(--fg-dim); line-height: 1.1;
  }
  #osm-body .osm-slot.used .osm-slotidx { color: var(--fg); }
  #osm-body .osm-slotn { font-size: 10.5px; font-weight: 600; line-height: 1.1; }
  #osm-body .osm-legend { font-size: 10.5px; margin-bottom: 6px; }

  /* ---------- ⑥ 总览/种类里那几条横条行 ---------- */
  .osm-catrow { grid-template-columns: 1fr auto; gap: 4px 8px; }
  .osm-catrow .osm-catbar { grid-column: 1 / -1; order: 3; }
  .osm-deptn { gap: 12px; }
}

/* ---------- 弹层里那排下拉：竖排、整行宽（只在手机上存在） ---------- */
@media (max-width: 480px) {
  .osm-fsheet .osm-frest select,
  .osm-fsheet .osm-frest .inp { height: 36px; }
}

/* ---------- 超窄屏兜底（≤359，iPhone SE 一代 / 老安卓） ----------
   总览那几个区块卡的头部（标题 + 副标题 + 「查看全部」）与两行式列表行
   都是 `white-space:nowrap`，min-content 能顶到 346px —— 375 宽放得下，
   320 宽就整页横向滚动（2026-11-07 实测 docScrollW 362 > 320）。
   只在这么窄的机器上允许折行：375 及以上一个字都不动。 */
@media (max-width: 359px) {
  #osm-body .osm-mod-h { flex-wrap: wrap; row-gap: 2px; }
  #osm-body .osm-mod-h .dim { white-space: normal; min-width: 0; }
  #osm-body .osm-rowline { gap: 6px; }
  #osm-body .osm-rl-2 { flex-wrap: wrap; white-space: normal; }
  #osm-body .osm-bar { gap: 5px; padding: 6px; }
}
