:root {
  --bg: #f1f3f6;
  --panel: #ffffff;
  --ink: #16202c;
  --muted: #667487;
  --line: #dfe4ea;
  /* 主题色跟着公司 logo 走：盾牌藏蓝 + 闪电金 */
  --brand: #0d3a66;
  --brand-2: #1c6ea8;
  --navy-deep: #071f3a;
  --accent: #c8901a;
  --gold: #d4a218;
  --gold-2: #f0c040;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 30, 50, .06), 0 6px 20px rgba(16, 30, 50, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.55 "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
/* 链接不加下划线（名称下面那道横线看着像分隔线，影响阅读）；
   鼠标移上去才显示下划线，用颜色区分可点 */
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #16202c 0%, #24405f 60%, #3a5f86 100%);
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 30px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card .brand { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 11px;
  background: transparent;                     /* 透明底，露出 logo 本身 */
  display: grid; place-items: center; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* 侧边栏是深色底，盾牌外侧加一点浅色光晕，免得暗部糊在一起 */
.brand.small .brand-mark {
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%);
}
.login-card h1 { font-size: 21px; text-transform: uppercase; letter-spacing: .09em; }
.login-card p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.login-foot { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 12px; }
.login-foot .login-hint { text-align: left; line-height: 1.6; }
.login-addr {
  margin: 8px 0 0; padding: 9px 11px; border-radius: 8px; text-align: center;
  background: #f2f6fb; border: 1px solid #d9e4f0; color: var(--brand);
  font: 600 14px/1.4 "Consolas", "Microsoft YaHei", monospace;
  letter-spacing: .02em; user-select: all; word-break: break-all;
}
.login-addr.plain { font: 13px/1.5 "Microsoft YaHei", system-ui, sans-serif; font-weight: 400; color: var(--muted); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, #0b2f56 0%, #071f3a 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand.small { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; }
.brand.small .brand-mark { width: 36px; height: 36px; font-size: 13px; border-radius: 9px; }
.brand.small strong {
  display: block; color: #fff; font-size: 15px;
  text-transform: uppercase; letter-spacing: .08em;   /* 跟 logo 上的 SAFEBLAST 一致 */
}
.brand.small span { font-size: 11.5px; color: #8fa3ba; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b8099; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: #cbd5e1; border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(28, 110, 168, .55), rgba(28, 110, 168, .12));
  color: #fff; box-shadow: inset 3px 0 0 var(--gold-2);
}
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }
.nav-item .badge {
  margin-left: auto; background: #b91c1c; color: #fff;
  border-radius: 9px; font-size: 11px; padding: 0 6px; line-height: 17px;
}
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .09); padding: 12px; font-size: 12.5px; }
#who { color: #fff; margin-bottom: 2px; }
#who small { color: #8fa3ba; display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.body { padding: 18px; max-width: 1400px; width: 100%; }

/* ---------- 通用组件 ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 13px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: .12s; white-space: nowrap;
}
.btn:hover { background: #f6f8fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: #fff; border-color: #f0c4c4; color: var(--danger); }
.btn.danger:hover { background: #fdf2f2; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(44, 74, 110, .28); border-color: var(--brand-2); }
input[readonly] { background: #f4f6f9; color: var(--muted); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
label.field > span { font-weight: 500; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-head {
  padding: 12px 15px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; flex: 1; min-width: 120px; }
.card-body { padding: 15px; }
.card-body.tight { padding: 0; }

.kpi { padding: 14px 16px; }
.kpi .v { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kpi.accent .v { color: var(--accent); }
.kpi.danger .v { color: var(--danger); }
.kpi.ok .v { color: var(--ok); }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px;
  padding: 9px 12px; background: #f7f9fc; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
/* 总表每个分区一张表：分区标题固定在顶上，列名紧接着停在它下面 ——
   下滑时永远知道自己在看哪一类、哪几列。 */
.table-wrap thead tr.cols > th { top: 40px; z-index: 2; }
tbody td { padding: 8px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
tbody tr:hover { background: #fafbfd; }
tbody tr.total { font-weight: 600; background: #f7f9fc; }
.table-wrap { overflow: auto; max-height: 68vh; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.center, td.center, th.center { text-align: center !important; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; border: 1px solid; line-height: 18px; white-space: nowrap;
}
.tag.gray { color: #475569; border-color: #d7dee7; background: #f6f8fb; }
.tag.blue { color: #1d4ed8; border-color: #c7d7fb; background: #eff4ff; }
.tag.green { color: #15803d; border-color: #bfe3cb; background: #f0fbf3; }
.tag.amber { color: #b45309; border-color: #f3dcb4; background: #fff8ec; }
.tag.red { color: #b91c1c; border-color: #f3c4c4; background: #fdf2f2; }
.tag.purple { color: #6d28d9; border-color: #ddd0fb; background: #f6f2ff; }

.hazard-banner {
  background: #fff8ec; border: 1px solid #f3dcb4; color: #92400e;
  padding: 10px 13px; border-radius: 9px; font-size: 13px; display: flex; gap: 9px;
}
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 140px; }

/* ---------- 单据类型选择 ---------- */
.cat-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 20px; padding: 5px 13px; font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: .12s;
}
.chip:hover { background: #f6f8fb; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip em { font-style: normal; font-size: 11.5px; opacity: .65; }
.chip.on em { opacity: .85; }

/* 分类标题行：每个分区最上面一行（上面是它，下面是这一类的列名和数据） */
.group-head {
  background: #eef3fa !important; color: #1f3550; font-size: 13.5px;
  border-top: 2px solid #cfdcec; border-bottom: 1px solid #cfdcec;
  position: sticky; top: 0; z-index: 3;
  height: 42px; padding: 5px 12px; text-align: left;
}
.group-head .muted { font-weight: 400; font-size: 12px; margin-left: 8px; }
/* 分区名（点一下改名字） */
.group-head .gh-name { cursor: pointer; border-bottom: 1px dashed #8aa4c4; }
.group-head .gh-name:hover { color: var(--brand); }
/* 分区标题右边的按钮：入库 / 出库 / 转移 / ＋增加 / 删除这类 */
.group-head .group-acts {
  display: inline-flex; gap: 5px; align-items: center;
  margin-left: 12px; vertical-align: middle;
}
.group-head .group-acts .btn {
  background: #fff; border-color: #cfdcec; color: #35506f;
  padding: 2px 9px; font-size: 12px;
}
.group-head .group-acts .btn:hover { background: #f2f7ff; border-color: #a9c2dd; }
/* 卡片标题栏里的「已选 N 项」批量操作条 */
.selbar { margin-left: auto; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
/* 「当页记账」小窗顶上那条：自动记账到哪本台账 */
.auto-note {
  background: #eef3fa; border: 1px solid #cfdcec; color: #1f3550;
  border-radius: 9px; padding: 10px 13px; font-size: 13px;
}
.auto-note .muted { color: #667487; }
/* 照片旁边「照着手打」那一行 */
.cand-add {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  margin-top: 12px; padding: 10px 12px; border: 1px dashed #c6d2e0;
  border-radius: 9px; background: #fbfcfe;
}
/* 危险 / 不可恢复的提示（删除、冲销这类） */
.danger-note {
  background: #fdf2f2; border: 1px solid #f3c4c4; color: #8c1c1c;
  border-radius: 9px; padding: 10px 13px; font-size: 13px; display: flex; gap: 9px;
}
/* 页面内确认框里的说明文字 */
.ask-msg { font-size: 13.5px; line-height: 1.7; color: #16202c; }
.ask-msg b { color: #b91c1c; }
/* 服务器换了新版界面时，提醒刷新（省得对着旧页面找按钮） */
.page-hint {
  background: #f4f8ff; border: 1px solid #d7e3f5; color: #274b73;
  border-radius: 9px; padding: 9px 13px; font-size: 13px; margin-bottom: 14px;
}
.update-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 999;
  display: flex; align-items: center; gap: 10px;
  background: #16202c; color: #fff; border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(15, 32, 55, .28);
}
.ov-table th.selcol, .ov-table td.selcol { width: 34px; }
/* 所有分区共用同一套列宽（table-layout:fixed + colgroup），
   这样每张表的每一列都对齐，「操作」那一列也永远在同一个位置 */
.ov-table { table-layout: fixed; min-width: 1210px; }
/* 列表类表格：列宽定死，中文不会被挤成竖排 */
.t-fixed { table-layout: fixed; min-width: 1000px; }
.t-fixed td, .t-fixed th { overflow: hidden; text-overflow: ellipsis; }
/* 多行内容（物料摘要、备注）允许换行，别裁掉 */
.t-fixed td.wrap-ok { white-space: normal; overflow: visible; }
/* 「操作」那一列钉在右边：横向滚动时入库 / 出库 / 转移 / 删除永远看得见 */
.ov-table th.opscol {
  width: 186px; white-space: nowrap;
  position: sticky; right: 0; z-index: 4;
}
.ov-table tbody td.ops {
  white-space: nowrap; position: sticky; right: 0; z-index: 1; background: #fff;
  box-shadow: -7px 0 7px -7px rgba(15, 32, 55, .25);
}
.ov-table tbody tr:hover td.ops { background: #fafbfd; }
/* 总表列多，间距收紧一点，尽量一屏放得下，不用左右拉 */
.ov-table thead th, .ov-table tbody td { padding-left: 8px; padding-right: 8px; }
.ov-table .ops .btn { padding: 4px 7px; }
.ov-table td.clip-cell { max-width: 132px; }
.ov-table small.clip { max-width: 100px; }
td.ed { cursor: text; border-bottom: 1px dashed #c6d2e0 !important; }
td.ed:hover { background: #fffdf4; box-shadow: inset 0 0 0 1px #f3dcb4; }
td.ed input { padding: 3px 6px; font-size: 13px; }
/* 备注之类的长文字压成一行，鼠标停上去看全文，别把表格行撑高 */
small.clip {
  display: block; max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
/* 一行放不下就省略号，鼠标停上去看全文；别把表格行撑成好几行 */
td.clip-cell {
  max-width: 170px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

.dtype-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.dtype-pick button {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 9px 13px; cursor: pointer; font: inherit; font-size: 13.5px; text-align: left;
  display: flex; flex-direction: column; gap: 1px; min-width: 108px;
}
.dtype-pick button small { color: var(--muted); font-size: 11.5px; }
.dtype-pick button.on { border-color: var(--brand-2); background: #eef3fa; box-shadow: inset 0 0 0 1px var(--brand-2); }
.dtype-pick button.on small { color: var(--brand-2); }
.dtype-pick-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 12px 18px; cursor: pointer; font: inherit; font-size: 14px;
  display: flex; flex-direction: column; gap: 2px; text-align: left; min-width: 190px;
}
.dtype-pick-btn small { color: var(--muted); font-size: 11.5px; }
.dtype-pick-btn:hover { border-color: var(--brand-2); background: #f7f9fc; }
.dtype-pick-btn.on {
  border-color: var(--brand-2); background: #eef3fa;
  box-shadow: inset 0 0 0 1px var(--brand-2);
}
.dtype-pick-btn.on small { color: var(--brand-2); }

/* ---------- 物料选择下拉 ---------- */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 3px);
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 30px rgba(16, 30, 50, .16); max-height: 250px; overflow: auto; min-width: 240px;
}
.combo-list div { padding: 7px 11px; cursor: pointer; font-size: 13px; display: flex; gap: 8px; }
.combo-list div:hover, .combo-list div.hi { background: #eef3fa; }
.combo-list div .sub { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.combo-list .none { color: var(--muted); cursor: default; }
.combo-list .none:hover { background: none; }
.combo-list .combo-head {
  position: sticky; top: 0; background: #f4f7fb; color: #1f3550;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 5px 11px; border-bottom: 1px solid #e4eaf2; cursor: default;
  display: block;
}
.combo-list .combo-head:hover { background: #f4f7fb; }
.combo-list .combo-head em { font-style: normal; color: var(--muted); font-weight: 400; }
.combo-list .combo-head b { color: #b45309; font-weight: 600; }
.conv { font-size: 11.5px; color: #15803d; margin-top: 2px; white-space: nowrap; }

/* ---------- 流转链 ---------- */
.trace { position: relative; padding-left: 20px; }
.trace::before {
  content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: #dfe4ea;
}
.trace-item { position: relative; padding: 0 0 12px 8px; }
.trace-dot {
  position: absolute; left: -19px; top: 6px; width: 11px; height: 11px;
  border-radius: 50%; background: #94a3b8; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #dfe4ea;
}
.trace-dot.green { background: #15803d; }
.trace-dot.blue { background: #1d4ed8; }
.trace-dot.amber { background: #b45309; }
.trace-dot.purple { background: #6d28d9; }
.trace-dot.red { background: #b91c1c; }
.trace-body { background: #fafbfd; border: 1px solid #eef1f5; border-radius: 8px; padding: 8px 11px; }
.trace-head { display: flex; gap: 9px; align-items: center; font-size: 13.5px; flex-wrap: wrap; }
.trace-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.step-table td { vertical-align: top; font-size: 13px; }
.step-table .tl { display: inline-block; white-space: nowrap; }
.step-table .tl b { font-weight: 600; }

.drop-zone {
  border: 2px dashed #c6d2e0; border-radius: 12px; padding: 26px 18px;
  text-align: center; cursor: pointer; background: #fafbfd; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--brand-2); background: #eef3fa; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column; position: relative;
}
.photo-thumb {
  height: 150px; background: #eef1f5; display: grid; place-items: center;
  cursor: zoom-in; overflow: hidden;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-meta { padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 4px; }
.photo-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-acts { padding: 6px 10px 10px; display: flex; gap: 6px; }
.photo-pick { position: absolute; top: 7px; left: 7px; z-index: 2;
  background: rgba(255,255,255,.92); border-radius: 6px; padding: 2px 5px; }
.photo-pick input { width: auto; }

.mini-photo {
  width: 104px; height: 104px; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; cursor: zoom-in; background: #eef1f5;
}
.mini-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cap-view { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.cap-img { background: #16202c; border-radius: 10px; display: grid; place-items: center; min-height: 360px; overflow: auto; }
.cap-img img { max-width: 100%; max-height: 72vh; display: block; }
.cap-side { min-width: 0; }
.cand {
  display: flex; gap: 8px; align-items: center; font-size: 13px;
  background: #eef3fa; border: 1px solid #dbe6f3; border-radius: 7px; padding: 5px 9px;
}
.cand-row {
  display: flex; gap: 8px; align-items: center; font-size: 13.5px;
  background: #eef3fa; border: 1px solid #dbe6f3; border-radius: 7px;
  padding: 6px 9px; margin-top: 8px; flex-wrap: wrap;
}
.cand-row input { width: auto; }
.cand-row .chips { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; }
.nchip {
  border: 1px solid #c6d2e0; background: #fff; border-radius: 6px;
  padding: 2px 9px; font: inherit; font-size: 12.5px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.nchip:hover { background: #f2f7fd; }
.nchip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cand-raw { font-size: 11.5px; color: var(--muted); margin: 3px 0 0 26px; }
@media (max-width: 900px) {
  .cap-view { grid-template-columns: 1fr; }
  .cap-img { min-height: 220px; }
}

.flow { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.flow-node {
  flex: 1 1 165px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 13px; position: relative;
}
.flow-node .t { font-size: 12.5px; color: var(--muted); }
.flow-node .q { font-size: 20px; font-weight: 600; margin: 5px 0 2px; font-variant-numeric: tabular-nums; }
.flow-node .b { font-size: 11.5px; color: var(--muted); }
.flow-line { font-size: 13.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.flow-line b { font-size: 16px; }
.flow-node.warn { border-color: #f3dcb4; background: #fffdf8; }
.flow-node.zero .q { color: #9aa7b6; }
.flow-arrow { align-self: center; color: #b6c2d1; font-size: 18px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(14, 22, 33, .5);
  display: grid; place-items: center; z-index: 100; padding: 18px;
}
.modal {
  background: #fff; border-radius: 12px; width: min(720px, 100%);
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.modal.wide { width: min(1000px, 100%); }
.modal-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { flex: 1; font-size: 15px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

/* ---------- 提示 ---------- */
.toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #16202c; color: #fff; padding: 10px 15px; border-radius: 9px;
  font-size: 13.5px; max-width: 460px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  white-space: pre-wrap; animation: pop .18s ease-out;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- 打印 ---------- */
.ledger-sheet { width: 100%; border-collapse: collapse; }
.ledger-sheet th, .ledger-sheet td {
  border: 1px solid #94a3b8; padding: 5px 8px; font-size: 13px;
}
.ledger-sheet thead th {
  background: #f1f5fa; text-align: center; color: #1f3550;
  position: static; font-size: 12.5px;
}
.ledger-sheet tbody td { height: 32px; }
.ledger-sheet tbody tr:hover { background: transparent; }
.ledger-sheet .total td { background: #f7f9fc; font-weight: 600; }

.print-area { display: none; }
/* 台账表头：屏幕上只看中文（后台都是中国人），打印出来才是中英文对照（当地员工要填） */
.scr-only { display: inline; }
.prt-only { display: none; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toast-root { display: none !important; }
  .body { padding: 0; }
  .no-print { display: none !important; }
  .print-area { display: block !important; }
  .scr-only { display: none !important; }
  .prt-only { display: inline !important; }
  .card { box-shadow: none; border: 0; }
  table { font-size: 11pt; }
  thead th { background: #fff; border-bottom: 1.5px solid #000; }
  tbody td { border-bottom: .5px solid #999; }
  .table-wrap { max-height: none; overflow: visible; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .sidebar {
    position: fixed; z-index: 90; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s;
  }
  .sidebar.open { transform: none; }
  .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #menu-toggle { display: block; }
}
@media (min-width: 921px) { #menu-toggle { display: none; } }
@media (max-width: 560px) {
  .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; }
  .body { padding: 12px; }
}

/* ---------- 首页看板：深色实时总览 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 14px; padding: 18px 20px 16px;
  background:
    radial-gradient(1000px 300px at 12% -30%, rgba(28, 110, 168, .55), transparent 60%),
    radial-gradient(680px 260px at 100% 120%, rgba(212, 162, 24, .22), transparent 62%),
    linear-gradient(135deg, #0b2f56 0%, #0a2444 45%, #071f3a 100%);
  color: #e8eef6;
  box-shadow: 0 18px 40px rgba(7, 31, 58, .28);
}
/* 细网格：像监控屏，不是花纹 */
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .65), transparent 78%);
}
.hero > * { position: relative; z-index: 1; }
.hero-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.hero-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 260px; }
.hero-title h3 { font-size: 17px; letter-spacing: .02em; color: #fff; }
.hero-title p { margin: 4px 0 0; font-size: 12.5px; color: #9db4cd; }
.pulse {
  width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px;
  background: var(--gold-2); box-shadow: 0 0 0 0 rgba(240, 192, 64, .7);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(240, 192, 64, .55); }
  70% { box-shadow: 0 0 0 11px rgba(240, 192, 64, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 192, 64, 0); }
}
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hchip {
  font-size: 12.5px; padding: 5px 11px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #d6e2f0;
}
.hchip b { color: #fff; font-variant-numeric: tabular-nums; }
.hchip.warn { border-color: rgba(240, 192, 64, .5); color: #f6d98a; background: rgba(240, 192, 64, .12); }
.hchip.ok { border-color: rgba(74, 222, 128, .4); color: #a7f3c0; background: rgba(74, 222, 128, .1); }

.hero-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.hkpi {
  padding: 13px 15px 12px; border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .1);
  border-top: 2px solid rgba(240, 192, 64, .65);
}
.hkpi .hk-l { font-size: 12.5px; color: #9db4cd; }
.hkpi .hk-v {
  margin-top: 4px; font-size: 29px; font-weight: 600; line-height: 1.1; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.hkpi .hk-v small { font-size: 13px; font-weight: 400; color: #9db4cd; margin-left: 4px; }
.hkpi .hk-s { margin-top: 3px; font-size: 11.5px; color: #8fa6c0; }
.hkpi.warn { border-top-color: #f0c040; }
.hkpi.warn .hk-v { color: #f7d67c; }
.hkpi.ok .hk-v { color: #8ce9ac; }

.flow-strip {
  margin-top: 16px; display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 13px;
}
.flow-node {
  flex: 1 1 130px; min-width: 118px; text-align: left; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .045);
  border-radius: 10px; padding: 9px 11px; color: #dce7f3;
  display: flex; flex-direction: column; gap: 2px;
  font: inherit; transition: border-color .15s, background .15s, transform .15s;
}
.flow-node:hover { border-color: rgba(240, 192, 64, .55); background: rgba(240, 192, 64, .1); transform: translateY(-1px); }
.flow-node .fn-name { font-size: 12px; color: #9db4cd; }
.flow-node .fn-qty {
  font-size: 19px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums;
}
.flow-node .fn-sub { font-size: 11px; color: #8fa6c0; }
.flow-arrow { align-self: center; color: rgba(240, 192, 64, .75); font-size: 18px; }
.flow-tail {
  align-self: center; margin-left: 6px; font-size: 11.5px; color: #8fa6c0;
  border-left: 1px solid rgba(255, 255, 255, .12); padding-left: 10px;
}

/* 最近登记：时间轴 */
.tl { padding: 6px 0; max-height: 430px; overflow: auto; }
.tl-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 15px 7px 13px;
  border-left: 2px solid var(--line); margin-left: 20px; position: relative; cursor: pointer;
}
.tl-row:hover { background: #f7f9fc; }
.tl-dot { position: absolute; left: -6px; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.tl-dot.in { background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, .12); }
.tl-dot.out { background: var(--accent); box-shadow: 0 0 0 3px rgba(200, 144, 26, .14); }
.tl-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-mat { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-mat small { color: var(--muted); font-size: 11.5px; }
.tl-qty { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tl-qty.in { color: var(--ok); }
.tl-qty.out { color: var(--accent); }
.tl-by { font-size: 12px; color: var(--muted); min-width: 56px; text-align: right; }

/* 需要关注 */
.alert-cap { margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
.alert-cap:first-child { margin-top: 0; }
.alert-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.alert-row:last-child { border-bottom: 0; }
.alert-row .al-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row .al-val { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* 库位 / 工序节点卡片 */
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 11px; }
.loc-card {
  text-align: left; cursor: pointer; font: inherit;
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
  background: linear-gradient(180deg, #fbfcfe, #fff);
  display: flex; flex-direction: column; gap: 3px;
  border-left: 3px solid var(--brand-2);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.loc-card:hover { border-color: var(--brand-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.loc-card .lc-name { font-weight: 600; color: var(--ink); }
.loc-card .lc-hz {
  font-style: normal; font-size: 11px; color: var(--warn);
  border: 1px solid #f3dcb4; background: #fff8ec; border-radius: 6px; padding: 0 5px; margin-left: 4px;
}
.loc-card .lc-kinds { font-size: 12.5px; color: var(--muted); }
.loc-card .lc-foot { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.dot.green { background: var(--ok); }
.dot.amber { background: var(--warn); }
.dot.gray { background: #cbd5e1; }

@media (max-width: 920px) {
  .hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 多人同时用：在线人数 / 有新登记提示 ---------- */
.online-chip {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 20px; padding: 4px 11px; font: inherit; font-size: 12.5px;
}
.online-chip:hover { border-color: var(--brand-2); color: var(--brand); }
.online-chip .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, .12); }
.pulse-chip {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #0b2f56, #071f3a);
  color: #e8eef6; border: 1px solid rgba(240, 192, 64, .45);
  border-radius: 12px; padding: 10px 14px; box-shadow: 0 14px 32px rgba(7, 31, 58, .35);
  font-size: 13px;
}
.pulse-chip.hidden { display: none; }
.pulse-chip b { color: var(--gold-2); }

/* 数据与安全里的备份状态条 */
.bk-box {
  background: #f4f8fc; border: 1px solid #dbe6f1; border-radius: 9px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 13px; line-height: 1.7;
}
