/* ============================================================================
   植莱 KDS · 设计系统 v2
   ----------------------------------------------------------------------------
   设计前提：面向几十到上百个日常用户（计划/仓管/拣货/配送/线长/主管）。
   因此：
     · 一个页面只做一件事，模块边界靠导航硬隔开，不靠 tab 混排
     · 视觉层级只有三级：模块名 → 页面名 → 内容块，绝不出现第四级
     · 所有页面共用同一套骨架（侧栏 + 页头 + 内容），学一次全站都会
     · 少用装饰：靠留白、细线、克制的色彩区分，不靠阴影和渐变

   Token 只在这里定义一次；页面里不要写死颜色。
   ========================================================================== */

:root {
  /* 底色与分隔 —— 三层表面：页面底 / 卡片面 / 卡片内嵌面 */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef1f6;
  --line: #e2e7ee;
  --line-soft: #edf0f5;

  /* 文字 —— 四级层次，正文只用 text / text-2 */
  --text: #101828;
  --text-2: #475467;
  --text-3: #7c8798;
  --text-4: #a4adbb;

  /* 主色（品牌蓝）：主按钮、选中态、链接 */
  --brand: #2557d6;
  --brand-dark: #1c409e;
  --brand-soft: #eaf0fe;
  --brand-line: #c7d6f8;

  /* 语义色：绿=完成/正常 黄=待办/超时 红=异常/危险 蓝=进行中 */
  --ok: #0f7b46;
  --ok-soft: #e6f6ed;
  --warn: #a25c07;
  --warn-soft: #fdf4e3;
  --bad: #bc2b2b;
  --bad-soft: #fdecec;
  --info: #0a6577;
  --info-soft: #e5f4f7;

  /* 尺寸：统一密度，别在页面里各写各的 */
  --sidebar: 232px;
  --header: 62px;
  --row: 40px;            /* 表格行高 */
  --ctl: 32px;            /* 控件高度（输入/下拉/按钮） */
  --ctl-sm: 26px;         /* 小控件（表格内按钮） */
  --r-sm: 6px;
  --r: 9px;
  --r-lg: 13px;

  /* 字体 */
  --mono: "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
          "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
/* 统一字阶：全站只有三级标题，页面里不要再写 font-size 造第四级 */
h1 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 14px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
table { border-collapse: collapse; }

/* ============================ 骨架 ============================ */

.app { display: flex; min-height: 100vh; }

/* ---- 侧栏 ---- */
.side {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.side .logo {
  height: var(--header); display: flex; align-items: center; gap: 9px;
  padding: 0 18px; border-bottom: 1px solid var(--line-soft); flex: 0 0 var(--header);
}
.side .logo .mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--brand);
  color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex: 0 0 26px;
}
.side .logo b { font-size: 14px; letter-spacing: -.01em; }
.side .logo span { font-size: 10.5px; color: var(--text-3); display: block; margin-top: -2px; }

.side nav { flex: 1; overflow-y: auto; padding: 10px 10px 18px; }
.side .grp { margin-bottom: 4px; }
.side .grp > .gh {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  user-select: none;
}
.side .grp > .gh:hover { background: var(--surface-3); }
.side .grp > .gh .ic {
  width: 18px; text-align: center; font-size: 13px; color: var(--text-3);
}
.side .grp > .gh .ar { margin-left: auto; font-size: 9px; color: var(--text-4); transition: transform .15s; }
.side .grp.open > .gh { color: var(--text); }
.side .grp.open > .gh .ar { transform: rotate(90deg); }
.side .grp.on > .gh { color: var(--brand); }
.side .grp.on > .gh .ic { color: var(--brand); }

.side .kids { display: none; padding: 2px 0 6px; }
.side .grp.open .kids { display: block; }
.side .kids a {
  display: block; padding: 7px 10px 7px 37px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--text-2); font-size: 13px;
  position: relative;
}
.side .kids a:hover { background: var(--surface-3); color: var(--text); }
.side .kids a.on {
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.side .kids a.on::before {
  content: ''; position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; border-radius: 2px; background: var(--brand);
}

.side .me {
  border-top: 1px solid var(--line-soft); padding: 10px 14px;
  display: flex; align-items: center; gap: 9px;
}
.side .me .av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3);
  color: var(--text-2); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: 0 0 28px;
}
.side .me .nm { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.side .me .rl { font-size: 11px; color: var(--text-3); }
.side .me .out { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.side .me .out:hover { color: var(--bad); }

/* ---- 主区 ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.head {
  height: var(--header); flex: 0 0 var(--header);
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.head .ttl { min-width: 0; }
.head .ttl .mod {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--brand); text-transform: uppercase;
}
.head .ttl h1 { font-size: 17px; line-height: 1.25; }
.head .grow { flex: 1; }
.head .meta { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

.page { padding: 20px 24px 48px; flex: 1; min-width: 0; }
.page.narrow { max-width: 1080px; }

/* 页内二级导航（同一模块内切页，保持位置不变） */
.tabs {
  display: flex; gap: 2px; padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: var(--header); z-index: 29;
  overflow-x: auto;
}
.tabs a {
  padding: 10px 14px; font-size: 13px; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ============================ 卡片 ============================ */
/* 全站唯一的"块"容器：标题行 / 内容区 / 说明脚 三段固定 */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 14px; overflow: hidden;
}
.card > .ch {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  min-height: 44px;
}
.card > .ch h2 { flex: 0 0 auto; }
.card > .ch .note { font-size: 12px; color: var(--text-3); }
/* 标题行的说明文字：老页面写 .note-t、新页面写 .note —— 视觉必须一致。
   这个类曾经压根没定义，12 个页面都在用，等于各页各长一样。 */
.note-t,
.card > .ch .note-t {
  font-size: 12px; color: var(--text-3); font-weight: 400;
}
.card > .ch .grow { flex: 1; }
.card > .cb { padding: 16px; }
.card > .cb.flush { padding: 0; }
.card > .cf {
  padding: 10px 16px; border-top: 1px solid var(--line-soft);
  background: var(--surface-2); font-size: 12px; color: var(--text-3); line-height: 1.65;
}
.card > .cf b { color: var(--text-2); font-weight: 650; }

/* ============================ 指标块 ============================ */

.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)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.split-r { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }

@media (max-width: 1320px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-r { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .g2, .g3, .g4, .g5, .g6 { grid-template-columns: minmax(0, 1fr); }
}

.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.tile .k { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.tile .v {
  font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tile .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.tile .s { font-size: 11.5px; color: var(--text-3); }
.tile.ok .v { color: var(--ok); }
.tile.warn .v { color: var(--warn); }
.tile.bad .v { color: var(--bad); }
.tile.brand .v { color: var(--brand); }
.tile.info .v { color: var(--info); }
.tile.plain .v { font-size: 19px; font-weight: 650; }
/* 可点的指标块：工作台待办用它。和 .tile 同尺寸，只是多一层 hover —— 
   以前这 7 行写在 index.html 的 <style> 里，别的页面想用就得再抄一遍。 */
a.tile { display: block; color: inherit; transition: border-color .12s, background .12s; }
a.tile:hover { border-color: var(--brand-line); background: var(--brand-soft); }
a.tile .t { font-size: 12.5px; font-weight: 650; color: var(--text); }
a.tile .v { font-size: 22px; font-weight: 750; margin: 4px 0 2px; line-height: 1.15; }
a.tile .s { font-size: 11.5px; color: var(--text-3); }

/* ============================ 按钮 ============================ */
/* 三档：默认 32px / sm 26px（表格内）/ lg 42px（PDA 粗手指） */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl); padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line); color: var(--text); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 550; }
.btn.pri:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #0b6238; border-color: #0b6238; color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #9c2222; border-color: #9c2222; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.ghost.pri { color: var(--brand); }
.btn.sm { height: var(--ctl-sm); padding: 0 9px; font-size: 12px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn .i { font-size: 12px; opacity: .85; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.g4x { gap: 4px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ============================ 表单 ============================ */

.f { display: flex; flex-direction: column; gap: 5px; }
.f > label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.fld {
  height: var(--ctl); padding: 0 10px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.fld:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fld::placeholder { color: var(--text-4); }
.fld.mono { font-family: var(--mono); font-size: 12.5px; }
select.fld { cursor: pointer; padding-right: 26px; }
textarea.fld { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }

/* 统一筛选栏 */
.bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
}
.bar > .fld, .bar > select.fld { width: auto; min-width: 132px; }
.bar .search { position: relative; }
.bar .search .fld { padding-left: 28px; min-width: 200px; }
.bar .search::before {
  content: '⌕'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); font-size: 14px; pointer-events: none;
}

/* ============================ 表格 ============================ */

.tw { overflow: auto; }
.tw.scroll { max-height: 62vh; }
.tbl { width: 100%; font-size: 13px; }
.tbl th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-weight: 650; font-size: 11px; color: var(--text-3);
  padding: 0 12px; height: 34px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td {
  padding: 0 12px; height: var(--row);
  border-bottom: 1px solid var(--line-soft); vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.on { background: var(--brand-soft); }
.tbl tbody tr.click { cursor: pointer; }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .m { font-family: var(--mono); font-size: 12.5px; }
.tbl .w { width: 1%; white-space: nowrap; }
.tbl.compact td, .tbl.compact th { padding: 0 10px; }
.tbl.compact td { height: 32px; }
.tbl .trunc {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.foot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--text-3); background: var(--surface-2);
}

/* ============================ 标记 ============================ */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 4px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.pill::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .75; flex: 0 0 5px;
}
.pill.nodot::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.solid { background: var(--bad); color: #fff; }
.pill.solid::before { background: #fff; }

.code {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--mono); font-size: 11.5px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 7px; }

/* ============================ 提示 ============================ */

.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 13px; border-radius: var(--r-sm);
  font-size: 12.5px; line-height: 1.6;
  background: var(--brand-soft); color: #1c3f9e;
  border: 1px solid var(--brand-line);
}
.note.warn { background: var(--warn-soft); border-color: #f3e0ae; color: #74440a; }
.note.bad { background: var(--bad-soft); border-color: #f4cdcd; color: #8f2020; }
.note.ok { background: var(--ok-soft); border-color: #c6e8d6; color: #0b5c34; }
.note.plain { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.note b { font-weight: 700; }

/* ============================ 空状态 ============================ */

.empty {
  padding: 44px 20px; text-align: center; color: var(--text-3);
}
.empty .ic { font-size: 26px; opacity: .35; margin-bottom: 8px; }
.empty .t { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty .d { font-size: 12.5px; line-height: 1.65; max-width: 420px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }

/* ============================ 进度 ============================ */

.bar-v { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-v > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .3s; }
.bar-v.ok > i { background: var(--ok); }
.bar-v.warn > i { background: var(--warn); }
.bar-v.bad > i { background: var(--bad); }

/* ============================ 时间轴 ============================ */

.tl { border-top: 1px solid var(--line-soft); }
.tl:first-child { border-top: 0; }
.tl-h {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px; background: var(--surface-2); font-size: 12.5px;
}
.tl-h b { font-size: 13px; }
.tl-b { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; }
.ev {
  flex: 0 0 172px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 10px; font-size: 12px;
}
.ev .tm { font-family: var(--mono); font-size: 13.5px; font-weight: 700; }
.ev .sk {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev .mt { margin-top: 7px; display: flex; gap: 4px; flex-wrap: wrap; }
.ev.full { border-left-color: var(--ok); }
.ev.blocked { border-left-color: var(--warn); background: #fffdf6; }
.ev.short { border-left-color: var(--bad); background: #fffafa; }
.ev.none { border-left-color: #cfd6e0; }
.ev.done { opacity: .55; }

/* ============================ 抽屉 / 弹窗 ============================ */

.mask {
  position: fixed; inset: 0; background: rgba(19, 26, 38, .38);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 960px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(19, 26, 38, .22);
}
.modal > .mh {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal > .mh h2 { flex: 1; }
.modal > .mb { padding: 16px 18px; overflow: auto; }
.modal > .mf {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* 右侧抽屉：看单不跳页，关掉回到原位。
   与 modal 的分工：modal 用于「填表单」，drawer 用于「看一单」。 */
.dmask {
  position: fixed; inset: 0; background: rgba(19, 26, 38, .30);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.dmask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 94vw;
  background: var(--surface); z-index: 91;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(19, 26, 38, .16);
  transform: translateX(102%); transition: transform .2s ease;
}
.drawer.open { transform: translateX(0); }
.drawer > .dh {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.drawer > .dh h2 { flex: 1; font-size: 15px; min-width: 0; overflow: hidden;
                   text-overflow: ellipsis; white-space: nowrap; }
.drawer > .db { padding: 16px 18px; overflow: auto; flex: 1; }
.drawer > .df {
  display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line);
  background: var(--surface-2); flex: 0 0 auto; flex-wrap: wrap;
}
.drawer .dsec { margin-top: 18px; }
.drawer .dsec:first-child { margin-top: 0; }
.drawer .dsec > h3 {
  font-size: 11.5px; color: var(--text-3); font-weight: 700;
  letter-spacing: .05em; margin-bottom: 8px;
}
.drawer .kv { display: grid; grid-template-columns: 76px 1fr; gap: 5px 10px; font-size: 12.5px; }
.drawer .kv .k { color: var(--text-3); }
.drawer .kv .v { color: var(--text-2); word-break: break-all; }

/* 抽屉里的环节条：这单走到哪一步了，一眼看到 */
.dstages { display: flex; gap: 0; overflow-x: auto; padding: 2px 0 6px; }
.dstages .n {
  flex: 1; min-width: 74px; position: relative; padding-top: 16px; text-align: center;
}
.dstages .n::before {
  content: ''; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--line);
}
.dstages .n:first-child::before { left: 50%; }
.dstages .n:last-child::before { right: 50%; }
.dstages .n i {
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--line);
}
.dstages .n.done i { background: var(--ok); border-color: var(--ok); }
.dstages .n.on i { background: var(--brand); border-color: var(--brand);
                   box-shadow: 0 0 0 3px var(--brand-soft); }
.dstages .n .t { font-size: 10.5px; font-weight: 600; color: var(--text-2); }
.dstages .n .d { font-size: 10px; color: var(--text-3); font-family: var(--mono); }


/* ============================ Toast ============================ */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  min-width: 220px; max-width: 420px; padding: 10px 14px;
  border-radius: var(--r-sm); background: #1c2433; color: #fff;
  font-size: 12.5px; line-height: 1.55;
  box-shadow: 0 8px 26px rgba(19, 26, 38, .22);
  animation: tin .16s ease-out;
}
.toast.ok { background: #0f7b46; }
.toast.bad { background: #b32525; }
.toast.warn { background: #9a5a09; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* ============================ 工具类 ============================ */

.mono { font-family: var(--mono); }
.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }
.f11 { font-size: 11px; } .f12 { font-size: 12px; } .f13 { font-size: 13px; }
.b600 { font-weight: 600; } .b700 { font-weight: 700; }
.tr { text-align: right; } .tc { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
/* 停用/失效行的统一弱化（表格行、卡片都用它，别各自写 opacity） */
.dim { opacity: .5; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb0 { margin-bottom: 0 !important; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================ 登录 ============================ */
/* PC 登录页已改为极简表单（只有账号 / 密码 / 登录），样式在 assets/login.css。
   原先的双栏 .auth 版式与文案已下线，这里不再保留死样式。 */

/* ============================ PDA ============================ */

body.pda { background: var(--bg); }
body.pda .ph {
  height: 54px; background: #16203a; color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box;
}
body.pda .ph b { font-size: 15px; }
body.pda .ph .mod { font-size: 10px; color: #8fa4c8; letter-spacing: .06em; }
body.pda .ph a { color: #a9c0e8; font-size: 12.5px; }
body.pda .pb { padding: 12px; }

.pcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin-bottom: 10px;
}
.plink {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 10px; color: var(--text);
}
.plink:active { background: var(--surface-2); }
.plink .l1 { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14.5px; }
.plink .l2 { margin-top: 5px; font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.plink.hot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.scanbox {
  background: var(--surface); border: 1.5px solid var(--brand); border-radius: var(--r);
  padding: 13px 14px; margin-bottom: 10px;
}
.scanbox .h { font-size: 11.5px; color: var(--text-3); margin-bottom: 5px; }
.scanbox .v {
  font-family: var(--mono); font-size: 21px; font-weight: 700;
  word-break: break-all; min-height: 28px; letter-spacing: .01em;
}
.scanhid {
  position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0;
}
.manual { display: flex; gap: 7px; margin-top: 9px; }
.manual input {
  flex: 1; height: 42px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-family: var(--mono); font-size: 14px; outline: none;
}
.manual input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.verdict { border-radius: var(--r); padding: 14px; margin-bottom: 10px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.verdict .big { font-size: 18px; display: block; margin-bottom: 3px; }
.verdict.ok { background: var(--ok-soft); color: #0b5c34; border: 1px solid #c6e8d6; }
.verdict.bad { background: var(--bad-soft); color: #8f2020; border: 1px solid #f4cdcd; }
.verdict.warn { background: var(--warn-soft); color: #74440a; border: 1px solid #f3e0ae; }

.flash { animation: fl .3s ease-out; }
@keyframes fl { from { box-shadow: 0 0 0 0 rgba(37,87,214,.42); } to { box-shadow: 0 0 0 12px rgba(37,87,214,0); } }
.shake { animation: sk .3s; }
@keyframes sk {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); }
  45% { transform: translateX(6px); } 70% { transform: translateX(-3px); }
}

/* ============================ 打印 ============================ */

@media print {
  .side, .head, .tabs, .bar, .no-print, #toasts { display: none !important; }
  body { background: #fff; }
  .app, .main { display: block; }
  .page { padding: 0; }
  .card { border: 0; box-shadow: none; }
}

/* ============================ 响应式侧栏 ============================ */

.side-toggle { display: none; }
@media (max-width: 1000px) {
  .side {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 0 0 40px rgba(19,26,38,.18);
  }
  .side.open { transform: translateX(0); }
  /* 抽屉关着的时候不拦点击：否则窄屏下侧栏的空白区会压住卡片上的按钮 */
  .side { pointer-events: none; }
  .side.open { pointer-events: auto; }
  .side-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r-sm);
    border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  }
  .head { padding: 0 14px; gap: 10px; }
  .page { padding: 14px; }
  .tabs { padding: 0 14px; }
}

/* ======================== 订单卡片与流转看板 ========================
   卡片是这套系统的"人话"单位：一张卡片 = 一张订单。
   设计约束（为什么是这个样子）：
     ① 卡片必须能一屏看 8~10 张 —— 所以字号小、行距紧，不放表头
     ② 单号用等宽字体且放第一行 —— 现场靠念单号沟通，必须一眼读得出
     ③ 分仓进度用点阵不用文字 —— "4/6 仓"要读，6 个点扫一眼就知道差几个
     ④ 超时/挂起只用左边一条色条 —— 大面积染色会让整屏都在喊，反而没人看
   ================================================================ */

/* ---- 看板骨架：横向多列，列内独立滚动 ---- */
.flow { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; }
.fcol {
  flex: 0 0 248px; min-width: 248px; display: flex; flex-direction: column;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); max-height: calc(100vh - 240px);
}
.fcol-h {
  display: flex; align-items: center; gap: 6px; padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 700;
  position: sticky; top: 0; background: var(--surface-2); z-index: 1;
  border-radius: var(--r) var(--r) 0 0;
}
.fcol-h .n {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
}
.fcol-h.warn .n { background: var(--warn-soft); color: var(--warn); }
.fcol-h.bad .n { background: var(--bad-soft); color: var(--bad); }
.fcol-h.ok .n { background: var(--ok-soft); color: var(--ok); }
.fcol-b { padding: 8px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; flex: 1; }
.fcol-b:empty::after {
  content: "空"; display: block; text-align: center; padding: 22px 0;
  font-size: 11.5px; color: var(--text-4);
}

/* ---- 订单卡片 ---- */
.ocard {
  position: relative; display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px 10px 8px 12px;
  transition: border-color .12s, box-shadow .12s;
}
.ocard:hover { border-color: var(--brand-line); box-shadow: 0 2px 10px rgba(37,87,214,.09); }
.ocard:active { background: var(--surface-2); }
/* 左侧色条 = 状态/风险。只染一条，不染整卡 */
.ocard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--line);
}
.ocard.t-warn::before { background: var(--warn); }
.ocard.t-bad::before  { background: var(--bad); }
.ocard.t-info::before { background: var(--info); }
.ocard.t-brand::before{ background: var(--brand); }
.ocard.t-ok::before   { background: var(--ok); }

.ocard .no { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: -.2px; }
.ocard .ln {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-2);
  vertical-align: 1px;
}
.ocard .sku {
  font-size: 11.5px; color: var(--text-2); margin-top: 5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ocard .meta {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 10.5px; color: var(--text-3);
}
.ocard .qty { font-family: var(--mono); font-weight: 700; color: var(--text-2); }

/* 分仓进度点阵：每个点代表一个分仓，填满=已拣完 */
.dots { display: inline-flex; gap: 2.5px; align-items: center; }
.dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line);
  display: block; font-style: normal;
}
.dots i.on { background: var(--ok); }
.dots i.bad { background: var(--bad); }

/* 停留时长：贴在右上角，超时才染色 */
.ocard .stay {
  position: absolute; right: 8px; top: 8px; font-size: 10px;
  font-family: var(--mono); color: var(--text-4);
}
.ocard .stay.over { color: var(--bad); font-weight: 700; }

/* 卡片上的角标（如"短拣""缺包"） */
.ocard .flag {
  display: inline-block; margin-top: 5px; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
  background: var(--bad-soft); color: var(--bad);
}
.ocard .flag.warn { background: var(--warn-soft); color: var(--warn); }

/* ---- 卡片网格（各环节页面用，替代表格） ---- */
.ogrid {
  display: grid; gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
}
.ogrid.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* 卡片列表的筛选条 */
.obar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
}
/* 分段按钮：可独立使用，也可放在 .obar 里 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button {
  border: 0; background: var(--surface); padding: 5px 11px; font-size: 12px;
  color: var(--text-2); cursor: pointer; border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }

/* 卡片选中态（派送池"点卡选单"用）：不靠 checkbox，整卡可点更好按 */
.ocard.picked { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ocard .pickmark {
  position: absolute; left: -6px; top: -6px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; font-weight: 700;
}
div.ocard { cursor: pointer; }

/* 底部浮动操作条：选了一堆卡片后从这里统一提交 */
.footbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--brand-line);
  border-radius: var(--r); box-shadow: 0 -2px 16px rgba(19,26,38,.08);
}
.footbar .n { font-family: var(--mono); font-weight: 700; color: var(--brand-dark); }

/* ============================ 订单中心（v8 UI） ============================ */

/* 状态漏斗：横条一排，点一段就筛选，是"快速定位订单状态"的主入口 */
.funnel2 {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px;
}
.fseg {
  flex: 1; min-width: 108px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); padding: 8px 10px; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s; position: relative;
}
.fseg:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.fseg.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-soft); }
.fseg .l { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.fseg .n { font-size: 20px; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; }
.fseg .n small { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.fseg .p { font-size: 10px; color: var(--text-4); }
.fseg.warn .n { color: var(--warn); }
.fseg.ok .n { color: var(--ok); }
.fseg.brand .n { color: var(--brand); }
.fseg.bad .n { color: var(--bad); }
.fseg.zero { opacity: .55; }
.fseg .ar {
  position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  color: var(--line); font-size: 12px; z-index: 1;
}
.fseg:last-child .ar { display: none; }

/* 侧挂小漏斗：挂起 / 已拆单 / 已取消，不占主流程 */
.funnel2-side { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 4px 11px; font-size: 11.5px; cursor: pointer; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 5px;
}
.fchip:hover { border-color: var(--brand-line); }
.fchip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.fchip .n { font-family: var(--mono); font-weight: 700; }
.fchip.bad.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* 工具条：搜索 + 筛选 + 视图切换，一条搞定 */
.ctxbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
}
.ctxbar .search { position: relative; flex: 1 1 220px; max-width: 320px; }
.ctxbar .search .fld { padding-left: 28px; width: 100%; }
.ctxbar .search::before {
  content: '⌕'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); font-size: 13px; pointer-events: none;
}

/* 已生效的筛选标签：点 × 移除，避免"筛选了但不知道筛了什么" */
.factive { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.factive .fa {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 999px; padding: 3px 9px; font-size: 11.5px; font-weight: 600;
}
.factive .fa b { cursor: pointer; font-weight: 700; opacity: .7; }
.factive .fa b:hover { opacity: 1; }
.factive .clr { font-size: 11.5px; color: var(--text-3); cursor: pointer; text-decoration: underline; }

/* 卡片主操作：悬停才出现，避免误触；触屏不显示（PDA 走列表页操作） */
.ocard .qa {
  position: absolute; right: 7px; bottom: 6px;
  height: 24px; padding: 0 9px; font-size: 11px; font-weight: 650;
  border-radius: 5px; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  opacity: 0; transition: opacity .12s; cursor: pointer;
}
.ocard:hover .qa { opacity: 1; }
.ocard .qa:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.ocard .qa.ok { background: var(--ok); border-color: var(--ok); }
.ocard .qa.ok:hover { background: #0b6238; border-color: #0b6238; }
.ocard .qa.warn { background: var(--warn); border-color: var(--warn); }
.ocard .qa.ghost { background: var(--surface); color: var(--text-2); border-color: var(--line); }
@media (hover: none) { .ocard .qa { display: none; } }

/* 列表视图：行左侧一条状态色，与卡片同语言 */
.tbl tr .stbar {
  display: inline-block; width: 3px; height: 22px; border-radius: 2px;
  background: var(--line); vertical-align: middle; margin-right: 7px;
}
.tbl tr .stbar.t-warn { background: var(--warn); }
.tbl tr .stbar.t-ok { background: var(--ok); }
.tbl tr .stbar.t-brand { background: var(--brand); }
.tbl tr .stbar.t-bad { background: var(--bad); }
.tbl tr .stbar.t-info { background: var(--info); }

/* 工单号列：外部计划进来的工单号 = 订单号-SKU，可能有 40~70 字符。
   硬塞一行会把整张表撑爆，所以拆两行显示：
     第一行 订单号（长了就省略号，完整值在 title 里）
     第二行 SKU（现场靠这一段区分同一单的不同款）
   行首色条改成 td 的伪元素，两行文本时也能对齐整行高度。 */
.tbl td.wonum {
  position: relative; height: auto;
  padding: 7px 12px 7px 16px; max-width: 300px; white-space: normal;
}
.tbl td.wonum::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 2px; background: var(--line);
}
.tbl td.wonum.st-FULL::before { background: var(--ok); }
.tbl td.wonum.st-BLOCKED::before { background: var(--warn); }
.tbl td.wonum.st-SHORT::before { background: var(--bad); }
.tbl td.wonum .po {
  font-family: var(--mono); font-size: 12px; color: var(--text); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px;
}
.tbl td.wonum .sk {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px;
}

/* 存货编号单独一列：与订单号并排，不再挤在工单号下面第二行 */
.tbl td.skcode {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3);
  white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}

/* 环节列头：责任人 + 超时数，一列一个答案 */
.fcol-h .who { font-size: 10.5px; color: var(--text-3); font-weight: 400; }
.fcol-h .late {
  font-size: 10px; font-weight: 700; color: var(--bad);
  background: var(--bad-soft); border-radius: 4px; padding: 1px 5px;
}

/* 键盘提示 */
.kbd {
  display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 10.5px;
  font-family: var(--mono); background: var(--surface-3); color: var(--text-3);
  border: 1px solid var(--line);
}

/* ============================ 统一页内构件 ============================ */

/* 键值信息表：抽屉、详情、弹窗里都用这一个 */
.kv { display: grid; grid-template-columns: 82px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text-2); word-break: break-all; }
.kv.wide { grid-template-columns: 110px 1fr; }

/* 卡片内分段小标题 */
.sec-t {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 8px; font-size: 11.5px;
}
.sec-t:first-child { margin-top: 0; }
.sec-t h3 {
  font-size: 11.5px; color: var(--text-3); font-weight: 700; letter-spacing: .05em;
}
.sec-t .grow { flex: 1; }

/* 概览条：KPI 与主区之间的轻分隔，避免每页各画一条 */
.rule { height: 1px; background: var(--line-soft); margin: 14px 0; border: 0; }

/* 两列信息布局：左图右文 / 左表右表 */
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 980px) { .cols2 { grid-template-columns: minmax(0, 1fr); } }

/* 表单弹窗里的行（label 在上，控件在下） */
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

/* ============================ 流程条（v11 全站统一） ============================ */

/* 六个环节一条线：谁手上、还有多少、现在看哪段。全站只有这一种画法。 */
.flowbar { display: flex; align-items: stretch; overflow-x: auto; padding: 2px 0; }
.fstep {
  flex: 1 1 0; min-width: 104px;
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 8px 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.fstep:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.fstep.on { border-color: var(--brand); background: var(--brand-soft); }
.fstep[disabled] { cursor: default; }
.fstep[disabled]:hover { border-color: var(--line); background: var(--surface); }
.fstep .idx { font-size: 9.5px; color: var(--text-4); font-family: var(--mono); line-height: 1; }
.fstep .nm { font-size: 12px; font-weight: 650; color: var(--text-2); }
.fstep .ct {
  font-size: 19px; font-weight: 750; line-height: 1.15; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.fstep .who { font-size: 10.5px; color: var(--text-3); }
.fstep.zero { opacity: .5; }
.fstep.on .ct, .fstep.on .nm { color: var(--brand-dark); }
.flowbar .arw {
  align-self: center; padding: 0 3px; font-style: normal;
  font-size: 13px; color: var(--line); user-select: none;
}

/* 「下一步做什么」提示条：全站一句话说清当前这一步的责任人与动作 */
.nextline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-2);
}
.nextline .who {
  font-size: 11px; font-weight: 650; color: var(--brand-dark);
  background: var(--brand-soft); border-radius: 4px; padding: 1px 7px;
}

/* ============================ 订单卡片 v12（卡片即主体） ============================ */
/*
   卡片的顺序是硬约定：订单号 → SKU 编码 → 产品名称。
   现场报单号、找料对 BOM、认货，三件事对应三行，谁都不能省。
   下面这段覆盖旧卡片样式（旧的只有单号末 9 位 + 名称，没有 SKU 编码）。
*/

.ocard {
  position: relative; display: block; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px 11px 15px;
  box-shadow: 0 1px 2px rgba(19, 26, 38, .04);
  transition: border-color .12s, box-shadow .12s;
}
.ocard:hover { border-color: #ccd6e6; box-shadow: 0 6px 18px rgba(19, 26, 38, .08); }
.ocard:active { background: var(--surface-2); }
.ocard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 10px 0 0 10px; background: var(--line);
}
.ocard.t-warn::before { background: var(--warn); }
.ocard.t-info::before { background: var(--info); }
.ocard.t-brand::before { background: var(--brand); }
.ocard.t-ok::before { background: var(--ok); }
.ocard.t-bad::before { background: var(--bad); }

.oc-h { display: flex; align-items: center; gap: 8px; }
.oc-no {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: -.2px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.oc-h .pill { flex: 0 0 auto; font-size: 10px; }

.oc-sku {
  display: inline-block; max-width: 100%; margin-top: 7px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-3);
  border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.oc-name {
  margin-top: 5px; font-size: 12.5px; line-height: 1.42; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 18px;
}

.oc-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 10.5px; color: var(--text-3);
}
.oc-meta .ln {
  font-weight: 700; font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2);
  /* 显示的是拉线名称（比 L01 长），超长省略、title 里保留编码 + 全名 */
  max-width: 92px; min-width: 0; flex-shrink: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.oc-meta .qty { font-family: var(--mono); font-weight: 700; font-size: 11.5px; color: var(--text-2); }
.oc-meta .u { color: var(--text-4); }
.oc-stay { margin-left: auto; font-family: var(--mono); }
.oc-stay.over { color: var(--bad); font-weight: 700; }

.oc-act {
  display: block; width: 100%; margin-top: 10px; height: 31px;
  border-radius: 6px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 650; font-family: inherit; cursor: pointer;
}
.oc-act:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.oc-act.warn { background: var(--warn); border-color: var(--warn); }
.oc-act.warn:hover { background: #8a4f08; border-color: #8a4f08; }
.oc-act.ok { background: var(--ok); border-color: var(--ok); }
.oc-act.ok:hover { background: #0b6238; border-color: #0b6238; }
.oc-act.ghost { background: var(--surface); color: var(--text-2); border-color: var(--line); }
.oc-act.ghost:hover { background: var(--surface-3); }

/* ============================ 泳道（卡片按环节并排流转） ============================ */

.lane {
  display: grid; grid-template-columns: repeat(6, minmax(232px, 1fr));
  gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start;
}
.lane.tight { grid-template-columns: repeat(auto-fit, minmax(238px, 330px)); overflow: visible; }

.lane-col {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 10px; display: flex; flex-direction: column; min-height: 132px;
}
.lane-h {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px; border-bottom: 1px solid var(--line-soft);
}
.lane-h b { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.lane-h .n {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
}
.lane-h .who { margin-left: auto; font-size: 10.5px; color: var(--text-4); }
.lane-col.warn .lane-h .n { background: var(--warn-soft); color: var(--warn); }
.lane-col.info .lane-h .n { background: var(--info-soft); color: var(--info); }
.lane-col.brand .lane-h .n { background: var(--brand-soft); color: var(--brand-dark); }
.lane-col.ok .lane-h .n { background: var(--ok-soft); color: var(--ok); }
.lane-col.bad .lane-h .n { background: var(--bad-soft); color: var(--bad); }
.lane-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.lane-b:empty::after {
  content: "—"; display: block; text-align: center; padding: 22px 0;
  font-size: 11px; color: var(--text-4);
}

/* 按线分组的卡片墙（拉线订单池、成品入库用） */
.walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.wall { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.wall-h {
  display: flex; align-items: center; gap: 7px; padding: 9px 11px;
  background: var(--surface); border-bottom: 1px solid var(--line-soft);
}
.wall-h b { font-size: 12.5px; }
.wall-h .who { margin-left: auto; font-size: 10.5px; color: var(--text-3); }
.wall-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; }

/* ============================ 数据导入（拖放区 / 预检统计 / 问题行） ============================ */

.drop {
  border: 2px dashed var(--line); border-radius: var(--r); padding: 30px 20px;
  text-align: center; cursor: pointer; transition: .15s; background: var(--surface-2);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big { font-size: 30px; line-height: 1; }
.drop .t { font-size: 14px; font-weight: 700; margin-top: 8px; }
.drop .s { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.sum > div { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: var(--surface-2); }
.sum .k { font-size: 11px; color: var(--text-3); }
.sum .v { font-size: 21px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.sum .ok .v { color: var(--ok); }
.sum .warn .v { color: var(--warn); }
.sum .bad .v { color: var(--bad); }

.issues { max-height: 300px; overflow: auto; }
.issues .it { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; align-items: flex-start; }
.issues .it:last-child { border-bottom: 0; }
.issues .ln { font-family: var(--mono); font-size: 11px; color: var(--text-3); min-width: 44px; text-align: right; flex-shrink: 0; }
.issues .msg { flex: 1; line-height: 1.5; }
.issues .it.bad .msg { color: var(--bad); }
.issues .it.warn .msg { color: var(--warn); }

.map { display: flex; gap: 6px; flex-wrap: wrap; }
.map .m { font-size: 11.5px; padding: 3px 8px; border-radius: 5px; background: var(--ok-soft); color: var(--ok); border: 1px solid #c6e8d6; }
.map .m b { font-weight: 700; }

.tpl { font-size: 12px; line-height: 1.9; color: var(--text-2); }
.tpl code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); }

/* ============================================================================
   按天排单（/pc/plan/assign.html）
   ----------------------------------------------------------------------------
   产能条 + 待排池 + 底部操作条。三块都是排单专用，别拿去别的页面复用。
   ========================================================================== */

/* 产能条：一行放下 9 条线，点一下就是「排到这条线」 */
.capbar { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.capcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.capcard:hover { border-color: var(--brand-line); }
.capcard.on { border-color: var(--brand); background: var(--brand-soft); }
.capcard.full { opacity: .72; }
.capcard .cn { font-size: 12px; font-weight: 700; color: var(--text);
  display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.capcard .cw { font-size: 11px; color: var(--text-3); font-weight: 400; }
/* 名称比编码长：不换行、超长省略，编码留在卡片的 title 里 */
.capcard .cnm { min-width: 0; flex: 1 1 auto; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
.capcard .capdot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }
/* 硬上限徽标：这条线开了「单日产能极限」，超排会被直接拒绝 */
.capcard .caplock { font-style: normal; font-size: 9px; font-weight: 700; color: var(--bad);
  border: 1px solid var(--bad); border-radius: 4px; padding: 0 3px; line-height: 13px;
  flex: 0 0 auto; letter-spacing: 1px; }
.capedit.btn { padding: 0 5px; height: 20px; line-height: 18px; margin-left: 4px;
  vertical-align: middle; }
/* 卡片右上「N 单」、左下「N 件」：现场只关心这条线今天已经排了什么 */
.capcard .cq { font-size: 11.5px; color: var(--text-2); font-weight: 500; flex: 0 0 auto; }
.capcard .qy { font-family: var(--mono); color: var(--text); font-weight: 700; }
.capcard .fulled { color: var(--bad); font-weight: 700; }
.capcard .cb { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 7px 0 6px; overflow: hidden; }
.capcard .cb > i { display: block; height: 100%; background: var(--ok); }
.capcard.mid .cb > i { background: var(--warn); }
.capcard.hot .cb > i { background: var(--bad); }
.capcard.empty .cb > i { background: var(--line); }
.capcard .cf2 { font-size: 11px; color: var(--text-2); display: flex; justify-content: space-between; }

/* 待排池：勾选行整行高亮 */
.pool { max-height: calc(100vh - 430px); min-height: 240px; overflow: auto; }
.tbl tr.sel { background: var(--brand-soft); }
.tbl tr.sel td { border-bottom-color: var(--brand-line); }
.chk { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand); }

/* 底部操作条：长列表滚动时始终可见 */
.assignbar { position: sticky; bottom: 0; z-index: 5; margin-top: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; display: flex; align-items: center; gap: 14px; }
.assignbar .big { font-size: 15px; font-weight: 700; font-family: var(--mono); }
.assignbar .warn { color: var(--bad); }
.assignbar .ok { color: var(--ok); }
.reslist { max-height: 240px; overflow: auto; }

/* ============================================================================
   拉线筛选带（计划工作台 · 订单主线）
   ----------------------------------------------------------------------------
   一条产线一个胶囊，点即只看这条线的单。计数与负载来自 day-board 同一份口径，
   和「按天排单」的产能卡不会打架。
   ========================================================================== */
.lbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lchip { display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: border-color .12s, background .12s; user-select: none; }
.lchip:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.lchip.on { background: var(--brand-soft); border-color: var(--brand);
  color: var(--brand-dark); font-weight: 700; }
.lchip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.lchip.mid .dot { background: var(--warn); }
.lchip.hot .dot { background: var(--bad); }
.lchip.zero .dot { background: var(--line); }
.lchip.zero { opacity: .6; }
.lchip .n { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.lchip.fixed { background: var(--surface-3); }
.lchip .sep { width: 1px; height: 14px; background: var(--line); margin: 0 1px; }
.lbar .lsep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

/* 拉线视角的看板列：一列一条线，列内按状态排 */
.lcol-h .cap { font-size: 10px; color: var(--text-4); font-weight: 500; }

/* 订单卡「计划 / 下单」两个时间：产品名下方各占一行 ——
   计划时间是第一优先级（导入、排产都以它为准），所以排在上面、字色更实；
   上线时间次之。两行同样式，不和产线/数量挤在同一行。 */
.oc-tm { margin-top: 4px; font-size: 10.5px; color: var(--text-3); }
.oc-tm b { font-family: var(--mono); font-weight: 700; color: var(--text-2); letter-spacing: .2px; }
.oc-tm.pri b { color: var(--text); }
.oc-tm.pri { color: var(--text-2); }

/* ============================================================================
   备料单打印（/pc/print.html）
   ----------------------------------------------------------------------------
   屏幕上这是一张普通表格，打印时把侧栏/工具条/说明全部收掉，只留单据本体。
   上线时间放在第一列：先上线的先备，一目了然（交付时间紧随其后）。
   ========================================================================== */
.print-head { display: none; }
.print-tip { font-size: 11.5px; color: var(--text-3); line-height: 1.7; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  #side, #head, .tabs, .ctxbar, .card > .ch, .card > .cf, .footbar, .print-tip { display: none !important; }
  body { background: #fff !important; }
  .app { display: block !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .page { padding: 0 !important; }
  .card { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
  .card > .cb { padding: 0 !important; }
  .tbl { font-size: 11px !important; }
  .tbl th { background: #eee !important; color: #000 !important; border-bottom: 1px solid #666 !important; }
  .tbl td { border-bottom: 1px solid #bbb !important; color: #000 !important; }
  .print-head { display: block !important; margin-bottom: 8px; }
  .print-head h1 { font-size: 16px; margin: 0 0 4px; }
  .print-head .meta { font-size: 11px; color: #333; }
}

/* ---- v21: due-date badges, note button, packing tag ---- */
.oc-tm .due-tag { margin-left: 6px; font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.oc-tm .due-tag.bad { background: #fdecec; color: #b42318; }
.oc-tm.t-bad b { color: #b42318; }
.oc-tm.t-warn b { color: var(--warn); }
.oc-note { margin-top: 6px; background: none; border: 1px dashed var(--line);
  color: var(--t3, #667085); font-size: 11px; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.oc-note:hover { border-color: var(--warn); color: var(--warn); }

/* ---- v23: 交期三档高亮（整卡换底色 + 左侧色条） ----
   为什么整卡变色而不只是文字变红：现场是"扫一眼挑单"，字色在 10 米外看不出来。
   三档必须一眼能分出轻重，所以底色 + 左边条 + 标签三个通道一起用。 */
.ocard.due-soon {
  background: #fffdf4; border-color: #f0dba9;
  box-shadow: inset 3px 0 0 #d8a318;
}
.ocard.due-urgent {
  background: #fff7f1; border-color: #f2c6ae;
  box-shadow: inset 3px 0 0 #d9601b;
}
.ocard.due-over {
  background: #fff5f5; border-color: #f0bcbc;
  box-shadow: inset 3px 0 0 var(--bad);
}
.ocard.due-soon:hover,
.ocard.due-urgent:hover,
.ocard.due-over:hover { box-shadow: inset 3px 0 0 #b54708, 0 2px 10px rgba(19, 26, 38, .1); }
.ocard.due-over:hover { box-shadow: inset 3px 0 0 var(--bad), 0 2px 10px rgba(19, 26, 38, .1); }
/* 已选中的卡片还要保留选中态，别被交期高亮盖掉 */
.ocard.picked.due-soon, .ocard.picked.due-urgent, .ocard.picked.due-over {
  border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft);
}

/* ---- 一键异常备注 ---- */
.note-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.note-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 16px; padding: 6px 14px; font-size: 13px; cursor: pointer; line-height: 1.2; }
.note-chip:hover { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.note-chip:active { transform: scale(.97); }
/* ---------------- 流转组：半重叠堆叠（v33） ----------------
   一组单叠成一摞：每张往上错 30px，露出自己的单号行；
   最上面那张完整可操作，其余点露出的那一条就翻上来。
   为什么不用"扇开+旋转"：卡片里有按钮，歪着点不准；错层能保证按钮永远在正位置。 */
.ostack { position: relative; margin: 4px 0 6px; }
.ostack-head {
  /* 组头必须留在文档流里：以前是 absolute，展开时正好压住第一张卡的单号行 */
  height: 30px; display: flex; align-items: center; gap: 8px;
}
.ostack-head .t { font-size: 11px; color: var(--text-3); }
.ostack-btn {
  height: 26px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 11.5px; line-height: 1; display: inline-flex; align-items: center; gap: 4px;
}
.ostack-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.ostack-btn[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.ostack > .olayer { position: absolute; left: 0; right: 0; transition: top .16s ease; }
.ostack > .olayer > .ocard { box-shadow: 0 -3px 10px rgba(15, 23, 42, .10); }
.ostack > .olayer:not(.top) > .ocard { cursor: pointer; }
.ostack > .olayer:not(.top):hover > .ocard { border-color: var(--brand); }
.ostack > .olayer.top > .ocard { box-shadow: 0 10px 24px rgba(15, 23, 42, .18); }

/* 确认到线：浅蓝按钮（原来是橙色，容易被当成"异常告警"） */
.oc-act.sky { background: #e8f1fd; border-color: #bcd7f7; color: #14508c; }
.oc-act.sky:hover { background: #d7e8fb; border-color: #8fbdf0; color: #0f3f70; }

/* 流转组折叠/展开：折叠=半重叠堆叠，展开=每张完整铺开 */
/* 关键：折叠时**顶层卡留在文档流里**（自然撑高容器），只有它上面的 n-1 张绝对定位。
   这样容器高度由浏览器算，不再依赖 JS 量卡片高度——收起后不会被裁、也不会压住下一张卡。 */
.ostack { position: relative; }
.ostack > .olayer { position: absolute; left: 0; right: 0; }
.ostack > .olayer.top { position: relative; left: auto; right: auto; }
.ostack.open > .olayer { position: static; left: auto; right: auto; margin-top: 8px; }
.ostack.open > .olayer:first-of-type { margin-top: 0; }


/* 订单池工具条：勾选数量 + 合并入口（合并只打组号，不排单、不离开池子） */
.pool-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface);
}
.pool-bar .t { font-size: 12px; color: var(--text-3); }

/* 订单池里已合并单的「拆解」小按钮：贴在标记后面，不抢主视觉 */
.mgr-unmerge {
  height: 20px; padding: 0 7px; margin-left: 4px; font-size: 11px;
  vertical-align: middle;
}

/* 按天排单：已合并行整行高亮 + 左侧色带，拆解按钮做成主色小块 */
.tbl tr.merged > td { background: #f2f7ff; }
.tbl tr.merged > td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.tbl tr.merged:hover > td { background: #e8f1fd; }
.mg-tag { margin-left: 6px; font-size: 10.5px; }
.mg-act {
  height: 22px; padding: 0 10px; font-size: 11.5px;
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark);
}
.mg-act:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 首页线况图表：纯 CSS 横条，不引第三方图表库（零依赖是这套系统的底线） */
.linechart { display: flex; flex-direction: column; gap: 9px; padding: 12px 16px 14px; }
.linechart .lc-row { display: grid; grid-template-columns: 92px minmax(80px, 1fr) 132px; gap: 10px; align-items: center; }
.linechart .lc-name { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linechart .lc-track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.linechart .lc-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.linechart .lc-fill.ok { background: var(--ok); }
.linechart .lc-fill.warn { background: var(--warn); }
.linechart .lc-fill.bad { background: var(--bad); }
.linechart .lc-fill.none { background: var(--line); }
.linechart .lc-meta { font-size: 11.5px; color: var(--text-3); text-align: right; white-space: nowrap; }

/* 新版本提示条：固定底部居中，不挡内容、可关掉 */
#verbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 4000; display: flex; align-items: center; gap: 10px;
  background: var(--text-1); color: #fff; border-radius: 999px;
  padding: 9px 10px 9px 16px; box-shadow: 0 10px 26px rgba(15, 23, 42, .28);
  font-size: 12.5px; max-width: calc(100vw - 32px);
}
#verbar code { background: rgba(255, 255, 255, .16); padding: 1px 6px; border-radius: 5px; }
#verbar .btn.sm { height: 26px; }
#verbar .btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
