﻿:root {
  --navy: #1f3864;
  --sub: #2f5597;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #dfe4ec;
  --text: #262626;
  --muted: #6b7280;
  --red: #c00000;
  --amber: #c55a11;
  --green: #375623;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--sub); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.topbar {
  height: 56px; background: var(--navy); color: #fff;
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; }
.topbar .bell {
  background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 14px;
  padding: 5px 12px; font-size: 12.5px;
}
.topbar .logout {
  background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff;
  border-radius: 4px; padding: 5px 12px; font-size: 12.5px;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--navy); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; }
.kv { display: flex; gap: 8px; font-size: 13.5px; }
.kv .k { color: var(--muted); min-width: 78px; }
.kv .v { color: var(--text); font-weight: 500; word-break: break-all; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f0f3f8; color: var(--navy); font-weight: 600; white-space: nowrap; }
tr.clickable:hover { background: #f7f9fc; cursor: pointer; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 12px;
  border: 1px solid transparent; white-space: nowrap;
}
.chip.draft { background: #f1f1f1; color: #555; }
.chip.submitted { background: #e6eefc; color: var(--sub); }
.chip.active { background: #fff4e5; color: var(--amber); }
.chip.attention { background: #fff2cc; color: #806000; }
.chip.closed { background: #e2efda; color: var(--green); }
.chip.dead { background: #ececec; color: #777; }
.chip.sevA { background: #fbe0e0; color: var(--red); }
.chip.sevB { background: #fff2cc; color: #806000; }
.chip.sevC { background: #e2efda; color: var(--green); }
.btn {
  border: 1px solid var(--sub); background: #fff; color: var(--sub);
  padding: 7px 14px; border-radius: 5px; font-size: 13px;
}
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px;
  font-family: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 68px; }
label.field { display: block; margin-bottom: 10px; }
label.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--muted); }
.login-box {
  max-width: 380px; margin: 12vh auto; background: #fff; padding: 28px 26px;
  border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(31,56,100,.08);
}
.login-box h2 { margin: 0 0 6px; color: var(--navy); font-size: 20px; }
.login-box p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
  background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px; box-sizing: border-box;
}
.modal {
  background: #fff; border-radius: 10px; width: min(620px, 96vw); max-height: 88vh;
  overflow: auto; padding: 20px 22px;
}
.modal h3 { margin: 0 0 14px; color: var(--navy); font-size: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.section-title { font-size: 13px; color: var(--sub); font-weight: 700; margin: 18px 0 8px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .item { margin-bottom: 12px; font-size: 13px; }
.timeline .item b { color: var(--navy); }
.timeline .when { color: var(--muted); font-size: 12px; margin-left: 8px; }
.empty { color: var(--muted); text-align: center; padding: 26px; font-size: 13px; }
.alert-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff8e6; border: 1px solid #f0c36d; border-left: 4px solid #d99a1e;
  border-radius: 6px; padding: 12px 16px; margin-bottom: 14px;
}
.alert-bar b { color: #8a5a00; font-size: 15px; }
.req { color: #c00000; font-weight: 700; margin-left: 2px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { background: #f0f3f8; color: var(--navy); font-weight: 600; padding: 6px 8px;
  border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.tbl td { padding: 4px 6px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl input, table.tbl select { padding: 5px 7px; font-size: 13px; }
.pie-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item b { color: var(--navy); }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.bar-wrap { display: flex; flex-direction: column; gap: 6px; }
.flow-wrap { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding: 6px 2px 10px; }
.flow-node { min-width: 118px; max-width: 150px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: #fff; flex: none; }
.flow-done { border-color: #b7d0a8; background: #f1f7ec; }
.flow-current { border-color: #e0a94a; background: #fff7e6; box-shadow: 0 0 0 2px rgba(224,169,74,.18); }
.flow-todo { background: #fafbfc; color: #6b7280; }
.flow-skipped { background: #f4f4f4; color: #9aa0a6; border-style: dashed; }
.flow-arrow { align-self: center; color: #b6bec9; flex: none; }
.flow-mark { font-weight: 700; font-size: 12px; }
.flow-done .flow-mark { color: var(--green); }
.flow-current .flow-mark { color: #c07a00; }
.flow-label { font-weight: 600; font-size: 13px; margin: 2px 0; }
.flow-meta { font-size: 12px; color: var(--muted); line-height: 1.35; }
.ver {
  position: fixed; left: 14px; bottom: 10px; font-size: 11.5px; color: #8a93a3;
  background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 4px; z-index: 30;
}
.ver.bad { color: #c00000; background: #fff2f2; font-weight: 600; }
.toast {
  position: fixed; right: 22px; bottom: 22px; background: var(--navy); color: #fff;
  padding: 11px 18px; border-radius: 6px; font-size: 13px; z-index: 60; opacity: 0;
  transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--red); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs .tab {
  padding: 6px 13px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--muted);
}
.tabs .tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.kpi .n { font-size: 22px; font-weight: 700; color: var(--navy); }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bad { color: var(--red); }
@media (max-width: 720px) {
  .wrap { padding: 12px 10px 40px; }
  .card { padding: 12px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}
/* 双线并行流程图 */
.flow-partial { border-color: #e0a94a; background: #fff4e0; border-style: dashed; }
.flow-partial .flow-mark { color: #c07a00; }
.flow-main { border-left: 3px solid #dfe4ec; padding-left: 8px; }
.flow-split { font-size: 12px; color: #6b7280; margin: 8px 0 6px; padding-left: 4px; }
.flow-track { display: flex; gap: 10px; align-items: stretch; border-left: 3px solid #dfe4ec;
  padding: 4px 0 4px 8px; margin-bottom: 8px; }
.flow-track-disp { border-left-color: #c9a227; }
.flow-track-analysis { border-left-color: #375623; }
.flow-track-label { min-width: 96px; font-size: 12.5px; padding-top: 6px; }
.flow-final-row { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.flow-final-label { font-size: 12px; color: #6b7280; min-width: 96px; }

/* 两条支线状态标签：物料处置用琥珀色系，问题分析用绿色系 */
.line-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.line-stack-inline { display: inline-flex; flex-direction: row; gap: 6px; vertical-align: middle; margin-left: 6px; }
.chip.line-disp.line-active { background: #f7d98b; color: #6b4a00; border-color: #d9ab3c; }
.chip.line-disp.line-done { background: #e8efe3; color: #4b5b46; }
.chip.line-ana.line-active { background: #cfe3c3; color: #25441c; border-color: #7ba55f; }
.chip.line-ana.line-done { background: #e8efe3; color: #4b5b46; }
.chip.line-disp.line-idle, .chip.line-ana.line-idle { background: #f2f3f5; color: #9aa0a6; }

/* 左侧导航布局 */
.layout { display: flex; min-height: 100vh; }
.side { width: 200px; background: #1f3864; color: #fff; display: flex; flex-direction: column;
  padding: 14px 12px; gap: 10px; position: sticky; top: 0; height: 100vh; box-sizing: border-box; }
.side-brand { font-weight: 600; font-size: 15px; padding: 4px 6px 12px; border-bottom: 1px solid rgba(255,255,255,.15); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-item { background: transparent; border: 0; color: #dbe3f0; text-align: left; padding: 9px 10px;
  border-radius: 5px; font-size: 13.5px; cursor: pointer; }
.side-item:hover { background: rgba(255,255,255,.08); }
.side-item.on { background: #fff; color: #1f3864; font-weight: 600; }
.side-actions { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.side-btn { width: 100%; font-size: 12.5px; padding: 7px 8px; }
.side-foot { border-top: 1px solid rgba(255,255,255,.15); padding-top: 10px; color: #c8d3e6; }
.main { flex: 1; min-width: 0; padding: 18px; }
/* 内容区顶部栏：页面名称 + 当前用户 + 退出 */
.mainbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 16px; margin-bottom: 12px; }
.mainbar .tb-title { font-size: 15px; font-weight: 600; color: var(--navy); }
.mainbar .tb-right { display: flex; align-items: center; gap: 12px; }
.mainbar .tb-user { position: relative; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; font-size: 13px; }
.mainbar .tb-user .hint { font-size: 12px; }
.mainbar .tb-user .user-btn {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 12px;
  background: #fff; border: 1px solid #c9d3e2; border-radius: 999px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.mainbar .tb-user .user-btn:hover { background: #f6f9fd; border-color: #8fa5c4; box-shadow: 0 1px 4px rgba(31, 56, 100, .12); }
.mainbar .tb-user .user-btn b { font-weight: 600; }
/* 下拉标识：实心三角 + 深色圆底，展开时翻转 180°，保证一眼看出可点 */
.mainbar .tb-user .user-btn .caret {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; margin-left: 2px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 10px; line-height: 1;
  opacity: 1; transition: transform .18s ease, background .15s ease;
}
.mainbar .tb-user .user-btn:hover .caret { background: #2a4a80; }
.mainbar .tb-user .user-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.mainbar .tb-user .user-menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 148px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12); z-index: 80;
}
.mainbar .tb-user .user-menu[hidden] { display: none; }
.mainbar .tb-user .user-menu a {
  display: block; padding: 8px 10px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: 13px;
}
.mainbar .tb-user .user-menu a:hover { background: #f1f5f9; }
@media print { .mainbar { display: none; } }
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-actions { margin-top: 0; flex-direction: row; }
  .side-foot { border-top: 0; padding-top: 0; }
}

/* 图标导航：默认收起 62px，悬停展开 210px */
.side { width: 62px; transition: width .18s ease; overflow: hidden; }
.side:hover { width: 210px; }
.side .lbl { opacity: 0; transition: opacity .12s ease; white-space: nowrap; }
.side:hover .lbl { opacity: 1; }
.side .ico { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; }
.side-item { display: flex; align-items: center; gap: 10px; }
/* 侧栏未处理报警计数：收起时贴在图标右上角，展开时跟在文字后面 */
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #d64545; color: #fff; font-size: 11.5px; line-height: 18px; text-align: center; font-weight: 600; }
.side[data-collapsed="1"]:not(:hover) .nav-badge { margin-left: 0; position: absolute; transform: translate(-6px, -6px); }
.side-item { position: relative; }
.side-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.side-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }
.side-btn .lbl { display: none; }
.side:hover .side-btn .lbl { display: inline; }
@media (max-width: 900px) {
  .side, .side:hover { width: 100%; }
  .side .lbl, .side:hover .lbl { opacity: 1; display: inline; }
  .side-btn .lbl { display: inline; }
}

/* 流程设计器 */
.df-canvas { min-height: 340px; background: #f7f9fc; border: 1px dashed #c9ced6; border-radius: 6px; margin: 10px 0; }
.df-node { font-size: 12px; line-height: 1.3; }
.df-node b { font-weight: 600; }
#df-canvas .drawflow-node { width: 150px; min-height: 54px; border-radius: 6px; padding: 8px; background: #fff; }
#df-canvas .nd-start { border: 1px solid #2f5597; }
#df-canvas .nd-approve { border: 1px solid #2f5597; }
#df-canvas .nd-condition { border: 1px solid #2f5597; transform: rotate(0deg); background: #eef7ea; }
#df-canvas .nd-countersign { border: 1px dashed #b8860b; background: #fff8e8; }
#df-canvas .nd-end { border: 1px solid #8b3a3a; }

#df-canvas .nd-subflow { border: 1px solid #6b4a00; background: #fff7e0; }


/* 用户额外权限选择 */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 4px 0 12px; }
.perm-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.perm-item input { width: auto; }
.perm-item.locked { color: #6b7280; }

/* 缺陷代码选择：复选框与文字紧邻、整体左对齐（全局 input 宽 100% 会把复选框拉宽） */
.code-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; padding: 2px; }
.code-pick { display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 5px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; text-align: left; }
.code-pick:hover { background: #f3f6fa; }
.code-pick input[type="checkbox"] { width: 15px; height: 15px; min-width: 0; flex: none; margin: 0; padding: 0; accent-color: var(--navy); }
.code-pick .code-txt { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-pick .hint { margin-left: 4px; }


/* 台账筛选栏：每项都有可见表头，窄屏自动换行 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }
.filter-item { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filter-item > span { padding-left: 2px; white-space: nowrap; }
.filter-item select, .filter-item input { min-width: 130px; }
.filter-item.grow { min-width: 240px; }
.filter-item.grow input { width: 100%; }
.filter-item.check .opt { display: flex; align-items: center; gap: 6px; height: 38px; color: var(--text); font-size: 13px; }
.filter-item.check .opt input { min-width: auto; width: auto; }


/* 指派给当前用户的未读标记 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e11d48; margin-right: 6px; vertical-align: middle; }


/* 筛选控件：默认浅蓝底，已选中/有值时变白 */
.filter-item select,
.filter-item input:not([type="checkbox"]) {
  background: #e8f1fd;
  border-color: #c9dcf3;
}
.filter-item.active select,
.filter-item.active input:not([type="checkbox"]) {
  background: #ffffff;
  border-color: #8fb6e6;
}
.filter-item.check .opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #c9dcf3;
  border-radius: 6px;
  background: #e8f1fd;
  color: var(--text);
  font-size: 13px;
}
.filter-item.check.active .opt { background: #ffffff; border-color: #8fb6e6; }

/* 快捷筛选在左、导出/清空固定在右下，不会被筛选项挤到上一行 */
.filter-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.filter-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }


/* 物料名称组合框：输入即筛产品库 */
.combo-list {
  max-height: 210px;
  overflow: auto;
  border: 1px solid #c9dcf3;
  border-radius: 6px;
  background: #fff;
  margin: -6px 0 10px;
  box-shadow: 0 6px 16px rgba(31, 56, 100, 0.08);
}
.combo-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid #eef2f8;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}
.combo-item:last-child { border-bottom: 0; }
.combo-item:hover { background: #e8f1fd; }
.combo-item .hint { font-size: 12px; }
.combo-empty { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }

/* 侧栏二级分组：打印 / 流程
   父级行与一级菜单同缩进、同字号，只有子项缩进，避免大模块名看着比别的模块“凹进去一截” */
.side-group { display: flex; flex-direction: column; gap: 2px; margin-left: 0; padding-left: 0; }
.side-parent { display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; color: #dbe3f0; padding: 9px 10px; border-radius: 5px;
  font-size: 13.5px; cursor: pointer; text-align: left; }
.side-parent:hover { background: rgba(255,255,255,.08); }
.side-parent.active { color: #fff; font-weight: 600; }
.side-parent .caret { margin-left: auto; font-size: 10px; opacity: .75; transition: transform .15s ease; }
.side-group.open .side-parent .caret { transform: rotate(180deg); }
.side-sub { display: flex; flex-direction: column; gap: 2px; }
.side-sub .side-item { padding-left: 36px; font-size: 13px; }
.side[data-collapsed="1"]:not(:hover) .side-parent .caret { display: none; }
.side[data-collapsed="1"]:not(:hover) .side-sub .side-item { padding-left: 10px; }

/* 人员勾选列表（推送设置 / 报警接收人共用）：复选框贴左、姓名与部门分行，多列对齐 */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 10px; }
.pick-grid.pick-box { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  max-height: 260px; overflow: auto; }
.pick-item { display: flex; align-items: flex-start; gap: 7px; padding: 5px 7px;
  border: 1px solid transparent; border-radius: 5px; font-size: 13px; line-height: 1.35; }
.pick-item:hover { background: #f5f8fd; border-color: #e3ebf7; }
.pick-item input { width: auto; min-width: auto; margin: 2px 0 0 0; flex: none; }
.pick-item .pick-txt { min-width: 0; }
.pick-item .pick-nm { display: block; color: var(--text); font-weight: 500; }
.pick-item .pick-meta { display: block; color: var(--muted); font-size: 12px; }

/* 角色页：选中角色用蓝色底 */
.tabs.role-tabs .tab.on { background: #1f4fa8; border-color: #1f4fa8; color: #fff; font-weight: 600; }
