/* ============================================================
 *  style.css  —— 碳酸/康饮 智能自动排产系统（v3 产销协同台风格）
 *  风格：图一「产销协同台」—— 浅绿底 + 白色卡片 + 绿色强调
 *  排产计划：图二「Excel编制式网格」—— 日期行×产品列，可编辑
 * ============================================================ */
:root {
  --bg: #eef4f0;          /* 页面浅绿底 */
  --bg2: #e5efe8;
  --panel: #ffffff;        /* 白色卡片 */
  --panel2: #f3f8f4;       /* 卡片内浅绿 */
  --border: #d7e5dc;       /* 浅绿边框 */
  --text: #1f2d25;         /* 深绿灰主文字 */
  --muted: #6e8f7c;        /* 次要文字 */
  --green: #27a35c;        /* 主绿色 */
  --green2: #1e8a4e;
  --green3: #e3f4ea;       /* 浅绿填充 */
  --blue: #2f8fd6;
  --orange: #e9a13b;
  --purple: #8a6ed6;
  --red: #e2544d;
  --yellow: #f2c94c;
  --shadow: 0 2px 10px rgba(39,163,92,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  min-height: 100vh;
}

/* ---------- 顶部导航（浅绿） ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #ffffff, #f2faf5);
  border-bottom: 2px solid var(--green3);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(39,163,92,.06);
}
.brand {
  font-size: 16px; color: #1f7a4a; font-weight: 700; white-space: nowrap;
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  line-height: 1.2;
  cursor: pointer; user-select: none;
}
.brand:hover { opacity: .85; }
.brand-logo {
  width: 40px; height: 40px; flex: none; object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(39,163,92,.18));
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { display: flex; align-items: center; gap: 4px; font-size: 16.5px; }
.brand-sub {
  font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 1px;
  margin-top: 2px;
}
.topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-item {
  padding: 6px 13px; cursor: pointer; border-radius: 20px;
  color: var(--muted); font-weight: 500; transition: .15s;
}
.nav-item:hover { background: var(--green3); color: var(--green2); }
.nav-item.active { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(39,163,92,.35); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.topbar-right label { color: var(--muted); font-size: 12px; }
.topbar-right select {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; outline: none;
}

/* ---------- 顶栏天气（合肥未来 5 天 · 常驻，替代原左侧「⛅ 天气」菜单） ---------- */
.topbar-weather {
  margin-left: 0;                 /* 排产月靠右（margin-left:auto），天气紧随其后 */
  display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  padding: 2px 4px; min-width: 0;
  scrollbar-width: thin;
}
.topbar-weather::-webkit-scrollbar { height: 5px; }
.topbar-weather::-webkit-scrollbar-thumb { background: #cfe3d8; border-radius: 3px; }
.tw-lead {
  display: flex; align-items: center; gap: 4px; flex: none;
  font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tw-item {
  display: flex; flex-direction: column; align-items: center; gap: 0; flex: none;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 2px 8px; line-height: 1.35; white-space: nowrap;
  font-variant-numeric: tabular-nums; cursor: pointer; transition: .15s;
}
.tw-item:hover { border-color: var(--green); box-shadow: var(--shadow); }
.tw-item.today { border-color: var(--green); background: #f2faf5; }
.tw-item.holiday { border-color: #e7b9ac; background: #fdf5f3; }
.tw-day { font-size: 10.5px; color: var(--muted); }
.tw-item.today .tw-day { color: var(--green2); font-weight: 700; }
.tw-ico { font-size: 14px; line-height: 1.1; }
.tw-temp { font-size: 11.5px; font-weight: 700; color: var(--green2); }
.tw-lo { font-weight: 400; color: var(--muted); }
.tw-rain { font-size: 11px; color: #2f6fa8; background: #e6f0fb; border-radius: 4px; padding: 0 5px; }
.tw-src { font-size: 10px; border-radius: 4px; padding: 0 4px; }
.tw-src.manual { background: #fdf3e2; color: #b07d22; }
.tw-btn {
  flex: none; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 3px 9px; font-size: 12px; cursor: pointer; color: var(--text);
}
.tw-btn:hover { border-color: var(--green); color: var(--green2); }
.tw-loading { font-size: 12px; color: var(--muted); }

/* ---------- 天气 7 天弹窗（点顶栏天气弹出） ---------- */
.wx-modal-mask {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.35); align-items: flex-start; justify-content: center;
}
.wx-modal {
  margin-top: 8vh; width: 440px; max-width: 94vw; max-height: 82vh;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.wx-modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 8px; font-size: 16px; color: var(--text);
}
.wx-modal-x { cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 6px; }
.wx-modal-x:hover { color: var(--text); }

/* ---------------- 可视化分析 ---------------- */
.viz-sub { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.viz-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 10px 0 14px; }
.viz-toolbar label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.viz-toolbar select { padding: 4px 8px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.chip-group { display: flex; gap: 6px; }
.viz-note { font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 12px; margin-bottom: 12px; }
.viz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.viz-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.viz-card.full { grid-column: 1 / -1; }
.viz-card-hd { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.viz-hd-sub { font-size: 11.5px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.viz-svg { width: 100%; height: auto; display: block; }
.viz-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.viz-lg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.viz-lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-empty { color: var(--muted); text-align: center; padding: 34px 0; font-size: 13px; }
/* 环形图 */
.vz-donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.viz-donut { width: 224px; height: 224px; flex: none; }
.vz-legend-list { flex: 1; min-width: 190px; }
.vz-lg-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed #f1f5f9; }
.vz-lg-row:last-child { border-bottom: none; }
.vz-lg-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.vz-lg-k { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vz-lg-v { color: var(--muted); font-variant-numeric: tabular-nums; }
.vz-lg-p { color: var(--green2); font-weight: 700; min-width: 54px; text-align: right; }
/* 横向条形 */
.vz-hb-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.vz-hb-k { width: 110px; font-size: 12.5px; text-align: right; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.vz-hb-track { flex: 1; height: 16px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.vz-hb-fill { height: 100%; border-radius: 8px; transition: width .4s; }
.vz-hb-v { width: 88px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); flex: none; }
.vz-hb-rate { width: 64px; text-align: right; font-size: 12px; color: var(--green2); font-weight: 700; flex: none; }
.vz-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
@media (max-width: 1100px) { .viz-grid { grid-template-columns: 1fr; } }

/* 预算品项明细弹窗（复用 wx-modal-mask 遮罩） */
.bd-modal {
  margin-top: 4vh; width: 96vw; max-width: 1500px; max-height: 90vh;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.bd-filters {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 18px 10px; border-bottom: 1px solid var(--border); background: var(--bg2);
}
.bdf-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); }
.bdf-item select {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; outline: none; font-size: 12.5px;
}
.bdf-item input {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; outline: none; font-size: 12.5px;
}
.bdf-item input:focus, .bdf-item select:focus { border-color: var(--green); }
.bdf-count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bd-modal-body { overflow: auto; padding: 0 0 12px; }
.bd-modal-body .tbl { min-width: 100%; }
.wx-modal-city {
  display: flex; align-items: center; gap: 8px; padding: 6px 18px 10px; font-size: 13px;
}
.wx-modal-city input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; outline: none;
}
.wx-modal-city input:focus { border-color: var(--green); }
.wxm-switch { padding: 6px 14px !important; }
.wx-modal-body { padding: 0 12px 8px; overflow-y: auto; }
.wxm-now {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef7f1; border-radius: 10px; padding: 12px 14px; margin: 4px 6px 8px;
}
.wxm-now-ico { font-size: 34px; line-height: 1; }
.wxm-now-t { font-size: 24px; font-weight: 800; color: var(--text); }
.wxm-unit { font-size: 14px; font-weight: 500; }
.wxm-cond { font-size: 14px; font-weight: 600; color: var(--text); }
.wxm-now-meta { width: 100%; font-size: 12px; color: var(--muted); }
.wxm-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; font-size: 13px;
}
.wxm-row:hover { background: #f5faf7; }
.wxm-row.today { background: #eef7f1; }
.wxm-row.today .wxm-day { color: var(--green2); font-weight: 700; }
.wxm-day { width: 40px; color: var(--text); font-weight: 500; }
.wxm-date { width: 44px; color: var(--muted); font-size: 12px; }
.wxm-ico { font-size: 18px; width: 26px; text-align: center; }
.wxm-cond2 { flex: 1; color: var(--text); }
.wxm-hi { color: #d24a43; font-weight: 600; font-variant-numeric: tabular-nums; }
.wxm-lo { color: #2f6fa8; font-variant-numeric: tabular-nums; }
.wx-modal-ft { padding: 8px 18px 14px; font-size: 12.5px; }
.wx-modal-ft a { color: var(--green2); text-decoration: none; }
.wx-modal-ft a:hover { text-decoration: underline; }
.btn {
  padding: 6px 13px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { filter: brightness(.97); box-shadow: var(--shadow); }
.btn-promary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn-promary:hover { background: var(--green2); filter: none; }
.btn-outline { background: transparent; }
.btn-outline:hover { background: var(--green3); }

/* ---------- 横幅 ---------- */
.banner {
  margin: 10px 18px 0; padding: 8px 14px; border-radius: 8px;
  background: var(--green3); color: var(--green2); font-weight: 500;
  border-left: 4px solid var(--green); display: none;
}
.banner.show { display: block; }

/* ---------- 应用主体 ---------- */
.app-body { display: flex; min-height: calc(100vh - 55px); }
.sidebar {
  width: 205px; background: #fff; border-right: 1px solid var(--border);
  padding: 14px 10px; flex-shrink: 0;
  /* 右侧内容滚动时左侧菜单保持不动 */
  position: sticky; top: var(--topbar-h, 56px);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h, 56px));
  overflow-y: auto; overflow-x: hidden;
}
.side-title { font-size: 12px; color: var(--muted); padding: 4px 10px 10px; font-weight: 600; }
.side-menu { list-style: none; }
.side-menu li {
  padding: 9px 12px; cursor: pointer; border-radius: 8px; margin-bottom: 3px;
  color: var(--muted); font-weight: 500; transition: .15s;
}
.side-menu li:hover { background: var(--green3); color: var(--green2); }
.side-menu li.has-sub.active,
.side-menu li.has-sub.open { background: transparent; color: var(--muted); font-weight: 500; }
.side-menu li.has-sub.active > .menu-toggle,
.side-menu li.has-sub.open > .menu-toggle { background: transparent; color: var(--muted); font-weight: 600; }
.side-log { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-log h4 { font-size: 12px; color: var(--muted); margin: 6px 0; }
.log-console, .warn-list {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; font-size: 11px; max-height: 160px; overflow: auto; line-height: 1.6;
}
.warn-list { color: var(--red); }
.side-info { display: none; }   /* 日志/冲突预警已按需求移除 */

/* ---------- 主内容 ---------- */
.content { flex: 1; padding: 14px 18px 30px; overflow-x: auto; }
.content h2 { font-size: 18px; color: var(--green2); margin-bottom: 12px; }
.module-page { display: none; }
.module-page.active { display: block; }

/* ---------- 侧栏（单一层级：一级模块直接列出） ---------- */
.side-menu li.single {
  padding: 9px 12px; cursor: pointer; border-radius: 8px; margin-bottom: 3px;
  color: var(--muted); font-weight: 500; transition: .15s;
}
.side-menu li.single:hover { background: var(--green3); color: var(--green2); }
.side-menu li.single.active { background: var(--green); color: #fff; font-weight: 600; }
.side-menu li.single .menu-label { display: block; }
.side-info { display: none; }

/* ---------- 侧栏折叠分组（后台数据导入） ---------- */
.side-menu li.has-sub { padding: 0; margin-bottom: 3px; }
.side-menu li.has-sub > .menu-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px; transition: .15s;
}
.side-menu li.has-sub > .menu-label:hover { background: var(--green3); color: var(--green2); }
.side-menu li.has-sub > .menu-label::after {
  content: '▸'; font-size: 10px; transition: transform .15s;
}
.side-menu li.has-sub.open > .menu-label::after { transform: rotate(90deg); }
.side-menu li.has-sub.open > .menu-label { color: var(--green2); font-weight: 600; }
.side-menu li.has-sub > .sub-menu { list-style: none; display: none; padding: 2px 0 4px 10px; }
.side-menu li.has-sub.open > .sub-menu { display: block; }
.side-menu li.has-sub > .sub-menu li {
  padding: 7px 12px; font-size: 13px; margin-bottom: 2px; border-radius: 8px;
}

/* ---------- 子选项卡（页面内） ---------- */
.sub-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.sub-tab {
  padding: 6px 14px; cursor: pointer; border-radius: 18px;
  font-size: 12px; font-weight: 500; color: var(--muted); transition: .15s;
}
.sub-tab:hover { background: var(--green3); color: var(--green2); }
.sub-tab.active { background: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(39,163,92,.3); }
.sub-content { display: none; }
.sub-content.active { display: block; }

/* 醒目的大号子模块导航（后台数据导入用） */
.sub-tabs-lg {
  gap: 10px; padding: 10px; margin-bottom: 16px;
  background: linear-gradient(180deg, #f4f8ff, #eaf1fb);
  border: 1px solid #cddcf5; border-radius: 14px;
  box-shadow: 0 3px 10px rgba(31,94,255,.10);
}
.sub-tabs-lg .sub-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 12px; font-size: 15px; font-weight: 700;
  color: var(--text); background: #fff; border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: .15s;
}
.sub-tabs-lg .sub-tab i { font-style: normal; font-size: 17px; }
.sub-tabs-lg .sub-tab:hover { border-color: var(--green); color: var(--green2); transform: translateY(-1px); }
.sub-tabs-lg .sub-tab.active {
  background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: 0 4px 12px rgba(39,163,92,.35); transform: none;
}

/* ---------- 后台数据导入 ---------- */
.imp-cols { display: flex; flex-wrap: wrap; gap: 6px 12px; max-height: 120px; overflow: auto; }
.imp-col { font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 3px; }
.imp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 14px; flex: 1; }
.imp-preview { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 8px; }
.imp-tag { padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--bg2); color: var(--muted); }
.imp-tag.on { background: var(--green); color: #fff; font-weight: 600; }

/* ---------- 表单行 ---------- */
.form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.form-row input, .form-row select {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; outline: none; font-size: 12px;
}

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel h3 { font-size: 15px; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.panel h3 small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- KPI 卡片组 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--green);
  position: relative; overflow: hidden;
}
.kpi.blue { border-top-color: var(--blue); }
.kpi.orange { border-top-color: var(--orange); }
.kpi.purple { border-top-color: var(--purple); }
.kpi.red { border-top-color: var(--red); }
.k-label { font-size: 12px; color: var(--muted); }
.k-val { font-size: 26px; font-weight: 700; color: var(--text); margin: 4px 0; }
.k-sub { font-size: 12px; color: var(--muted); }
.k-delta { font-size: 11px; color: var(--green2); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  background: var(--green3); color: var(--green2); font-weight: 600;
  padding: 8px 10px; text-align: left; border: 1px solid var(--border);
}
.tbl td { padding: 7px 10px; border: 1px solid var(--border); color: var(--text); }
.tbl tr:nth-child(even) td { background: #fafdfb; }
.tbl .empty { color: var(--muted); text-align: center; padding: 16px; }

/* ---------- 预算达成矩阵（工厂分组行 → 生产线 → 品项 × 月份） ---------- */
.tbl.budget-matrix th, .tbl.budget-matrix td { text-align: center; white-space: nowrap; }
.tbl.budget-matrix th.proj-cell,
.tbl.budget-matrix td.proj-cell {
  text-align: left; background: var(--panel2); font-weight: 600;
  position: sticky; left: 0; z-index: 3;
  width: 210px; min-width: 210px; max-width: 210px;
  overflow: hidden; text-overflow: ellipsis;
}
.tbl.budget-matrix th.pack-cell, .tbl.budget-matrix td.pack-cell {
  width: 52px; min-width: 52px; color: var(--muted); background: var(--panel2);
  position: sticky; left: 210px; z-index: 2;
}
.tbl.budget-matrix tr.fac-band td {
  text-align: left; font-weight: 700; color: var(--green2); background: #e7f1ea;
  padding: 5px 10px; letter-spacing: .5px; border-top: 1px solid #cfe3d7;
}
.tbl.budget-matrix tr.fac-band .band-label {
  position: sticky; left: 10px; display: inline-block; letter-spacing: .5px;
}
.tbl.budget-matrix th.unit-th { font-size: 10px; font-weight: 400; color: var(--muted); padding: 3px 10px; }
.tbl.budget-matrix th.unit-th.cur-month { color: #8a6d1b; }
.tbl.budget-matrix th.cur-month { background: #fff4d6; color: #8a6d1b; }
.tbl.budget-matrix td.cur-month { background: #fffbf0; font-weight: 600; }
.tbl.budget-matrix td.tot-cell, .tbl.budget-matrix th.tot-cell {
  background: var(--green3); font-weight: 700; color: var(--green2);
}
.tbl.budget-matrix .unit-tag { font-size: 9px; font-weight: 400; color: var(--muted); }
.tbl.budget-matrix tr.subtotal-row td { background: #eef7f1; font-weight: 600; }
.tbl.budget-matrix tr.subtotal-row td.proj-cell { text-align: right; padding-right: 10px; font-weight: 700; }
.tbl.budget-matrix tr.subtotal-row td.cur-month { background: #fdf3d8; }
.tbl.budget-matrix tr.total-row td { background: var(--green3); font-weight: 700; color: var(--green2); }
.tbl.budget-matrix tr.total-row td.proj-cell { text-align: left; padding-left: 8px; }
.tbl.budget-matrix tr.grand-row td { background: #d7ecdd; color: #1d6b3f; }

/* ---------- 预算达成 · 卡片图 ---------- */
.card-charts { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.card-block { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(20,40,30,.04); }
.card-block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; flex-wrap: wrap; }
.cb-title { font-size: 14px; font-weight: 700; color: #1d3a2a; }
.cb-sub { font-size: 11px; color: var(--muted); }
/* 项目柱状对比（左右 2 大卡） */
.bars-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.bar-card { background: #fbfdfc; border: 1px solid; border-left-width: 4px; border-radius: 8px; padding: 10px 12px; transition: transform .15s; }
.bar-card:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(20,40,30,.06); }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.bar-title { font-size: 13px; font-weight: 700; }
.bar-pct { font-size: 18px; font-weight: 700; color: #1d3a2a; }
.bar-track { height: 8px; background: #eef3f0; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.bar-meta { font-size: 11px; color: #506a5d; }
.bar-meta .m-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed #eef3f0; }
.bar-meta .m-row:last-child { border-bottom: none; }
.bar-meta .m-k { color: var(--muted); }
/* 类别柱状列表（4 个小卡） */
.mini-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mini-card { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--c, #6b7280); border-radius: 8px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.mini-card:hover { box-shadow: 0 3px 8px rgba(0,0,0,.07); }
.mini-title { font-size: 12px; font-weight: 700; color: #1d3a2a; margin-bottom: 4px; }
.mini-num { font-size: 20px; font-weight: 700; color: var(--c, #1d3a2a); line-height: 1.1; }
.mini-sub { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.mini-bar { height: 6px; background: #f3f5f4; border-radius: 3px; overflow: hidden; margin-bottom: 5px; }
.mini-bar-fill { height: 100%; background: var(--c, #6b7280); border-radius: 3px; transition: width .4s; }
.mini-meta { display: flex; justify-content: space-between; font-size: 10px; color: #506a5d; }
.tbl.budget-matrix tr.grand-row td { background: #d7ecdd; color: #1d6b3f; }
.tbl.budget-matrix .mini { font-size: 10px; font-weight: 400; color: var(--muted); }
.tbl.budget-matrix .zero { color: #c3d5ca; }

/* ---------- 产线预算量（工作中心 × 月份，按工厂分组） ---------- */
.line-budget-block { margin-bottom: 14px; }
.tbl.budget-line th.proj-cell, .tbl.budget-line td.proj-cell {
  width: 150px; min-width: 150px; max-width: 150px; letter-spacing: .3px;
}
.tbl.budget-line tbody tr:not(.fac-band):not(.total-row) td { background: #fff; }
.tbl.budget-line tbody tr:not(.fac-band):not(.total-row):hover td { background: #f6fbf8; }
.tbl.budget-line tbody tr:not(.fac-band):not(.total-row):hover td.proj-cell { background: #eaf4ee; }

/* ---------- 甘特图 ---------- */
.gantt-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.gantt-head { display: flex; background: var(--green3); color: var(--green2); font-size: 11px; }
.gantt-head span { flex: 1; text-align: center; padding: 6px 0; border-right: 1px solid var(--border); }
.gantt-head .gday { flex: 0 0 34px; }
.gantt-row { display: flex; border-top: 1px solid var(--border); }
.gantt-row .gprod { width: 150px; flex-shrink: 0; padding: 6px; font-size: 12px; background: var(--panel2); border-right: 1px solid var(--border); }
.gcell { flex: 0 0 34px; height: 30px; border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; }
.gcell.work { background: var(--green); }
.gcell.sterilize { background: var(--orange); }
.gcell.cip { background: var(--purple); }

/* ============================================================
 *  v3 产销协同台 首页看板专属样式
 * ============================================================ */
/* 顶部欢迎横幅（恢复最初版：绿色渐变） */
.hero-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 24px; border-radius: 14px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(120deg, #2fae66, #1e8a4e 60%, #2fae66);
  box-shadow: 0 6px 20px rgba(39,163,92,.35);
  flex-wrap: wrap;
}
.hero-banner .hello { font-size: 22px; font-weight: 700; color: #ffffff; }
.hero-banner .hello .wave { font-size: 24px; }
.hero-banner .slogan { font-size: 13.5px; color: #ffffff; opacity: .95; margin-top: 7px; letter-spacing: .5px; }

/* 首页 6+1 KPI 卡（含小字+红点） */
.hc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hc-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); position: relative;
}
.hc-card .t { font-size: 12px; color: var(--muted); }
.hc-card .v { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }
.hc-card .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hc-card .dot { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.hc-card .dot.y { background: var(--yellow); }
.hc-card .dot.g { background: var(--green); }
.hc-card .sub { font-size: 11px; color: var(--green2); margin-top: 4px; }

/* 首页三区布局 */
.hc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 16px; }
.hc-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.hc-box h4 { font-size: 13px; color: var(--green2); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

/* 区域达成条形 */
.region-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.region-bar .rk { width: 60px; color: var(--muted); }
.region-bar .rtrack { flex: 1; height: 10px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.region-bar .rfill { height: 100%; background: linear-gradient(90deg, var(--green), var(--green2)); border-radius: 6px; }
.region-bar .rv { width: 52px; text-align: right; color: var(--text); font-weight: 600; }

/* SKU 红黄灯列表 */
.sku-light { font-size: 12px; }
.sku-light .row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--bg2); }
.sku-light .row:last-child { border-bottom: none; }
.sku-light .nm { flex: 1; color: var(--text); }
.sku-light .lv { font-size: 10px; padding: 2px 7px; border-radius: 10px; color: #fff; }
.sku-light .lv.r { background: var(--red); }
.sku-light .lv.y { background: var(--yellow); color: #7a5a00; }
.sku-light .lv.g { background: var(--green); }
.sku-light .qt { width: 70px; text-align: right; color: var(--muted); }

/* 供需小卡片组 */
.supply-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.supply-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.supply-card .st { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.supply-card .sv { font-size: 20px; font-weight: 700; color: var(--green2); }
.supply-card .smeta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ============================================================
 *  v4.3 首页：全厂×产线 矩阵表（KPI + 工厂分组）
 * ============================================================ */
.matrix-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  background: #fff; border-radius: 8px; overflow: hidden;
}
.matrix-table th, .matrix-table td { padding: 8px 10px; border: 1px solid var(--border); }
.matrix-table thead th {
  background: var(--green3); color: var(--green2); font-weight: 600; text-align: center;
}
.matrix-table thead th.row-tag { text-align: left; min-width: 110px; }
.matrix-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix-table tbody td.label { color: var(--text); font-weight: 500; }
.matrix-table tbody td.wc {
  background: var(--panel2); color: var(--green2); font-weight: 600; text-align: center;
}
.matrix-table tbody tr:hover { background: #f8fbf6; }
.matrix-table tbody tr.factory-row td {
  background: #e9f3ee; color: var(--green2); font-weight: 700;
}
.matrix-table tbody tr.total-row td {
  background: var(--green3); color: var(--green2); font-weight: 700;
}
.pct-bar {
  display: inline-block; width: 90px; height: 8px; background: var(--bg2);
  border-radius: 5px; overflow: hidden; vertical-align: middle; margin-right: 6px;
}
.pct-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--green2)); border-radius: 5px; }
.pct-bar.r > span { background: linear-gradient(90deg, #e2544d, #c5443a); }
.pct-bar.y > span { background: linear-gradient(90deg, #f2c94c, #e9a13b); }

/* v4.4 首页：14 列产销达成表（线别分组 · 预算/排产/实际） */
.ach-table thead th { white-space: nowrap; }
.ach-table tbody td.label { white-space: nowrap; font-weight: 600; }
.ach-table tbody td.num { min-width: 84px; white-space: nowrap; }
.ach-table tbody td.num:not(:nth-child(2)) { color: #333; }
.ach-table tbody tr.factory-row td { text-align: left; }
.ach-table tbody tr.total-row td.label { text-align: left; }

.summary-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.summary-table th, .summary-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.summary-table th { background: var(--green3); color: var(--green2); font-weight: 600; text-align: left; }
.summary-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.summary-table tbody tr:hover { background: #f8fbf6; }

.sched-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sched-bar .note { font-size: 12px; color: var(--muted); }
.sched-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.sched-grid { border-collapse: collapse; font-size: 11.5px; }
.sched-grid th, .sched-grid td { border: 1px solid #cfdfd6; }
.sched-grid thead th { background: var(--green3); color: var(--green2); font-weight: 600; padding: 5px 6px; }
.sched-grid thead .line-grp { text-align: center; font-weight: 700; font-size: 12px; }
.sched-grid thead .prod-cell { position: relative; text-align: center; min-width: 92px; max-width: 118px; padding: 5px 14px 5px 5px; font-size: 10.5px; white-space: normal; word-break: break-all; vertical-align: middle; line-height: 1.28; }
.sched-grid thead .prod-name { display: block; }
.sched-grid thead .prod-del { position: absolute; top: 2px; right: 3px; cursor: pointer; color: #c44; font-size: 14px; line-height: 1; user-select: none; }
.sched-grid thead .prod-del:hover { color: #f33; }
.sched-grid thead .cap-cell { background: var(--bg2); color: var(--muted); font-size: 10px; text-align: center; padding: 2px 3px; white-space: normal; min-width: 62px; }
.sched-grid thead .conc-cell { background: var(--bg2); color: #5d7560; font-size: 10px; text-align: center; padding: 2px 3px; white-space: normal; min-width: 62px; }
.sched-grid tbody td.date-cell { background: var(--panel2); text-align: center; font-weight: 600; color: var(--green2); min-width: 56px; width: 56px; }
.sched-grid tbody td.qty-cell { padding: 1px 2px; text-align: center; }
.sched-grid tbody td.tot-cell { background: var(--panel2); font-weight: 600; color: var(--green2); text-align: center; }
.sched-grid tbody td.tot-cell.std { background: #fff8e1; color: #8a6d1b; }
.sched-grid tbody td.tot-cell.grand { background: var(--green3); font-size: 13px; }
.sched-grid thead .tot-cell-head { background: #f3f7eb; color: var(--green2); font-size: 11px; font-weight: 700; text-align: center; padding: 2px 5px; min-width: 64px; }

/* 产线页面级切换按钮组 */
.line-switcher { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 12px; background: var(--bg2); border-radius: 8px; }
.line-switcher .line-tab { background: #fff; border: 1px solid var(--border); padding: 6px 16px; border-radius: 18px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); transition: all 0.15s; }
.line-switcher .line-tab:hover { border-color: var(--green1); color: var(--green2); }
.line-switcher .line-tab.active { background: var(--green1); color: #fff; border-color: var(--green1); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.cell-input {
  width: 100%; border: none; background: transparent; text-align: center;
  padding: 5px 4px; font-size: 12px; color: var(--text); outline: none;
}
.cell-input:hover { background: var(--green3); cursor: text; }
.cell-input:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--green); }
.cell-input.edited { background: #fffbe6; color: #7a5a00; }
.sched-grid tbody tr:nth-child(odd) .qty-cell { background: #fcfefd; }

/* 碳酸排产计划等 sched-grid 表：周六/周日淡蓝、法定节假日淡红（与 wp-grid 规则一致） */
.sched-grid tbody tr.row-weekend > td,
.sched-grid tbody tr.row-weekend > td.qty-cell,
.sched-grid tbody tr.row-weekend > td.tot-cell { background: #dceffb; }
.sched-grid tbody tr.row-holiday > td,
.sched-grid tbody tr.row-holiday > td.qty-cell,
.sched-grid tbody tr.row-holiday > td.tot-cell { background: #fddcdc; }
.sched-grid tbody tr.row-weekend > td.tot-cell.std { background: #d3ebfa; }
.sched-grid tbody tr.row-holiday > td.tot-cell.std { background: #fbd2d2; }
.sched-grid tbody tr.row-weekend input.cell-input,
.sched-grid tbody tr.row-holiday input.cell-input { background: transparent; }
.sched-grid tbody tr.row-weekend > td.date-cell { color: #1a6699; box-shadow: inset 3px 0 0 #7cc0e8; }
.sched-grid tbody tr.row-holiday > td.date-cell { color: #a83232; box-shadow: inset 3px 0 0 #e88a8a; }

/* 交互式可编辑侧边表格（参数表/产品表/代工订单） */
.side-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.side-table th, .side-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.side-table th { background: var(--green3); color: var(--green2); font-weight: 600; }
.side-table tbody tr:hover { background: #f8fbf6; }
.side-table .col-action { width: 160px; white-space: nowrap; text-align: right; }
.side-table .row-action { padding: 2px 8px; font-size: 12px; border-radius: 4px; cursor: pointer; margin-left: 4px; border: 1px solid transparent; }
.row-action.del { background: #fff0ee; color: #c5443a; border-color: #f5c5be; }
.row-action.del:hover { background: #f7d5cf; }
.row-action.edit { background: #eef7ff; color: #2774c5; border-color: #cfe5fa; }
.row-action.edit:hover { background: #d8ebfb; }
.row-action.save { background: #e6f7ec; color: #1f7a45; border-color: #a7d9b7; }
.row-action.save:hover { background: #d6efe0; }
.row-action.cancel { background: #fff8e1; color: #876300; border-color: #e8d28a; }
.row-action.cancel:hover { background: #fff1c4; }
.side-table tr.editing { background: #fffbe6; box-shadow: inset 3px 0 0 var(--green2); }
.side-table tr.editing .editable-cell { background: #fff7d6; }
.btn-undo { background: #fff8e1; color: #876300; border: 1px solid #e8d28a; font-weight: 600; padding: 6px 14px; border-radius: 4px; cursor: pointer; }
.btn-undo:hover { background: #fff1c4; }
.btn-undo[disabled] { opacity: 0.5; cursor: not-allowed; }
.editable-cell { background: #fffce8; }
.editable-cell input { width: 100%; border: 1px solid #c2d8f0; padding: 3px 6px; border-radius: 3px; font: inherit; color: inherit; }
.action-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.action-bar .grow { flex: 1; }
.action-bar .note { font-size: 12px; color: var(--muted); }
.action-bar .btn-danger { background: #c5443a; color: #fff; }
.action-bar .btn-danger:hover { background: #a8382f; }
.dirty-badge { background: #f5b800; color: #fff; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.cell-add { background: #e6f7ec; color: #27a35c; padding: 4px 12px; border: 1px dashed #27a35c; border-radius: 4px; cursor: pointer; font-size: 12px; }
.cell-add:hover { background: #d4f0dd; }

/* 底部微标签 */
.foot-note { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ============================================================
 *  通用 Modal 弹窗（用于"加产品列"等带下拉选择的交互）
 * ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 10px; min-width: 420px; max-width: 640px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25); overflow: hidden;
}
.modal-head {
  background: var(--green); color: #fff; padding: 12px 18px;
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
.modal-head .close-x {
  cursor: pointer; font-size: 18px; opacity: .8; line-height: 1;
}
.modal-head .close-x:hover { opacity: 1; }
.modal-body { padding: 18px; }
.modal-body label.field {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 13px;
}
.modal-body label.field .lbl { width: 78px; color: var(--muted); }
.modal-body label.field input,
.modal-body label.field select {
  flex: 1; padding: 7px 10px; border: 1px solid #d0d7d2; border-radius: 5px;
  font-size: 13px; background: #fff; min-width: 0;
}
.modal-body label.field input:focus,
.modal-body label.field select:focus { outline: 2px solid var(--green3); border-color: var(--green); }
.modal-body .hint { font-size: 11px; color: var(--muted); margin-top: -6px; margin-bottom: 12px; margin-left: 88px; }
.modal-body .preview {
  background: #f6f8f5; border-left: 3px solid var(--green3);
  padding: 8px 12px; font-size: 12px; color: #456; margin: 8px 0 14px 88px;
  border-radius: 0 4px 4px 0;
}
.modal-foot {
  padding: 12px 18px; border-top: 1px solid #ecf0eb;
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal-foot .btn { padding: 7px 14px; border-radius: 5px; cursor: pointer; }
.modal-foot .btn-secondary { background: #f1f4f0; border: 1px solid #d0d7d2; color: #456; }
.modal-foot .btn-secondary:hover { background: #e6ebe5; }

/* ============================================================
 *  自产供需 · 品项供需明细（2026年X月自产供需.xlsx）
 *  检索工具栏 / 分组表格（类别 → 规格别 → 品项 + 小计/合计）
 * ============================================================ */
/* 数值通用（供表格右对齐 + 等宽数字） */
.supply-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.supply-table td.num.muted { color: var(--muted); }
/* 负数标红 */
.supply-table td.neg { color: var(--red); font-weight: 600; }
/* 比率徽标：≥100 ok / ≥90 warn / <90 bad */
.rate { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate.ok { background: var(--green3); color: var(--green2); }
.rate.warn { background: #fdf3dd; color: #b57e14; }
.rate.bad { background: #fdebe9; color: var(--red); }

/* 检索工具栏 */
.sup-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 12px 0 6px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
}
.sup-search {
  flex: 1 1 240px; min-width: 200px;
  padding: 7px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px; outline: none;
  background: #fff; color: var(--text);
  transition: box-shadow .15s, border-color .15s;
}
.sup-search:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,163,92,.14); }
.sup-search::placeholder { color: #9ab8a6; }
.sup-sel {
  padding: 6px 8px; font-size: 13px; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; background: #fff; outline: none;
}
.sup-sel:focus { border-color: var(--green); }
.sup-mini-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--green); color: var(--green2); background: #fff;
  border-radius: 6px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.sup-mini-btn:hover { background: var(--green3); }
.sup-count { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* 类别 / 规格别按钮组筛选（chip） */
.sup-chip-row {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 8px 0 0; padding: 0 2px;
}
.sup-chip-label {
  flex: none; font-size: 12px; font-weight: 600; color: var(--green2);
  padding: 5px 0; min-width: 44px;
}
.sup-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  padding: 4px 12px; font-size: 12px; font-weight: 500;
  color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.chip-btn:hover { border-color: var(--green); color: var(--green2); background: var(--green3); }
.chip-btn.active {
  background: var(--green); border-color: var(--green); color: #fff;
  font-weight: 700; box-shadow: 0 2px 6px rgba(39,163,92,.35);
}

/* 横向滚动容器（16 列较宽） */
.sup-scroll { overflow-x: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* 品项供需分组表 */
.supply-table { width: 100%; min-width: 1380px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.supply-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--green3); color: var(--green2);
  padding: 8px 10px; text-align: center; font-weight: 600;
  border-bottom: 2px solid var(--green); white-space: nowrap;
}
.supply-table tbody td {
  padding: 6px 10px; border-bottom: 1px solid #e8f0ea; white-space: nowrap;
}
.supply-table tbody tr:nth-child(even) td { background: #fbfdfc; }
.supply-table tbody tr:hover td { background: #f0f8f2; }
/* 类别分组头 */
.supply-table tr.sup-cat td {
  background: var(--green2); color: #fff; font-weight: 700; font-size: 13px;
  padding: 7px 12px; letter-spacing: .5px;
}
/* 规格别分组头 */
.supply-table tr.sup-spec td {
  background: #e7f4ec; color: #2f6b48; font-weight: 600;
  padding: 5px 12px; border-bottom: 1px solid #cfe6d8;
}
/* 规格别小计 / 类别合计行 */
.supply-table tr.sup-sub td {
  background: #f0f7f2 !important; color: var(--text); font-weight: 700;
  border-top: 1px solid #bcdcc9; border-bottom: 1px solid #bcdcc9;
  font-size: 12px;
}
.supply-table tr.sup-sub td.s-name { color: var(--green2); }
/* 品项名单元格：主名 + 料号 + 悬浮完整名 */
.supply-table td.s-name { text-align: left; }
.supply-table td.s-name .n { font-weight: 600; color: var(--text); }
.supply-table td.s-name .m { margin-left: 6px; font-size: 11px; color: #4a7d61; background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.supply-table td.s-name .tip {
  display: none; position: absolute; z-index: 20;
  background: #1f2d25; color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 4px;
  max-width: 420px; white-space: normal; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.supply-table td.s-name { position: relative; }
.supply-table td.s-name:hover .tip { display: block; }
.supply-table td.s-txt { color: var(--muted); text-align: left; }
/* 空态 */
.supply-table td.s-empty { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; background: #fbfdfc; }

/* ==================== 拖拽排产看板 ==================== */
.board-wrap {
  overflow: auto; max-height: 66vh; border: 1px solid var(--line, #d8e5dd);
  border-radius: 6px; background: #fff;
}
.board-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.board-grid th, .board-grid td { border-right: 1px solid #e8efe9; border-bottom: 1px solid #e8efe9; }
.board-day-hd {
  position: sticky; top: 0; z-index: 5; background: #eef5f0; color: var(--text, #23322a);
  min-width: 84px; padding: 5px 4px; font-weight: 700; text-align: center; white-space: nowrap;
}
.board-day-hd .wd { display: block; font-size: 10px; color: #7b9484; font-weight: 400; }
.board-day-hd.wknd { background: #f7f0ea; }
.board-day-hd.today { background: #fdeeee; color: #c0392b; box-shadow: inset 0 -2px 0 #c0392b; }
.board-day-hd.tot { min-width: 70px; background: #f0f4f1; }
.board-line-hd {
  position: sticky; left: 0; top: 0; z-index: 6; background: #e3ede6;
  min-width: 148px; padding: 5px 8px; text-align: left; font-weight: 700; white-space: nowrap;
}
.board-line-cell {
  position: sticky; left: 0; z-index: 2; background: #f6faf7; text-align: left;
  font-weight: 600; padding: 4px 8px; white-space: nowrap; min-width: 148px;
}
.board-line-cell .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c, #4a9ff5); margin-right: 6px; vertical-align: middle;
}
.board-line-cell .board-prod-n { display: block; font-size: 10px; color: #8aa394; font-weight: 400; margin-left: 14px; }
.board-cell {
  vertical-align: top; padding: 3px; min-width: 84px; height: 46px;
  background: #fff; transition: background .12s;
}
.board-cell.tot { background: #f4f8f5; font-weight: 700; text-align: right; padding: 6px 8px; vertical-align: middle; }
.board-cell.over { background: #fff3d6 !important; box-shadow: inset 0 0 0 2px #e8a33d; }
.board-chip {
  display: flex; flex-direction: column; margin: 2px; padding: 2px 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--c, #4a9ff5) 12%, #fff);
  border-left: 3px solid var(--c, #4a9ff5); cursor: grab; user-select: none; line-height: 1.3;
}
.board-chip b { font-size: 11px; font-weight: 600; color: var(--text, #23322a); max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-chip i { font-style: normal; font-size: 11px; color: var(--c, #4a9ff5); font-weight: 700; }
.board-chip:hover { background: color-mix(in srgb, var(--c, #4a9ff5) 22%, #fff); }
.board-chip.dragging { opacity: .45; cursor: grabbing; }
.board-span {
  padding: 5px 8px; border-radius: 4px; border: 1px solid var(--line, #cfe0d5);
  background: #fff; color: var(--text, #23322a); font-size: 13px; cursor: pointer;
}

/* ------- 排产方案对比 ------- */
.kpi-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.kpi-row .kpi { flex: 1; min-width: 180px; }
.badge {
  display: inline-block; padding: 2px 8px; margin: 0 4px 0 0;
  border-radius: 10px; background: var(--panel2, #eef5f0); color: var(--green2, #2e7d32);
  font-size: 12px; font-weight: 500;
}
.chip { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 11px; font-weight: 500; }
.chip.water { background: #d6ecff; color: #1565c0; }
.chip.hotfill { background: #ffe2c8; color: #c2520e; }
.chip.tp { background: #d8f0e0; color: #2e7d32; }
.chip.carbon { background: #e8d8f5; color: #6a1b9a; }
.chip.gray { background: #eee; color: #555; }
.chip.orange { background: #ffe2c8; color: #c2520e; }
.chip.red { background: #ffcccc; color: #b71c1c; }
.chip.green { background: #c8e6c9; color: #2e7d32; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.bold { font-weight: 700; }
.red { color: var(--red, #c62828); font-weight: 600; }
.green { color: var(--green2, #2e7d32); font-weight: 600; }
.orange { color: var(--orange, #ef6c00); font-weight: 600; }
.purple { color: #6a1b9a; font-weight: 600; }
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.scroll-x { overflow-x: auto; }
.warn-panel { background: #fff8e1; border-left: 4px solid #f57c00; padding: 10px 14px; margin: 12px 0; border-radius: 4px; }
.warn-panel h4 { margin: 0 0 8px; color: #c2520e; font-size: 14px; }
.warn-panel ul { margin: 0; padding-left: 18px; font-size: 13px; color: #555; }
.log-panel { margin: 12px 0; padding: 8px 14px; background: #f5f8f5; border-radius: 4px; }
.log-panel summary { cursor: pointer; color: var(--green2); font-weight: 500; font-size: 13px; }
.log-panel pre { margin: 8px 0 0; font-size: 12px; color: #555; max-height: 200px; overflow: auto; }
.stockdays-input { padding: 3px 4px; border: 1px solid var(--border); border-radius: 3px; font-size: 12px; }
.tbl.cal th.line-cell { text-align: left; padding: 8px 12px; background: var(--panel2); position: sticky; left: 0; z-index: 2; min-width: 130px; }
.tbl.cal td.line-cell { text-align: left; padding: 8px 12px; background: var(--panel2); font-weight: 600; position: sticky; left: 0; }
.tbl.cal .day-cell { min-width: 52px; text-align: center; padding: 4px; vertical-align: top; }
.tbl.cal .tot-cell { background: var(--green3, #e8f5e9); font-weight: 700; color: var(--green2); text-align: center; min-width: 70px; }
.day-qty { font-size: 13px; font-weight: 700; color: var(--green2); }
.day-tip { font-size: 10px; color: var(--muted, #888); margin-top: 2px; }

/* ============================================================
 *  rolling 滚动排产模块（v1.0）
 * ============================================================ */
.rolling-topbar {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; margin: 12px 0;
  background: linear-gradient(135deg, #eef7f0 0%, #f8fbf9 100%);
  border-radius: 8px; border: 1px solid #c8e0ce;
}
.rolling-topbar label { font-size: 13px; color: var(--text); }
.rolling-topbar .btn-primary {
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  color: #fff; border: none; padding: 8px 18px;
  border-radius: 6px; font-size: 14px; cursor: pointer; font-weight: 500;
  box-shadow: 0 1px 4px rgba(46, 125, 50, 0.2);
}
.rolling-topbar .btn-primary:hover { box-shadow: 0 2px 8px rgba(46, 125, 50, 0.35); }
.rolling-topbar .btn-outline {
  background: #fff; border: 1px solid #c8e0ce; padding: 7px 14px;
  border-radius: 6px; font-size: 13px; cursor: pointer;
}
.rolling-topbar #rp-result-tip { font-size: 13px; color: var(--text); margin-left: 12px; }

.data-status, .data-files, .data-notes, .data-log {
  margin: 14px 0; background: #fff; padding: 14px 18px;
  border-radius: 8px; border: 1px solid #d8e8de;
}
.data-status h4, .data-files h4, .data-notes h4, .data-log h4 {
  margin: 0 0 10px; color: var(--green2); font-size: 14px;
}
.data-files .tbl.simple {
  font-size: 12px;
}
.data-files .tbl.simple .row-warn td { background: #fff4e1; color: #c2520e; }
.data-notes ul { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: #555; line-height: 1.8; }
.data-log pre.err { background: #fff5f5; color: #c62828; padding: 10px; border-radius: 4px; max-height: 200px; overflow: auto; }
.data-log .warn { color: #c2520e; font-size: 12px; }
.data-log > div { font-size: 12px; font-family: Consolas, monospace; color: #2c3e50; margin: 2px 0; }

.kpi .kpi-n { font-size: 22px; font-weight: 700; color: var(--green2); }
.kpi .kpi-l { font-size: 12px; color: var(--muted, #777); margin-top: 4px; }

.rolling-summary {
  display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0;
}
.rolling-summary .kpi {
  flex: 1; min-width: 150px; text-align: center;
  padding: 14px; background: #fff;
  border-radius: 8px; border: 1px solid #d8e8de;
}
.rolling-summary .kpi .kpi-n { font-size: 24px; color: var(--green2); }

/* 排产总表 - 时间线矩阵 */
.tbl-wrap-wide { overflow-x: auto; max-width: 100%; max-height: 700px; overflow-y: auto; }
.tbl.plan-matrix { font-size: 11px; border-collapse: collapse; }
.tbl.plan-matrix th, .tbl.plan-matrix td { padding: 5px 6px; border: 1px solid #e0ebe4; }
.tbl.plan-matrix thead th {
  background: #e8f5e9; position: sticky; top: 0; z-index: 3; color: #1b5e20; font-weight: 600;
  text-align: center; min-width: 50px;
}
.tbl.plan-matrix th.sticky, .tbl.plan-matrix td.sticky {
  position: sticky; left: 0; z-index: 2; background: #f6fbf6;
  text-align: left; min-width: 180px; max-width: 240px;
  border-right: 2px solid #c8e0ce;
}
.tbl.plan-matrix th.num { text-align: center; }
.tbl.plan-matrix td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.plan-matrix td.has { color: var(--green2); font-weight: 500; }
.tbl.plan-matrix td.zero { color: #c3d5ca; }
.tbl.plan-matrix td.total-cell, .tbl.plan-matrix th.total-cell {
  background: #fff8e1; font-weight: 700; color: #c2520e;
  position: sticky; right: 0; z-index: 1;
}
.tbl.plan-matrix thead th.total-cell { z-index: 4; }
.tbl.plan-matrix tr.line-band th {
  background: var(--green2); color: #fff; text-align: left;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  position: sticky; left: 0; z-index: 1;
}

/* 排产总表 - 计划量/实际产量 双列 */
.tbl.plan-matrix td.plan-cell { background: #f5faf6; color: #1b5e20; }
.tbl.plan-matrix th.sub-th { font-size: 10px; padding: 3px 4px; background: #d8ecda; }
.tbl.plan-matrix th.act-th { background: #fef3c7; color: #92400e; }
.tbl.plan-matrix td.act-cell { background: #fffbeb; }
.tbl.plan-matrix td.act-cell.cell-pos { background: #ecfdf5; }
.tbl.plan-matrix td.act-cell.cell-neg { background: #fef2f2; }
.tbl.plan-matrix td.act-cell .act-input {
  width: 60px; padding: 2px 4px; font-size: 11px;
  border: 1px solid #fbbf24; border-radius: 3px; background: #fffefb;
  text-align: right; font-variant-numeric: tabular-nums;
  font-family: inherit; color: #92400e; outline: none;
}
.tbl.plan-matrix td.act-cell .act-input:focus { border-color: #d97706; box-shadow: 0 0 0 2px rgba(217,119,6,.15); }
.tbl.plan-matrix td.act-cell .act-input:hover { border-color: #d97706; }
.tbl.plan-matrix td.act-cell.total-cell { color: #c2520e; }
.tbl.plan-matrix td.act-cell.total-cell .act-input { width: 70px; }
.tbl.plan-matrix th.sku-name { font-size: 11px; }
.plan-tip { padding: 6px 8px; font-size: 12px; margin-bottom: 6px; }
.plan-tip .btn-mini { padding: 2px 8px; font-size: 11px; margin-left: 8px; }
.btn-mini { padding: 2px 8px; font-size: 11px; }

/* 供需看板 */
.tbl.simple { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl.simple thead th {
  background: #e8f5e9; color: #1b5e20; font-weight: 600; padding: 8px 10px;
  text-align: left; border: 1px solid #c8e0ce;
}
.tbl.simple td {
  padding: 6px 10px; border: 1px solid #e0ebe4;
}
.tbl.simple td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.simple tr.row-ok td { background: #f6fbf6; }
.tbl.simple tr.row-mid td { background: #fffbf0; }
.tbl.simple tr.row-bad td { background: #fff5f5; }
.tbl.simple td.cell-bad { background: #ffebee; color: #c62828; font-weight: 600; }
.tbl.simple td.cell-ok { background: #e8f5e9; color: #2e7d32; }
.legend { margin-top: 12px; font-size: 12px; color: #555; }
.legend span { display: inline-block; margin-right: 14px; padding: 2px 8px; border-radius: 4px; }
.legend .row-ok { background: #f6fbf6; }
.legend .row-mid { background: #fffbf0; }
.legend .row-bad { background: #fff5f5; }

/* 差异对比 */
.diff-summary h3 { margin: 0 0 12px; color: var(--green2); }
.diff-summary h4 { margin: 18px 0 8px; color: #1b5e20; font-size: 14px; }
.diff-summary .muted { color: var(--muted); font-size: 12px; }

.info, .loading {
  padding: 30px; text-align: center; color: var(--muted);
  background: #fafdfb; border-radius: 8px; font-size: 14px;
}
.error {
  padding: 16px; color: #c62828; background: #fff5f5;
  border-radius: 4px; border-left: 4px solid #c62828;
}

.kpi.cell-bad .kpi-n { color: #c62828; }
.kpi-row .kpi { padding: 12px 16px; background: #fff; border-radius: 6px; border: 1px solid #d8e8de; }

/* ============================================================
 *  水排产计划（合肥康水 / 阜阳）—— 对标厂内水计划 Excel 版式
 *  三层表头（箱/h → 产线分组+生产合计 → 品项名）+ 日期行 + 可编辑单元格
 * ============================================================ */

/* 表头上方 · 排产原则 */
.wp-tabs { margin-top: 10px; }
.wp-rules {
  background: #f6fbf7;
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 4px;
}
.wp-rules-h { font-size: 13px; font-weight: 700; color: var(--green2); margin-bottom: 6px; }
.wp-rules-list {
  margin: 0; padding-left: 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 26px;
}
.wp-rules-list li { font-size: 12px; color: var(--text); line-height: 1.55; }

/* 表格 */
.wp-grid { border-collapse: collapse; font-size: 12px; }
.wp-grid thead th.wp-corner {
  background: var(--green3); color: var(--green2);
  text-align: center; font-weight: 700; vertical-align: middle; min-width: 46px;
}
.wp-grid thead th.wp-cap {
  background: var(--bg2); color: #6e8f7c;
  font-size: 10px; font-weight: 500; text-align: center;
  padding: 2px 4px; white-space: nowrap;
}
.wp-grid thead th.wp-line {
  background: var(--green3); color: var(--green2);
  font-size: 12px; font-weight: 700; text-align: center; padding: 4px 8px; white-space: nowrap;
}
/* [1031] 计划量（SAP 订单数量）表头：产线分组下面挂线小计 */
.wp-grid thead th.wp-line .wp-line-sum {
  display: block; font-size: 10px; font-weight: 600; color: inherit; opacity: .72; margin-top: 1px;
}
/* [1031b] 计划量：线别色块 —— **只上海头两行**（产线行 + 品项名行），数据行保持原样
   （用户 2026-10-31：整片填色太丑，数据区不要色块）。组间竖线 3px，4 色循环：绿/蓝/橙/紫 */
.wp-grid thead th.wp-line.ln-hd-a { background: #bfe3cb; color: #14512c; }
.wp-grid thead th.wp-line.ln-hd-b { background: #c3daf7; color: #143f7d; }
.wp-grid thead th.wp-line.ln-hd-c { background: #f8d9a8; color: #7a4c02; }
.wp-grid thead th.wp-line.ln-hd-d { background: #d6cbf7; color: #3f2185; }
.wp-grid thead th.wp-name.ln-nm-a { background: #dcf0e4; color: #1f5c39; }
.wp-grid thead th.wp-name.ln-nm-b { background: #e0ecfd; color: #1b4a89; }
.wp-grid thead th.wp-name.ln-nm-c { background: #fdf0d8; color: #7f5509; }
.wp-grid thead th.wp-name.ln-nm-d { background: #eae3fe; color: #452b8a; }
/* 组间分隔线：3px 本组色调，贯穿表头 / 数据 / 合计；表头产线格与品项格各一条 */
.wp-grid thead th.ln-sep.ln-hd-a, .wp-grid thead th.ln-sep.ln-nm-a,
.wp-grid tbody td.ln-sep.ln-a { border-left: 3px solid #4f9e72; }
.wp-grid thead th.ln-sep.ln-hd-b, .wp-grid thead th.ln-sep.ln-nm-b,
.wp-grid tbody td.ln-sep.ln-b { border-left: 3px solid #3f86e0; }
.wp-grid thead th.ln-sep.ln-hd-c, .wp-grid thead th.ln-sep.ln-nm-c,
.wp-grid tbody td.ln-sep.ln-c { border-left: 3px solid #d1902f; }
.wp-grid thead th.ln-sep.ln-hd-d, .wp-grid thead th.ln-sep.ln-nm-d,
.wp-grid tbody td.ln-sep.ln-d { border-left: 3px solid #8f6ed6; }
.wp-grid thead th.ln-sep, .wp-grid tfoot td.ln-sep { border-left: 3px solid #8ea79a; }
/* [1009V3] 表头第1/2行的单位标签列（每桶产量 桶/箱、每小时产能 箱/h） */
.wp-grid th.wp-ulbl, .wp-grid td.wp-ulbl {
  width: 58px; min-width: 58px; max-width: 58px;
  font-size: 11px; line-height: 1.15; white-space: nowrap;
  color: #6b7280; font-weight: 600; text-align: center; vertical-align: middle;
  background: var(--bg2); border: 1px solid var(--line, #e3ece7); padding: 2px 3px;
}
.wp-grid thead th.wp-name {
  background: #eef7f1; color: var(--green2);
  font-size: 10px; font-weight: 600; text-align: center;
  padding: 4px 5px; min-width: 80px; max-width: 112px;
  white-space: normal; word-break: break-all; line-height: 1.25; vertical-align: middle;
}
.wp-grid thead th.wp-tot {
  background: #fff8e1; color: #8a6d1b;
  font-size: 11px; font-weight: 700; text-align: center;
  padding: 4px 8px; min-width: 76px; white-space: normal; vertical-align: middle;
}
.wp-grid thead th.wp-tot.nat { background: #fff3d6; }

.wp-grid tbody td.wp-date,
.wp-grid tfoot td.wp-date {
  background: var(--panel2); color: var(--green2);
  text-align: center; font-weight: 600; width: 46px; min-width: 46px;
}
.wp-grid tbody td.wp-qty { padding: 0; min-width: 62px; }
.wp-grid tbody td.wp-tot-c,
.wp-grid tfoot td.wp-tot-c {
  background: #fffdf5; color: #8a6d1b; font-weight: 600;
  text-align: right; padding: 4px 8px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wp-grid tbody td.wp-tot-c.nat,
.wp-grid tfoot td.wp-tot-c.nat { background: #fff8e8; }
.wp-grid tfoot td { background: #fff3cf; font-weight: 700; }
.wp-grid tfoot td.wp-tot-c.grand { background: #ffeeb8; color: #7a5a00; }
.wp-grid tfoot td.wp-date { background: var(--green3); }
.wp-grid tbody tr:hover td.wp-tot-c { background: #fff6dd; }

/* 逐列小字注释（热充 箱/h） */
.wp-grid thead th.wp-note,
.wp-grid thead th .wp-note {
  display: block; margin-top: 2px; font-size: 9px; font-weight: 500; color: #7c9a88;
}
.wp-grid thead th.wp-speed { color: #5b7f96; }

/* ---------- 日期行标识：周六周日淡蓝 / 法定假日淡红 ---------- */
.wp-legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 2px; }
.wp-legend .wp-lg { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.wp-legend .sw { width: 14px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.12); display: inline-block; }
.wp-legend .sw-weekend { background: #dceffb; }
.wp-legend .sw-holiday { background: #fddcdc; }
.wp-legend .sw-workday { background: #fff; }

.wp-grid tbody tr.row-weekend > td,
.wp-grid tbody tr.row-weekend > td.wp-date { background: #dceffb; }
.wp-grid tbody tr.row-weekend > td.wp-tot-c { background: #d3ebfa; }
.wp-grid tbody tr.row-holiday > td,
.wp-grid tbody tr.row-holiday > td.wp-date { background: #fddcdc; }
.wp-grid tbody tr.row-holiday > td.wp-tot-c { background: #fbd2d2; }
/* 标记行内的输入框透出底色 */
.wp-grid tbody tr.row-weekend input.cell-input,
.wp-grid tbody tr.row-holiday input.cell-input { background: transparent; }
.wp-grid tbody tr.row-weekend > td.wp-date { color: #1a6699; }
.wp-grid tbody tr.row-holiday > td.wp-date { color: #a83232; }
/* 周末/假日行的日期格加左侧色条，便于快速定位 */
.wp-grid tbody tr.row-weekend > td.wp-date { box-shadow: inset 3px 0 0 #7cc0e8; }
.wp-grid tbody tr.row-holiday > td.wp-date { box-shadow: inset 3px 0 0 #e88a8a; }

/* 计划量镜像：只读单元格 + 已冻结的历史日期行 */
.wp-grid tbody td.wp-qty.ro { text-align: right; padding: 0 6px; color: #24323d; }
.wp-grid tbody td.wp-qty.ro .qty-ro { display: block; min-height: 18px; line-height: 18px; }
.wp-grid tbody td.wp-date.past { color: #8a949c; background: #f4f6f7; box-shadow: inset 3px 0 0 #c3ccd2; }
.wp-grid tbody tr.row-weekend > td.wp-date.past { background: #dceffb; color: #1a6699; box-shadow: inset 3px 0 0 #7cc0e8; }
.wp-grid tbody tr.row-holiday > td.wp-date.past { background: #fddcdc; color: #a83232; box-shadow: inset 3px 0 0 #e88a8a; }

/* ============================================================
 *  参数中心 / 天气 / 登录（S2 + S3 + S7）
 * ============================================================ */
.pc-wrap, .wx-wrap { display: flex; flex-direction: column; gap: 10px; }
.pc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pc-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-tab {
  padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  background: #fff; border: 1px solid var(--border); color: var(--muted);
  transition: .15s; user-select: none;
}
.pc-tab:hover { border-color: var(--green); color: var(--green2); }
.pc-tab.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
/* ===== 排产配置 · 参数分组条 / 只读列 / 表头说明（S27）===== */
.pc-groups { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px; border-radius: 10px; background: #f4f9f6; border: 1px solid #e3efe8; }
.pc-group { padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  color: #48604f; border: 1px solid transparent; white-space: nowrap; }
.pc-group:hover { background: #fff; border-color: #cfe3d6; }
.pc-group.active { background: #1f7a4a; color: #fff; font-weight: 600; }
.pc-group-d { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.pc-lock { color: #93a09a; background: #f3f5f4; border-radius: 4px; padding: 1px 5px;
  font-size: 11.5px; white-space: nowrap; cursor: help; }
.pc-th-tip { cursor: help; }
.pc-th-tip::after { content: ' ⓘ'; color: #9fb3a8; font-size: 10px; }
.pc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pc-search {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; min-width: 180px; outline: none; background: #fff;
}
.pc-search:focus { border-color: var(--green); }
/* 参数管理 · 产品主数据：口味别 / 容量 下拉筛选 */
.pm-filter {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; background: #fff; color: var(--text); outline: none; max-width: 170px;
}
.pm-filter:focus { border-color: var(--green); }
.pc-hint {
  font-size: 12px; color: var(--muted); background: var(--panel2);
  border-left: 3px solid var(--green); padding: 7px 11px; border-radius: 4px;
}
.pc-dirty { color: var(--orange); font-weight: 600; }
.pc-body { background: #fff; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
/* [1026] 高度留出底部常驻横向滚动条的位置，保证它落在首屏内（表4 两级表头多占 24px）
   [1027] 横向滚动条统一交给下方镜像条 → 这里隐掉原生横向条，底部只留一条，视觉更干净；
   顺带把表高加 12px，表0（11 行）等短表能整行显示，最后一行不再被切一半。 */
.pc-scroll { max-height: calc(100vh - 380px); overflow: auto; }
/* 注意：不要用 scrollbar-width:thin —— Chrome 下它会让 ::-webkit-scrollbar 定制失效，
   原生横向条又冒出来，跟底部镜像条叠成两条 */
.pc-scroll::-webkit-scrollbar { width: 10px; height: 0; }
.pc-scroll::-webkit-scrollbar-thumb { background: #cfe0d6; border-radius: 5px; }
.pc-scroll::-webkit-scrollbar-thumb:hover { background: #a9c8b8; }
.pc-scroll::-webkit-scrollbar-track { background: #f6faf7; }
/* [1026] 表格下方常驻横向滚动条（镜像条）：不用把纵向滚到底才能左右拖 */
/* [1027] 底部横向拖动条：只留一条细滑块，不要整条色带（用户嫌原来那条宽边难看）
   放在表格与页脚之间（不在滚动区内）→ 不再需要 sticky */
.pc-hbar {
  position: relative; z-index: 1;
  height: 16px; margin: 0 0 2px; padding: 0 2px;
  overflow-x: auto; overflow-y: hidden;
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
.pc-hbar::-webkit-scrollbar { height: 14px; width: 14px; }
.pc-hbar::-webkit-scrollbar-thumb {
  background: #8fbfa4; border-radius: 7px; border: 2px solid #f6fbf8;
}
.pc-hbar::-webkit-scrollbar-thumb:hover { background: #7fae95; border-color: #e3f1ea; }
.pc-hbar::-webkit-scrollbar-track { background: transparent; }
.pc-hbar-in { height: 1px; }
.pc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pc-table th {
  position: sticky; top: 0; z-index: 2;
  background: #e8f4ee; color: #2a4a38; font-weight: 600;
  padding: 7px 5px; text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--border); border-right: 1px solid #dcebe2;
}
/* [1026] 列多且表头长的表（表1~表4 / 一致性校验）才允许表头换行：
   靠换行把列压窄，一屏放得下；表0（27 列）/ HW 宽表列更密，换行会把表头堆成 8 行，
   反而更难用，那两张保持不换行 + 横向滚动 */
.pc-table.pc-wrapth th {
  white-space: normal; line-height: 1.2; word-break: break-word;
  padding: 6px 3px; font-size: 11.5px;
}
/* ================= [1026] 表4 两级分组表头 + 按数据族标色 =================
   四块：需求量(蓝) / 供货·排单进度(绿) / 调整需求量(橙) / 次月需求·下月进度累计(紫)
   第一行只写组名，第二行写 HW1/HW2… → 窄列也不会被压成一字一行
   单元格同步上同一族底色（半透明，行悬停仍能透出来），一眼分得清哪几列是一类 */
.pc-table.pc-grouped thead tr.pg-head th {
  z-index: 4; text-align: center; padding: 5px 4px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  border-bottom: 1px solid #d5e4db;
}
.pc-table.pc-grouped thead tr.pg-sub th {
  top: var(--pc-th1h, 30px); z-index: 3;
  text-align: center; padding: 5px 3px; font-weight: 600;
}
/* 组名的四个区域色（表头深一点） */
.pc-table.pc-grouped thead th.pg-dem  { background: #d7e7f8; color: #1d466f; }
.pc-table.pc-grouped thead th.pg-prog { background: #d3ebdc; color: #1f5a3c; }
.pc-table.pc-grouped thead th.pg-adj  { background: #fbe1c6; color: #7c4415; }
.pc-table.pc-grouped thead th.pg-next { background: #e2daf5; color: #3f2f68; }
/* 第二行（列名）用同族浅色，跟第一行连成一块 */
.pc-table.pc-grouped thead tr.pg-sub th.pg-dem  { background: #e9f3fc; color: #24557f; }
.pc-table.pc-grouped thead tr.pg-sub th.pg-prog { background: #e8f6ee; color: #26664a; }
.pc-table.pc-grouped thead tr.pg-sub th.pg-adj  { background: #fdeee0; color: #85501d; }
.pc-table.pc-grouped thead tr.pg-sub th.pg-next { background: #f0ebfa; color: #4a3a75; }
/* 单元格区域底色 */
.pc-table td.pg-dem  { background: rgba(205, 226, 247, .55); }
.pc-table td.pg-prog { background: rgba(200, 232, 213, .60); }
.pc-table td.pg-adj  { background: rgba(250, 224, 197, .60); }
.pc-table td.pg-next { background: rgba(223, 215, 243, .55); }
/* 区域起点画一道竖线，四块之间不连成一片 */
.pc-table .pg-first { box-shadow: inset 2px 0 0 rgba(72, 104, 88, .28); }
/* 每个区域内的列宽下限（够放 HW1 / 61,095，不至于一字一行） */
.pc-table.pc-grouped th:not(.col-sku):not(.col-remark):not(.pc-op),
.pc-table.pc-grouped td:not(.col-sku):not(.col-remark):not(.pc-op) { min-width: 58px; }
/* 表头第一行的「序 / SKU名称」跨两行，居中显示 */
.pc-table.pc-grouped thead tr.pg-head th[rowspan] { vertical-align: middle; }
/* 横滚时冻结的「序 / SKU名称」必须压在所有分组表头之上，否则会被滚过来的组名/列名盖住 */
.pc-table.pc-grouped thead th.pc-fz { z-index: 7 !important; }

/* 允许横向滚动后，给窄列一个下限：表头不至于被压成一字一行 */
/* [1027] 表1 并入原表3 的 6 列后列更多，44px 会把「ABC分类」压成「AB/C分/类」→ 提到 56px */
.pc-table.pc-wrapth th, .pc-table.pc-wrapth td { min-width: 56px; }
/* [1026] 表4「备注」列：长文本换行、限宽 220px（放在 min-width 之后覆盖 44px 下限） */
.pc-table.pc-wrapth th.col-remark, .pc-table.pc-wrapth td.col-remark,
.pc-table th.col-remark, .pc-table td.col-remark {
  max-width: 220px; min-width: 120px; white-space: normal; word-break: break-word;
}
.pc-table td.col-remark .pc-cell { width: 100%; min-width: 0; }
.pc-table td {
  padding: 2px 3px; border-bottom: 1px solid #eef2ef; border-right: 1px solid #f2f6f3;
  white-space: nowrap;
}
.pc-table tbody tr:hover { background: #f7fbf8; }
.pc-table td.pc-idx, .pc-table th.pc-idx {
  position: sticky; left: 0; background: #f6faf7; color: var(--muted);
  text-align: center; width: 42px; font-variant-numeric: tabular-nums;
}
.pc-table th.pc-idx { z-index: 3; background: #e0efe6; }
.pc-table th.pc-op, .pc-table td.pc-op {
  position: sticky; right: 0; background: #fbfdfb; text-align: center;
  width: 150px; min-width: 150px; max-width: 150px; white-space: nowrap; z-index: 1;
}
/* [1023V2] 参数中心行级编辑：默认只读，点「✏️ 修改」才出现输入框 */
.pc-op-cell { display: flex; align-items: center; justify-content: center; gap: 3px; flex-wrap: wrap; row-gap: 2px; }
.pc-table td.pc-op .pc-mini { font-size: 10.5px; padding: 2px 4px; margin: 0; }
.pc-ro { display: inline-block; padding: 4px 1px; font-size: 12px; color: var(--text); }
.pc-ro.pc-num { text-align: right; font-variant-numeric: tabular-nums; }
.pc-ro.pc-nil { color: #c2cbc6; }
.pc-table .pc-ref { color: #7a6a52; background: #faf7f0; border-radius: 4px; padding: 3px 5px; }
.pc-th-ref { background: #f8f4ea !important; }
.pc-ref-mark { font-style: normal; font-size: 9px; font-weight: 500; color: #b08a4a;
  margin-left: 4px; border: 1px solid #e3d3b4; border-radius: 6px; padding: 0 3px; vertical-align: 1px; }
.pc-table tr.pc-editing td { background: #f4fbf6 !important; }
.pc-table tr.pc-editing td.pc-idx { background: #e2f4e9 !important; }
.pc-mini.edit { color: #1f6fa8; border-color: #bcdaea; }
.pc-mini.edit:hover { border-color: #1f6fa8; color: #17527c; }
.pc-mini.cfg { color: #7a5aa0; border-color: #ddcfec; margin-left: 3px; }
.pc-mini.cfg:hover { border-color: #7a5aa0; color: #5b3f7d; }
/* 机组多值 chip */
.pc-grp-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-width: 130px; }
.pc-chip { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px;
  background: #eef3fb; border: 1px solid #d3e0f0; color: #2b5d8c; white-space: nowrap; }
/* 机组勾选弹层 */
.pc-grp-modal { max-width: 640px; }
.pc-grp-tip { font-size: 12px; color: #55665c; background: #f4faf6; border-left: 3px solid var(--green);
  border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; line-height: 1.6; }
.pc-grp-tip code { background: #fff; border: 1px solid #dbe7df; border-radius: 3px; padding: 0 4px; }
.pc-grp-list { display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow: auto; }
.pc-grp-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 9px; background: #fff; font-size: 12.5px; }
.pc-grp-row.on { border-color: #9fcbb0; background: #f5fbf7; }
.pc-grp-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; flex: 1; }
.pc-grp-name { font-weight: 600; }
.pc-grp-ord { font-size: 11px; color: var(--green2); background: var(--green3);
  border-radius: 9px; padding: 1px 7px; white-space: nowrap; }
.pc-grp-cap { width: 64px; border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px;
  font-size: 12px; text-align: center; }
.pc-grp-add { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; }
.pc-grp-add input { flex: 0 0 190px; border: 1px solid var(--border); border-radius: 5px; padding: 4px 7px; font-size: 12px; }
.pc-grp-sum { margin-left: auto; color: #55665c; }.pc-table th.pc-op { z-index: 3; background: #e0efe6; }
.pc-cell {
  width: 100%; min-width: 58px; border: 1px solid transparent; background: transparent;
  padding: 4px 5px; border-radius: 4px; font-size: 12px; font-family: inherit;
  color: var(--text); outline: none;
}
.pc-cell:hover { border-color: #d5e5db; background: #fbfefc; }
.pc-cell:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 2px rgba(39,163,92,.13); }
.pc-cell.wide { min-width: 260px; }
.pc-dirty-row td { background: #fff9ec !important; }
.pc-dirty-row td.pc-idx { background: #fdf1d8 !important; }
.pc-new td { background: #eefaf1 !important; }
.pc-new td.pc-idx { background: #dcf3e4 !important; color: var(--green2); font-weight: 700; }
/* 标记待删除的行 */
.pc-del-row td { opacity: .5; text-decoration: line-through; }

/* 参数管理 · 表格卡片（只读展示，点「✏️ 编辑」才出现输入框） */
.pm-panel > h3 { display: flex; align-items: center; gap: 8px; }
.pm-panel > h3 .pm-ops { margin-left: auto; display: flex; gap: 4px; }
.pm-badge {
  font-size: 11px; font-weight: 600; color: var(--green2); background: var(--green3);
  border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px;
}
.pm-table td.pm-idx, .pm-table th.pm-idx { width: 42px; text-align: center; color: var(--muted); }
.pm-table td.editable-cell { background: transparent; word-break: break-all; }
.pm-table tr.pc-del-row .row-action.edit { opacity: .4; pointer-events: none; }
.pm-actions-note { margin: 0 0 10px; }
.pc-wrap .action-bar .note { font-size: 12px; color: var(--muted); }
.pc-mini {
  border: 1px solid var(--border); background: #fff; border-radius: 4px;
  padding: 2px 7px; font-size: 11px; cursor: pointer; margin: 0 1px; color: var(--muted);
}
.pc-mini:hover { border-color: var(--green); color: var(--green2); }
.pc-mini.ok { color: var(--green2); border-color: #b7e0c7; }
.pc-mini.del { color: var(--red); border-color: #f2c9c6; }
.pc-mini.undo { color: var(--orange); border-color: #f0dcb6; }
.pc-empty, .pc-loading { padding: 34px; text-align: center; color: var(--muted); }
.pc-err { padding: 20px; color: var(--red); }
.pc-foot { padding: 7px 12px 6px; font-size: 12px; color: var(--muted); border-top: 1px dashed #e6f0ea; background: #fbfdfb; }
.pc-mono { font-family: Consolas, Consolas, monospace; font-size: 11.5px; color: #4a6b58; }
.pc-note { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.pc-badge { padding: 1px 7px; border-radius: 999px; font-size: 11px; background: #eef2ef; color: var(--muted); }

/* 参数管理 · 紧凑排版：表头自动换行、行距缩小，整表不横向滚动、尽量一屏放下 */
.pm-panel { margin-bottom: 10px; }
.pm-panel .pc-scroll { max-height: calc(100vh - 260px); }
.pm-table { font-size: 12px; table-layout: fixed; }
.pm-table th, .pm-table td { padding: 3px 6px; vertical-align: middle; }
.pm-table th { white-space: normal; word-break: break-all; line-height: 1.25; text-align: center; }
.pm-table td { line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-table td.full { white-space: normal; word-break: break-word; }   /* 生产线名称/口味别/瓶型完整显示 */
.pm-table tr.editing td { overflow: visible; }
.pm-table tr.editing td input { width: 100%; box-sizing: border-box; }
.pm-table td.pm-idx, .pm-table th.pm-idx { width: 34px; }
.pm-table .col-action { width: 150px; white-space: nowrap; text-align: center; }
.pm-table .row-action { padding: 1px 6px; margin-left: 2px; }
.pc-wrap .panel { margin-bottom: 10px; }
.pc-wrap .pc-actions, .pc-wrap .action-bar { margin-bottom: 8px; }

/* 参数管理 · 小表美化：斑马纹 + 数值居中 + 空值淡化 + 表头弱化 */
.pm-table { border-collapse: separate; border-spacing: 0; }
.pm-table th {
  font-size: 11.5px; font-weight: 600; color: #55705f;
  background: #f2f8f4; border-bottom: 2px solid #dcebe2;
}
.pm-table tbody tr:nth-child(even) { background: #fafcfb; }
.pm-table tbody tr:hover { background: #f2f8f2; }
.pm-table td { border-bottom: 1px solid #eef3ef; }
.pm-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.pm-table td.muted { color: #b9c4bc; text-align: center; }
.pm-table tr.editing td.muted { color: inherit; }
.pm-table .col-action .row-action { border-radius: 999px; }
.pc-badge.insert { background: #e2f5e9; color: var(--green2); }
.pc-badge.update { background: #e6f0fb; color: #2f6fa8; }
.pc-badge.delete { background: #fdeaea; color: var(--red); }
.pc-badge.save { background: #f2ecfb; color: #6b4fb8; }
.pc-badge.revert { background: #fdf3e2; color: #b07d22; }

/* 撤销弹窗 */
.pc-modal-mask {
  position: fixed; inset: 0; background: rgba(20,40,30,.42); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pc-modal {
  background: #fff; border-radius: 10px; width: min(880px, 96vw);
  max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.pc-modal-h { padding: 13px 18px; font-weight: 700; border-bottom: 1px solid var(--border); }
.pc-modal-b { padding: 12px 16px; overflow: auto; }
.pc-modal-f { padding: 11px 18px; border-top: 1px solid var(--border); text-align: right; }

/* ---------- 天气 ---------- */
.wx-title { font-weight: 700; font-size: 14px; }
.wx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.wx-card {
  background: linear-gradient(160deg, #ffffff, #f4fbf7);
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px;
  box-shadow: var(--shadow); position: relative;
}
.wx-card.today { border-color: var(--green); box-shadow: 0 3px 14px rgba(39,163,92,.20); }
.wx-d { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.wx-wk { color: #8aa79a; }
.wx-today { background: var(--green); color: #fff; border-radius: 4px; padding: 0 5px; font-size: 10.5px; }
.wx-ico { font-size: 30px; line-height: 1.25; margin: 5px 0 1px; }
.wx-cond { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.wx-temp { font-size: 19px; font-weight: 700; color: var(--green2); font-variant-numeric: tabular-nums; }
.wx-unit { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.wx-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.wx-tag { font-size: 11px; background: #eef4f0; color: var(--muted); border-radius: 4px; padding: 1px 6px; }
.wx-src { position: absolute; top: 10px; right: 11px; font-size: 10px; border-radius: 4px; padding: 1px 5px; }
.wx-src.auto { background: #e6f0fb; color: #2f6fa8; }
.wx-src.manual { background: #fdf3e2; color: #b07d22; }
.wx-table .pc-cell { min-width: 78px; }

/* ---------- 登录 ---------- */
#login-mask {
  position: fixed; inset: 0; z-index: 1000; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(150deg, #eaf6f0, #dceade);
}
.login-box {
  background: #fff; border-radius: 14px; padding: 30px 32px 24px;
  width: min(378px, 92vw); box-shadow: 0 14px 46px rgba(31,74,52,.20);
  border-top: 4px solid var(--green);
}
.login-brand { font-size: 18px; text-align: center; margin-bottom: 20px; color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-logo { width: 42px; height: 42px; object-fit: contain; }
.login-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; text-align: left; }
.login-field { margin-bottom: 13px; }
.login-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.login-field input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; outline: none; font-family: inherit;
}
.login-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,163,92,.12); }
.login-err { color: var(--red); font-size: 12px; min-height: 17px; margin-bottom: 6px; }
.login-btn { width: 100%; padding: 10px; font-size: 14px; }
.login-tip { font-size: 11px; color: #9bb3a6; text-align: center; margin-top: 12px; line-height: 1.7; }
.login-tip b { color: var(--green2); font-weight: 600; }
.user-chip {
  font-size: 12px; background: var(--green3); color: var(--green2);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; user-select: none;
  border: 1px solid #c7e8d5;
}
.user-chip:hover { background: #d3eedd; }

/* ---------- 轻提示 ---------- */
.pc-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(31,60,45,.94); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 1200; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 76vw; text-align: center;
}
.pc-toast.err { background: rgba(178,55,48,.95); }

/* ============================================================
   排产结果模块（#module-result）
     · .pr-bar     顶部运行批次条
     · .pr-board   日排产看板（线×SKU × 日期），支持拖动改时间
     · .pr-sheet   12 张输出表通用呈现
   ============================================================ */
.pr-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--panel2, #f4faf6); border: 1px solid var(--border);
  border-radius: 8px;
}
.pr-lb { font-size: 12px; color: var(--muted); }
.pr-select {
  padding: 6px 10px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); max-width: 420px;
}
.pr-input {
  padding: 6px 10px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text);
}
.pr-filter { margin-bottom: 8px; }
.pr-filter .btn { padding: 5px 10px; font-size: 12px; }
.pr-kpi { font-size: 12px; color: var(--muted); margin-left: auto; }
.pr-kpi b { color: var(--green2, #1d6b3f); font-size: 13px; }

.pr-note {
  font-size: 12px; color: #6b7d72; line-height: 1.7;
  background: #f7fbf8; border-left: 3px solid var(--green, #35a06a);
  padding: 8px 12px; border-radius: 0 6px 6px 0; margin-bottom: 10px;
}
.pr-hint { font-size: 11px; color: var(--muted); margin-top: 8px; }
.pr-legend { font-size: 11px; color: var(--muted); margin-top: 8px; text-align: right; }

.pr-empty, .pr-loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.9; }
.pr-empty .btn { margin-top: 14px; }
.pr-loading::before {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  border: 2px solid #cfe3d7; border-top-color: var(--green, #35a06a);
  border-radius: 50%; animation: pr-spin .8s linear infinite; vertical-align: -1px;
}
@keyframes pr-spin { to { transform: rotate(360deg); } }

/* 碳酸排产确认（订单驱动 · 上下值） */
.pr-carbon { padding: 10px 4px 30px; }
.pr-carbon-note {
  background: #f4f8ff; border-left: 3px solid #4a7fd4; color: #35507d;
  padding: 8px 12px; border-radius: 0 6px 6px 0; margin-bottom: 10px;
  font-size: 12px; line-height: 1.9;
}
.cp-table { font-size: 12px; }
.cp-table td, .cp-table th { padding: 5px 6px; }
.cp-table .r, .cp-table th.r { text-align: right; }
.cp-table .c, .cp-table th.c { text-align: center; }
.cp-table tfoot th { background: #f2f5f8; font-weight: 700; }
.cp-pick { display: inline-flex; align-items: center; gap: 2px; margin: 0 3px; font-size: 12px; cursor: pointer; }
.cp-neg { color: #c0392b; }
.cp-pos { color: #1e8449; }

/* ---------- 日排产看板 ---------- */
.pr-board-wrap, .pr-sheet-wrap {
  overflow: auto; max-height: 68vh; max-width: 100%;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.tbl.pr-board, .tbl.pr-sheet { border-collapse: separate; border-spacing: 0; font-size: 12px; width: auto; min-width: 100%; }
.tbl.pr-board th, .tbl.pr-board td,
.tbl.pr-sheet th, .tbl.pr-sheet td {
  padding: 6px 8px; border-bottom: 1px solid var(--border); border-right: 1px solid #eef4f0;
  white-space: nowrap;
}
.tbl.pr-board thead th, .tbl.pr-sheet thead th {
  position: sticky; top: 0; z-index: 3;
  background: #e0efe6; color: var(--green2, #1d6b3f); font-weight: 600;
  border-bottom: 1px solid #cfe3d7;
}
/* 冻结前三列 + 月合计 */
.tbl.pr-board th.pr-fix1, .tbl.pr-board td.pr-fix1,
.tbl.pr-board th.pr-fix2, .tbl.pr-board td.pr-fix2,
.tbl.pr-board th.pr-fix3, .tbl.pr-board td.pr-fix3 {
  position: sticky; z-index: 4; background: #f7fbf8; text-align: left;
  border-right: 1px solid #dfeee6;
}
.tbl.pr-board thead th.pr-fix1, .tbl.pr-board thead th.pr-fix2, .tbl.pr-board thead th.pr-fix3 { z-index: 6; background: #e0efe6; }
.tbl.pr-board th.pr-fix1, .tbl.pr-board td.pr-fix1 { left: 0; min-width: 96px; }
.tbl.pr-board th.pr-fix2, .tbl.pr-board td.pr-fix2 { left: 96px; min-width: 190px; }
.tbl.pr-board th.pr-fix3, .tbl.pr-board td.pr-fix3 { left: 286px; min-width: 84px; }
.tbl.pr-board th.pr-sum, .tbl.pr-board td.pr-sum {
  position: sticky; left: 370px; z-index: 4; min-width: 92px;
  background: #eef7f1; font-weight: 700; color: var(--green2, #1d6b3f);
  text-align: right; border-right: 2px solid #cfe3d7;
}
.tbl.pr-board thead th.pr-sum { z-index: 6; background: #dceee3; }

.tbl.pr-board th.pr-d, .tbl.pr-sheet th.pr-d { text-align: center; min-width: 62px; }
.tbl.pr-board td.pr-drop,
.tbl.pr-board td.pr-cell { text-align: right; min-width: 62px; font-variant-numeric: tabular-nums; }
.tbl.pr-board td.pr-cell { cursor: grab; }
.tbl.pr-board td.pr-cell:active { cursor: grabbing; }
.tbl.pr-board td.pr-cell:hover { background: #eef8f2; }
.tbl.pr-board td.pr-drop { background: #fcfdfc; }
.tbl.pr-board td.pr-drop:hover { background: #eaf6ef; outline: 1px dashed var(--green, #35a06a); outline-offset: -2px; }
.tbl.pr-board td.pr-adj { background: #fff4d6; color: #8a6d1b; font-weight: 600; }
.tbl.pr-board td.pr-adj:hover { background: #ffedbf; }
.tbl.pr-board tbody tr:hover td.pr-fix1,
.tbl.pr-board tbody tr:hover td.pr-fix2,
.tbl.pr-board tbody tr:hover td.pr-fix3 { background: #eef8f2; }

.tbl.pr-sheet td.pr-neg { color: #b23730; }
.tbl.pr-sheet th { position: sticky; top: 0; }
.tbl.pr-sheet td:first-child { text-align: left; }
/* 排产结果输出表：冻结前三列（生产线 / SKU名称 / 瓶型） */
.tbl.pr-sheet th.pr-fix1, .tbl.pr-sheet td.pr-fix1,
.tbl.pr-sheet th.pr-fix2, .tbl.pr-sheet td.pr-fix2,
.tbl.pr-sheet th.pr-fix3, .tbl.pr-sheet td.pr-fix3 {
  position: sticky; z-index: 4; background: #f7fbf8; text-align: left;
  border-right: 1px solid #dfeee6;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}
.tbl.pr-sheet thead th.pr-fix1, .tbl.pr-sheet thead th.pr-fix2, .tbl.pr-sheet thead th.pr-fix3 { z-index: 6; background: #e0efe6; }
.tbl.pr-sheet th.pr-fix1, .tbl.pr-sheet td.pr-fix1 { left: 0; min-width: 96px; }
.tbl.pr-sheet th.pr-fix2, .tbl.pr-sheet td.pr-fix2 { left: 96px; min-width: 190px; }
.tbl.pr-sheet th.pr-fix3, .tbl.pr-sheet td.pr-fix3 { left: 286px; min-width: 84px; }
.tbl.pr-sheet tbody tr:hover td.pr-fix1,
.tbl.pr-sheet tbody tr:hover td.pr-fix2,
.tbl.pr-sheet tbody tr:hover td.pr-fix3 { background: #eef8f2; }

/* ============================================================
 *  「🧩 品项对应」弹窗 —— 日排产 SKU ↔ 计划表头品项
 * ============================================================ */
.pds-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: fadeIn .15s ease;
}
.pds-dlg {
  background: #fff; border-radius: 10px; width: min(960px, 92vw);
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.25); overflow: hidden;
}
.pds-h {
  background: var(--green); color: #fff; padding: 12px 18px; font-weight: 600;
  font-size: 14px;
}
.pds-tip { font-size: 12px; color: var(--muted); }
.pds-body {
  padding: 12px 18px; overflow: auto; flex: 1;
  background: var(--panel2, #f3f8f4);
}
.pds-body .pds-loading,
.pds-body .pds-empty {
  padding: 30px; text-align: center; color: var(--muted); font-size: 13px;
}
.pds-sum {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; margin-bottom: 10px; font-size: 12px; color: #456;
}
.pds-sum b { color: var(--green2); }
.pds-sum b.bad { color: var(--red); }
.pds-tbl { background: #fff; table-layout: fixed; }
.pds-tbl th { background: #e0efe6; text-align: left; }
.pds-tbl td, .pds-tbl th { font-size: 12px; padding: 6px 8px; vertical-align: middle; }
.pds-tbl td.r, .pds-tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.pds-tbl td:first-child { word-break: break-all; }
.pds-tbl tr.pds-bad td { background: #fff6f5; }
.pds-tbl select {
  width: 100%; padding: 5px 8px; border: 1px solid #d0d7d2; border-radius: 5px;
  font-size: 12px; background: #fff;
}
.pds-tbl select:focus { outline: 2px solid var(--green3); border-color: var(--green); }
.pds-f {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  border-top: 1px solid var(--border); background: #fff;
}
.pds-f .btn { font-size: 12px; }

/* 排产计划只读单元格（改为日排产回填后统一为只读） */
.sched-grid tbody td.qty-cell.ro { background: #fcfefd; }
.pds-tbl tr.pds-warn td { background: #fff8e6; }

/* ===== 生产订单 · 批导订单（SAP 天计划批输入） ===== */
.ob-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 10px 0; padding: 8px 12px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 8px; font-size: 12px;
}
.ob-bar label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.ob-bar input[type="date"], .ob-bar select {
  padding: 4px 7px; border: 1px solid #d0d7d2; border-radius: 5px;
  font-size: 12px; background: #fff; color: var(--text);
}
.ob-bar .btn { font-size: 12px; padding: 5px 12px; }
.ob-bar .ob-gap { flex: 1 1 auto; }
.ob-dirty {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: #fff3cd; color: #8a6d1b; font-weight: 700; text-align: center;
}
.ob-warn {
  margin: 8px 0; padding: 8px 12px; border: 1px solid #f0d29a; border-radius: 8px;
  background: #fff8e6; color: #8a6d1b; font-size: 12px; line-height: 2;
}
.ob-warn .ob-sku {
  display: inline-block; margin: 0 4px; padding: 1px 7px; border-radius: 10px;
  background: #fff; border: 1px solid #e8d28a; font-weight: 600; color: #a3342b;
}
.ob-warn .ob-warn-tip { color: var(--muted); font-size: 11px; line-height: 1.6; }
/* 起始日之后没有数量：强提示（不是故障，是还没锁定） */
.ob-warn.ob-warn-empty { border-color: #e2a03f; background: #fff4e0; color: #8a5a12; font-size: 13px; }
.ob-warn code { background: #fff; padding: 1px 5px; border-radius: 4px; }
.ob-warn .ob-sel { max-width: 320px; padding: 3px 6px; font-size: 12px; border: 1px solid #d0d7d2; border-radius: 5px; }
.ob-wrap {
  overflow: auto; max-height: 68vh; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; padding: 6px;
}
.ob-grid { border-collapse: separate; border-spacing: 0; font-size: 11px; }
.ob-grid th, .ob-grid td { border-right: 1px solid #d7e4dc; border-bottom: 1px solid #d7e4dc; }
.ob-grid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--green3); color: var(--green2);
  font-weight: 600; padding: 5px 6px; text-align: center; white-space: nowrap;
}
.ob-grid thead th.ob-day { min-width: 62px; }
.ob-grid thead th.ob-c3 { min-width: 300px; }
.ob-grid thead th.ob-c2 { min-width: 150px; }
.ob-grid tbody td.ob-c1, .ob-grid tbody td.ob-c4, .ob-grid tbody td.ob-c5, .ob-grid tbody td.ob-c6 {
  position: sticky; z-index: 2; background: var(--panel2); text-align: center; color: var(--muted);
}
.ob-grid tbody td.ob-c2 {
  position: sticky; left: 46px; z-index: 2; background: var(--panel2);
  font-weight: 600; color: var(--green2); white-space: nowrap; padding: 0 6px;
  width: 150px; max-width: 150px; overflow: hidden;
}
.ob-grid tbody td.ob-c3 {
  position: sticky; left: 196px; z-index: 2; background: var(--panel2);
  color: var(--text); width: 300px; max-width: 300px; overflow: hidden; white-space: nowrap; padding: 0 6px;
}
.ob-grid tbody td.ob-c1 { left: 0; min-width: 46px; }
.ob-grid tbody td.ob-c4 { left: 496px; min-width: 78px; width: 78px; }
.ob-grid tbody td.ob-c5 { left: 574px; min-width: 56px; }
.ob-grid tbody td.ob-c6 { left: 630px; min-width: 56px; }
.ob-grid tbody tr:hover td.ob-c2, .ob-grid tbody tr:hover td.ob-c3 { background: #eef7f1; }
.ob-main {
  display: inline-block; padding: 0 4px; border-radius: 3px; background: var(--green);
  color: #fff; font-size: 9px; vertical-align: middle;
}
/* 收货库位：仅「五码合一」料号填 0022（其余留空，故留空是正常态，不标红） */
.ob-grid tbody td.ob-c5.ob-loc-on { color: var(--green2); font-weight: 700; }
/* 数据来源条：版本下拉 + 口径说明（S4c） */
.ob-src {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 8px 0 0; padding: 8px 12px; background: #f2f8f4;
  border: 1px solid var(--border); border-left: 3px solid var(--green1);
  border-radius: 8px; font-size: 12px; color: var(--text);
}
.ob-src select {
  padding: 4px 7px; border: 1px solid #d0d7d2; border-radius: 5px;
  font-size: 12px; background: #fff; color: var(--text); max-width: 340px;
}
.ob-src .ob-inc { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.ob-src .ob-src-tip { color: var(--muted); line-height: 1.6; }
.ob-src .ob-pend { color: #A32D2D; font-weight: 600; }
/* 物料描述：下拉选（候选按「物料码」限定），选中后物料号码自动同步 */
.ob-matSel {
  width: 284px; max-width: 284px; padding: 2px 2px; border: 1px solid #d7e4dc;
  border-radius: 4px; background: #fff; font-size: 11px; color: var(--text);
  text-overflow: ellipsis; cursor: pointer;
}
.ob-matSel:hover { border-color: var(--green1); background: #eaf6ee; }
.ob-matSel:focus { outline: none; border-color: var(--green1); background: #eaf6ee; box-shadow: 0 0 0 2px rgba(46,125,50,.15); }
/* 已改但未保存的换料号 → 浅黄提示 */
.ob-matSel.mat-chg { background: #fff3cd; border-color: #e0c26a; font-weight: 600; }
/* 生产版本：下拉选（候选 = 该物料号码在「成品料号」表登记的生产版本1/2/3） */
.ob-verSel {
  width: 72px; max-width: 72px; padding: 2px 1px; border: 1px solid #d7e4dc;
  border-radius: 4px; background: #fff; font-size: 11px; color: var(--text);
  cursor: pointer; text-align: center;
}
.ob-verSel:hover { border-color: var(--green1); background: #eaf6ee; }
.ob-verSel:focus { outline: none; border-color: var(--green1); background: #eaf6ee; box-shadow: 0 0 0 2px rgba(46,125,50,.15); }
.ob-verSel.mat-chg { background: #fff3cd; border-color: #e0c26a; font-weight: 600; }
.ob-grid td.ob-cell { padding: 0; text-align: center; background: #fff; }
.ob-in {
  width: 100%; min-width: 58px; border: none; background: transparent; text-align: right;
  padding: 4px 5px; font-size: 11px; color: var(--text); outline: none;
  font-variant-numeric: tabular-nums;
}
.ob-in:focus { background: #eaf6ee; box-shadow: inset 0 0 0 2px var(--green1); }
.ob-in.dirty { background: #fff3cd; font-weight: 600; }
.ob-in.is-main { color: var(--green2); }
.ob-grid td.ob-tot, .ob-grid th.ob-tot {
  background: var(--green3); color: var(--green2); font-weight: 700;
  text-align: right; padding: 0 6px; min-width: 88px; white-space: nowrap;
  position: sticky; right: 0; z-index: 2;
}
.ob-grid tfoot td {
  position: sticky; bottom: 0; background: #f3f7eb; font-weight: 700;
  color: var(--green2); text-align: right; padding: 3px 6px; z-index: 2;
}
.ob-grid tfoot td.ob-c1, .ob-grid tfoot td.ob-c2, .ob-grid tfoot td.ob-c3 { text-align: left; }

/* ===== 参数中心 · HW需求明细（电子表宽表） ===== */
.pc-hw .pc-table th, .pc-hw .pc-table td { font-size: 11.5px; }
.pc-hw th.hw-sku, .pc-hw td.hw-sku {
  position: sticky; left: 42px; z-index: 2;
  min-width: 150px;
  background: #f9fcfa; border-right: 2px solid #dcebe2; font-weight: 600;
  white-space: nowrap;   /* [0928] 列宽自适应内容，不截断 */
}
.pc-hw th.hw-sku { z-index: 4; background: #e0efe6; }
.pc-hw tbody tr:hover td.hw-sku { background: #eef7f1; }
.pc-hw .hw-num { text-align: right; font-variant-numeric: tabular-nums; }
.pc-hw .hw-calc { display: inline-block; width: 100%; text-align: right; padding: 4px 6px; color: #2a4a38; }
.pc-hw td.hw-sku .pc-cell { font-weight: 600; width: auto; min-width: 120px; }   /* [0928] 不再锁 100% 宽，随内容撑开 */

/* [0928] 普通视图（表4 等）SKU名称列：自适应宽度（冻结改由下面的 .pc-fz 统一处理） */
.pc-table th.col-sku, .pc-table td.col-sku {
  background: #f9fcfa; border-right: 2px solid #dcebe2; font-weight: 600; white-space: nowrap;
}
.pc-table th.col-sku { background: #e0efe6; }
.pc-table tbody tr:hover td.col-sku { background: #eef7f1; }
.pc-table td.col-sku .pc-cell { font-weight: 600; }
.pc-dirty-row td.col-sku { background: #fff9ec !important; }
.pc-new td.col-sku { background: #eefaf1 !important; }

/* [1026] 参数中心前两列冻结（左贴）：第一列 left 0，第二列 left = 第一列实测宽度（--pc-fz1w 由 JS 量出）
   覆盖表0 产线/线型、表1~4 序/SKU、表5 序/产线、HW SKU/当月需求，滚到右边时这两列不丢 */
.pc-table .pc-fz { position: sticky; z-index: 2; background: #fbfdfb; }
.pc-table th.pc-fz { z-index: 4; background: #e0efe6; }
.pc-table .pc-fz1 { left: 0; }
.pc-table .pc-fz2 { left: var(--pc-fz1w, 0px); }
.pc-table td.pc-fz2 { border-right: 2px solid #dcebe2; }
.pc-table tbody tr:hover td.pc-fz { background: #eef7f1; }
.pc-dirty-row td.pc-fz { background: #fff9ec !important; }
.pc-new td.pc-fz { background: #eefaf1 !important; }
.pc-table tr.pc-editing td.pc-fz { background: #f4fbf6 !important; }

/* HW 需求量（公式自动填充，只读） */
.pc-hw .hw-auto { background: #f2f8f4; color: #35634a; font-weight: 600; cursor: default; }
.pc-hw td:has(.hw-auto) { background: #f2f8f4; }
.pc-hw .pc-table thead th:first-child { background: #d6ead9; }
/* [1023V3] HW 表去掉「#」后 SKU 列变第一列，无需再为 pc-no-idx 调 left */

/* ===== 参数中心 · 表4 页内的「需求版本 / 代工订单版本」选择条 ===== */
.pc-verbar {
  margin: 0 0 10px; padding: 8px 12px;
  background: linear-gradient(90deg, #eef6ff 0%, #f7fbff 100%);
  border: 1px solid #cfe1fb; border-left: 4px solid var(--blue, #1f5eff);
  border-radius: 8px; font-size: 13px;
}
.pc-ver-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 3px 0;
}
.pc-ver-row + .pc-ver-row { border-top: 1px dashed #d8e6fb; margin-top: 4px; padding-top: 7px; }
.pc-ver-lb { font-weight: 600; color: #23406f; white-space: nowrap; min-width: 104px; }
.pc-verbar select {
  min-width: 180px; max-width: 320px; padding: 4px 8px;
  border: 1px solid #bcd3f6; border-radius: 6px; background: #fff; font-size: 13px;
}
.pc-verbar select:disabled { color: #98a4b8; background: #f5f7fa; }
.pc-ver-meta { color: #5b7a9e; font-size: 12.5px; }
.pc-ver-row .btn { padding: 3px 10px; font-size: 12.5px; margin-left: auto; }
.pc-ver-dg { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; }
.pc-ver-dg b { color: #23406f; font-weight: 600; }
.pc-ver-dg select { min-width: 150px; }
/* 需求版本的「槽位月份」小标签（当月 / 次月 / 下下月） */
.pc-ver-slot {
  padding: 2px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap;
  background: #eaf1fd; color: #37527f; border: 1px solid #cddcf5;
}
.pc-ver-slot.next { background: #eefaf1; color: #1f6b3a; border-color: #bfe3cb; }
.pc-ver-slot.m2 { background: #fdf3ea; color: #8a5314; border-color: #f0d9bd; }
.pc-ver-row .pc-ver-meta.ok { color: #237a45; font-weight: 600; }

/* ===== 后台数据导入 · 模块工具条 ===== */
.imp-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 8px 12px;
  background: linear-gradient(90deg, #f2f8ff 0%, #fbfdff 100%);
  border: 1px solid #d8e6fb; border-radius: 8px;
}
.imp-bar .btn { text-decoration: none; display: inline-flex; align-items: center; }
.imp-bar .grow { flex: 1; }
.imp-bar .note { font-size: 12px; color: #5b7a9e; }

/* ===== 分类别 / 规格别 / 关键字 查询条 ===== */
.imp-filter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 10px; margin: 8px 0 10px;
  background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px;
}
.imp-filter .flt-label { font-weight: 600; font-size: 13px; color: #23406f; }
.imp-filter label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.imp-filter select, .imp-filter input {
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 12.5px;
}
.imp-filter .grow { flex: 1; }
.imp-filter .note { font-size: 12px; color: var(--muted); }

/* ===== 表格编辑工具条 ===== */
.imp-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.imp-tools .grow { flex: 1; }
.imp-tools .note { font-size: 11.5px; color: var(--muted); }
.imp-tools .btn { padding: 4px 10px; font-size: 12.5px; }

#imp-paste-daigong, [id^="imp-paste-dg-"], [id^="imp-paste-"] {
  background: #fffbe9; border: 1px solid #f0d68a; border-radius: 8px; padding: 8px; margin-bottom: 8px;
}
.imp-paste-wrap textarea, textarea[id^="imp-pastebox-"] {
  width: 100%; font-family: Consolas, Menlo, monospace; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px;
}

/* ===== 可编辑表格 ===== */
.imp-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 8px; }
.imp-editable thead th { position: sticky; top: 0; z-index: 2; background: #eef3fb; }
.imp-editable td.idx { color: var(--muted); font-size: 11.5px; text-align: center; }
.imp-editable td.editable-cell:focus {
  outline: 2px solid var(--blue); outline-offset: -2px; background: #fff;
}
.imp-editable tr.dirty td.editable-cell { background: #fff3c4; }
.imp-editable tr.dirty td:first-child { border-left: 3px solid #f0a020; }
.imp-editable tr.to-del { opacity: .6; }
.imp-editable tr.to-del td.editable-cell { background: #ffe3e3; text-decoration: line-through; }

/* 预算量明细：源表宽表（工厂/工作中心/品类/物料码/品项/1~12月/合计预算量） */
.imp-budget-tbl thead th { position: sticky; top: 0; z-index: 2; background: #eef3fb; white-space: nowrap; }
.imp-budget-tbl th, .imp-budget-tbl td { padding: 5px 8px; white-space: nowrap; font-size: 12.5px; }
.imp-budget-tbl td.idx { color: var(--muted); font-size: 11.5px; text-align: center; }
.imp-budget-tbl tbody tr:nth-child(even) { background: #fafbfd; }
.imp-editable tr.to-del td:first-child { border-left: 3px solid #e05252; }
.imp-editable tr[data-id=""] td.editable-cell { background: #eefaf1; }
.imp-hint {
  margin: 2px 0 10px; padding: 6px 10px; font-size: 12.5px; color: #23506f;
  background: #eaf4ff; border-left: 3px solid var(--blue); border-radius: 4px;
}
.imp-ver-detail { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }

/* ===== 代工订单：按月折叠（.dem-month = 1+3需求按年月分组，同款样式） ===== */
.dg-month, .dem-month { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.dg-month > .dg-body, .dem-month > .dg-body { display: none; padding: 10px; background: #fcfdff; }
.dg-month.open > .dg-body, .dem-month.open > .dg-body { display: block; }
.dem-head { background: #f6f2fc; }
.dem-head:hover { background: #efe7fb; }
.dg-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 9px 12px; background: #f2f6fc; font-size: 13.5px;
}
.dg-head:hover { background: #e8f0fb; }
.dg-head .arrow { font-size: 10px; color: var(--muted); transition: transform .15s; display: inline-block; }
.dg-month.open .dg-head .arrow, .dem-month.open .dg-head .arrow { transform: rotate(90deg); }
.dg-head .note { font-size: 12px; color: var(--muted); }
.dg-head .grow { flex: 1; }
.dg-ver-badge {
  padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600;
  background: #e7edf8; color: #37527f; border: 1px solid #cddcf5;
}
.dg-ver-badge.on { background: var(--green); color: #fff; border-color: var(--green); }
/* 需求月份卡：写入目标标签（当月需求 / 次月需求） */
.dg-head .dem-slot {
  padding: 2px 8px; border-radius: 10px; font-size: 11.5px;
  background: #fff; color: #6b4fa1; border: 1px solid #ddd0f2;
}
.dem-month.slot-next .dg-head .dem-slot { color: #1f6b3a; border-color: #bfe3cb; background: #f2fbf5; }
.dem-month.slot-next > .dg-head { background: #f2f8f4; }
.dem-month.slot-next > .dg-head:hover { background: #e9f5ee; }
.dem-month.slot-m2 .dg-head .dem-slot { color: #8a5314; border-color: #f0d9bd; background: #fdf6ee; }
.dem-month.slot-m2 > .dg-head { background: #fdf8f3; }
.dem-month.slot-m2 > .dg-head:hover { background: #faf1e8; }
.dem-month.slot-cur > .dg-head { background: #f6f2fc; }
.dg-head .dem-slot.warn { color: #a15c00; border-color: #f0d9ab; background: #fff8ea; }
.dem-month.on .dg-head, .dg-month.on .dg-head { box-shadow: inset 3px 0 0 var(--green); }
.dg-versel {
  display: flex; align-items: center; gap: 4px; cursor: default;
  font-size: 12px; color: var(--muted);
}
.dg-versel select {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 6px; font-size: 12px; outline: none;
}
.dg-verbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px; border-radius: 8px;
  background: #eef3fb; border: 1px solid #dbe5f5; font-size: 12.5px;
}
.dg-verbar .grow { flex: 1; }
.dg-verbar .note { color: var(--muted); }

/* ---------- 数据统计 · 产量统计（线别 × 月份） ---------- */
.out-tbl-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 10px; }
.tbl.out-matrix { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl.out-matrix th, .tbl.out-matrix td { text-align: center; white-space: nowrap; padding: 5px 9px; }
.tbl.out-matrix thead th {
  position: sticky; top: 0; z-index: 3; background: #eef7f1; color: #1d3a2a; font-weight: 700;
}
.tbl.out-matrix tr.out-hd2 th { top: 28px; font-size: 11px; font-weight: 500; color: var(--muted); background: #f6faf7; }
.tbl.out-matrix td.out-fac, .tbl.out-matrix th:first-child {
  position: sticky; left: 0; z-index: 2; background: var(--panel2); text-align: left; font-weight: 600;
}
.tbl.out-matrix td.out-wc { position: sticky; left: 0; z-index: 2; background: var(--panel2); text-align: left; }
.tbl.out-matrix thead th:first-child { z-index: 4; position: sticky; left: 0; }
.tbl.out-matrix tr.out-sub td { background: #eef7f1; font-weight: 600; color: #1d3a2a; }
.tbl.out-matrix tr.out-sub td.out-wc { background: #e7f1ea; }
.tbl.out-matrix tr.out-total td { background: var(--green3); font-weight: 700; color: var(--green2); }
.tbl.out-matrix tr.out-total td.out-wc { background: #d7ecdd; }
.tbl.out-matrix td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.out-matrix .zero { color: #cbd5e1; }
/* 通用：分组工厂列 / 小计行（排产达成等） */
.tbl td.out-fac { font-weight: 600; color: var(--green2); white-space: nowrap; }
.tbl tr.out-sub td { background: #eef7f1; font-weight: 600; color: #1d3a2a; }
.tbl.out-matrix .out-rate { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.1; }

/* ---------- [0924V3 日滚动] 作业时刻表（表12 / plan_segment） ---------- */
.seg-day {
  margin: 10px 0 14px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; overflow: hidden;
}
.seg-day-hd {
  padding: 7px 10px; background: #e0efe6; color: var(--green2, #1d6b3f);
  font-size: 12px; border-bottom: 1px solid #cfe3d7;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.seg-day-hd b { font-size: 12.5px; }
.seg-open { color: #1d6b3f; font-weight: 600; }
.seg-close { color: #b45309; font-weight: 600; }
.seg-dur { color: var(--muted); font-size: 11px; margin-left: auto; }
.tbl.seg-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl.seg-tbl th, .tbl.seg-tbl td {
  padding: 5px 9px; border-bottom: 1px solid #eef4f0; white-space: nowrap; text-align: left;
}
.tbl.seg-tbl thead th {
  background: #f3f9f5; color: #1d3a2a; font-weight: 600; border-bottom: 1px solid #dfebe4;
}
.tbl.seg-tbl td.c-seq, .tbl.seg-tbl td.c-num { text-align: right; color: var(--muted); }
.tbl.seg-tbl td.c-ts { font-family: ui-monospace, Consolas, monospace; letter-spacing: .2px; }
.tbl.seg-tbl td.c-span { color: var(--muted); font-size: 11.5px; }
.tbl.seg-tbl tr:hover td { background: #f6fbf8; }
.seg-kind {
  display: inline-block; padding: 1px 7px; border-radius: 9px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
}
.seg-kind.k-prod { background: #dcf3e4; color: #14663a; }
.seg-kind.k-co   { background: #fdf0d5; color: #92610a; }
.seg-kind.k-cip  { background: #dceaf8; color: #14508c; }
.seg-kind.k-prep { background: #eee6f8; color: #5b2a91; }
.seg-kind.k-wait { background: #f0f0f0; color: #666; }

/* ============================================================
 *  二期 S5 人力排班（左侧栏独立模块 🧑‍🏭）
 *  ① 名册（可编辑表格） ② 班次种类 ③ 月排班矩阵 ④ 工时统计
 * ============================================================ */
.hr-scroll { overflow: auto; max-height: calc(100vh - 250px); border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.hr-editable td.editable-cell { outline: none; }
.hr-editable td.editable-cell:focus { background: var(--green3); box-shadow: inset 0 0 0 2px var(--green); }
.hr-editable tr.dirty td { background: #fff8e1; }
.hr-editable tr.new-row td { background: #eaf7ee; }
.hr-editable tr.to-del td { background: #fdeaea; text-decoration: line-through; }
.hr-note { color: var(--muted); font-size: 12px; line-height: 1.9; margin: 6px 0 8px; }
.hr-note code { background: var(--panel2); padding: 1px 4px; border-radius: 3px; color: var(--green2); }
.hr-alert {
  background: #fdf3e3; border: 1px solid #f0d9a8; color: #92610a;
  padding: 7px 10px; border-radius: 6px; font-size: 12px; margin-bottom: 8px;
}

/* 班次代号色块（6 个代号，两位且保留前导零） */
.hr-chip {
  display: inline-block; min-width: 26px; padding: 1px 6px; border-radius: 4px;
  font-size: 11.5px; font-weight: 700; text-align: center; line-height: 1.7;
}
.hr-chip.c01 { background: #e8f1fb; color: #1a5fa8; }
.hr-chip.c02 { background: #eeeeee; color: #777; }
.hr-chip.c03 { background: #e3f4ea; color: #167c46; }
.hr-chip.c04 { background: #ece6fa; color: #5b2a91; }
.hr-chip.c05 { background: #fdf0d5; color: #92610a; }
.hr-chip.c22 { background: #fde7ef; color: #a32c62; }
.hr-code-cell { text-align: center; }

/* 月排班矩阵：行=人，列=日期 */
.hr-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.hr-grid th, .hr-grid td { padding: 2px 3px; border-bottom: 1px solid #eef4f0; border-right: 1px solid #f0f6f2; white-space: nowrap; }
.hr-grid thead th { position: sticky; top: 0; z-index: 3; background: #f3f9f5; color: #1d3a2a; font-weight: 600; text-align: center; }
.hr-grid th.hr-day { min-width: 44px; line-height: 1.3; }
.hr-grid th.hr-day.wk, .hr-grid td.hr-cell-td.wk { background: #f4f9fd; }
.hr-wk { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.hr-grid td.hr-cell-td { padding: 1px; text-align: center; }
.hr-grid td.sch-chg { background: #fff2cc; }
/* 前三列冻结 */
.hr-grid th.hr-st1, .hr-grid td.hr-st1 { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 76px; }
.hr-grid th.hr-st2, .hr-grid td.hr-st2 { position: sticky; left: 76px; z-index: 2; background: #fff; min-width: 76px; }
.hr-grid th.hr-st3, .hr-grid td.hr-st3 { position: sticky; left: 290px; z-index: 2; background: #fff; min-width: 66px; }
.hr-grid thead th.hr-st1, .hr-grid thead th.hr-st2, .hr-grid thead th.hr-st3 { z-index: 4; background: #f3f9f5; }
.hr-grid tbody tr:hover td.hr-st1, .hr-grid tbody tr:hover td.hr-st2, .hr-grid tbody tr:hover td.hr-st3 { background: #f8fcf9; }

/* 单元格：改用 <input list=...>，既保留下拉选择，也能直接敲科长的写法 12/Y/Z/8/0 */
.hr-grid .hr-cell {
  width: 44px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 3px;
  background: transparent; color: var(--text); font-size: 11.5px; text-align: center; cursor: pointer;
  font-family: ui-monospace, Consolas, monospace;
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
}
.hr-grid .hr-cell::-webkit-calendar-picker-indicator { display: none; }
.hr-grid .hr-cell:hover { border-color: var(--border); background: #fff; }
.hr-grid .hr-cell:focus { outline: none; border-color: var(--green); background: #fff; box-shadow: 0 0 0 1px var(--green); }
.hr-grid .hrc01 { background: #e8f1fb; color: #1a5fa8; font-weight: 700; }
.hr-grid .hrc02 { background: #eeeeee; color: #777; }
.hr-grid .hrc03 { background: #d8f0e2; color: #167c46; font-weight: 700; }
.hr-grid .hrc04 { background: #e4dcf8; color: #5b2a91; font-weight: 700; }
.hr-grid .hrc05 { background: #fbe8c8; color: #92610a; font-weight: 700; }
.hr-grid .hrc22 { background: #fbdde8; color: #a32c62; font-weight: 700; }

/* ---- 月排班工时：上方排产 / 下方人员（同一张表，日期列天然对齐）---- */
/* 分区带（🏭 排产区 / 👥 人员区） */
.hr-grid tr.hr-band td {
  background: var(--panel2); font-weight: 600; color: #1d3a2a;
  border-top: 2px solid var(--green); border-bottom: 1px solid var(--border);
  padding: 5px 8px;
}
.hr-grid tr.hr-band-staff td { border-top-color: #7aa8d8; }
.hr-grid tr.hr-band-code td { border-top-color: #7aa8d8; }
.hr-grid td.hr-band-l { text-align: left; }
.hr-grid td.hr-band-r { text-align: right; color: var(--muted); font-weight: 400; font-size: 11.5px; }

/* ③ 班次代号区（只读）：由上方「人员排班 · 工时写法」自动换算而来 */
.hr-grid td.hr-code-td { padding: 1px; text-align: center; }
.hr-grid .hr-code {
  display: inline-block; min-width: 30px; height: 20px; line-height: 20px;
  border-radius: 3px; font-size: 11.5px; color: #b0b0b0; font-weight: 400;
  font-family: ui-monospace, Consolas, monospace;
}
.hr-grid td.hr-st0 { width: 30px; text-align: center; }

/* 产线行：左侧标签 + 右侧每日「品项 / 数量」 */
.hr-grid tr.hr-prod-row td { background: #fbfdfc; }
.hr-grid tr.hr-prod-row:hover td { background: #f4faf6; }
.hr-grid td.hr-prod-lbl {
  font-weight: 600; color: #167c46; text-align: left; padding-left: 6px;
  position: sticky; left: 30px; z-index: 2; background: #fbfdfc;
}
.hr-grid tr.hr-prod-row:hover td.hr-prod-lbl { background: #f4faf6; }
.hr-grid td.hr-prod-cell {
  padding: 2px 3px; text-align: center; vertical-align: middle;
  min-width: 44px; line-height: 1.15; cursor: help;
}
.hr-grid td.hr-prod-cell.on { background: #eef7f1; }
.hr-grid td.hr-prod-cell.off { background: #fafbfa; color: #d8e2dc; }
.hr-p-sku {
  display: block; font-size: 9.5px; color: #4a6b57; max-width: 62px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hr-p-qty {
  display: block; font-size: 11px; font-weight: 700; color: #167c46;
  font-family: ui-monospace, Consolas, monospace;
}
.hr-grid td.hr-prod-cell.off .hr-p-qty { color: #d8e2dc; }

/* 合计列 */
.hr-grid th.hr-sum, .hr-grid td.hr-sum {
  background: #f3f9f5; text-align: center; font-weight: 600;
  border-left: 2px solid var(--border); min-width: 46px;
}
.hr-grid td.hr-sum { font-family: ui-monospace, Consolas, monospace; }

/* 工具栏：三个新按钮 + 分隔 */
.btn-auto { background: #e8f4ee; border-color: #b8ddc9; color: #167c46; font-weight: 600; }
.btn-auto:hover { background: #d8ecdf; }
.btn-sap { background: #e9f0fa; border-color: #bfd3ee; color: #1a5fa8; font-weight: 600; }
.btn-sap:hover { background: #d9e5f6; }
.btn-mgr { background: #fdf1e3; border-color: #eccfa8; color: #92610a; font-weight: 600; }
.btn-mgr:hover { background: #f8e6d0; }
.hr-vsep { display: inline-block; width: 1px; height: 20px; background: var(--border); margin: 0 4px; vertical-align: middle; }

/* 班组人员名册 / 班次种类：挂在月排班工时工具栏的按钮 + 弹层
 * 比通用 .modal 宽得多 —— 名册是宽表，要放得下 */
.btn-roster { background: #eef1f8; border-color: #c9d3e6; color: #2c4a7c; font-weight: 600; }
.btn-roster:hover { background: #dfe6f4; }
.hr-modal-panel {
  background: #fff; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
  width: min(1480px, 95vw); max-height: 90vh;
}
.hr-modal-head {
  background: var(--green); color: #fff; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.hr-modal-head .close-x { cursor: pointer; font-size: 18px; line-height: 1; opacity: .85; }
.hr-modal-head .close-x:hover { opacity: 1; }
.hr-modal-body { flex: 1; overflow: auto; padding: 0; background: #f5f8f6; }
.hr-modal-body > .panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; }

/* 工时统计 */
.hr-cnt { text-align: center; color: #cfd8d2; font-size: 11.5px; }
.hr-cnt.on { color: var(--text); font-weight: 600; }
.hr-sum-foot td { background: var(--panel2); font-weight: 700; border-top: 1px solid var(--border); }
.hr-tip { color: var(--muted); font-size: 11.5px; }
.hr-tip.warn { color: #92610a; font-weight: 600; }

/* 工具栏表单件 */
.hr-sel, .hr-inp {
  height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: 5px;
  background: #fff; color: var(--text); font-size: 12px;
}
.hr-sel:focus, .hr-inp:focus { outline: none; border-color: var(--green); }
.hr-badge {
  display: inline-block; min-width: 16px; margin-left: 4px; padding: 0 4px;
  border-radius: 8px; background: rgba(255, 255, 255, .35); font-size: 11px;
}

/* ============================================================
 *  二期 S5 工时管理（左侧栏独立模块 🕒）
 *  人力排班：科室选择页（背景图 + 7 科室按钮）→ 科室作业界面
 *  工时分析：科室汇总 / 人员明细 / 按日 24H 覆盖
 * ============================================================ */
/* ---- 科室选择页 ----
 * 背景图铺满「内容区剩余高度」：模块 → 子内容 → panel → wrap 四层 flex 贯通，
 * 由 #module-hr 的 min-height(视口高 - 顶栏/内边距/页签) 兜底，
 * 窗口再高背景也一直延伸到底部。 */
#module-hr.module-page.active {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 156px);
}
#hr-sched-content.sub-content.active { display: flex; flex-direction: column; flex: 1; }
.hr-dept-panel { padding: 0; margin-bottom: 0; overflow: hidden; display: flex; flex: 1; }
.hr-dept-wrap {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #f4fbf6 url('../img/hr-dept-bg.jpg') no-repeat right bottom;
  background-size: cover;
  flex: 1; min-height: 460px; padding: 30px 34px 22px;
}
.hr-dept-wrap:before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.74) 44%, rgba(255,255,255,0) 72%);
  pointer-events: none;
}
.hr-dept-title { position: relative; margin-bottom: 18px; }
.hr-dept-title h2 { font-size: 20px; color: #14532d; margin: 0 0 6px; }
.hr-dept-title p { font-size: 12.5px; color: #4c7a5f; margin: 0; }
.hr-dept-title p b { color: #1e8a4e; }
.hr-dept-grid {
  position: relative; display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  max-width: 700px; margin-bottom: 14px;
}
@media (max-width: 1280px) { .hr-dept-grid { grid-template-columns: repeat(3, minmax(110px, 1fr)); } }
.hr-dept-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 13px 15px; border-radius: 10px; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.9); border: 1px solid rgba(39,163,92,.22);
  box-shadow: 0 2px 8px rgba(20,80,50,.07);
  transition: transform .14s, box-shadow .14s, border-color .14s, background .14s;
  font-family: inherit;
}
.hr-dept-card:hover {
  background: #fff; border-color: var(--green); transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(20,80,50,.16);
}
.hr-dept-ico { font-size: 21px; line-height: 1.15; }
.hr-dept-name { font-size: 15px; font-weight: 700; color: #1e8a4e; }
.hr-dept-meta { font-size: 11.5px; color: var(--muted); }
.hr-dept-foot { position: relative; font-size: 11.5px; color: #6b8f7b; }
.hr-dept-misc {
  margin-left: 8px; padding: 2px 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.85); border: 1px dashed var(--border);
  color: var(--muted); font-size: 11.5px; font-family: inherit;
}
.hr-dept-misc:hover { border-color: var(--green); color: var(--green2); }

/* ---- 科室作业界面头部 + 内层页签 ---- */
.hr-dept-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.hr-dept-bar .grow { flex: 1; }
.hr-dept-cur { font-weight: 700; color: var(--green2); font-size: 14px; }
.hr-dept-sub { color: var(--muted); font-size: 12px; }
.hr-itabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.hr-itab {
  padding: 6px 13px; border-radius: 16px; font-size: 12.5px; cursor: pointer;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  user-select: none; transition: all .14s;
}
.hr-itab:hover { border-color: var(--green); color: var(--green2); }
.hr-itab.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }

/* --- 名册：科室只读（点击才解锁下拉）+ 生产线输入框 --- */
.hr-td-dept { white-space: nowrap; }
.hr-dept-ro {
  display: inline-block; padding: 1px 8px; border-radius: 10px; cursor: pointer;
  background: var(--green3); color: var(--green2); font-size: 12px;
  border: 1px dashed transparent; transition: all .14s;
}
.hr-dept-ro:hover { border-color: var(--green); background: #fff; }
.hr-td-dept.editing { padding: 2px 6px; }
.hr-cell-inp {
  width: 100%; box-sizing: border-box; padding: 3px 6px; font: inherit; font-size: 12.5px;
  color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.hr-cell-inp:hover { border-color: var(--border); background: #fff; }
.hr-cell-inp:focus { outline: none; border-color: var(--green); background: #fff; box-shadow: 0 0 0 2px rgba(39,163,92,.12); }

/* ---- 工时分析 ---- */
.hr-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.hr-kpi {
  flex: 1 1 118px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; display: flex; flex-direction: column; gap: 1px;
}
.hr-kpi.hl { background: #eaf7ee; border-color: #bfe3cc; }
.hr-kpi-n { font-size: 20px; font-weight: 700; color: var(--green2); line-height: 1.25; }
.hr-kpi-l { font-size: 11.5px; color: var(--muted); }
.hr-bar-wrap {
  position: relative; height: 15px; background: var(--panel2);
  border-radius: 8px; overflow: hidden; min-width: 140px;
}
.hr-bar { height: 100%; background: linear-gradient(90deg, #9adcb4, #2f9e5f); }
.hr-bar-t {
  position: absolute; right: 6px; top: 0; line-height: 15px;
  font-size: 10.5px; font-weight: 700; color: #1c4630;
}
.hr-ana-dept tbody tr:hover td { background: #f0faf4; }
.hr-ana-dept tbody tr.misc td { color: var(--muted); }

/* ---- 「按生产线分组」：人员区里每组一条产线带（该线的人排该产线下）---- */
.hr-chk {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none;
}
.hr-chk input { margin: 0; cursor: pointer; }
.hr-grid tr.hr-group td {
  background: #e2f1e8; color: #1c5c39; font-size: 12.5px; font-weight: 600;
  text-align: left; padding-left: 10px; border-top: 2px solid #a5d3ba;
}
.hr-grid tr.hr-group td.hr-st0 { text-align: center; padding-left: 0; }
.hr-grid td.hr-group-s {
  text-align: right; padding-right: 10px; font-weight: 400; color: #2e7d52;
}
.hr-grid .hr-group-n {
  display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 9px;
  background: #fff; color: #2e7d52; font-size: 11.5px; font-weight: 400;
}
.hr-grid tr.hr-group td.hr-group-l { position: sticky; left: 0; z-index: 2; }

/* ---- 分组模式：产线排产行搬到人员分组里（产线跟着人走）---- */
.hr-grid tr.hr-prod-row.in-group td.hr-st0,
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl { background: #f4faf6; }
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl { padding-left: 20px; color: #2e7d52; }
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl::before { content: '└ '; color: #9ecfb4; }

/* 分组模式下「产线行」＝该组标题行（不再有单独的分组带，所以要求它跟分组带一样醒目） */
.hr-grid tr.hr-prod-row.in-group td.hr-st0,
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl { background: #e2f1e8; border-top: 2px solid #a5d3ba; }
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl { padding-left: 10px; color: #1c5c39; font-weight: 600; }
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl::before { content: none; }
.hr-grid tr.hr-prod-row.in-group td.hr-sum {
  background: #e2f1e8; border-top: 2px solid #a5d3ba;
  color: #2e7d52; font-weight: 400; font-size: 11.5px; white-space: nowrap;
}
.hr-grid .hr-prod-stat {
  margin-left: 7px; font-weight: 400; font-size: 11.5px; color: #2e7d52; white-space: nowrap;
}
.hr-grid tr.hr-prod-row.in-group td.hr-prod-lbl { padding-left: 6px; }

/* ---- 姓名后新增两列：工时合计 / 最大出勤天数（sticky 固定列，横向滚动也看得到）---- */
.hr-grid th.hr-tot, .hr-grid td.hr-tot {
  position: sticky; left: 152px; z-index: 2; background: #fff;
  min-width: 58px; text-align: center; font-size: 12px;
}
.hr-grid th.hr-max, .hr-grid td.hr-max {
  position: sticky; left: 210px; z-index: 2; background: #fff;
  min-width: 80px; text-align: center; font-size: 12px;
}
.hr-grid thead th.hr-tot, .hr-grid thead th.hr-max { z-index: 4; background: #f3f9f5; font-size: 11.5px; }
.hr-grid tbody tr:hover td.hr-tot, .hr-grid tbody tr:hover td.hr-max { background: #f8fcf9; }
.hr-grid td.hr-tot b { font-weight: 700; }

/* 连续上班达到上限（默认 9 天）→ 标红：这两列 + 「超 9 天」的那几天格子 */
.hr-grid td.hr-tot.over9, .hr-grid td.hr-max.over9 {
  background: #fdd; color: #a32d2d; font-weight: 700;
}
.hr-grid td.hr-cell-td.over9, .hr-grid td.hr-code-td.over9 { background: #fdd; }
.hr-grid .hr-cell.over9, .hr-grid .hr-code.over9 {
  background: #fdd; color: #a32d2d; font-weight: 700;
}

/* ================================================================
 *  日排班表（岗位工序 × 日期 × 白班/夜班）
 *  行色约定：组首行（带班）橙 · 保全浅蓝 · 其他粉 · 休息灰
 * ================================================================ */
.hr-daygrid { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; }
.hr-daygrid th, .hr-daygrid td {
  padding: 2px 3px; border-bottom: 1px solid #eef4f0; border-right: 1px solid #f0f6f2;
  white-space: nowrap; vertical-align: top;
}
.hr-daygrid thead th {
  position: sticky; top: 0; z-index: 3; background: #f3f9f5; color: #1d3a2a;
  font-weight: 600; text-align: center; line-height: 1.35;
}
.hr-daygrid thead tr:nth-child(2) th { top: 26px; }
.hr-daygrid th.hr-dh { font-size: 12.5px; border-left: 2px solid #cfdcd4; }
.hr-daygrid th.hr-dsub { font-size: 11px; color: var(--muted); font-weight: 400; border-left: 2px solid #cfdcd4; }
.hr-daygrid th.hr-dh.wk, .hr-daygrid th.hr-dsub.wk { background: #eef6fc; color: #1a5fa8; }

/* 左侧「岗位」固定列 */
.hr-daygrid th.hr-dl, .hr-daygrid td.hr-dl {
  position: sticky; left: 0; z-index: 2; background: #f7fbf8;
  min-width: 132px; width: 132px; text-align: left; padding: 4px 8px;
  font-weight: 600; color: #1d3a2a; border-right: 2px solid #cfdcd4;
}
.hr-daygrid thead th.hr-dl { z-index: 5; background: #f3f9f5; text-align: center; }

/* 开产线别 / 品项 / 数量 */
.hr-daygrid tr.hr-drow-open td, .hr-daygrid tr.hr-drow-open th {
  background: #fdf0da; font-weight: 600; color: #8a4b06; text-align: center; font-size: 10.5px;
  letter-spacing: -0.2px;
  border-top: 2px solid #ecc38c;
}
.hr-daygrid td.hr-dlcell { white-space: normal; word-break: break-all; line-height: 1.25; padding: 3px 2px; }

/* 班次行（白班 / 夜班） */
.hr-daygrid th.hr-dsh { text-align: center; font-size: 11.5px; color: #24503a; background: #eef7f1; min-width: 86px; }
.hr-daygrid th.hr-dsh-n { background: #eaeef6; color: #2d4270; }
.hr-daygrid th.hr-dsh.wk { background: #eef6fc; }

/* 岗位行 */
.hr-daygrid tr.hr-dprow th.hr-dl { font-weight: 600; }
.hr-daygrid tr.hr-dlead td, .hr-daygrid tr.hr-dlead th {
  background: #fdeacb; color: #7d4304; border-top: 2px solid #eeb673;
}
.hr-daygrid tr.hr-dlead th.hr-dl { font-weight: 700; background: #fbe0b4; }
.hr-daygrid tr.hr-dmaint td, .hr-daygrid tr.hr-dmaint th { background: #dceaf8; color: #1a4f86; }
.hr-daygrid tr.hr-dother td, .hr-daygrid tr.hr-dother th { background: #fbdde4; color: #98304f; }
.hr-daygrid tr.hr-drest td, .hr-daygrid tr.hr-drest th { background: #ededed; color: #5f5f5f; }
.hr-dcnt {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 8px;
  background: rgba(255,255,255,.75); font-size: 10.5px; font-weight: 400; color: #6b5a3a;
}

/* 格子：人员胶囊 + ＋ */
.hr-daygrid td.hr-dcell { min-width: 86px; height: 26px; padding: 2px; text-align: center; position: relative; }
.hr-dnames { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-content: flex-start; }
.hr-dchip {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  padding: 1px 5px; border-radius: 4px; background: #dff2e5; color: #14663c;
  font-size: 11.5px; font-weight: 600; line-height: 1.5; cursor: default;
}
.hr-dchip em { font-style: normal; }
.hr-dchip.rest { background: #e2e2e2; color: #6b6b6b; font-weight: 400; }
.hr-dchip.dirty { background: #fff1c9; color: #8a5a00; box-shadow: inset 0 0 0 1px #eec97a; }
.hr-dchip .hr-dx {
  font-style: normal; cursor: pointer; color: #8aa596; font-weight: 700; font-size: 12px;
  visibility: hidden; line-height: 1;
}
.hr-dchip:hover .hr-dx { visibility: visible; color: var(--red); }
.hr-dadd {
  position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; line-height: 13px;
  border-radius: 3px; font-size: 11px; color: #7fa48d; cursor: pointer; background: #f1f7f3;
  opacity: 0; transition: opacity .12s;
}
.hr-daygrid td.hr-dcell:hover .hr-dadd { opacity: 1; }
.hr-dadd:hover { background: var(--green3); color: var(--green2); }
.hr-dfoot { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* 行内图例 */
.hr-dlegend { display: inline-block; padding: 0 6px; border-radius: 8px; margin: 0 2px; font-size: 11px; }
.hr-dlegend.lead { background: #fdeacb; color: #7d4304; }
.hr-dlegend.maint { background: #dceaf8; color: #1a4f86; }
.hr-dlegend.other { background: #fbdde4; color: #98304f; }
.hr-dlegend.rest { background: #ededed; color: #5f5f5f; }

/* ---- 调岗浮层 ---- */
.hr-daypop {
  position: fixed; z-index: 9998; width: 268px; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; box-shadow: 0 8px 26px rgba(31,45,37,.22); overflow: hidden;
}
.hr-daypop-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; background: var(--green3); color: var(--green2);
  font-size: 12px; font-weight: 600;
}
.hr-daypop-x { cursor: pointer; color: var(--muted); }
.hr-daypop-x:hover { color: var(--red); }
.hr-daypop-b { max-height: 300px; overflow: auto; }
.hr-daypop-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; cursor: pointer;
  border-bottom: 1px solid #f2f7f3; font-size: 12px;
}
.hr-daypop-row:hover { background: var(--panel2); }
.hr-daypop-row.on { background: #e9f7ee; }
.hr-daypop-n { font-weight: 600; color: var(--text); min-width: 52px; }
.hr-daypop-c { flex: 1; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.hr-daypop-p { font-size: 11px; color: #8a6a2a; background: #fdf3e0; padding: 0 5px; border-radius: 8px; }
.hr-daypop-p.here { color: var(--green2); background: #d9f0e2; font-weight: 600; }
.hr-daypop-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12px; }
.hr-daypop-f { padding: 6px 10px; font-size: 11px; color: var(--muted); background: #fafcfb; }

/* ---- 🧱 岗位工序 弹层 ---- */
.hr-poswrap { padding: 4px 2px 10px; }
.hr-posgrp { border: 1px solid var(--border); border-radius: 9px; margin: 10px 0; background: #fbfdfc; }
.hr-posgrp-h {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  background: var(--green3); border-bottom: 1px solid var(--border); border-radius: 9px 9px 0 0;
}
.hr-posgrp-h label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); }
.hr-poshint { font-size: 11px; color: var(--muted); }
.hr-posrow { display: flex; align-items: center; gap: 8px; padding: 5px 10px; }
.hr-posno {
  display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: 9px; background: #e6f2ea; color: var(--green2); font-size: 11px; font-weight: 600;
}
.hr-posadd { margin: 4px 0 8px 10px; }
.hr-posfoot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }

/* ---- 🔒 历史锁定（当天之前只读）---- */
.hr-grid td.hr-lock, .hr-daygrid td.hr-lock { background: #f4f6f5; }
.hr-cell-fix {
  display: inline-block; width: 44px; height: 22px; line-height: 22px; text-align: center;
  font-size: 11.5px; border-radius: 3px; font-family: ui-monospace, Consolas, monospace;
  color: #5c6b62; background: #eef2f0;
}
.hr-cell-fix.hrc03 { background: #e4efe8; color: #167c46; }
.hr-cell-fix.hrc04 { background: #ebe7f5; color: #5b2a91; }
.hr-cell-fix.hrc05 { background: #f6efdd; color: #92610a; }
.hr-cell-fix.hrc22 { background: #f7e4eb; color: #a32c62; }
.hr-cell-fix.hrc02 { background: #ededed; color: #777; }
.hr-cell-fix.over9 { background: #fdd; color: #a32d2d; font-weight: 700; }
.hr-unlock { accent-color: var(--orange); }

/* ---- 日排班表「备注」行 ---- */
.hr-daygrid tr.hr-dnote-row td, .hr-daygrid tr.hr-dnote-row th { background: #fbfbf6; }
.hr-daygrid td.hr-dnote-td { padding: 1px; min-width: 86px; }
.hr-dnote {
  width: 100%; box-sizing: border-box; border: 1px solid transparent; border-radius: 3px;
  background: transparent; color: var(--text); font-size: 11px; padding: 2px 3px;
  font-family: inherit;
}
.hr-dnote:hover { border-color: var(--border); background: #fff; }
.hr-dnote:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green); background: #fff; }
.hr-dnote[readonly] { color: #8a9a91; cursor: not-allowed; }

/* ================================================================
 *  权限：只读账号（2026-10-19）
 *  真源 = py_db.perm_of()；前端只做「隐藏/禁用」
 * ================================================================ */
/* 只读：模块内容区里的写操作主按钮全部隐藏（登录框/天气/弹层的普通按钮不受影响） */
body.perm-view main.content .btn-promary,
body.perm-view main.content .btn-del,
body.perm-view main.content .row-action.del,
body.perm-view main.content .imp-bulk,
body.perm-view main.content .btn-danger { display: none !important; }
/* 只读：宽表里的可编辑单元格给个「不可编辑」光标 */
body.perm-view main.content input.hr-cell,
body.perm-view main.content input.hr-dnote { cursor: not-allowed; }

/* 人力排班：没有 hr_write（组织层级非 1/2 阶且非管理员/生产计划员）→ 隐藏全部写按钮 */
body.hr-ro .hr-wbtn { display: none !important; }

/* 登录框：灰色 placeholder */
.login-field input::placeholder { color: #9aa8a0; }

/* 只读账号在人力排班工具栏上的标识（替代「🔓 解锁历史」） */
.hr-rochip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 10px; background: #eef2f0; color: #5c6b62;
  font-size: 12px; border: 1px solid #dde5e0;
}

/* 「人力排班可写」的账号（组织层级 1阶/2阶、管理员、生产计划员）：
   即便整体是只读（perm-view），本模块的写按钮也要露出来 */
body.perm-view.hr-rw #module-hr .btn-promary,
body.perm-view.hr-rw #module-hr .btn-del,
body.perm-view.hr-rw #module-hr .btn-danger { display: inline-flex !important; }
body.perm-view.hr-rw #module-hr input.hr-cell,
body.perm-view.hr-rw #module-hr input.hr-dnote { cursor: text; }

/* ================================================================
 *  只读账号的界面收口（2026-10-19）
 *  后端已拦写接口；这里让界面「看起来也没权限」，避免误以为能改。
 * ================================================================ */
.ro-hide { display: none !important; }
td input.ro-inp, td textarea.ro-inp, td select.ro-inp,
.pm-cell.ro-inp, .pc-cell.ro-inp, .imp-cell.ro-inp {
  background: #f4f6f5 !important; color: #6b7a72 !important;
  border-color: transparent !important; cursor: not-allowed !important;
  box-shadow: none !important;
}
.module-page.ro-page .pcfg-edit, .module-page.ro-page .pm-edit { display: none !important; }
/* 只读页右上角提示条 */
.module-page.ro-page::before {
  content: '🔒 只读（当前账号无编辑权限）';
  position: absolute; right: 14px; top: 8px; z-index: 5;
  background: #eef2f0; color: #6b7a72; border: 1px solid #dde5e0;
  padding: 2px 9px; border-radius: 10px; font-size: 11.5px;
}
.module-page.ro-page { position: relative; }
/* 只读账号：上传用的文件选择框也藏起来（留着只会让人以为能传） */
.module-page.ro-page input[type="file"] { display: none !important; }
.module-page.ro-page [id^="imp-fileinfo-"] { display: none !important; }

/* ================================================================
 *  管理日志（S8）：登录日志 / 账号管理
 * ================================================================ */
.adm-scroll { max-height: calc(100vh - 300px); overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.adm-table { width: 100%; font-size: 12.5px; }
.adm-table thead th {
  position: sticky; top: 0; z-index: 2; background: #f3f9f5; color: #1d3a2a;
  font-weight: 600; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.adm-table tbody td { padding: 6px 8px; border-bottom: 1px solid #f1f6f3; vertical-align: middle; }
.adm-table tbody tr:hover td { background: #f8fcf9; }
.adm-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #40514a; }
.adm-sub { color: var(--muted); font-size: 11.5px; }
.adm-red { color: #a32d2d; font-weight: 700; }
.adm-failrow td { background: #fdf2f2; }
.adm-failrow:hover td { background: #fbe9e9; }

.adm-tag {
  display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11.5px;
  background: #eef2f0; color: #5c6b62; white-space: nowrap;
}
.adm-tag.p-admin { background: #ded4f6; color: #4a2b8c; font-weight: 600; }
.adm-tag.p-planner { background: #d8ecdd; color: #1a6b3c; font-weight: 600; }
.adm-tag.p-prod { background: #fdf0da; color: #8a4b06; }
.adm-tag.p-hr { background: #e4eff8; color: #1a5fa8; }
.adm-tag.p-ro { background: #eeeeee; color: #6b6b6b; }
.adm-tag.p-ok { background: #e2f1e8; color: #167c46; }
.adm-tag.p-fail { background: #fbdada; color: #a32d2d; font-weight: 600; }

.adm-ops { white-space: nowrap; }
.adm-op {
  display: inline-block; margin-right: 8px; cursor: pointer; color: var(--green2);
  font-size: 12px; text-decoration: none;
}
.adm-op:hover { text-decoration: underline; }
.adm-op.warn { color: #a3612d; }

/* ---- S9：操作日志 / 排产调整日志 ---- */
.adm-tools label { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.adm-mod {
  display: inline-block; padding: 1px 7px; border-radius: 9px; white-space: nowrap;
  background: #eaf3ee; color: #2b5443; font-size: 11.5px;
}
.adm-note { color: #3d4f47; max-width: 420px; }
.adm-detail td { background: #fbfdfb; padding: 0 !important; border-bottom: 1px solid var(--border); }
.adm-diff { padding: 10px 14px; }
.adm-diff-hd { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.adm-diff-box {
  max-height: 300px; overflow: auto; border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}
.adm-difftbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.adm-difftbl th {
  position: sticky; top: 0; z-index: 1; background: #f4f8f5; text-align: left;
  padding: 5px 8px; border-bottom: 1px solid var(--border); font-weight: 600; color: #1d3a2a;
}
.adm-difftbl td { padding: 5px 8px; border-bottom: 1px solid #f2f7f3; vertical-align: top; word-break: break-all; }
.adm-difftbl tr.adm-chg td { background: #fff9ea; }
.adm-diff-2col { display: flex; gap: 10px; border: none; background: none; max-height: 300px; overflow: visible; }
.adm-diff-2col > div { flex: 1 1 0; min-width: 0; }
.adm-diff-lb { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.adm-pre {
  margin: 0; padding: 8px; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; max-height: 240px; overflow: auto; white-space: pre-wrap;
  word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
}

/* ================================================================
 *  生产管理（S10）：开机天数 / 生产简表 / 饮品合计 / CIP·换模
 * ================================================================ */
.pm-bar { display: flex; align-items: center; gap: 10px; padding: 2px 2px 8px; flex-wrap: wrap; }
.pm-bar .grow { flex: 1; }
.pm-title { font-size: 15px; color: #1d3a2a; }
.pm-sub { font-size: 12px; color: var(--muted); }
.pm-ym { font-size: 12.5px; color: #40514a; }
.pm-tip {
  font-size: 11.5px; color: #2d5443; background: #f0f7f2;
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 10px;
}
.pm-two { display: flex; gap: 12px; align-items: flex-start; }
.pm-two > .pm-panel { flex: 1 1 0; min-width: 0; }
.pm-panel { padding: 10px 12px 12px; }
.pm-panel h3 { font-size: 13.5px; margin: 0 0 8px; color: #1d3a2a; }
.pm-panel h3 small { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.pm-scroll, .pm-scroll-big {
  max-height: calc(100vh - 300px); overflow: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.pm-scroll-big { max-height: calc(100vh - 290px); }
.pm-scroll-lite { overflow: auto; }
.pm-empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13px; }

.pm-tbl { border-collapse: separate; border-spacing: 0; font-size: 12px; width: 100%; }
.pm-tbl th, .pm-tbl td {
  border-bottom: 1px solid #eef3ef; border-right: 1px solid #f2f6f3;
  padding: 4px 6px; text-align: center; white-space: nowrap; background: #fff;
}
.pm-tbl thead th {
  position: sticky; top: 0; z-index: 4; background: #f1f8f3;
  font-weight: 600; color: #1d3a2a; border-bottom: 1px solid var(--border);
}
.pm-tbl thead tr:nth-child(2) th { top: 29px; }
.pm-tbl thead tr:first-child:last-child th { top: 0; }
.pm-ln { min-width: 56px; }
.pm-code { display: block; font-size: 12px; font-weight: 700; color: #17352a; }
.pm-alias { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
.pm-grp { background: #e6f2e9 !important; font-weight: 700; color: #1d3a2a; }

.pm-date, .pm-wd { background: #f7fbf8; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.pm-sticky { position: sticky; left: 0; z-index: 3; }
.pm-sticky2 { position: sticky; left: 56px; z-index: 3; }
thead .pm-sticky, thead .pm-sticky2 { z-index: 6; }
.pm-tbl tbody tr.pm-wk td { background: #fdf8ec; }
.pm-tbl tbody tr.pm-wk td.pm-date, .pm-tbl tbody tr.pm-wk td.pm-wd { background: #fbf1dc; }

.pm-cell.on { background: #d8f0da !important; color: #146c33; font-weight: 700; }
.pm-cell.mold { background: #fbe9d6 !important; color: #8a4b06; font-weight: 700; }
.pm-cell.editable { cursor: pointer; }
.pm-cell.editable:hover { outline: 2px solid #8fc99d; outline-offset: -2px; }
.pm-tot { background: #fafdfb !important; font-weight: 600; color: #2d4b3d; }
.pm-tot-hd { background: #eef6f0 !important; }
.pm-sum td { background: #edf6ef !important; font-weight: 600; }
.pm-ratio { color: #40514a; }

.pm-items {
  text-align: left !important; white-space: normal !important;
  font-size: 11px; line-height: 1.5; color: #33463d; min-width: 240px;
}
.pm-qty { text-align: right !important; font-variant-numeric: tabular-nums; }
.pm-subtot { background: #f8fcf9 !important; font-weight: 600; color: #2d4b3d; }

.pm-kpi-tbl th, .pm-kpi-tbl td { padding: 5px 7px; }
.pm-kpi-tbl td:first-child { text-align: left; }
.pm-strong { font-weight: 700; color: #146c33; }
.pm-bad { color: #a32d2d; font-weight: 700; }
.pm-na { color: #b9c4bd; }
.pm-note { font-size: 11.5px; color: #6b7a72; line-height: 1.6; margin: -2px 0 8px; }
/* 汇总三行（合计 / 日历天数 / 比例）钉在底部，长表也不用滚到底 */
.pm-tbl tbody tr.pm-sum:nth-last-child(1) td { position: sticky; bottom: 0; z-index: 2; }
.pm-tbl tbody tr.pm-sum:nth-last-child(2) td { position: sticky; bottom: 25px; z-index: 2; }
.pm-tbl tbody tr.pm-sum:nth-last-child(3) td { position: sticky; bottom: 50px; z-index: 2; }

/* 合肥厂饮品合计：品项级列（规格×入数 分组）+ 右侧系列汇总 */
.pm-drinks thead tr:first-child th { height: 26px; padding: 2px 4px; }
.pm-drinks thead tr:nth-child(2) th { top: 26px; }
.pm-drinks thead th.pm-item-hd {
  width: 92px; min-width: 92px; max-width: 92px; white-space: normal;
  word-break: break-all; font-size: 10px; line-height: 1.25; font-weight: 500;
  color: #33463d; padding: 3px 4px; vertical-align: bottom;
}
.pm-drinks thead th.pm-series-hd {
  min-width: 96px; white-space: normal; font-size: 10.5px; line-height: 1.25;
  background: #fdeee1 !important; color: #6d3a12;
}
.pm-grp-sum { background: #f7d9c4 !important; color: #6d3a12 !important; }
.pm-drinks td.pm-item-c { font-size: 10.5px; padding: 3px 4px; }
.pm-drinks td.pm-series-c { background: #fffaf6 !important; font-size: 11px; }
.pm-strongc { font-weight: 700; color: #146c33; }

/* 生产简表：三行表头（车间 / 线别 / 品项·数量）+ 品项列收窄 */
.pm-tbl-simple thead tr:nth-child(1) th { top: 0; height: 26px; }
.pm-tbl-simple thead tr:nth-child(2) th { top: 26px; height: 24px; }
.pm-tbl-simple thead tr:nth-child(3) th { top: 50px; height: 22px; }
.pm-tbl-simple thead th.pm-line-hd { font-size: 12px; font-weight: 700; color: #17352a; }
.pm-tbl-simple thead th.pm-sub-hd {
  font-size: 10.5px; font-weight: 500; color: var(--muted); background: #f7fbf8 !important;
}
.pm-tbl-simple td.pm-items {
  width: 186px; min-width: 0; max-width: 186px; white-space: normal; text-align: left;
  font-size: 10.5px; line-height: 1.35; word-break: break-all; color: #33463d;
}

/* ================================================================
 *  工时管理 · 理论工时（S11）
 * ================================================================ */
.ht-bar { display: flex; align-items: center; gap: 10px; padding: 2px 2px 8px; flex-wrap: wrap; }
.ht-bar .grow { flex: 1; }
.ht-title { font-size: 15px; color: #1d3a2a; }
.ht-sub { font-size: 12px; color: var(--muted); }
.ht-lb { font-size: 12.5px; color: #40514a; }
.ht-date { padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.ht-ro {
  font-size: 11.5px; color: #8a5a1e; background: #fdf3e3;
  border: 1px solid #f0dcc0; padding: 2px 8px; border-radius: 10px;
}
.ht-panel { padding: 10px 12px 12px; margin-bottom: 12px; }
.ht-panel h3 { font-size: 13.5px; margin: 0 0 8px; color: #1d3a2a; }
.ht-panel h3 small { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.ht-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
/* 26 列宽表：字号/内边距收紧 + 整表按容器等比缩放（htFit），不再横向溢出 */
.ht-tbl { border-collapse: separate; border-spacing: 0; width: auto; font-size: 10.5px; }
.ht-tbl th, .ht-tbl td {
  border-bottom: 1px solid #eef3ef; border-right: 1px solid #f2f6f3;
  padding: 3px 3px; text-align: center; white-space: nowrap; background: #fff;
  font-variant-numeric: tabular-nums;
}
.ht-tbl thead th {
  position: sticky; top: 0; z-index: 3; background: #f1f8f3;
  font-weight: 600; color: #1d3a2a; font-size: 10.5px; line-height: 1.2;
}
.ht-tbl thead tr:nth-child(2) th { top: var(--ht-t2, 21px); }
.ht-tbl thead tr:nth-child(3) th { top: var(--ht-t3, 42px); }
.ht-c1 { width: 60px; background: #f7fbf8 !important; font-weight: 600; color: #2d4b3d;
  white-space: nowrap !important; line-height: 1.2; font-size: 10px; }
.ht-c2 { width: 106px; text-align: left !important; color: #33463d;
  white-space: normal !important; line-height: 1.25; font-size: 11px; }
.ht-grp { background: #e6f2e9 !important; font-weight: 700; }
.ht-unit-grp { background: #edf6ef !important; }
.ht-unit2 { font-size: 10px; color: var(--muted); font-weight: 500; }
.ht-cell { min-width: 44px; }
.ht-sumb { background: #f8fcf9 !important; font-weight: 600; }
.ht-editable { background: #fffdf6 !important; }
/* 结构性「没有这项数据」：灰底 + 淡横杠，不用填 */
.ht-tbl td.ht-na { background: #eff2f0 !important; color: #b9c5be !important; }
/* 出勤人次公式格（瓶胚）：可点进去看/改公式 */
.ht-fcell { background: #fffdf0 !important; }
.ht-fcell .ht-inp-f { cursor: cell; }
.ht-fcell .ht-inp-f:focus { font-family: Consolas, Menlo, monospace; font-size: 11px; }
.ht-inp {
  width: 100%; min-width: 40px; border: 1px solid transparent; border-radius: 4px;
  background: transparent; text-align: center; font-size: 10.5px; padding: 1px 2px; color: #1d3a2a;
}
.ht-inp:hover { border-color: #cfe3d6; }
.ht-inp:focus { outline: none; border-color: var(--green); background: #fff; }
.ht-note { font-size: 11.5px; color: #6b7a72; line-height: 1.75; }
.ht-note b { color: #2d4b3d; }
.ht-empty { padding: 30px; text-align: center; color: var(--muted); }

/* 理论工时：本周定版号 + 历史定版弹层 */
.ht-ver {
  font-size: 12px; font-weight: 600; color: #6d3a12;
  background: #fdeee1; border: 1px solid #f0dcc0;
  padding: 3px 9px; border-radius: 11px;
}
.ht-link { color: var(--green2); cursor: pointer; text-decoration: none; font-size: 12px; }
.ht-link:hover { text-decoration: underline; }
.ht-ver-look {
  font-size: 12.5px; color: #6d3a12; background: #fdf3e3;
  border: 1px solid #f0dcc0; padding: 3px 10px; border-radius: 11px;
}
.ht-ver-look small { color: #8a6a45; font-weight: 400; margin-left: 4px; }

/* 月排班工时·瓶胚组：上方「瓶胚线开机天数」矩阵 */
.hr-grid td.hr-prod-cell.hr-bot { text-align: center; font-size: 12px; font-weight: 700; }
.hr-grid td.hr-prod-cell.hr-bot.on { background: #d8f0da !important; color: #146c33; }
.hr-grid td.hr-prod-cell.hr-bot.off { background: #fff; color: #cfdbd3; }
.hr-grid tr.hr-bot-row td.hr-prod-lbl { color: #2d4b3d; font-weight: 600; }

/* 瓶胚数据来源徽标（当月表 / 次月表 / 已归档） */
.pm-src {
  font-size: 11.5px; color: #2d5443; background: #eef7f1;
  border: 1px solid var(--border); padding: 2px 9px; border-radius: 10px;
}
.pm-src-frozen {
  color: #8a5a1e; background: #fdf3e3; border-color: #f0dcc0;
}

/* ================================================================
 *  月排班工时：排班代码类别说明（高亮块）
 * ================================================================ */
.hr-codecard {
  margin: 2px 0 10px; padding: 10px 12px 11px;
  background: linear-gradient(180deg, #d5efdf 0%, #bfe6cd 100%);
  border: 1px solid #7cc79c; border-left: 5px solid #17864a;
  border-radius: 8px;
  box-shadow: 0 2px 7px rgba(23, 134, 74, .18), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.hr-codecard-hd { font-size: 13px; font-weight: 700; color: #0f5c33; margin-bottom: 8px; }
.hr-codecard-hd small { font-weight: 400; color: #2f6b49; font-size: 11px; margin-left: 8px; }
.hr-codecard-list { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.hr-codeitem {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid #a8d8ba; border-radius: 7px;
  padding: 3px 8px 3px 5px; font-size: 11.5px; color: #1d3a2a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03); white-space: nowrap;
}
.hr-codeitem b { font-weight: 600; }
.hr-codeitem small { color: #6b8a77; font-size: 11px; }
.hr-fillhint {
  font-size: 10.5px; font-weight: 700; color: #1d6b3c;
  background: #e4f4ea; border: 1px dashed #a9d8bb; border-radius: 5px;
  padding: 1px 6px; margin-left: 2px;
}
.hr-codeitem b { font-size: 11.5px; color: #17352a; }
.hr-codeitem small { font-size: 10.5px; }

/* 排产结果：排产前体检条 + 运行日志条 */
.pr-ready {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; padding: 7px 12px; margin: -4px 0 10px;
  border-radius: 8px; border: 1px solid var(--border); background: #f7fbf8; color: #2d4b3d;
}
.pr-ready b { color: #14603a; }
.pr-ready-ok { background: #eaf6ee; border-color: #b7ddc6; color: #1d6b3f; }
.pr-ready-warn { background: #fdf6e6; border-color: #ecd7a8; color: #7a5310; }
.pr-ready-warn b { color: #a3612d; }
.pr-ready-tip { color: #8a7443; font-size: 11.5px; }

.pr-log {
  margin: -4px 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fbfdfc; overflow: hidden;
}
.pr-log-hd {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px;
  background: #eef6f0; font-size: 12px; color: #1d3a2a;
}
.pr-log-x { margin-left: auto; cursor: pointer; color: var(--green2, #1d6b3f); font-size: 11.5px; }
.pr-log-body {
  margin: 0; padding: 8px 12px; max-height: 150px; overflow: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.6;
  color: #33463d; white-space: pre-wrap;
}
.pr-hide { display: none !important; }

/* ===== 生产管理 · 每日排程表（S14） ===== */
.pm-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #5b6b61; }
.pm-sel select { height: 26px; border: 1px solid #cfd8d2; border-radius: 5px;
  background: #fff; font-size: 12px; padding: 0 6px; color: #33443a; }
.pm-sch-tbl { table-layout: fixed; }
.pm-sch-tbl thead th { white-space: normal; line-height: 1.25; }
.pm-sch-row { cursor: pointer; }
.pm-sch-row:hover td { background: #f3f8f4; }
.pm-sch-row td { vertical-align: middle; }
.pm-sch-row.off td { background: #fafbfa; color: #9aa8a0; }
.pm-sch-row.off:hover td { background: #f5f7f5; }
.pm-sch-plant, .pm-sch-day, .pm-sch-open { background: #f7faf8; text-align: center; vertical-align: top !important; padding-top: 9px !important; }
.pm-sch-plant { font-weight: 600; }
.pm-sch-open.on { color: #146c33; font-weight: 700; }
.pm-sch-line { font-weight: 600; }
.pm-sch-mat { font-family: Consolas, Menlo, monospace; font-size: 11px; }
.pm-sch-part { font-size: 11px; color: #41544a; }
.pm-sch-part > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-sch-sub td { background: #f8fbf9; padding: 0 !important; }
.pm-sch-bomwrap { padding: 8px 12px 10px; }
.pm-sch-bomhead { font-size: 12px; color: #2f6b45; margin-bottom: 6px; }
.pm-sch-bom { background: #fff; }
.pm-sch-bom thead th { position: static !important; top: auto !important; z-index: auto; }
.pm-sch-bom td { font-size: 11.5px; }

/* ===== 成品BOM：成品级列合并显示（S15 / S18 配色重做）===== */
.imp-editable td.imp-merge { vertical-align: top;
  font-weight: 600; color: #2f4a3a; padding-top: 6px !important; }
.imp-editable tr.to-del td.imp-merge { background: #fdecec; }
.imp-editable td.imp-merge[contenteditable="true"] { background: #fffbe8;
  outline: 1px dashed #d9a400; outline-offset: -2px; }
.col-action .row-action + .row-action { margin-left: 4px; }
.imp-fixed td, .imp-fixed th {
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.32; padding: 4px 5px; font-size: 11.5px; vertical-align: top;
}
/* 表头：只在词/中英边界断行，别把「BOM」「组件数量」从中间劈开 */
.imp-fixed thead th {
  line-height: 1.22; font-size: 11px; padding: 4px 4px;
  word-break: normal; overflow-wrap: normal;
}
/* 操作列：两个按钮竖排，省出横向空间 */
.imp-fixed .col-action { padding: 4px 4px; }
.imp-fixed .col-action .row-action {
  display: block; width: 100%; margin: 0 0 3px; padding: 2px 4px;
  font-size: 11px; line-height: 1.5; text-align: center;
}
.imp-fixed .col-action .row-action:last-child { margin-bottom: 0; }

/* ===== BOM管理 · 页面紧凑化（S16：压缩蓝框区域高度 + 表格一屏宽）===== */
.imp-tight .imp-bar { padding: 4px 9px; margin: 0 0 7px; gap: 8px; }
.imp-tight .imp-bar .btn { padding: 3px 9px; font-size: 12px; }
.imp-tight .imp-bar .note { font-size: 11.5px; }
.imp-tight .panel { padding: 9px 12px; margin-bottom: 8px; border-radius: 10px; }
.imp-tight .panel h3 { font-size: 12.5px; margin-bottom: 5px; gap: 5px; }
.imp-tight .panel h3 .btn-mini { padding: 2px 7px; font-size: 11px; }
.imp-tight .panel h3 small { font-size: 11.5px; line-height: 1.4; }
.imp-tight .form-row { margin-bottom: 2px; gap: 8px; }
.imp-tight .form-row input[type="file"] { font-size: 11.5px; }
.imp-tight .form-row .btn { padding: 3px 10px; font-size: 12px; }
.imp-tight .form-row select { padding: 2px 6px; font-size: 12px; }
.imp-tight .imp-filter { padding: 3px 8px; margin: 4px 0 5px; gap: 8px; line-height: 1.2; }
.imp-tight .imp-filter select, .imp-tight .imp-filter input { height: 24px; padding: 0 6px; font-size: 12px; }
.imp-tight .imp-filter label { line-height: 1.2; }
.imp-tight .imp-tools { padding: 3px 8px; margin-bottom: 5px; gap: 6px; }
.imp-tight .imp-tools .btn { padding: 2px 8px; font-size: 11.5px; }
.imp-tight .imp-tools .note { font-size: 11px; }
.imp-tight .imp-scroll { max-height: calc(100vh - 330px); min-height: 300px; }
/* BOM 上传区：单行紧凑（S16） */
.imp-bom-up { padding: 8px 12px !important; }
.imp-bom-up .form-row { margin-bottom: 0; flex-wrap: wrap; row-gap: 4px; }
.imp-bom-up .imp-vline { width: 1px; height: 18px; background: var(--border); }
.imp-bom-up .imp-up-tip { flex: 1 1 220px; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
#imp-map-bom:empty { display: none; }
.imp-tight .imp-filter .btn { padding: 2px 8px; font-size: 11.5px; }
/* 短字段不换行（日期 / 容量 / 单位 / 套数 / 数量等），避免被拆成两行 */
.imp-fixed td[data-col="valid_from"], .imp-fixed td[data-col="capacity"],
.imp-fixed td[data-col="plant"], .imp-fixed td[data-col="unit"],
.imp-fixed td[data-col="bom_sets"], .imp-fixed td[data-col="qty"],
.imp-fixed td[data-col="item_no"], .imp-fixed td[data-col="base_qty"],
.imp-fixed td[data-col="scrap_pct"] { white-space: nowrap; }   /* 口味别允许换行，避免窄屏挤出去 */
/* 这些列窄，字号略小一点，保证一屏内不被挤出去 */
.imp-fixed td[data-col="valid_from"], .imp-fixed td[data-col="capacity"],
.imp-fixed td[data-col="bom_sets"], .imp-fixed td[data-col="item_no"],
.imp-fixed td[data-col="scrap_pct"] { font-size: 11px; }
.imp-fixed th { white-space: normal; }

/* ===== 成品BOM 明细：低饱和配色 + 组分隔 + 静默操作按钮（S18）=====
 * 之前每个可编辑格都是米黄 + 每行两个带色块按钮，900 行看着很吵；
 * 现在：子件列白底/极淡交替、成品级合并列浅绿并带左色条、组间一条分隔线，
 * 操作按钮默认灰字无底，hover 才显色。 */
.imp-fixed tbody td { border-bottom: 1px solid #eef3ef; }
.imp-fixed tbody td.editable-cell { background: #fff; }
.imp-fixed tbody tr.imp-grp-alt td.editable-cell { background: #fcfdfc; }
.imp-fixed tbody tr:hover td.editable-cell { background: #f4faf6; }
/* 组与组之间：一条清晰的分隔线（组首行上边） */
.imp-fixed tbody tr.imp-grp-first > td { border-top: 1px solid #dbe8e0; }
.imp-fixed tbody tr:first-child > td { border-top: 0; }
/* 成品级合并列：淡绿底 + 左侧色条，和子件列区分开但不刺眼 */
.imp-fixed tbody td.imp-merge { background: #f4f8f5; border-right: 1px solid #e7efe9; }
.imp-fixed tbody tr.imp-grp-alt td.imp-merge { background: #f1f7f2; }
.imp-fixed tbody td.imp-merge[data-col="plant"] { box-shadow: inset 3px 0 0 #bcd9c6; }
.imp-fixed tbody tr.to-del td.imp-merge { background: #fbeeee; }
/* 表头：淡绿灰、加粗、下边框稍重 */
.imp-fixed thead th {
  background: #eef5f0; color: #365243; font-weight: 600;
  border-bottom: 2px solid #d7e6dd; border-right: 1px solid #e7efe9;
}
.imp-fixed thead th:last-child { border-right: 0; }
/* 数值列右对齐 + 等宽数字 */
.imp-fixed td[data-col="qty"], .imp-fixed td[data-col="scrap_pct"],
.imp-fixed td[data-col="base_qty"], .imp-fixed td[data-col="bom_sets"],
.imp-fixed th[data-col="qty"], .imp-fixed th[data-col="scrap_pct"],
.imp-fixed th[data-col="base_qty"], .imp-fixed th[data-col="bom_sets"] {
  text-align: right; font-variant-numeric: tabular-nums;
}
.imp-fixed th[data-col="plant"], .imp-fixed th[data-col="capacity"],
.imp-fixed th[data-col="flavor"], .imp-fixed th[data-col="valid_from"] { text-align: left; }
/* 单位列居中、淡一点，和两侧数字拉开层次 */
.imp-fixed td[data-col="unit"], .imp-fixed th[data-col="unit"] { text-align: center; }
.imp-fixed tbody td[data-col="unit"] { color: #7d8d84; }
/* 套数只有一个数字，居中更稳 */
.imp-fixed td[data-col="bom_sets"], .imp-fixed th[data-col="bom_sets"] { text-align: center; }
/* 表头：不强制均衡（balance 会把「部件废品(%)」断成「部件废/品(%)」），靠列宽保证整词一行 */
/* 操作列：默认灰字无底，hover 才显色（减少 900 行的视觉噪音） */
.imp-fixed .col-action { padding: 3px 3px 3px 2px; text-align: left; white-space: nowrap; }
.imp-fixed .col-action .row-action {
  display: inline-block; width: auto; margin: 0 0 0 1px; padding: 1px 4px;
  border: 1px solid transparent; background: transparent; border-radius: 5px;
  color: #93a29a; font-size: 11px; line-height: 1.5; text-align: left;
  white-space: nowrap;               /* 「✏️ 修改 / 🗑 删除」并排一行，不换行 */
}
.imp-fixed .col-action .row-action + .row-action { margin-top: 0; }
.imp-fixed .col-action .row-action.edit:hover {
  color: #16703e; background: #eaf6ef; border-color: #cfe6d8;
}
.imp-fixed .col-action .row-action.del:hover {
  color: #c0392b; background: #fdeeea; border-color: #f5cdc6;
}
.imp-fixed tbody tr:hover .col-action .row-action { color: #6f8078; }
/* ===== 成品BOM：默认只读，点「✏️ 修改」进入编辑态（S19）=====
 * 只读：无光标、无底色；编辑中：淡杏色底 + 可输入；改过：整行淡黄（dirty） */
.imp-fixed tbody td[data-col]:not(.editable-cell) { cursor: default; }
.imp-fixed tbody tr.imp-editing td.editable-cell { background: #fffdf3; }
.imp-fixed tbody tr.imp-editing td.editable-cell:focus {
  background: #fff; outline: 2px solid var(--blue); outline-offset: -2px;
}
.imp-fixed tbody tr.imp-editing td.imp-merge.editable-cell {
  background: #fffbe8; outline: 1px dashed #d9a400; outline-offset: -2px;
}
/* 编辑中：行首一道绿条提示"这一组正在编辑" */
.imp-fixed tbody tr.imp-editing td:first-child { box-shadow: inset 3px 0 0 #35a06a; }
/* ===== 通用表（成品料号）默认只读 / 行编辑态（S20）=====
 * 与成品BOM 同一套手感：只读无底色；点「✏️ 修改」后该行淡杏色 + 行首绿条 */
.side-table tbody tr.imp-editing td.editable-cell { background: #fffdf3; }
.side-table tbody tr.imp-editing td.editable-cell:focus {
  background: #fff; outline: 2px solid var(--blue); outline-offset: -2px;
}
.side-table tbody tr.imp-editing td:first-child { box-shadow: inset 3px 0 0 #35a06a; }

/* 登录密码框：文本输入 + 圆点遮蔽（避免 http 页面触发浏览器「不安全表单」警告条） */
#lg-pwd.pwd-mask, .pwd-mask { -webkit-text-security: disc; }

/* ============================================================================
   [1027] 全站表格表头吸顶（用户要求：机台配置的「瓶型产能」和其它所有表，表头都要固定）
   各模块的表格都已经在各自的滚动容器里（.pm-scroll / .pr-board-wrap / .pc-scroll /
   .adm-scroll / .ht-scroll / .out-tbl-wrap / .tbl-wrap-wide），所以只要给 thead th
   加 sticky top:0 就会吸在容器顶部。表头底色本来就有，滚动时不会透出内容。
   ------------------------------------------------------------------------- */
.pc-table thead th,
.pm-table thead th,
.side-table thead th,
.tbl thead th,
.pm-tbl thead th,
.ht-tbl thead th,
.aps-tbl thead th,
.supply-table thead th,
.adm-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  /* border-collapse: collapse 的表格在 sticky 时边框会消失 → 用内阴影补一条底线 */
  box-shadow: inset 0 -1px 0 var(--border, #dcebe2);
}
/* 表体首列/末列本来就有 sticky 的表格（排产看板、日历）：表头要压在它们之上 */
.tbl.pr-board thead th,
.tbl.pr-sheet thead th,
.tbl.cal thead th { z-index: 6; }
/* 参数中心两级表头：第二行贴在组名行下方（这条更具体，别被上面的 top:0 覆盖） */
.pc-table.pc-grouped thead tr.pg-sub th { top: var(--pc-th1h, 30px); z-index: 6; }

/* ============================================================================
   [1027V3] 后台数据导入 ·「查看明细」弹窗（用户要求：不能在页面下方展开，要弹窗）
   复用 .modal-mask（fixed/inset:0/flex）+ .hr-modal-head/body，只要把面板放宽。
   ------------------------------------------------------------------------- */
.imp-modal-panel {
  width: min(1420px, 96vw); max-height: 88vh;
  background: #fff; border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.24);
}
.imp-modal-panel .hr-modal-head { flex: 0 0 auto; }
.imp-modal-panel .hr-modal-body { flex: 1 1 auto; overflow: auto; background: #f7faf8; padding: 10px 12px 14px; }
.imp-modal-panel .imp-ver-detail { margin-top: 0; border-top: 0; padding-top: 0; }
.imp-modal-panel .imp-ver-detail > .note { margin-bottom: 8px; }

/* ============================================================================
   [1027V4] 1+3需求「查看明细」：整页窗口（非弹窗），顶部返回条 + 铺满的宽表
   ------------------------------------------------------------------------- */
.imp-detail-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  position: sticky; top: 0; z-index: 8;
}
.imp-detail-head .imd-title { font-size: 13.5px; font-weight: 600; }
.imp-detail-head .imd-title b { color: var(--green); }
.imp-detail-head .imd-meta { font-size: 12px; color: var(--muted); }
.imp-detail-head .note { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.imp-detail-panel { margin: 0; padding: 0; border-radius: 8px; overflow: hidden; }
.imp-detail-scroll { max-height: calc(100vh - 210px); overflow: auto; }
.imd-tbl { font-size: 12px; border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.imd-tbl th, .imd-tbl td { padding: 3px 6px; border-bottom: 1px solid #eef2ef; white-space: nowrap; }
.imd-tbl thead th {
  position: sticky; z-index: 3; background: #e8f4ee; color: #2a4a38;
  font-weight: 600; text-align: center;
}
.imd-tbl thead tr:first-child th { top: 0; z-index: 4; }
.imd-tbl thead tr:nth-child(2) th { top: 25px; z-index: 3; font-size: 11.5px; }
.imd-tbl .imd-grp { border-left: 2px solid #cfe0d6; }
.imd-tbl thead th.imd-tot, .imd-tbl td.imd-tot { background: #fff8d6; }
.imd-tbl thead th.imd-tot { background: #f5e08a; }
.imd-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.imd-tbl tbody tr:hover td { background: #f2f9f5; }
.imd-tbl tbody tr:hover td.imd-tot { background: #fff3bf; }
.imd-tbl .imd-idx, .imd-tbl .imd-code, .imd-tbl .imd-item { position: sticky; background: #fbfdfb; z-index: 2; }
.imd-tbl th.imd-idx, .imd-tbl th.imd-code, .imd-tbl th.imd-item { position: sticky; z-index: 5; background: #e8f4ee; }
.imd-tbl .imd-idx { left: 0; width: 40px; text-align: center; }
.imd-tbl .imd-code { left: 40px; width: 96px; }
.imd-tbl .imd-item { left: 136px; min-width: 150px; font-weight: 600; }
.imd-tbl .imd-sum { font-weight: 700; background: #eef7f1; }

/* ============================================================================
   [1027] 版本列表（1+3需求 / 代工订单 / 预算量）列宽修复
   删掉「来源」列后，.col-action 的固定 160px 装不下「启用 + 查看明细 + 删除」三个按钮，
   auto 布局下整表最小宽度撑超容器（表格盒子 1203px，实际栅格 1454px），
   于是 thead 被裁在容器内、tbody 溢出到右侧 → 看上去"表头和数据对不齐"。
   改成 shrink-to-fit（width:1%）即可，让操作列按内容取宽，其它列平分剩余空间。
   ------------------------------------------------------------------------- */
.dg-body > .side-table { width: 100%; }
.dg-body > .side-table .col-action { width: 1%; white-space: nowrap; text-align: right; }
.dg-body > .side-table td, .dg-body > .side-table th { padding: 7px 8px; }
.dg-body > .side-table td:nth-child(3) { text-align: right; }   /* 行数 */
.dg-body > .side-table th:nth-child(3) { text-align: right; }

/* 期初库存（1027）：年月卡片 + 明细合计行 */
#imp-open-panel .dg-head .btn { padding: 3px 10px; font-size: 12px; margin-left: 6px; }
#imp-open-panel .dg-head b { font-size: 13px; }
.imd-tbl .imd-totalrow td { font-weight: 700; background: #f2f9f4; border-top: 2px solid var(--border); }

/* 期初库存明细：普通表格布局（10 列，不需要横向冻结前三列） */
.imd-tbl.open-tbl { width: 100%; min-width: 0; table-layout: auto; }
.imd-tbl.open-tbl .imd-idx, .imd-tbl.open-tbl .imd-code, .imd-tbl.open-tbl .imd-item {
  position: static; left: auto; width: auto; min-width: 0; background: transparent;
}
.imd-tbl.open-tbl thead th { position: sticky; top: 0; z-index: 4; background: #e8f4ee; }
.imd-tbl.open-tbl thead th.imd-idx { width: 42px; }
.imd-tbl.open-tbl thead th.imd-code { width: 120px; }
.imd-tbl.open-tbl thead th.imd-item { width: 260px; text-align: left; }
.imd-tbl.open-tbl thead th.imd-wk { width: 110px; }
.imd-tbl.open-tbl thead th.imd-sum { width: 130px; }
.imd-tbl.open-tbl td.imd-item { text-align: left; font-weight: 600; }
.imd-tbl.open-tbl tbody tr:hover td { background: #f7fbf8; }

/* 期初明细：字段过长时省略，别让一格把整张表撑爆 */
.imd-tbl.open-tbl tbody td.imd-code, .imd-tbl.open-tbl thead th.imd-code { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.imd-tbl.open-tbl tbody td.imd-item, .imd-tbl.open-tbl thead th.imd-item { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }

/* 排产配置 · 每月操作顺序条（2026-10-27 按「实际排产动作顺序」重排页签） */
.param-steps { display:flex; align-items:center; gap:5px; flex-wrap:wrap; padding:7px 10px; margin:0 0 8px;
  background:#f3f8f5; border:1px solid #dbe9e1; border-radius:8px; font-size:12px; color:#456; }
.ps-lb { color:#2a7a52; font-weight:600; margin-right:4px; }
.ps-step { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:14px;
  background:#fff; border:1px solid #d7e7dd; color:#26543c; cursor:pointer; user-select:none; }
.ps-step:hover { background:#eaf6ef; border-color:#9ecdb1; }
.ps-step b { display:inline-block; min-width:15px; height:15px; line-height:15px; text-align:center;
  border-radius:50%; background:#27a35c; color:#fff; font-size:10px; font-weight:600; }
.ps-step > span { color:#8aa397; font-size:11px; }
.ps-arr { color:#b9cbc1; font-style:normal; }

/* 排产参数「按月存档」状态条（表0 + 表2 快照） */
.pc-snap { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: #f5faf7;
  border: 1px solid #dceade; font-size: 12px; color: #3c5a4a; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pc-snap b { color: #1f6b3a; }
.pc-snap .note { color: #8aa397; }

/* 排产结果 · 排产月标识（只读，改月走顶栏） */
.pr-planym { font-size: 12px; padding: 3px 10px; border-radius: 14px; cursor: help;
  background: #eaf4ee; color: #26603f; border: 1px solid #cfe4d8; }
.pr-planym:hover { background: #dceedf; }

/* ===== 碳酸：某线整月无排产（全月停产）提示卡（2026-10-30） ===== */
.plan-dead { margin: 4px 0 2px; padding: 22px 26px; background: #FFF8F6; border: 1px solid #F3D6D0;
  border-left: 5px solid #C62828; border-radius: 10px; }
.plan-dead-t { font-size: 17px; font-weight: 800; color: #A32D2D; margin-bottom: 10px; }
.plan-dead-t b { background: #FCEBEB; padding: 1px 8px; border-radius: 6px; margin-left: 2px; }
.plan-dead-d { font-size: 13px; color: #6B4A46; line-height: 1.7; margin-bottom: 8px; }
.plan-dead-k { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.plan-dead-h { font-size: 12.5px; font-weight: 700; color: #A32D2D; margin-bottom: 6px; }
.plan-dead-l { margin: 0 0 2px 18px; padding: 0; }
.plan-dead-l li { font-size: 12.5px; color: #6B4A46; line-height: 1.85; }

/* ===== 排产原则（左侧栏独立模块，2026-10-30） ===== */
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1200px) { .rules-grid { grid-template-columns: 1fr; } }
.rules-card { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--green1);
  border-radius: 10px; padding: 12px 16px 14px; }
.rules-card.alt { border-left-color: #C98A2B; background: #FFFDF7; }
.rules-h { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--green2); margin-bottom: 6px; }
.rules-h b { font-weight: 800; }
.rules-ico { font-size: 15px; }
.rules-tag { margin-left: auto; font-size: 10.5px; font-weight: 600; color: #0F6E56;
  background: #E6F3EE; border-radius: 20px; padding: 1px 8px; white-space: nowrap; }
.rules-card.alt .rules-tag { color: #8A5D14; background: #FBF0DB; }
.rules-note { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.rules-list { margin: 0 0 0 18px; padding: 0; }
.rules-list li { font-size: 12px; color: var(--text); line-height: 1.72; margin-bottom: 3px; }
.rules-list li b { color: var(--green2); }

/* ===== 瓶型产能「版别」列（2026-10-31）：只有 通用/五码合一/普通版 三个值，不折行 ===== */
.pm-table td[data-col="ver"], .pm-table th:nth-child(8) { white-space: nowrap; }
.pm-table td[data-col="ver"] select { width: 100%; font-size: 12px; }

/* [1031c] 计划量：每条生产线的「自然箱 / 标箱」合计列（组内最后两列） */
.wp-grid thead th.wp-sub {
  color: #3d6152; font-size: 10px; font-weight: 700; text-align: center;
  padding: 5px 4px; white-space: nowrap; min-width: 56px;
}
.wp-grid thead th.wp-sub.ln-nm-a { background: #f1faf4; }
.wp-grid thead th.wp-sub.ln-nm-b { background: #f1f7fe; }
.wp-grid thead th.wp-sub.ln-nm-c { background: #fffaf1; }
.wp-grid thead th.wp-sub.ln-nm-d { background: #f8f5fe; }
.wp-grid tbody td.wp-sum, .wp-grid tfoot td.wp-sum {
  font-weight: 700; color: #1f4d36; border-left: 1px dashed #c9d6ce;
}
/* 兜底：数据行/合计行的线别分隔线一律 3px（带组色调的规则优先级更高） */
.wp-grid tbody td.ln-sep { border-left: 3px solid #8ea79a; }
/* [1031d] 排产计划合并页：每条线一张表纵向铺开，锚点跳转留出顶部间距 */
.wp-anchor { scroll-margin-top: 10px; }

/* [1031e] 排产计划 / 计划量：**日期列横向滚动时固定在左侧**（用户 2026-10-31）
   注意 sticky 需要不透明背景，日期格本身有底色；表头角格 z-index 再高一档，压在数据列之上 */
.wp-grid thead th.wp-corner { position: sticky; left: 0; top: 0; z-index: 7; }
.wp-grid tbody td.wp-date,
.wp-grid tfoot td.wp-date { position: sticky; left: 0; z-index: 4; }
.sched-grid thead th.date-cell { position: sticky; left: 0; top: 0; z-index: 7; background: var(--panel2); }
.sched-grid tbody td.date-cell { position: sticky; left: 0; z-index: 4; }
.sched-grid th.sticky { position: sticky; left: 0; z-index: 5; }
/* 固定日期列时保持列宽（否则 table-layout 自动压缩，「日期」两字会竖排、数字挤在一起） */
.wp-grid thead th.wp-corner,
.wp-grid tbody td.wp-date,
.wp-grid tfoot td.wp-date { min-width: 54px; width: 54px; white-space: nowrap; }
.sched-grid thead th.date-cell,
.sched-grid tbody td.date-cell { min-width: 56px; width: 56px; }
/* [1102] 组内「自然箱 / 生产合计(标箱)」列表头也跟线别色（原来被 .wp-tot 的米黄盖住，
   TP/碳酸/热充表头会出现一绿一白不统一） */
.wp-grid thead th.wp-tot.ln-hd-a { background: #bfe3cb; color: #14512c; }
.wp-grid thead th.wp-tot.ln-hd-b { background: #c3daf7; color: #143f7d; }
.wp-grid thead th.wp-tot.ln-hd-c { background: #f8d9a8; color: #7a4c02; }
.wp-grid thead th.wp-tot.ln-hd-d { background: #d6cbf7; color: #3f2185; }
