/* ============================================================
   通用样式（所有桌面页面共用）—— common.css
   约定：跨页面共享的样式只写在这里，不要再写回各模板。

   1) 滚动条统一样式：细、浅、悬停加深，各页面观感一致
   2) scrollbar-gutter:stable：滚动容器预留滚动条槽位，
      避免"滚动条出现 / 消失"时内容宽度抖动（右侧内容被挤来挤去）
   3) 纵向列表容器禁止横向滚动条：这些区域只该纵向滚动；
      一旦横向溢出，底部会多出一条横向滚动条（还吃掉高度、
      再引出竖向滚动条 → 卡片内容整体偏移），属于副作用，直接禁止
   4) 卡片小表格 .nm-tbl（库存预警 / 最近添加）：固定布局 + 省略号。
      否则"规格"这类长文本在 nowrap 下会把表格撑到 800px+，
      而卡片只有 550px 宽 → 必然出现横向滚动条（本次问题的根因）

   ⚠️ 以后新增滚动容器，请把它补进下面 2)、3) 两个选择器列表。
   ============================================================ */

/* ---- 1) 滚动条外观 ---- */
html{scrollbar-width:thin;scrollbar-color:#cfd3d9 transparent;}
::-webkit-scrollbar{width:9px;height:9px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:#d5d8dd;border-radius:6px;border:2px solid transparent;background-clip:content-box;}
::-webkit-scrollbar-thumb:hover{background:#bfc4cb;background-clip:content-box;}
::-webkit-scrollbar-thumb:active{background:#a9afb8;background-clip:content-box;}
::-webkit-scrollbar-corner{background:transparent;}

/* ---- 2) 预留滚动条槽位（防抖动 / 防内容移位） ---- */
html,.content,.pc-body,.sc-body,.sidebar,.settings-nav,.table-area,.table-wrap,
.nm-card-b,.pp-body,.scroll-body,.cp-list,.ac-drop,.code-results,.search-results,
.flow-wrap,#mmList,#material-list,.modal,.edit-modal,.p-modal .modal{scrollbar-gutter:stable;}

/* ---- 3) 纵向列表：禁止横向滚动条 ---- */
.content,.sidebar,.settings-nav,.sc-body,.nm-card-b,.pp-body,.scroll-body,.cp-list,
.ac-drop,#mmList,#material-list,.code-results,.search-results{overflow-x:hidden;}

/* ============================================================
   库存预警 + 最近添加 卡片（dashboard.html / desktop_entry.html 共用）
   ============================================================ */
.nm-wrap{margin-top:16px;display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.nm-card{background:#fff;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.06);overflow:hidden;display:flex;flex-direction:column;height:350px;}
.nm-card-h{display:flex;align-items:center;gap:6px;padding:10px 14px;background:#f7f8fa;border-bottom:1px solid #e5e6eb;font-size:14px;font-weight:600;color:#1f2329;}
.nm-card-h .nm-sub{font-size:12px;color:#8f959e;font-weight:400;margin-left:auto;white-space:nowrap;}
.nm-card-b{padding:6px 10px;flex:1;overflow-y:auto;}
.nm-empty{padding:24px;text-align:center;color:#8f959e;font-size:13px;}

/* 固定布局：列宽由 <th> 决定，长文本一律省略号，表格绝不超出卡片宽度
   ⚠️ 选择器用 .nm-card-b .nm-tbl 双类（权重 0,2,1）：desktop_entry.html 里有条全局
      `tbody td:not(.c-op){padding:16px 18px}`（权重 0,1,2）会盖掉单类写法，
      导致单元格左右被撑掉 36px、内容全被压成省略号（2026-10-02 踩过）。 */
.nm-tbl{width:100%;border-collapse:collapse;font-size:12px;margin:4px 0;table-layout:fixed;}
.nm-card-b .nm-tbl th,.nm-card-b .nm-tbl td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left;vertical-align:middle;border-right:none;}
.nm-card-b .nm-tbl th{padding:6px 8px;border-bottom:1px solid #e5e6eb;font-weight:500;color:#646a73;font-size:11px;}
.nm-card-b .nm-tbl td{padding:5px 8px;border-bottom:1px solid #f0f1f2;}
.nm-tbl tbody tr:last-child td{border-bottom:none;}
.nm-tbl tbody tr:hover{background:#f8fafd;}
.nm-tbl .num{text-align:right;font-variant-numeric:tabular-nums;}

/* 列宽（固定布局下由首行 th 决定）；未写宽度的"规格"列自动吃掉剩余宽度 */
#alertBody .nm-tbl th:nth-child(1){width:68px;}  /* 品号 */
#alertBody .nm-tbl th:nth-child(2){width:112px;} /* 品名 */
#alertBody .nm-tbl th:nth-child(4){width:54px;}  /* 库存 */
#alertBody .nm-tbl th:nth-child(5){width:50px;}  /* 阈值 */
#alertBody .nm-tbl th:nth-child(6){width:78px;}  /* 状态 */
#recentBody .nm-tbl th:nth-child(1){width:82px;} /* 日期 */
#recentBody .nm-tbl th:nth-child(2){width:68px;} /* 品号 */
#recentBody .nm-tbl th:nth-child(3){width:112px;}/* 品名 */
#recentBody .nm-tbl th:nth-child(5){width:62px;} /* 数量 */
#recentBody .nm-tbl th:nth-child(6){width:76px;} /* 结余 */

.nm-code{font-weight:600;color:#3370ff;}
.nm-qty-in{color:#34a853;font-weight:600;}
.nm-qty-out{color:#f54a45;font-weight:600;}
.nm-bal-low{color:#f54a45;font-weight:600;}
.nm-bal-ok{color:#1f2329;font-weight:600;}
@media(max-width:900px){.nm-wrap{grid-template-columns:1fr;}}

/* 只读输入框（如编辑弹窗的 品名/规格 —— 由品号联动，不允许手改）：灰底 + 默认光标，一眼看出不可编辑 */
input[readonly]{background:#f5f6f7;color:#646a73;cursor:default;}
input[readonly]:focus{border-color:#dee0e3;box-shadow:none;}
