/* 产品系统 · 本系统专属样式
   规矩：base.css 是生产视觉基线的逐字副本，一个字都不改（它有 md5 校验）。
        通用板块（统计条 .kstrip / 筛选条 .fbar / 表格 table.tb）在 base.css 里
        被生产的页面 id 圈住了，本系统用不了；这些规则的复本在 scope.css（脚本生成）。
        本文件只放生产没有对应物的东西，能复用一律复用。 */

/* ── 视图容器：与生产的 #view-* 同构 ── */
#view-product, #view-doc, #view-project, #view-board,
#view-notify, #view-todo, #view-system, #view-perms, #view-settings {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ── 页面工具条（base.css 没有，招商同款，直接沿用） ── */
.pgbar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top-color: var(--hair);
  box-shadow: var(--shadow-1);
  border-radius: var(--r-lg);
  padding: var(--sp-2) var(--sp-3);
}
.pgbar .sum { font-size: var(--fs-sm); color: var(--text-2); }
.pgbar .sum b { color: var(--text); font-size: var(--fs-lg); }
.pgbar .grow { flex: 1 1 auto; }

/* ── 空态里的两行字 ── */
.empty b { color: var(--text); font-weight: 500; }
.empty span { max-width: 34em; text-align: center; line-height: 1.8; }

/* ── 统计条列数：不抄生产的 5 列（那是看板的格数），按可用宽度自适应，
      3 格 4 格 5 格都排得下，不会留空格子也不会竖排 ── */
:is(#view-product,#view-doc,#view-project,#view-board) .kstrip {
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}
/* 手机上 auto-fit 只能排 1 列 → 4 个格子竖成一根柱子。窄屏固定 2 列（与生产同口径）。 */
@media (max-width:600px){
  :is(#view-product,#view-doc,#view-project,#view-board) .kstrip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── 底部导航：超过 5 个收进「更多」 ──
   base.css 里负责隐藏的类叫 .nav-over（display:none!important），
   而 app.js 的 setupMobileNav() 是照招商的写法打 .mobile-extra，两边名字对不上就会
   全部挤在底部一条里。这里把 .mobile-extra 也按同样口径隐藏，不动物理结构。 */
@media (max-width:820px){
  .sidenav nav button.mobile-extra { display: none !important; }
}

/* ── 表格外框：横向可滚但不许整页横滚（移动端硬约束） ── */
:is(#view-doc,#view-product) .tb-host { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* table-layout 用 auto：生产那套是 fixed + 固定列宽（数字表），文字表的名称列会被压成一条，
   出现"一个字一行"的竖排。auto 让列宽跟内容走，放不下时由 .tb-host 横向滚动。 */
:is(#view-doc,#view-product) table.tb { min-width: 900px; table-layout: auto; }
:is(#view-doc,#view-product) table.tb th { white-space: nowrap; }
/* 生产的 .tb 是给看板数字表用的，默认全居中；资料清单是文字表，左对齐才好读。
   编号 / 名称 / 类别 / 产品 左对齐，版本 / 状态 / 维护人 / 时间 居中。 */
:is(#view-doc,#view-product) table.tb th:nth-child(-n+4),
:is(#view-doc,#view-product) table.tb td:nth-child(-n+4) { text-align: left; }
:is(#view-doc,#view-product) table.tb td:nth-child(2) { line-height: 1.55; padding-top: 10px; padding-bottom: 10px; }

/* ── 筛选条里的搜索框：给足宽度，别把 placeholder 切掉 ──
   scope.css 里 .fbar input 只有固定宽度，遇到后面还有 select 的一行就会把提示文字截断。 */
:is(#view-doc,#view-product) .fbar input[type="text"],
:is(#view-doc,#view-product) .fbar input:not([type]) {
  flex: 1 1 240px;
  min-width: 180px;
}

/* ── 状态标签：几何由 base.css 的 .tag 提供，这里只补色档 ──
   base 只给了 borrow / done / urgent / void 四档（生产的订单用语），
   本系统的「在研 / 在售 / 已终止 / 已作废」另立四档。
   ⚠ 不要重定义裸 `.tag`：那会把生产的几何（内边距/圆角/字色）一起带偏。 */
.tag.blue  { background: var(--accent-soft); color: var(--accent-text); }
.tag.green { background: var(--ok-soft);     color: var(--good); }
.tag.red   { background: var(--ba-soft);     color: var(--bad); }
.tag.warn  { background: var(--wa-soft);     color: var(--warn); }
.tag.grey  { background: var(--panel2);      color: var(--text-2); }
/* .tag 自带 margin-left:4px（给正文内联标签用的）；表格里要居中，去掉 */
td .tag { margin-left: 0; }

/* ── 效果编辑行（产品弹窗里） ── */
.pe-row {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.pe-row:last-child { border-bottom: none; }
.pe-grid {
  flex: 1 1 auto; min-width: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.pe-grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--text-2); }
.pe-grid input, .pe-grid select {
  width: 100%; box-sizing: border-box;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 7px 9px; font-family: inherit; font-size: var(--fs-sm); min-height: 34px;
}
.pe-grid input:focus, .pe-grid select:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
@media (max-width:820px) {
  .pe-row { flex-direction: column; align-items: stretch; }
  .pe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── 弹层内部（.sheet 已提供底色/圆角/内边距） ── */
.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}
.dlg-head .close {
  border: none; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.dlg-head .close:hover { background: var(--chip); color: var(--text); }
.dlg-body { display: flex; flex-direction: column; gap: var(--sp-2); }

/* .sheet 在大屏是两列 grid；本系统的详情/弹窗都是单列，头与正文各跨满 */
#detailBody > .dlg-head { grid-column: 1 / -1; grid-row: 1; }
#detailBody > .dlg-body { grid-column: 1 / -1; grid-row: 2; }
#modalBody  > .dlg-head { grid-column: 1 / -1; grid-row: 1; }
#modalBody  > .dlg-body { grid-column: 1 / -1; grid-row: 2; }

/* ── 表单栅格 ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); }
.form-grid .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld label { font-size: var(--fs-xs); color: var(--text-2); }
.fld label .req { color: var(--req); margin-left: 2px; }
.fld input, .fld select, .fld textarea {
  width: 100%; box-sizing: border-box;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 8px 10px; font-family: inherit; font-size: var(--fs-sm);
  min-height: 38px;
}
.fld textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.fld .hint { font-size: var(--fs-xs); color: var(--muted); }

/* ── 详情层在电脑端改成居中卡片 ──
   base.css 只给 #modal 做了「≥821px 居中卡」，#detail 仍是通栏抽屉（那是手机形态）。
   在 1440 宽屏上通栏抽屉会让 6 个字段各占一整行，没法看。
   这里把 #modal 那套处理原样套给 #detail：安全居中（align-items:flex-start + margin:auto），
   内容超高时能滚、不高时仍垂直居中，不会把顶部裁掉。 */
@media (min-width:821px){
  #detail{align-items:flex-start;justify-content:center;padding:var(--sp-4);overflow-y:auto}
  #detail>.sheet{
    max-width:640px;
    max-height:calc(100vh - 32px);
    max-height:calc(100dvh - 32px);
    margin:auto;
    border:1px solid var(--border-strong);
    border-radius:var(--r-lg);
  }
}

/* ── 效果卡片（产品详情里用，替代 8 列表格） ──
   8 个字段塞进 640px 的详情卡会挤成一团、字叠字，扫一眼啥也看不出来。 */
.eff-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.eff-card {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.eff-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eff-head b { font-size: var(--fs-sm); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.eff-head .tag { margin-left: 0; }
.eff-name { font-size: var(--fs-xs); color: var(--text-2); margin: 4px 0 8px; }
.eff-kv { margin: 0; display: grid; grid-template-columns: 1fr; gap: 3px; }
.eff-kv > div { display: flex; gap: 8px; font-size: var(--fs-xs); }
.eff-kv dt { color: var(--muted); flex: 0 0 44px; }
.eff-kv dd { margin: 0; color: var(--text); min-width: 0; word-break: break-word; }
@media (max-width:820px) { .eff-list { grid-template-columns: 1fr; } }

/* ── 资料库：产品勾选、附件、审批记录、正文预览 ── */
.pick-box {
  max-height: 168px; overflow-y: auto; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.pick-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; font-size: var(--fs-sm); color: var(--text);
  cursor: pointer; min-height: 30px;
}
.pick-row input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

.doc-body-preview {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 14px;
  max-height: 260px; overflow-y: auto;
  font-size: var(--fs-sm); line-height: 1.8; color: var(--text);
  word-break: break-word;
}
.doc-body-preview p { margin: 0 0 8px; }

.att-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px dashed var(--line-soft);
}
.att-row:last-child { border-bottom: none; }
.att-name { font-size: var(--fs-sm); color: var(--text); min-width: 0; word-break: break-all; flex: 1 1 200px; }
.att-size { font-size: var(--fs-xs); color: var(--muted); flex: none; }

.appr-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: var(--fs-sm);
}
.appr-row:last-child { border-bottom: none; }
.appr-lv { color: var(--muted); font-size: var(--fs-xs); flex: none; }
.appr-ck { font-size: var(--fs-xs); padding: 1px 8px; border-radius: var(--r-pill); flex: none; }
.appr-ck.pass { background: var(--ok-soft); color: var(--good); }
.appr-ck.reject { background: var(--ba-soft); color: var(--bad); }
.appr-by { color: var(--text); flex: none; }
.appr-t { color: var(--muted); font-size: var(--fs-xs); flex: none; }
.appr-cm { color: var(--text-2); font-size: var(--fs-xs); flex: 1 1 100%; }

/* 消息列表 */
.nt-item { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.nt-item:last-child { border-bottom: none; }
.nt-item.unread .nt-t { color: var(--text); }
.nt-item.unread::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle;
}
.nt-t { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.nt-b { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.nt-time { font-size: var(--fs-xs); color: var(--hint); margin-top: 3px; }

/* 待办列表 */
.td-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.td-row:last-child { border-bottom: none; }
.td-row:hover { background: var(--panel2); }
.td-kind { font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--r-pill); flex: none; }
.td-kind.approve { background: var(--wa-soft); color: var(--warn); }
.td-kind.fix { background: var(--ba-soft); color: var(--bad); }
.td-name { font-size: var(--fs-sm); color: var(--text); flex: 1 1 200px; min-width: 0; }
.td-code { font-size: var(--fs-xs); color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.td-detail { font-size: var(--fs-xs); color: var(--muted); flex: 1 1 100%; }

/* ── 全局错误横幅（照抄招商系统 extra.css，层级口径一致） ── */
.fms-errbar{
  position:fixed;left:0;right:0;top:0;z-index:9001;
  display:flex;align-items:center;gap:var(--sp-3);flex-wrap:wrap;
  padding:9px var(--sp-3);
  background:var(--panel);color:var(--bad);
  border-bottom:1px solid var(--bad);
  box-shadow:var(--shadow-2);
  font-size:var(--fs-sm);line-height:1.5;
}
.fms-errbar-tx{flex:1 1 auto;min-width:0}
.fms-errbar-btn{
  flex:0 0 auto;height:28px;padding:0 var(--sp-3);
  border:1px solid var(--bad);border-radius:var(--r-sm);
  background:var(--panel2);color:var(--bad);
  font-family:inherit;font-size:var(--fs-xs);font-weight:600;cursor:pointer;
}
.fms-errbar-btn:hover{background:var(--ba-soft)}
.fms-errbar-btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
@media (max-width:600px){
  .fms-errbar{font-size:var(--fs-xs);gap:var(--sp-2)}
  .fms-errbar-btn{height:30px}
}
