/* ============================================================
   欧剋管理系统 · 前端样式 (原生 CSS，无依赖)
   ------------------------------------------------------------
   分区：
   0. 变量与基础重置
   1. 通用工具类
   2. 按钮 / 徽标 / 表单
   3. 登录页
   4. 主框架：侧边栏 / 顶栏 / 页面
   5. 卡片 / KPI / 图表
   6. 表格 / 分页 / 筛选条
   7. 弹窗 / 抽屉 / 轻提示
   8. 特殊页面：跟踪看板 / 时间轴 / 报表标签 / 工艺路线
   9. 内部沟通（聊天）：未读角标 / 三栏布局 / 消息气泡 / 联系人选择器
   10. 适配 1366×768 及以上车间大屏
   ============================================================ */

/* ---------------- 0. 变量与基础重置 ---------------- */
:root {
  --c-bg: #eef2f7;
  --c-panel: #ffffff;
  --c-side: #1e293b;
  --c-side-dark: #172033;
  --c-side-active: #2563eb;
  --c-text: #1f2937;
  --c-text-2: #5b6779;
  --c-text-3: #6b7280;   /* 原 #8a94a6 白底只有 3.06:1，达不到 WCAG 正文 4.5:1 */
  --c-line: #dde3ec;
  --c-line-2: var(--c-bg-4);
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-green: #16a34a;
  --c-red: #dc2626;
  --c-orange: #ea580c;
  --c-amber: #d97706;
  --c-purple: #7c3aed;
  --c-teal: #0d9488;
  --c-gray: #64748b;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .18);
  --tap: 40px;                 /* 触屏最小点击高度 */
  /* ---- 侧栏专用（侧栏三套主题都是深底，所以文字永远浅色；
         不能拿 --c-line 这种「边框色」当文字色用——深色主题下会隐形）---- */
  --c-side-text: #dde3ec;
  --c-side-hover: #273548;
  /* ---- 按钮底色单独一个令牌：按钮上要压白字，需要比强调色更深才够对比度 ---- */
  --c-btn-primary: #2563eb;
  --c-btn-red: #dc2626;
  /* ---- 语义色（成对：浅底 + 深字）。深色主题下这两个会一起翻转 ---- */
  --c-ok-bg: #dcfce7;      --c-ok-fg: #15803d;      --c-ok-line: #86efac;
  --c-warn-bg: #ffedd5;    --c-warn-fg: #92400e;    --c-warn-line: #fdba74;
  --c-err-bg: #fee2e2;     --c-err-fg: #b91c1c;     --c-err-line: #fca5a5;
  --c-info-bg: #e8f0fe;    --c-info-fg: #1d4ed8;    --c-info-line: #bfdbfe;
  --c-purple-bg: #ede9fe;  --c-teal-bg: #ccfbf1;
  /* ---- 中性面板的第三层（表头/悬停/分隔）---- */
  --c-bg-5: #fcfdff;
  --c-bg-6: #f4f6fa;
  --c-bg-7: #f8fafc;
  /* ---- 追加：底色/文字层（换肤要用的令牌，值与原写死的色一致）---- */
  /* ⚠️ 2026-10-25 修复：这 8 个原来是 `var(--自己)` 的循环引用（无效值），
     导致浅色主题下行悬停/表头底色/条纹全部失效。这里给真值。 */
  --c-bg-2: #f5f7fa;          /* 表头、次级背景 */
  --c-bg-3: #eef2f7;          /* 悬停、条纹 */
  --c-bg-4: #e6ebf2;
  --c-hover: #eaf1ff;         /* 行悬停（浅蓝，和主色一系） */
  --c-sel: #dbeafe;           /* 选中 */
  --c-sel-2: #e6efff;         /* 选中（更淡） */
  --c-stripe: #fafbfd;        /* 斑马条纹 */
  --c-slate: #64748b;
  --c-on-accent: #ffffff;     /* 彩色按钮/徽标上的字，永远白，不跟主题变 */
  --c-shadow: rgba(16, 24, 40, .08);
  --c-shadow-2: rgba(16, 24, 40, .04);
  /* ---- 字号令牌：车间嫌小就整体放大这一组 ---- */
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-34: 34px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-15);
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

table { border-collapse: collapse; width: 100%; }

input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }

.noscript-warn {
  margin: 60px auto; max-width: 560px; padding: 20px 24px; border-radius: var(--radius);
  background: var(--c-warn-bg); border: 1px solid #f5c98a; color: var(--c-warn-fg); font-size: var(--fs-16);
}

/* ---------------- 1. 通用工具类 ---------------- */
.app-root { min-height: 100%; }

.boot-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; height: 100vh; color: var(--c-text-2);
}

.muted { color: var(--c-text-3); }
.muted-2 { color: var(--c-text-2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.center { text-align: center; }
.right { text-align: right; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.text-green { color: var(--c-green); }
.text-red { color: var(--c-red); }
.text-orange { color: var(--c-orange); }
.text-primary { color: var(--c-primary); }
.fs12 { font-size: var(--fs-12); }
.fs13 { font-size: var(--fs-13); }
.fs16 { font-size: var(--fs-16); }
.fs18 { font-size: 18px; }
.fs20 { font-size: var(--fs-20); }
.bold { font-weight: 600; }

/* ---------------- 2. 按钮 / 徽标 / 表单 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--c-line); background: var(--c-panel); color: var(--c-text);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--c-stripe); border-color: #c9d3e0; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--c-btn-primary); border-color: var(--c-btn-primary); color: var(--c-on-accent); }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn-green { background: var(--c-green); border-color: var(--c-green); color: var(--c-on-accent); }
.btn-green:hover { background: var(--c-green); border-color: var(--c-ok-fg); }
.btn-danger { background: var(--c-btn-red); border-color: var(--c-btn-red); color: var(--c-on-accent); }
.btn-danger:hover { background: var(--c-red); border-color: var(--c-err-fg); }
.btn-warn { background: var(--c-amber); border-color: var(--c-amber); color: var(--c-on-accent); }
.btn-warn:hover { background: var(--c-amber); border-color: var(--c-amber); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-info-bg); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: var(--fs-13); }
.btn-block { width: 100%; }
.btn-file { position: relative; overflow: hidden; }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 12px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--c-bg-4); color: var(--c-text-2); border: 1px solid transparent;
}
.badge-gray   { background: var(--c-bg-4); color: var(--c-gray); }
.badge-blue   { background: var(--c-info-bg); color: var(--c-primary-dark); }
.badge-green  { background: var(--c-ok-bg); color: var(--c-ok-fg); }
.badge-orange { background: var(--c-warn-bg); color: var(--c-warn-fg); }
.badge-red    { background: var(--c-err-bg); color: var(--c-err-fg); }
.badge-purple { background: var(--c-purple-bg); color: #6d28d9; }
.badge-dark   { background: var(--c-line); color: #334155; }
.badge-teal   { background: var(--c-teal-bg); color: #0f766e; }
.badge-lg { height: 28px; padding: 0 12px; font-size: var(--fs-14); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13.5px; color: var(--c-text-2); font-weight: 600; }
.field .req::after { content: " *"; color: var(--c-red); }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field input[type="date"], .field input[type="datetime-local"], .field input[type="time"],
.field input[type="search"], .field select, .field textarea {
  min-height: var(--tap); padding: 6px 10px; border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); background: var(--c-panel); width: 100%; outline: none;
}
.field textarea { min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
.field input:disabled, .field select:disabled { background: var(--c-bg-6); color: var(--c-text-3); }
.field .hint { font-size: 12.5px; color: var(--c-text-3); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.checkbox-row input[type="checkbox"] { width: 20px; height: 20px; }
.checkbox-row label { font-size: var(--fs-14); }

.inline-error {
  margin-bottom: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--c-err-bg); border: 1px solid #fca5a5; color: var(--c-err-fg); font-size: var(--fs-14);
}

/* ---------------- 3. 登录页 ---------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, var(--c-primary-dark) 100%); padding: 24px;
}
.login-card {
  width: 420px; max-width: 96vw; background: var(--c-panel); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 32px 34px 26px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .logo {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 12px;
  background: var(--c-primary); color: var(--c-on-accent); font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 23px; letter-spacing: 1px; }
.login-brand p { margin-top: 6px; color: var(--c-text-3); font-size: 13.5px; }
.login-card .btn { min-height: 46px; font-size: var(--fs-16); }
.login-error {
  margin-bottom: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--c-err-bg); border: 1px solid #fca5a5; color: var(--c-err-fg); font-size: var(--fs-14);
}
.login-foot { margin-top: 18px; text-align: center; color: var(--c-text-3); font-size: 12.5px; }

/* ---------------- 4. 主框架 ---------------- */
/* 外壳锁定视口高度、由 .page 内部滚动：聊天三栏才能真正铺满且不产生整页滚动条 */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 208px; flex: 0 0 208px; background: var(--c-side); color: var(--c-line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 16px 16px;
  background: var(--c-side-dark); border-bottom: 1px solid #0f172a;
}
.sidebar-brand .mark {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; background: var(--c-primary);
  color: var(--c-on-accent); font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .t1 { color: var(--c-on-accent); font-size: var(--fs-15); font-weight: 600; line-height: 1.25; }
.sidebar-brand .t2 { color: #94a3b8; font-size: 11.5px; }

.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--c-side-text); cursor: pointer; margin-bottom: 4px;
  font-size: var(--fs-15); border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--c-side-hover); color: var(--c-on-accent); }
.nav-item.active { background: var(--c-side-active); color: var(--c-on-accent); font-weight: 600; }
.nav-item .ico { width: 20px; text-align: center; font-size: var(--fs-15); opacity: .95; }
.nav-sep { height: 1px; background: #2b3a4f; margin: 8px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 18px; min-height: 62px;
  background: var(--c-panel); border-bottom: 1px solid var(--c-line); box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px;
  border: 1px solid var(--c-line); border-radius: var(--radius-sm); background: var(--c-panel); cursor: pointer;
}
.user-chip:hover { background: var(--c-stripe); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c-side);
  color: var(--c-on-accent); display: flex; align-items: center; justify-content: center; font-size: var(--fs-13);
}
.user-chip .u-name { font-size: var(--fs-14); font-weight: 600; line-height: 1.15; }
.user-chip .u-role { font-size: var(--fs-12); color: var(--c-text-3); line-height: 1.15; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 168px; background: var(--c-panel);
  border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; z-index: 40;
}
.dropdown-menu.open { display: block; }
.dropdown-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--tap);
  padding: 0 12px; border: none; background: transparent; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
}
.dropdown-menu button:hover { background: var(--c-bg-3); }
.dropdown-menu button.danger { color: var(--c-red); }
.dropdown-sep { height: 1px; background: var(--c-line-2); margin: 5px 4px; }

.page { padding: 16px 18px 28px; flex: 1; min-width: 0; overflow-y: auto; }

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.page-head h2 { font-size: var(--fs-20); }
.page-head .sub { color: var(--c-text-3); font-size: var(--fs-13); margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.breadcrumb { color: var(--c-text-3); font-size: var(--fs-13); margin-bottom: 10px; }
.breadcrumb a { color: var(--c-text-2); }

/* ---------------- 5. 卡片 / KPI / 图表 ---------------- */
.card {
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--c-line-2); min-height: 52px;
}
.card-title { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title::before {
  content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--c-primary);
}
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 14px; position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c-gray); }
.kpi.kpi-green::after { background: var(--c-green); }
.kpi.kpi-red::after { background: var(--c-red); }
.kpi.kpi-blue::after { background: var(--c-primary); }
.kpi.kpi-orange::after { background: var(--c-orange); }
.kpi.kpi-teal::after { background: var(--c-teal); }
.kpi.kpi-purple::after { background: var(--c-purple); }
.kpi-label { font-size: var(--fs-13); color: var(--c-text-2); margin-bottom: 6px; }
.kpi-value { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: var(--fs-13); font-weight: 400; color: var(--c-text-3); margin-left: 4px; }
.kpi-sub { font-size: 12.5px; color: var(--c-text-3); margin-top: 5px; min-height: 18px; }

.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--c-text-2); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
.donut-flex { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-flex .donut-svg { flex: 0 0 240px; max-width: 240px; }
.donut-flex .donut-legend { flex: 1; min-width: 180px; }
.donut-legend-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--c-line-2); font-size: 13.5px;
}
.donut-legend-row:last-child { border-bottom: none; }
.donut-legend-row .lbl { display: flex; align-items: center; gap: 8px; }

.progress {
  height: 10px; border-radius: 6px; background: var(--c-bg-4); overflow: hidden; min-width: 70px;
}
.progress > span { display: block; height: 100%; background: var(--c-primary); border-radius: 6px; transition: width .3s; }
.progress.green > span { background: var(--c-green); }
.progress.orange > span { background: var(--c-orange); }
.progress.red > span { background: var(--c-red); }
.progress-lg { height: 16px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .pct { font-size: var(--fs-13); color: var(--c-text-2); min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 6. 表格 / 分页 / 筛选条 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: max-content; max-width: 100%; min-width: 640px; font-size: var(--fs-14); }
table.data th {
  text-align: left; font-weight: 600; color: var(--c-text-2); background: var(--c-bg-2);
  padding: 11px 12px; border-bottom: 1px solid var(--c-line); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--c-line-2); vertical-align: middle; }
table.data tbody tr:hover { background: var(--c-hover); }
table.data td.actions { white-space: nowrap; }
table.data tbody tr.row-active { background: var(--c-sel-2); }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.cell-2line { display: flex; flex-direction: column; line-height: 1.3; }
.cell-2line .s1 { font-weight: 600; }
.cell-2line .s2 { font-size: var(--fs-12); color: var(--c-text-3); }
text.table-empty { color: var(--c-text-3); }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; flex-wrap: wrap; border-top: 1px solid var(--c-line-2);
}
.pager-info { color: var(--c-text-2); font-size: 13.5px; }
.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-btns .pg {
  min-width: var(--tap); min-height: var(--tap); padding: 0 10px; border: 1px solid var(--c-line);
  background: var(--c-panel); border-radius: var(--radius-sm); cursor: pointer;
}
.pager-btns .pg:hover:not(:disabled) { background: var(--c-bg-3); }
.pager-btns .pg.active { background: var(--c-btn-primary); border-color: var(--c-primary); color: var(--c-on-accent); font-weight: 600; }
.pager-btns .pg:disabled { opacity: .45; cursor: not-allowed; }

.filter-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--c-line-2); background: var(--c-bg-5);
}
.filter-bar .field { margin-bottom: 0; min-width: 150px; }
.filter-bar .field.grow { min-width: 220px; flex: 1; }
.filter-bar .field > label { font-size: 12.5px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.empty {
  padding: 44px 16px; text-align: center; color: var(--c-text-3);
}
.empty .ico { font-size: var(--fs-34); opacity: .5; margin-bottom: 8px; }
.empty .t { font-size: var(--fs-15); }
.empty .h { font-size: var(--fs-13); margin-top: 5px; }

.loading { padding: 34px 16px; text-align: center; color: var(--c-text-3); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid #dbe3ee; border-top-color: var(--c-primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 7. 弹窗 / 抽屉 / 轻提示 ---------------- */
.modal-mask, .drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; animation: fade .15s ease-out;
}
.modal-mask { align-items: center; justify-content: center; padding: 22px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--c-panel); border-radius: 10px; box-shadow: var(--shadow-lg); width: 620px;
  max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.99); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--c-line-2);
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--c-line-2);
}
.modal-close {
  border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--c-text-3);
  cursor: pointer; width: 40px; height: 40px; border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--c-bg-3); color: var(--c-text); }

.drawer-mask { justify-content: flex-end; }
.drawer {
  background: var(--c-panel); width: 880px; max-width: 96vw; height: 100%; display: flex;
  flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .7; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--c-line-2);
}
.drawer-head h3 { font-size: 17px; }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }

.toast-root {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none;
}
.toast {
  min-width: 220px; max-width: 78vw; padding: 11px 18px; border-radius: var(--radius);
  background: #1f2937; color: var(--c-on-accent); box-shadow: var(--shadow-lg); font-size: 14.5px;
  display: flex; align-items: center; gap: 9px; animation: drop .18s ease-out;
}
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { background: var(--c-green); }
.toast.error { background: var(--c-red); }
.toast.warn { background: var(--c-amber); }
.toast.info { background: var(--c-primary-dark); }

/* 确认弹窗内文案 */
.confirm-text { font-size: var(--fs-15); line-height: 1.65; white-space: pre-line; }
.confirm-text .em { color: var(--c-red); font-weight: 600; }

/* 详情键值列表 */
.kv-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.kv-list.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv .k { font-size: 12.5px; color: var(--c-text-3); margin-bottom: 3px; }
.kv .v { font-size: var(--fs-15); font-weight: 600; word-break: break-all; }
.kv .v.normal { font-weight: 400; }

.section-title {
  font-size: 14.5px; font-weight: 600; color: var(--c-text-2); margin: 18px 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--c-line-2);
}
.section-title:first-child { margin-top: 0; }

/* ---------------- 8. 特殊页面 ---------------- */
/* 生产跟踪看板 */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col {
  flex: 0 0 300px; width: 300px; background: var(--c-bg-2); border: 1px solid var(--c-line);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px);
}
.board-col-head {
  padding: 10px 12px; border-bottom: 1px solid var(--c-line); background: var(--c-panel);
  border-radius: var(--radius) var(--radius) 0 0;
}
.board-col-head .n { font-weight: 600; font-size: var(--fs-15); }
.board-col-head .m { font-size: var(--fs-12); color: var(--c-text-3); margin-top: 2px; }
.board-col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.board-card {
  background: var(--c-panel); border: 1px solid var(--c-line); border-left: 4px solid var(--c-primary);
  border-radius: var(--radius-sm); padding: 10px 11px; box-shadow: var(--shadow);
}
.board-card.s-in_progress { border-left-color: var(--c-orange); }
.board-card.s-ready { border-left-color: var(--c-primary); }
.board-card.s-pending { border-left-color: var(--c-gray); }
.board-card.s-completed { border-left-color: var(--c-green); }
.board-card .bc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.board-card .bc-no { font-weight: 600; font-size: var(--fs-14); }
.board-card .bc-proc { font-size: var(--fs-14); margin-top: 4px; }
.board-card .bc-meta { font-size: 12.5px; color: var(--c-text-2); margin-top: 5px; line-height: 1.55; }
.board-card .bc-act { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* 时间轴 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--c-line);
}
.tl-item { position: relative; padding: 0 0 16px 4px; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--c-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px #dbe7ff;
}
.tl-item.tl-done::before { background: var(--c-green); box-shadow: 0 0 0 2px #d6f5e2; }
.tl-item.tl-warn::before { background: var(--c-amber); box-shadow: 0 0 0 2px #fdeed6; }
.tl-item.tl-danger::before { background: var(--c-red); box-shadow: 0 0 0 2px #fbdcdc; }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-action { font-weight: 600; font-size: 14.5px; }
.tl-time { font-size: 12.5px; color: var(--c-text-3); }
.tl-meta { font-size: var(--fs-13); color: var(--c-text-2); margin-top: 3px; }

/* 标签页 */
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--c-line); overflow-x: auto; }
.tab {
  min-height: 46px; padding: 0 16px; border: none; background: transparent; cursor: pointer;
  color: var(--c-text-2); font-size: var(--fs-15); border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--c-text); background: var(--c-bg-2); }
.tab.active { color: var(--c-primary-dark); border-bottom-color: var(--c-primary); font-weight: 600; }

/* 工艺路线工序行 */
.steps-table td { padding: 7px 8px; }
.steps-table input, .steps-table select {
  min-height: 38px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  width: 100%; background: var(--c-panel);
}
.steps-table input[type="number"] { text-align: right; }
.seq-cell { text-align: center; font-weight: 600; color: var(--c-text-2); }
.order-move { display: flex; gap: 4px; }
.order-move button {
  width: 34px; min-height: 34px; border: 1px solid var(--c-line); background: var(--c-panel);
  border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-14); line-height: 1;
}
.order-move button:hover:not(:disabled) { background: var(--c-bg-3); }
.order-move button:disabled { opacity: .4; cursor: not-allowed; }

.status-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-13); color: var(--c-text-2); }

/* ---------------- 9. 内部沟通（聊天） ---------------- */
/* 未读角标（侧边菜单 / 顶栏共用） */
.nav-label { flex: 1; min-width: 0; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
  background: var(--c-red); color: var(--c-on-accent); font-size: 11.5px; font-weight: 600; line-height: 1;
}
.nav-item .nav-badge { margin-left: auto; }
.topbar .btn .nav-badge { margin-left: 6px; }

.chat-page { display: flex; gap: 12px; height: calc(100vh - 156px); min-height: 480px; }

/* 左栏：会话列表 */
.chat-side {
  flex: 0 0 286px; width: 286px; min-width: 0; background: var(--c-panel); border: 1px solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.chat-side-head { padding: 10px 12px; border-bottom: 1px solid var(--c-line-2); background: var(--c-bg-5); }
.chat-search {
  width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); background: var(--c-panel); outline: none;
}
.chat-search:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.chat-seg { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chat-seg-btn {
  min-height: 32px; padding: 0 11px; border-radius: 16px; border: 1px solid var(--c-line);
  background: var(--c-panel); color: var(--c-text-2); font-size: var(--fs-13); cursor: pointer;
}
.chat-seg-btn:hover { background: var(--c-bg-3); }
.chat-seg-btn.active { background: var(--c-btn-primary); border-color: var(--c-primary); color: var(--c-on-accent); font-weight: 600; }
.chat-conv-list { flex: 1; overflow-y: auto; }
.chat-group-title {
  padding: 7px 12px; font-size: var(--fs-12); color: var(--c-text-3); background: var(--c-bg-2);
  border-bottom: 1px solid var(--c-line-2); position: sticky; top: 0; z-index: 1;
}
.chat-conv {
  padding: 10px 12px; border-bottom: 1px solid var(--c-line-2); cursor: pointer;
  border-left: 3px solid transparent;
}
.chat-conv:hover { background: var(--c-hover); }
.chat-conv.active { background: var(--c-sel-2); border-left-color: var(--c-primary); }
.chat-conv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-conv-name {
  font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 5px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-conv-time { font-size: var(--fs-12); color: var(--c-text-3); white-space: nowrap; }
.chat-conv-bottom { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-height: 22px; }
.chat-conv-pre {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--c-text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--c-red); color: var(--c-on-accent);
  font-size: 11.5px; font-weight: 600; line-height: 1;
}
.chat-dots {
  display: none; width: 26px; height: 22px; padding: 0; border: 1px solid var(--c-line);
  background: var(--c-panel); border-radius: 4px; cursor: pointer; color: var(--c-text-2); line-height: 1;
}
.chat-conv:hover .chat-dots { display: block; }
.online-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--c-green);
  box-shadow: 0 0 0 2px #d6f5e2; flex: 0 0 9px;
}
.offline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-line); flex: 0 0 9px; }
.pin-flag { font-size: var(--fs-11); }
.mute-flag { font-size: var(--fs-12); opacity: .75; }
.chat-ctx-menu { z-index: 60; }

/* 中栏：消息区 */
.chat-main {
  flex: 1; min-width: 0; background: var(--c-panel); border: 1px solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.chat-placeholder { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--c-line-2); min-height: 60px; flex-wrap: wrap;
}
.chat-head-name { font-size: var(--fs-16); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chat-head-sub { font-size: 12.5px; color: var(--c-text-3); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.chat-head-r { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chat-ref {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px;
  background: var(--c-sel-2); color: var(--c-primary-dark); border: 1px solid #c7d7fb; font-size: var(--fs-12);
  cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-ref:hover { background: var(--c-info-bg); }
.chat-stream { flex: 1; overflow-y: auto; padding: 14px 16px 10px; background: var(--c-bg-2); }
.chat-stream-tip { text-align: center; color: var(--c-text-3); font-size: var(--fs-13); padding: 18px 0 8px; }
.chat-load { text-align: center; }
.chat-day { text-align: center; margin: 12px 0 10px; }
.chat-day span {
  display: inline-block; padding: 2px 12px; border-radius: 10px;
  background: var(--c-line-2); color: #5b6779; font-size: var(--fs-12);
}
.chat-msg { display: flex; gap: 9px; margin-bottom: 14px; align-items: flex-start; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #94a3b8; color: var(--c-on-accent);
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-14); font-weight: 600;
}
.chat-avatar.owner { background: var(--c-primary); }
.chat-msg-col { max-width: 74%; min-width: 0; display: flex; flex-direction: column; }
.chat-msg.mine .chat-msg-col { align-items: flex-end; }
.chat-meta {
  font-size: var(--fs-12); color: var(--c-text-3); margin-bottom: 2px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.chat-bubble {
  background: var(--c-panel); border: 1px solid var(--c-line); padding: 8px 12px; border-radius: 10px;
  font-size: 14.5px; line-height: 1.5; word-break: break-word; overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.chat-msg.mine .chat-bubble { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-accent); }
.chat-msg.mine .chat-bubble .chat-ref { background: rgba(255, 255, 255, .18); color: var(--c-on-accent); border-color: rgba(255, 255, 255, .45); }
.chat-msg.mine .chat-bubble .chat-file { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: var(--c-on-accent); }
.chat-foot { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-height: 20px; }
.chat-time { font-size: var(--fs-12); color: var(--c-text-3); }
.chat-recall {
  display: none; min-height: 24px; padding: 0 8px; font-size: var(--fs-12); border-color: var(--c-line);
  background: var(--c-panel); color: var(--c-text-2);
}
.chat-msg:hover .chat-recall { display: inline-flex; }
.chat-sys { text-align: center; margin: 10px 0; color: var(--c-text-3); font-size: 12.5px; }
.chat-recalled { color: var(--c-text-3); font-style: italic; }
.chat-img {
  display: block; max-width: 240px; max-height: 240px; border-radius: 6px; cursor: zoom-in; background: var(--c-panel);
}
.chat-file {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--c-line);
  border-radius: 6px; background: var(--c-bg-2); color: var(--c-text); min-width: 170px;
}
.chat-file:hover { background: var(--c-bg); text-decoration: none; }
.chat-file-ico { font-size: var(--fs-20); }
.chat-file-main { display: flex; flex-direction: column; min-width: 0; }
.chat-file-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chat-file-size { font-size: var(--fs-12); color: var(--c-text-3); }
.chat-msg.mine .chat-file-size { color: rgba(255, 255, 255, .85); }
.chat-newtip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 112px; z-index: 5;
  padding: 6px 14px; border-radius: 14px; background: var(--c-primary); color: var(--c-on-accent);
  font-size: var(--fs-13); cursor: pointer; box-shadow: var(--shadow-lg);
}

/* 输入区 */
.chat-input { border-top: 1px solid var(--c-line-2); padding: 10px 12px 12px; background: var(--c-panel); }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1; min-height: 54px; max-height: 140px; padding: 9px 11px; border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); resize: none; outline: none; line-height: 1.5;
}
.chat-input-row textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.chat-input-row textarea:disabled { background: var(--c-bg-6); color: var(--c-text-3); }
.chat-input-row .btn { min-height: 54px; padding: 0 20px; }
.chat-input-tools { display: flex; align-items: center; gap: 8px; margin-top: 7px; }

/* 右栏：成员（屏宽不足时改为浮层，由 JS 切换 .float） */
.chat-aside {
  flex: 0 0 208px; width: 208px; background: var(--c-panel); border: 1px solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.chat-aside.float {
  position: absolute; right: 12px; top: 68px; bottom: 12px; z-index: 8;
  box-shadow: var(--shadow-lg); display: flex !important;
}
.chat-aside-head {
  padding: 10px 12px; border-bottom: 1px solid var(--c-line-2); font-size: 13.5px;
  font-weight: 600; background: var(--c-bg-5);
}
.chat-member-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.chat-member { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.chat-member:hover { background: var(--c-hover); }
.chat-member-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-member-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-member-sub { font-size: var(--fs-12); color: var(--c-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-member .chat-avatar { width: 28px; height: 28px; flex: 0 0 28px; font-size: var(--fs-12); }
.chat-member-lg { padding: 8px 4px; border-bottom: 1px solid var(--c-line-2); }
.chat-info-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 600; flex-wrap: wrap; }

/* 联系人选择器 */
.chat-contact-search {
  width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); outline: none; margin-bottom: 8px;
}
.chat-contact-search:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.chat-contact-summary {
  padding: 7px 10px; margin-bottom: 8px; border-radius: var(--radius-sm);
  background: var(--c-info-bg); color: var(--c-primary-dark); font-size: 12.5px; min-height: 30px;
}
.chat-contact-list {
  max-height: 46vh; overflow-y: auto; border: 1px solid var(--c-line); border-radius: var(--radius-sm);
}
.chat-contact {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-bottom: 1px solid var(--c-line-2); cursor: pointer;
}
.chat-contact:last-child { border-bottom: none; }
.chat-contact:hover { background: var(--c-hover); }
.chat-contact.picked { background: var(--c-sel-2); }
.chat-contact input { width: 18px; height: 18px; flex: 0 0 18px; }
.chat-contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-contact-name { font-size: var(--fs-14); font-weight: 600; }
.chat-contact-sub { font-size: var(--fs-12); color: var(--c-text-3); }
.chat-pick-names {
  padding: 9px 11px; margin-bottom: 10px; border-radius: var(--radius-sm);
  background: var(--c-bg-2); border: 1px solid var(--c-line); font-size: var(--fs-14); font-weight: 600;
}

/* 图片放大预览 / 公告输入 */
.chat-modal-body { text-align: center; background: #0f172a; border-radius: var(--radius-sm); padding: 8px; }
.chat-modal-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; }
#chat-bc-text {
  width: 100%; min-height: 110px; padding: 9px 11px; border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); resize: vertical; outline: none; line-height: 1.55;
}
#chat-bc-text:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }

@media (max-width: 1500px) {
  /* 默认隐藏右栏；点「在线成员」时由 JS 加 .float 变成浮层（用 !important 压过 .hidden） */
  .chat-aside:not(.float) { display: none !important; }
}
@media (max-width: 1200px) {
  .chat-page { height: auto; }
  .chat-side { flex: 0 0 232px; width: 232px; }
  .chat-stream { max-height: 52vh; min-height: 300px; }
}
@media (max-width: 900px) {
  .chat-page { flex-direction: column; }
  .chat-side { flex: none; width: 100%; max-height: 300px; }
  .chat-main { min-height: 460px; }
}

/* ---------------- 10. 车间大屏适配 ---------------- */
@media (min-width: 1600px) {
  body { font-size: var(--fs-16); }
  .sidebar { width: 224px; flex-basis: 224px; }
  .kpi-value { font-size: var(--fs-34); }
  .login-card { width: 440px; }
  .chat-page { height: calc(100vh - 168px); }
}

@media (max-width: 1366px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-dash { grid-template-columns: minmax(0, 1fr); }
  .sidebar { width: 190px; flex-basis: 190px; }
  .nav-item { font-size: 14.5px; }
  .chat-side { flex: 0 0 248px; width: 248px; }
  .chat-page { height: calc(100vh - 152px); }
}

@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kv-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .sidebar, .topbar, .page-actions, .filter-bar, .pager { display: none !important; }
  .card { box-shadow: none; }
}

/* ============================================================
   统一通知层（顶栏角标 + 抽屉）
   ============================================================ */
.notify-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--c-line-2);
}
.notify-hint { color: var(--c-text-3); font-size: var(--fs-12); margin-left: auto; }
.notify-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--c-line-2); margin-bottom: 8px;
  background: var(--c-panel);
}
.notify-item.unread {
  border-color: var(--c-primary);
  background: var(--c-info-bg);
}
.notify-ico { font-size: 18px; line-height: 1.4; flex: 0 0 auto; }
.notify-main { flex: 1 1 auto; min-width: 0; }
.notify-title { font-weight: 600; color: var(--c-text); margin-bottom: 2px; }
.notify-body { color: var(--c-text-2); font-size: var(--fs-13); margin-bottom: 4px; word-break: break-word; }
.notify-meta { color: var(--c-text-3); font-size: var(--fs-12); }
.notify-ops { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }

/* ============================================================
   @功能
   ============================================================ */
.chat-mention-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 0 0 6px;
}
.chat-mention-bar:empty { display: none; }
.mention-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 8px; border-radius: 999px;
  background: var(--c-sel); color: var(--c-primary-dark);
  font-size: var(--fs-12); border: 1px solid #c7dbff;
}
.mention-chip-x {
  border: 0; background: transparent; cursor: pointer;
  color: var(--c-primary-dark); font-size: var(--fs-14); line-height: 1;
  padding: 0 3px;
}
.mention-chip-x:hover { color: var(--c-red); }
.mention-list { max-height: 52vh; overflow: auto; }
.mention-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.mention-opt:hover { background: var(--c-line-2); }
.mention-opt.picked { background: var(--c-info-bg); border-color: var(--c-primary); }
.mention-name { font-weight: 600; }
.mention-sub { color: var(--c-text-3); font-size: var(--fs-12); margin-left: auto; }
.mention-tag {
  color: var(--c-primary-dark); background: var(--c-sel);
  border-radius: 4px; padding: 0 3px;
}
.chat-msg.mention-me .chat-bubble {
  border-color: var(--c-amber);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, .18);
}
.mention-me-tag {
  display: inline-block; margin-left: 6px;
  padding: 0 6px; border-radius: 999px;
  background: var(--c-amber); color: var(--c-on-accent); font-size: var(--fs-11);
}

/* ============================================================
   任务协同图（四泳道 DAG）
   本轮只做静态渲染：跑马灯与补丁式增量更新留到下一轮
   ============================================================ */
.flow-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 0 0 10px; margin-bottom: 8px;
  border-bottom: 1px solid var(--c-line-2);
  font-size: var(--fs-12); color: var(--c-text-2);
}
.flow-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.flow-dot {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block;
  border: 1px solid var(--c-line); background: var(--c-slate);
}
.flow-dot.in_progress { background: var(--c-sel); border-color: var(--c-primary); }
.flow-dot.done { background: var(--c-ok-bg); border-color: var(--c-green); }
.flow-dot.blocked { background: var(--c-slate); border-color: var(--c-red); }
.flow-dot.overdue { background: var(--c-slate); border-color: var(--c-orange); }
.flow-dot.critical { background: var(--c-panel); border: 3px solid var(--c-red); }
.flow-dot.active {
  background: var(--c-sel); border-color: var(--c-primary);
  background-image: repeating-linear-gradient(90deg, var(--c-primary) 0 3px, transparent 3px 6px);
}

.flow-cpm-note {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--c-bg-7); border-left: 3px solid var(--c-primary);
  font-size: var(--fs-12); line-height: 1.7; color: var(--c-text-2);
}

.flow-feasibility {
  padding: 11px 14px; border-radius: 9px; margin-bottom: 12px;
  font-size: var(--fs-13); line-height: 1.7;
}
.flow-feasibility.danger { background: var(--c-err-bg); border-left: 4px solid var(--c-red); color: #991b1b; }
.flow-feasibility.warn { background: var(--c-warn-bg); border-left: 4px solid var(--c-amber); color: var(--c-warn-fg); }
.flow-feasibility.ok { background: var(--c-ok-bg); border-left: 4px solid var(--c-green); color: #166534; }

/* 系统设置表单 */
.settings-form { display: flex; flex-wrap: wrap; gap: 16px 20px; }
.settings-form .field { min-width: 260px; max-width: 380px; }
.settings-form input { width: 100%; }
.field-hint { margin-top: 4px; font-size: var(--fs-11); line-height: 1.55; color: var(--c-text-3); }
.settings-actions { margin-top: 14px; }

/* 协同模板维护 */
.tpl-detail { margin-top: 16px; }
.tpl-meta { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 12px; }
.tpl-meta .field { min-width: 240px; max-width: 360px; }
.tpl-meta input { width: 100%; }
.tpl-actions { margin-bottom: 10px; }
.tpl-count { margin-top: 4px; }
.tpl-tip { margin-top: 8px; }

.flow-canvas { overflow: auto; padding-bottom: 6px; }
.flow-svg { display: block; min-width: 100%; }

.flow-lane-band { fill: #f8fafc; }
.flow-lane-band.alt { fill: var(--c-slate); }
.flow-lane-label { font-size: var(--fs-13); font-weight: 600; fill: var(--c-text-2); }
.flow-lane-sub { font-size: var(--fs-11); fill: var(--c-text-3); }

.flow-edge { fill: none; stroke: #c3cbd8; stroke-width: 1.6; }
.flow-edge.done { stroke: var(--c-green); }

/* 跑马灯：只画在"上游已完成、下游还没完成"的边上——那才是现在真正在流动的工序。
   整条链都画动画只会变成满屏闪烁，反而看不出卡在哪。 */
.flow-edge.active {
  stroke: var(--c-primary);
  stroke-width: 2.2;
  stroke-dasharray: 7 6;
  animation: flow-march .85s linear infinite;
}
@keyframes flow-march {
  to { stroke-dashoffset: -13; }
}
/* 无障碍：用户系统里设了"减少动态效果"就退化成静态加粗，不做动画 */
@media (prefers-reduced-motion: reduce) {
  .flow-edge.active { animation: none; stroke-dasharray: none; stroke-width: 2.6; }
}

.flow-node { cursor: pointer; }
.flow-node rect {
  fill: var(--c-slate); stroke: var(--c-line); stroke-width: 1.4;
  transition: filter .12s ease-out;
}
.flow-node:hover rect { filter: brightness(.97); }
.flow-node.in_progress rect { fill: var(--c-sel); stroke: var(--c-primary); stroke-width: 2; }
.flow-node.done rect { fill: #dcfce7; stroke: var(--c-green); stroke-width: 2; }
.flow-node.blocked rect { fill: #fef2f2; stroke: var(--c-red); stroke-width: 2.5; }
.flow-node.overdue rect { fill: #fff7ed; stroke: var(--c-orange); stroke-width: 2.5; }
/* 关键路径：粗框。必须放在三态规则之后，否则同权重下会被覆盖 */
.flow-node.critical rect { stroke-width: 3.4; }
.flow-node-name { font-size: var(--fs-12); font-weight: 600; fill: var(--c-text); }
.flow-node-owner { font-size: var(--fs-11); fill: var(--c-text-3); }
.flow-node-pct { font-size: var(--fs-11); fill: var(--c-text-2); }
.flow-float { font-size: 10px; fill: var(--c-text-3); }
.flow-float.crit { fill: var(--c-red); font-weight: 700; }
.flow-chat-dot { font-size: var(--fs-11); }
.flow-bar-bg { fill: #e2e8f0; }
.flow-bar { fill: var(--c-primary); }
.flow-node.done .flow-bar { fill: var(--c-green); }
.flow-node.blocked .flow-bar { fill: var(--c-red); }
.flow-node.overdue .flow-bar { fill: var(--c-orange); }

.flow-tag {
  display: inline-block; margin-left: 4px; padding: 0 5px;
  border-radius: 999px; font-size: var(--fs-11);
  background: var(--c-line-2); color: var(--c-text-2);
}
.flow-tag.danger { background: var(--c-err-bg); color: var(--c-red); }
.flow-tag.warn { background: var(--c-warn-bg); color: var(--c-orange); }

.flow-node-detail .kv-list { margin-bottom: 10px; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.alert-sm {
  padding: 7px 10px; border-radius: 7px; font-size: var(--fs-12);
  background: var(--c-warn-bg); color: var(--c-orange); margin-bottom: 8px;
}
.alert-sm.danger { background: var(--c-err-bg); color: var(--c-red); }
.flow-checks { border-top: 1px solid var(--c-line-2); padding-top: 10px; }
.flow-checks-title { font-weight: 600; font-size: var(--fs-13); margin-bottom: 6px; }
.flow-check {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-radius: 6px; cursor: pointer;
}
.flow-check:hover { background: var(--c-line-2); }
.flow-check span:first-of-type { flex: 1 1 auto; }
.flow-check-add { display: flex; gap: 8px; margin-top: 8px; }
.flow-check-add input {
  flex: 1 1 auto; padding: 6px 9px; border: 1px solid var(--c-line);
  border-radius: 7px; font-size: var(--fs-13);
}

/* ---------------- 排班计划（月历网格） ---------------- */
.sp-wrap { overflow-x: auto; }
.sp-table { table-layout: fixed; }
.sp-table th, .sp-table td { text-align: center; padding: 2px 1px; font-size: var(--fs-12); }
.sp-table .sp-fixed { text-align: left; width: 150px; min-width: 150px; position: sticky;
  left: 0; background: var(--c-panel); z-index: 1; }
.sp-table .sp-day { width: 26px; min-width: 26px; }
.sp-dow { font-weight: 400; opacity: .6; font-size: 10px; }
.sp-weekend { background: rgba(220, 60, 60, .07); }
.sp-cell { cursor: pointer; position: relative; border: 1px solid rgba(0, 0, 0, .06); }
.sp-cell:hover { outline: 2px solid var(--c-primary); outline-offset: -2px; }
.sp-plan { background: var(--c-bg-6); color: var(--c-text-3); }
.sp-ok { background: var(--c-ok-bg); color: #1c6b32; font-weight: 600; }
.sp-rest { background: var(--c-err-bg); color: #b23b3b; }
.sp-off { background: var(--c-bg-5); color: #c8ccd2; }
.sp-dot { position: absolute; top: 0; right: 1px; width: 5px; height: 5px;
  border-radius: 50%; background: #d97706; display: inline-block; }
.sp-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: var(--fs-12); color: var(--c-text-3); }
.sp-chip { display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .1); margin-left: 10px; }
.sp-chip:first-child { margin-left: 0; }
.sp-wds { display: flex; gap: 12px; flex-wrap: wrap; }
.sp-wd { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-13); }
/* 排产页：设备视角的日期格 */
.sc-table th, .sc-table td { text-align: center; }
.sc-table td:first-child, .sc-table th:first-child { text-align: left; }

/* ============================================================
   平板 / 窄屏适配（≤1100px 才生效，电脑上外观完全不变）
   ------------------------------------------------------------
   车间用的是平板。横屏 1024、竖屏 768 —— 在没有这段之前，顶栏标题会被挤成
   **一列竖排**（一个字一行），公司名变成竖条，顶栏撑得很高还读不出来。
   实测出处：iPad 竖屏 768×1024 的「准备与跟进」页。
   ============================================================ */
@media (max-width: 1100px) {
  /* 顶栏：标题单行 + 省略号；副标题（公司名）隐藏——它在侧栏顶部已经显示过。
     ⚠️ 但**光 nowrap 不够**：标题不折了，溢出的就变成右侧那排按钮（实测 555px 宽）。
     窄屏真正的解法是**允许顶栏折成两行**（标题一行、按钮一行），而不是谁都不许折。 */
  .topbar {
    gap: 8px; padding: 8px 12px; height: auto; min-height: 56px;
    flex-wrap: wrap; align-content: center;
  }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; }
  .topbar-left { min-width: 0; flex: 1 1 auto; overflow: hidden; }
  .topbar-title {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: var(--fs-16);
  }
.topbar-right { flex: 0 0 auto; gap: 6px; }
  .topbar-right .btn { padding: 0 10px; white-space: nowrap; }

  /* 内容区留白收一点，窄屏上多出可用宽度 */
  .content, .page, .main { padding-left: 12px; padding-right: 12px; }

  /* KPI 一行两个（窄屏上一个就太浪费纵向空间） */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 工具栏允许换行，别把按钮挤出屏幕 */
  .toolbar, .filter-bar { flex-wrap: wrap; row-gap: 8px; }

  /* 侧栏窄一点（标签还在，只是不那么宽） */
  .sidebar { width: 184px; }

  /* 触摸友好：输入框/下拉至少 34px 高（原来 24px，手指点不准）
     ⚠️ 必须连**裸 select** 一起管：工具栏里的筛选下拉没挂 input-sm 类，
     只写 .input-sm 会漏掉它们（第一版就是这么漏的）。*/
  .input-sm, input, select, textarea { min-height: 34px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; }
  select { padding-top: 4px; padding-bottom: 4px; }
  .btn-sm { min-height: 34px; }
  .chat-seg-btn { min-height: 36px; }
}

@media (max-width: 820px) {
  /* 竖屏手机/小平板：侧栏再窄一档，KPI 一个一行太浪费就用两个 */
  .sidebar { width: 160px; }
  .nav-item { font-size: var(--fs-14); padding: 0 8px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-right .btn { font-size: var(--fs-13); padding: 0 8px; }
  /* 更窄时：只留头像，隐掉用户名/角色文字（它们占 ~90px） */
  .user-chip .u-name, .user-chip .u-role { display: none; }
  .user-chip { gap: 6px; }
}

/* 开始使用清单（只在新系统/设置没做完时出现在看板顶部） */
.setup-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 10px; border-bottom: 1px solid var(--c-line-2);
}
.setup-row:last-child { border-bottom: none; }
.setup-row.done { opacity: .62; }
.setup-no {
  flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: var(--c-bg-4); color: var(--c-text-2);
  font-size: var(--fs-12); font-weight: 700;
}
.setup-row.done .setup-no { background: var(--c-ok-bg); color: var(--c-ok-fg); }
.setup-label { flex: 0 0 190px; font-weight: 600; font-size: var(--fs-14); }
.setup-why { flex: 1 1 260px; min-width: 0; }
@media (max-width: 1100px) {
  .setup-label { flex: 0 0 130px; }
  .setup-why { flex: 1 1 100%; }
}

/* ============================================================
   三条链泳道图
   ------------------------------------------------------------
   上=行政资源（留空）· 中=工序过程（逐道）· 下=采购物料齐备（逐单）
   每个框左下角是完成度 5/10、右下角是百分比
   颜色全部走设计令牌，所以深色/看板/浅色三套主题都自动对
   ============================================================ */
.sw-lane {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--c-line);
}
.sw-lane:last-of-type { border-bottom: none; }
.sw-lane-head {
  font-size: 13px;
  color: var(--c-text);
  padding-top: 4px;
  line-height: 1.5;
  /* 车间 2026-10-22：泳道头（标题+按钮）单独占一整行，否则被挤在 132px 的窄列里 */
  grid-column: 1 / -1;
}
/* 车间 2026-10-22：标题 + 按钮固定一行，提示文字单独一行 */
.sw-lane-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 32px;
}
.sw-lane-row > b { flex: none; }
.sw-lane-hint {
  display: block;
  width: 100%;
  clear: both;
  font-size: 11px;
  margin: 2px 0 6px;
}
.sw-lane-body {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  /* 车间 2026-10-19：块多了不要横向滚动条，**超出直接换行**（点「+ 加一块」也不会被挤到屏幕外） */
  flex-wrap: wrap;
  gap: 12px 20px;
  overflow-x: visible;
  padding: 4px 2px 10px;
}
.sw-box {
  flex: 0 0 auto;
  min-width: 148px;
  max-width: 196px;
  padding: 8px 10px 6px;
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-slate, var(--c-line));
  border-radius: var(--radius);
  background: var(--c-panel);
  cursor: pointer;
  transition: box-shadow .12s, transform .12s;
  user-select: none;
}
.sw-box:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.sw-box.sw-done { border-left-color: var(--c-ok-fg); }
.sw-box.sw-run { border-left-color: var(--c-warn-fg); }
.sw-box.sw-sel { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.sw-box-title {
  font-weight: 600;
  font-size: var(--fs-13, 13px);
  color: var(--c-text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sw-box-sub, .sw-box-extra {
  font-size: 11px;
  color: var(--c-text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sw-box-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding-top: 5px;
  border-top: 1px solid var(--c-line);
}
.sw-box-left {
  font-size: 12px;
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.sw-box-right {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.sw-empty {
  padding: 12px 14px;
  border: 1px dashed var(--c-line);
  border-radius: var(--radius);
  color: var(--c-text-3);
  font-size: 12px;
  line-height: 1.6;
  max-width: 460px;
}
.sw-edge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px 0;
  border-bottom: 1px dashed var(--c-line);
  font-size: 13px;
}
.sw-edge-row:last-child { border-bottom: none; }
.sw-edge-row .btn { margin-left: auto; }

@media (max-width: 820px) {
  .sw-lane { grid-template-columns: 1fr; }
  .sw-lane-head { padding-top: 0; }
  .sw-box { min-width: 132px; }
}

/* ============================================================
   工位终端
   ------------------------------------------------------------
   现场用：字要大、按钮要大（戴手套也能点）。
   颜色全部走设计令牌，三套主题自动适配。
   ============================================================ */
.tm-lookup { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.tm-input {
  font-family: Consolas, "Courier New", monospace;
  font-size: 26px;
  letter-spacing: 4px;
  padding: 10px 14px;
  min-width: 220px;
  border: 2px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-panel);
  color: var(--c-text);
}
.tm-input:focus { outline: none; border-color: var(--c-primary); }
select.tm-input, input.tm-input[type="number"] {
  font-family: inherit; font-size: 18px; letter-spacing: 0;
  min-width: 120px; text-transform: none;
}
.tm-btn { font-size: 18px; padding: 10px 22px; }
.tm-btn-big { font-size: 20px; padding: 14px 34px; }
.tm-hint { color: var(--c-text-3); font-size: 12px; margin-top: 6px; }
.tm-cam {
  margin-top: 10px; padding: 10px 12px;
  border: 1px dashed var(--c-line); border-radius: var(--radius);
  color: var(--c-text-3); font-size: 12px; line-height: 1.7;
}
.tm-card {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--c-bg-2, var(--c-panel));
  border-left: 4px solid var(--c-primary);
  border-radius: var(--radius);
}
.tm-m {
  font-family: Consolas, "Courier New", monospace;
  font-size: 30px; font-weight: 700; letter-spacing: 5px; color: var(--c-text);
}
.tm-prod { font-size: 18px; font-weight: 600; color: var(--c-text); }
.tm-meta { font-size: 13px; color: var(--c-text-3); }
.tm-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.tm-step {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; text-align: left;
  border: 2px solid var(--c-line); border-radius: var(--radius);
  background: var(--c-panel); color: var(--c-text);
  cursor: pointer; font-family: inherit;
}
.tm-step:hover { border-color: var(--c-primary); }
.tm-step.on { border-color: var(--c-primary); background: var(--c-sel, var(--c-bg-2)); }
.tm-step-seq { font-size: 11px; color: var(--c-text-3); }
.tm-step-name { font-size: 17px; font-weight: 600; }
.tm-step-meta { font-size: 11px; color: var(--c-text-3); }
.tm-step-num { font-size: 13px; color: var(--c-text-3); font-variant-numeric: tabular-nums; }
.tm-form { border-top: 1px solid var(--c-line); padding-top: 12px; }
.tm-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tm-row > label { font-size: 13px; color: var(--c-text-3); min-width: 84px; }
.tm-bad {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--c-err-bg); color: var(--c-err-fg);
  border: 1px solid var(--c-err-line); font-size: 15px; line-height: 1.6;
}
.tm-ok {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--c-ok-bg); color: var(--c-ok-fg);
  border: 1px solid var(--c-ok-line); font-size: 15px;
}
@media (max-width: 820px) {
  .tm-input { font-size: 22px; min-width: 170px; }
  .tm-m { font-size: 24px; }
  .tm-steps { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   优先级徽章（我的任务 / 各个看板共用）
   ------------------------------------------------------------
   1~2 特急、3 急、4~6 普通、7~9 低 —— 数字越小越急。
   颜色走语义令牌，三套主题自动适配。
   ============================================================ */
.prio {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.prio-urgent {
  background: var(--c-err-bg); color: var(--c-err-fg);
  border-color: var(--c-err-line);
}
.prio-high {
  background: var(--c-warn-bg); color: var(--c-warn-fg);
  border-color: var(--c-warn-line);
}
.prio-normal {
  background: var(--c-bg-2); color: var(--c-text-3);
  border-color: var(--c-line);
}
.prio-low {
  background: var(--c-bg-2); color: var(--c-text-3);
  border-color: var(--c-line);
  opacity: .75;
}

/* ============================================================
   真 logo（O-K）
   ------------------------------------------------------------
   原图是深色底（#464646）+ 金属质感，所以放进同色瓷片里最自然：
   深色主题下看不出边界，浅色主题下是一块"品牌牌"，都不突兀。
   ============================================================ */
.mark-img {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
  /* 新 logo 是白底深色字：瓷片用白底，在深色侧边栏上像一枚"品牌牌" */
  background: #fff;
  object-fit: contain;
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}
.login-logo {
  display: block;
  width: 168px;
  max-width: 62%;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 14px;
}
@media (max-width: 820px) {
  .login-logo { width: 132px; }
  .mark-img { width: 34px; height: 34px; flex-basis: 34px; }
}

/* 行政资源框的勾选标记（右上角的 ✓ / ○） */
.sw-check {
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-3);
  line-height: 1;
}
.sw-box.sw-done .sw-check { color: var(--c-ok-fg); }
.sw-box { position: relative; }

/* 我的任务里的图纸缩略图（报告说的"来图加工容易看错件"）
   64×40，正好对标报告里"约 160×100 像素"在 DPI 缩放下的观感 */
.mt-thumb {
  display: inline-block;
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--c-line);
  background: var(--c-bg-2);
  margin-right: 8px;
  vertical-align: middle;
}
.mt-thumb:hover { border-color: var(--c-primary); }

/* ============================================================
   设置页的「品牌」卡片（品牌名 + Logo 可配）
   ============================================================ */
.brand-set {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.brand-set-preview {
  flex: 0 0 200px;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
}
.brand-set-preview img {
  max-width: 100%;
  max-height: 92px;
  object-fit: contain;
}
.brand-set-info { flex: 1 1 260px; min-width: 240px; }
.brand-set-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

/* 品牌名可能比较长（"某某公司管理系统"），最多两行、超出打点，别把侧边栏顶变形 */
.sidebar-brand .t1 {
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 岗位权限矩阵：格子多，尽量紧凑 */
.rp-table { width: 100%; }
.rp-table th, .rp-table td { padding: 4px 8px; font-size: 13px; }
.rp-table td code { font-size: 12px; color: var(--c-text-2); }
.rp-table input[type="checkbox"] { width: 15px; height: 15px; }

/* ---------- 两级菜单（父模块 + 子模块）---------- */
.nav-group { display: block; }
.nav-parent { position: relative; }
.nav-caret {
  margin-left: auto; padding: 0 4px; font-size: 11px; color: var(--c-text-3);
  transition: transform .15s ease; display: inline-block; line-height: 1;
}
.nav-caret.open { transform: rotate(90deg); }
.nav-item.ancestor { background: rgba(255,255,255,.06); }
.nav-kids { padding: 2px 0 4px 0; }
.nav-child {
  padding-left: 40px !important; font-size: 13px !important;
  color: var(--c-text-3) !important; min-height: 32px !important;
}
.nav-child .nav-label::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .45; margin-right: 8px; vertical-align: middle;
}
.nav-child.active { color: var(--c-text-1) !important; background: var(--c-brand-weak, rgba(37,99,235,.16)) !important; }
.nav-child.active .nav-label::before { opacity: 1; background: var(--c-brand, #2563eb); }

/* 泳道定位：从子菜单进来时，那条链高亮、其它淡一点 */
.sw-lane.lane-focus { box-shadow: 0 0 0 2px var(--c-brand, #2563eb) inset; border-radius: 8px; }
.sw-lane.lane-dim { opacity: .45; }
/* ---------- 订单录入（按车间草图：顶部按钮 + 13 列明细表）---------- */
.so-bar { display: flex; align-items: center; gap: 8px; padding: 8px 2px 6px; }
.so-bar-gap { flex: 1; }
.so-title { font-size: 15px; font-weight: 600; padding: 4px 2px 8px; color: var(--c-text-1); }
.so-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: 8px; }
.so-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.so-table th, .so-table td { border-bottom: 1px solid var(--c-border); padding: 4px 4px; text-align: left; }
.so-table thead th {
  background: var(--c-bg-2, #f1f5f9); font-weight: 600; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.so-table td input, .so-table td select { width: 100%; min-width: 0; padding: 4px 6px; }
.so-table td.so-seq, .so-table th.so-seq { width: 34px; text-align: center; color: var(--c-text-3); }
.so-table td.so-act { width: 40px; text-align: center; }
.so-msg { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px;
  background: var(--c-ok-bg, #ecfdf5); color: var(--c-ok-fg, #065f46); max-height: 180px; overflow: auto; }
.so-msg.err { background: var(--c-err-bg, #fef2f2); color: var(--c-err-fg, #991b1b); }
/* ---------- 任务拆分：待拆分列表 ---------- */
.sw-pending td { vertical-align: top; }
.sw-pending tr.sw-row-active td { background: rgba(37,99,235,.06); }
.pbar { height: 8px; border-radius: 999px; background: var(--c-bg-2, #e2e8f0); overflow: hidden; margin-bottom: 3px; }
.pbar > i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #22c55e); border-radius: 999px; }
.mno { font-family: Consolas, monospace; letter-spacing: 1px; font-weight: 600; }

/* ---------- 产品技术信息梳理：可拖拽的框 ---------- */
.sw-box[data-drag="1"] { cursor: grab; }
/* 拖动中显示抓取手势；原来 cursor:move 在 Windows 上是四向十字箭头，看着吓人 */
.sw-box[data-drag="1"]:active { cursor: grabbing; }
.sw-drag {
  position: absolute; top: 4px; left: 6px; font-size: 11px; line-height: 1;
  color: var(--c-text-3); letter-spacing: -2px; opacity: .55;
}
.sw-box[data-drag="1"] .sw-box-title { padding-left: 14px; }
.sw-box.sw-dragging { opacity: .45; }
.sw-box.sw-drop { outline: 2px dashed var(--c-brand, #2563eb); outline-offset: 2px; }


/* 任务拆分：产品卡片（缩略图 / 名称 / 图号 / 数量） */
.sw-prod {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--c-card); border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-primary); border-radius: 10px;
}
.sw-prod-img {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--c-line); background: var(--c-bg-2); flex: none;
}
.sw-prod-ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--c-text-3); text-align: center;
  padding: 4px; word-break: break-all; line-height: 1.2;
}
.sw-prod-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.sw-prod-meta { font-size: 13px; color: var(--c-text-2); }
.sw-prod-meta b { color: var(--c-text); font-weight: 600; }
.sw-prod-k { color: var(--c-text-3); margin: 0 4px 0 12px; }
.sw-prod-k:first-child { margin-left: 0; }

/* 任务块的执行步骤编辑器 */
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tb-grid3 { grid-template-columns: 1fr 1fr 1fr; }
.tb-prog { padding: 7px 10px; border: 1px dashed var(--c-line);
  border-radius: 6px; font-size: 13px; color: var(--c-text-2); }
.tb-steps-head { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.tb-steps-head .btn { margin-left: auto; }
.tb-step { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tb-step-no { width: 20px; text-align: center; color: var(--c-text-3); font-size: 12px; flex: none; }
.tb-step-title { flex: 1 1 auto; min-width: 120px; }
.tb-step-emp { width: 150px; flex: none; }
.tb-step-done { flex: none; font-size: 12px; }
.tb-step-del { flex: none; }
textarea.tb-detail { width: 100%; resize: vertical; font-family: inherit; }

.sw-prod-thumb { display: block; cursor: pointer; flex: none; }
.sw-prod-thumb:hover .sw-prod-img { border-color: var(--c-primary); }

/* ---------- 右键菜单（审批块用） ---------- */
.ctx-menu {
  position: fixed; z-index: 9999; min-width: 150px; padding: 4px;
  background: #fff; border: 1px solid rgba(15,23,42,.12); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.16);
}
.ctx-item {
  padding: 7px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
  color: var(--c-text, #0f172a); white-space: nowrap;
}
.ctx-item:hover { background: rgba(37,99,235,.08); color: #2563eb; }

/* ---------- 采购块详情表格 ---------- */
.ptd-table td { padding: 4px 6px; vertical-align: middle; }
.ptd-table .input { width: 100%; min-width: 60px; }
.ptd-table tr.ptd-add td { background: rgba(37,99,235,.04); }

/* ---------- 采购块详情：头部（任务块 / 任务类型 / 增加行） ---------- */
.ptd-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 2px 10px; border-bottom: 1px solid var(--c-line); margin-bottom: 8px;
}
.ptd-head b { font-size: 14px; }
.ptd-table tr.ptd-newrow td { background: rgba(37,99,235,.05); }

/* ---------- 采购块三阶段进度 ---------- */
.pt-stage { display: flex; gap: 3px; margin: 4px 0 2px; }
.pt-stage i {
  flex: 1; font-style: normal; font-size: 10px; text-align: center;
  padding: 2px 0; border-radius: 4px; background: var(--c-bg-2, #eef2f7);
  color: var(--c-text-3, #94a3b8); white-space: nowrap;
}
.pt-stage i.on { background: rgba(37,99,235,.14); color: #2563eb; font-weight: 600; }

/* ---------- 工序块：只显示工序号 + 工序名称 ---------- */
.sw-box-compact {
  min-width: 132px; max-width: 220px;
  padding: 10px 12px; text-align: center;
}
.sw-box-compact .sw-box-title { white-space: normal; line-height: 1.3; }

/* ---------- 工序修改：左右对照 ---------- */
.rv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rv-sec { font-size: 13px; margin: 6px 0; }
.rv-table .input { width: 100%; min-width: 40px; }
.rv-table tr.rv-removed td { background: rgba(220,38,38,.06); color: #991b1b; }
@media (max-width: 1000px) { .rv-grid { grid-template-columns: 1fr; } }

/* 数字列的表头也要右对齐 —— 否则「任务单 / 计划数 / 完工数」的标题
   和下面的数字对不齐（车间 2026-10-21 要求）。
   table.data th 的 text-align:left 特异性比 .num 高，必须单独覆盖。 */
table.data th.num { text-align: right; }

/* ---------- 生产星环（iframe 模块） ---------- */
.nebula-frame {
  position: relative;
  width: 100%;
  height: calc(100vh - 96px);
  min-height: 480px;
  border: 1px solid rgba(56,189,248,.18);
  border-radius: 14px;
  overflow: hidden;
  background: #03060c;
  box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.02);
}
.nebula-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 900px) {
  .nebula-frame { height: calc(100vh - 120px); min-height: 420px; border-radius: 10px; }
}

/* 待拆分列表：鼠标移到哪一行，整行变色 + 手型，方便确认点哪张（车间 2026-10-22） */
.sw-pend-row { cursor: pointer; transition: background .12s; }
.sw-pend-row:hover { background: #eef4ff !important; }
.sw-pend-row:hover td { background: transparent; }

/* 待拆分列表：固定列宽，表头与内容同一套宽度（车间 2026-10-22 反馈对不齐） */
table.sw-pending { width: 100%; table-layout: fixed; }
table.sw-pending th, table.sw-pending td {
  padding: 8px 10px; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
table.sw-pending th { text-align: left; font-weight: 600; }
table.sw-pending th:nth-child(1), table.sw-pending td:nth-child(1) { width: 15%; }
table.sw-pending th:nth-child(2), table.sw-pending td:nth-child(2) { width: 20%; }
table.sw-pending th:nth-child(3), table.sw-pending td:nth-child(3) { width: 8%;  text-align: right; }
table.sw-pending th:nth-child(4), table.sw-pending td:nth-child(4) { width: 11%; }
table.sw-pending th:nth-child(5), table.sw-pending td:nth-child(5) { width: 15%; }
table.sw-pending th:nth-child(6), table.sw-pending td:nth-child(6) { width: 21%; }
table.sw-pending th:nth-child(7), table.sw-pending td:nth-child(7) { width: 10%; text-align: right; }
table.sw-pending td div.muted { white-space: normal; }

/* 工艺变更弹窗里的对齐表：固定列宽，表头与内容对齐 */
#oc-body table { width: 100%; table-layout: fixed; }
#oc-body th, #oc-body td { padding: 7px 8px; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis; }
#oc-body table th:nth-child(1), #oc-body table td:nth-child(1) { width: 7%;  text-align: right; }
#oc-body table th:nth-child(2), #oc-body table td:nth-child(2) { width: 17%; }
#oc-body table th:nth-child(3), #oc-body table td:nth-child(3) { width: 11%; }
#oc-body table th:nth-child(4), #oc-body table td:nth-child(4) { width: 7%;  text-align: right; }
#oc-body table th:nth-child(5), #oc-body table td:nth-child(5) { width: 14%; }
#oc-body table th:nth-child(6), #oc-body table td:nth-child(6) { width: 7%;  text-align: right; }
#oc-body table th:nth-child(7), #oc-body table td:nth-child(7) { width: 37%; white-space: normal; }
/* 旧工艺表 5 列 */
#oc-body table:last-of-type th:nth-child(1), #oc-body table:last-of-type td:nth-child(1) { width: 20%; text-align: left; }
#oc-body table:last-of-type th:nth-child(2), #oc-body table:last-of-type td:nth-child(2) { width: 10%; }
#oc-body table:last-of-type th:nth-child(3), #oc-body table:last-of-type td:nth-child(3) { width: 20%; }
#oc-body table:last-of-type th:nth-child(4), #oc-body table:last-of-type td:nth-child(4) { width: 10%; }
#oc-body table:last-of-type th:nth-child(5), #oc-body table:last-of-type td:nth-child(5) { width: 40%; }
#oc-body .oc-orphan { width: 100%; }

/* 工艺变更：三区布局（车间 2026-10-22） */
.oc-wrap { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.oc-col { border: 1px solid var(--c-line); border-radius: 10px; padding: 10px; min-height: 320px;
  background: #fcfcfd; display: flex; flex-direction: column; }
.oc-head { font-weight: 600; margin-bottom: 8px; }
.oc-head .muted { font-weight: 400; }
.oc-list { margin-top: 8px; overflow: auto; max-height: 300px; flex: 1; }
.oc-item { padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.oc-item:hover { background: #eef4ff; }
.oc-item.on { background: #e6efff; border-color: #b9d0ff; }
.oc-item.dim { opacity: .5; }
.oc-item .mono { font-family: ui-monospace, Consolas, monospace; color: #555; }
.oc-act { font-size: 13px; }
.oc-radio { display: block; margin: 6px 0; cursor: pointer; }

/* 待拆分列表：固定高度 + 滚动条，表头固定（车间 2026-10-22） */
.sw-pend-scroll { max-height: 430px; overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--c-line); border-radius: 8px; }
.sw-pend-scroll table.sw-pending { margin: 0; }
.sw-pend-scroll thead th { position: sticky; top: 0; z-index: 2;
  background: #f5f7fb; box-shadow: 0 1px 0 var(--c-line); }

/* 产品卡片右侧的「保存拆分进度」（车间 2026-10-22） */
.sw-prod { display: flex; align-items: center; gap: 14px; }
.sw-prod-act { margin-left: auto; }

/* 员工工号即时搜索下拉（车间 2026-10-22） */
.emp-pop { position: absolute; z-index: 50; left: 0; right: 0; top: 100%;
  margin-top: 2px; background: #fff; border: 1px solid var(--c-line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.10); max-height: 220px; overflow: auto; }
.emp-pop-item { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f2f4f8; }
.emp-pop-item:last-child { border-bottom: 0; }
.emp-pop-item:hover { background: #eef4ff; }
.emp-pop-code { font-family: ui-monospace, Consolas, monospace; color: #666; }
.emp-pop-empty { padding: 8px 10px; color: #999; font-size: 13px; }

/* 登录页定位副标题（2026-10-23） */
.login-sub {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--c-text-2, #64748b);
  letter-spacing: .2px;
}

/* ============================================================
   生产看板 · 四个汇总完成度看板（2026-10-23）
   大字号、一行一个任务、列表自动滚动
   ============================================================ */
.bd-wrap { display: flex; flex-direction: column; gap: 12px; }
.bd-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.bd-kpi { background: #fff; border: 1px solid var(--c-line); border-radius: 12px;
          padding: 14px 16px; }
.bd-kpi .k { font-size: 13px; color: var(--c-text-2, #64748b); }
.bd-kpi .v { font-size: 30px; font-weight: 800; line-height: 1.2; margin-top: 4px;
             font-variant-numeric: tabular-nums; }
.bd-kpi.ok .v { color: #1a7f37; }
.bd-kpi.doing .v { color: #1d4ed8; }
.bd-kpi.late .v { color: #d92d20; }
.bd-kpi.pct .bar { margin-top: 8px; height: 8px; border-radius: 6px; background: #eef2f7;
                   overflow: hidden; }
.bd-kpi.pct .bar i { display: block; height: 100%; background: linear-gradient(90deg,#1d4ed8,#22c55e); }

.bd-list-head, .bd-row {
  display: grid;
  grid-template-columns: 48px 200px minmax(220px, 1fr) 120px 108px 200px 96px;
  align-items: center; gap: 8px;
}
.bd-list-head { font-size: 12px; color: var(--c-text-2, #64748b); padding: 0 14px 6px;
                font-weight: 700; letter-spacing: .3px; }
.bd-scroll { max-height: calc(100vh - 360px); min-height: 320px; overflow: hidden;
             background: #fff; border: 1px solid var(--c-line); border-radius: 12px;
             padding: 6px 0; }
.bd-row { padding: 12px 14px; border-bottom: 1px dashed #eef1f6; font-size: 15px; }
.bd-row:last-child { border-bottom: 0; }
.bd-row .c-idx { color: #94a3b8; font-variant-numeric: tabular-nums; text-align: right; }
.bd-row .c-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-row .c-name { overflow: hidden; }
.bd-row .c-name i { display: block; font-style: normal; font-size: 12px; color: #7a879c;
                    margin-top: 2px; }
.bd-row .c-owner { font-weight: 700; color: #16233a; }
.bd-row .c-due { font-variant-numeric: tabular-nums; color: #475569; }
.bd-row .c-bar { position: relative; height: 18px; border-radius: 9px; background: #eef2f7;
                 overflow: hidden; }
.bd-row .c-bar i { display: block; height: 100%; background: #1d4ed8; }
.bd-row .c-bar b { position: absolute; inset: 0; display: flex; align-items: center;
                   justify-content: center; font-size: 11px; color: #16233a; }
.bd-row .c-st { font-size: 13px; text-align: center; border-radius: 8px; padding: 4px 0;
                background: #f1f5f9; color: #475569; }
.bd-row.late { background: #fff7f6; }
.bd-row.late .c-bar i { background: #d92d20; }
.bd-row.late .c-st { background: #fee4e2; color: #b42318; }
.bd-row.ok .c-bar i { background: #1a7f37; }
.bd-row.ok .c-st { background: #dcfce7; color: #166534; }
.bd-row.doing .c-bar i { background: #1d4ed8; }
.bd-foot { font-size: 12px; color: var(--c-text-2, #64748b); }

@media (max-width: 1100px) {
  .bd-list-head, .bd-row { grid-template-columns: 36px 150px minmax(140px,1fr) 90px 88px 140px 72px; }
  .bd-stats { grid-template-columns: repeat(2, 1fr); }
}

/* 任务拆分页顶部说明（2026-10-24） */
.sw-hint { margin: 8px 0 12px; padding: 12px 14px; border-radius: 10px;
  background: #f4f8ff; border: 1px solid #cddcf7; }
.sw-hint-t { font-weight: 700; color: #1d4ed8; margin-bottom: 6px; font-size: 14px; }
.sw-hint-b { font-size: 13px; color: #334155; line-height: 1.9; }
.sw-hint-b b { color: #16233a; }
.sw-hint-k { display: block; margin-top: 6px; color: #b45309; font-weight: 600; }
.sw-hint-ok { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px;
  background: #dcfce7; color: #166534; font-size: 12px; font-weight: 700; }

/* 任务拆分页顶部状态条（2026-10-24） */
.sw-splitbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 0 12px; padding: 8px 12px; border-radius: 10px;
  background: #eef4ff; border: 1px solid #cddcf7; }
.sw-splitbar-t { font-weight: 700; color: #1d4ed8; }
.sw-splitbar-no { font-family: ui-monospace, Consolas, monospace; font-size: 15px; color: #16233a; }
.sw-splitbar-act { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sw-splitbar-in { width: 190px; height: 30px; padding: 0 8px; border-radius: 6px;
  border: 1px solid #c9d6ea; font-size: 13px; }

/* 弹窗可拖动（2026-10-24） */
.modal-head, .drawer-head { cursor: move; user-select: none; }
.modal-head h3, .drawer-head h3 { cursor: move; }

/* 采购申请单：人员单元格（部门 → 人员 两连下拉） */
.pt-person-td { min-width: 104px; }
.pt-person-td .pt-dept, .pt-person-td .pt-person {
  width: 100%; margin-bottom: 2px; font-size: 12px; padding: 2px 4px; height: 26px;
}
.pt-person-td .pt-person { margin-bottom: 0; }

/* 我的任务 · 派给我的任务块（2026-10-25） */
#mt-blocks { margin-bottom: 14px; }
#mt-blocks .table td { vertical-align: middle; }
#mt-blocks .badge { font-weight: 600; }

/* MOM 四项指标：趋势小柱（2026-10-25） */
.kpi-trend-grid { display: flex; flex-direction: column; gap: 10px; }
.kpi-trend-row { display: flex; align-items: center; gap: 12px; }
.kpi-trend-name { width: 90px; font-size: 13px; color: #475569; flex: none; }
.kpi-trend-bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; flex: 1; }
.kpi-bar { flex: 1; height: 100%; background: #f1f5f9; border-radius: 3px;
  display: flex; align-items: flex-end; min-width: 6px; }
.kpi-bar i { display: block; width: 100%; border-radius: 3px; min-height: 2px; }

/* ============================================================
   全站表格行悬停高亮（2026-10-25 车间要求：鼠标移到哪一行，哪一行就亮）
   ------------------------------------------------------------
   为什么不只改 table.data：全站有多种表格（table.data / class="table" /
   弹窗里的明细表 / 泳道表 / 统计小表…）。这里统一用 td 背景来做，
   避免被 sticky 首列、斑马纹、行内联样式挡住。
   优先级：选中行(row-active) > 悬停 > 斑马纹
   ============================================================ */
table tbody tr > td {
  transition: background-color .12s ease;
}
table tbody tr:hover > td {
  background: var(--c-hover, #eaf1ff);
}
table tbody tr.row-active > td,
table tbody tr.row-active:hover > td {
  background: var(--c-sel-2, #e6efff);
}
/* 深色主题下悬停稍微亮一点，别和底色糊在一起 */
[data-theme="a"] table tbody tr:hover > td,
[data-theme="b"] table tbody tr:hover > td {
  background: var(--c-bg-3, #1f2731);
}
/* 弹窗/卡片里的明细表也一起生效（有的写了 table-layout:fixed，不影响） */
.modal table tbody tr:hover > td,
.card table tbody tr:hover > td,
.drawer table tbody tr:hover > td {
  background: var(--c-hover, #eaf1ff);
}

/* ============================================================
   表格列宽与留白统一（2026-10-26 车间反馈：列间距太散、宽窄不均）
   ============================================================ */
table.data th,
table.data td {
  padding: 10px 14px;            /* 原来 12px，左右各加 2px，看起来不挤 */
}
table.data th:first-child,
table.data td:first-child { padding-left: 18px; }
table.data th:last-child,
table.data td:last-child { padding-right: 18px; }
table.data td.actions,
table.data th.actions {
  width: 1%;                      /* 操作列贴右边，不再被拉宽 */
  white-space: nowrap;
}
table.data td.num,
table.data th.num { font-variant-numeric: tabular-nums; }
/* 长文本列优先吃掉剩余宽度，短列保持窄 */
table.data td { vertical-align: middle; }

/* ============================================================
   工厂建模等"主数据表"：紧凑列宽（2026-10-26 车间反馈：列间距太散）
   ------------------------------------------------------------
   不再强行把表格拉满整屏 —— 列宽由内容决定，短列就窄、长文本列才宽；
   列特别多（设备 15 列）时在卡片内横向滚动，而不是把每列都撑成 200px。
   ============================================================ */
table.data.data-master {
  /* 表格宽度跟着内容走：实测只有 width:max-content 能让 <table> 收缩到内容宽度
     （fit-content / inline-table 在 Chromium 里对 table 无效，会被拉满整屏）。
     列多时用 max-width:100% + 容器横向滚动，不会把每列都撑宽。 */
  width: max-content;
  max-width: 100%;
  min-width: 0;
}
table.data.data-master th,
table.data.data-master td {
  white-space: nowrap;
}
table.data.data-master td {
  max-width: 420px;               /* 超长文本不再无限撑宽 */
  overflow: hidden;
  text-overflow: ellipsis;
}
table.data.data-master td.actions,
table.data.data-master th.actions {
  width: 1%;
  overflow: visible;
}

/* ============================================================
   表格宽度策略（2026-10-26 车间反馈：各列之间空隙太大、宽窄不均）
   ------------------------------------------------------------
   默认：列宽 = 内容宽（max-content），短列短、长列长，不再把每列撑成 200px；
   下面这些"编辑器/排班"类表格必须撑满，显式保留 100%。
   ============================================================ */
table.so-table,
table.sp-table,
table.sw-pending,
table.steps-table,
table.rp-table,
table.ptd-table,
table.rv-table,
table.sc-table,
table.so-table { width: 100%; }

/* MOM 运营等手写表格（class="table"）同样按内容收缩 */
table.table {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
}
table.table th,
table.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-line-2);
  text-align: left;
  white-space: nowrap;
}
table.table th {
  background: var(--c-bg-2);
  color: var(--c-text-2);
  font-weight: 600;
  border-bottom: 1px solid var(--c-line);
}
table.table th.num,
table.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table th.actions,
table.table td.actions { width: 1%; white-space: nowrap; }

/* ============================================================
   表头吸顶 + 列筛选（2026-10-27 车间要求）
   ------------------------------------------------------------
   ① 标题行不滚动：.table-wrap 变成内滚动容器，thead 吸顶
   ② 标题行加筛选：表头下面一行输入框，按列即时过滤（顶栏「筛选」开关）
   ============================================================ */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 250px);   /* 表头固定、表体在框里滚 */
  border-radius: var(--radius-sm);
  scrollbar-gutter: stable;          /* 滚不滚都不跳宽度 */
  overscroll-behavior: contain;      /* 滚到底不带着整页跳 */
}
/* 弹窗/抽屉里的表格：别用整屏高度，否则对话框被顶出去 */
.modal-body .table-wrap,
.drawer-body .table-wrap { max-height: 52vh; }
/* 看板/泳道里的表格本来就是小容器，别再加内滚动 */
.board-col-body .table-wrap,
.sw-pend-scroll .table-wrap { max-height: none; overflow: visible; }

table.data thead th,
table.table thead th,
table.data-master thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--c-bg-2);
  box-shadow: inset 0 -1px 0 var(--c-line), inset 0 1px 0 var(--c-bg-2);
}
/* 吸顶时（页面/表格滚过一点点）加个投影，层次更清楚 */
table.data thead th.is-stuck,
table.table thead th.is-stuck {
  box-shadow: 0 2px 8px rgba(15, 23, 42, .10), inset 0 -1px 0 var(--c-line);
}

/* ---- 筛选行 ---- */
table.data tr.filter-row > th,
table.table tr.filter-row > th {
  position: sticky;
  top: 0;                       /* 实际 top 由 JS 设为表头高度 */
  z-index: 2;
  padding: 4px 6px;
  background: var(--c-bg-3);
  border-bottom: 1px solid var(--c-line);
}
tr.filter-row input.th-filter {
  width: 100%;
  min-width: 48px;
  box-sizing: border-box;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: var(--c-bg);
  color: var(--c-text);
}
tr.filter-row input.th-filter:focus {
  outline: none;
  border-color: var(--c-primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}
/* 默认隐藏筛选行；html.filters-on 时显示 */
table.data tr.filter-row,
table.table tr.filter-row { display: none; }
html.filters-on table.data tr.filter-row,
html.filters-on table.table tr.filter-row { display: table-row; }

/* 顶栏「筛选」按钮激活态 */
.btn.btn-on {
  background: var(--c-primary, #2563eb);
  border-color: var(--c-primary, #2563eb);
  color: #fff;
}
/* 空结果提示（过滤后没匹配） */
tr.filter-empty > td {
  text-align: center;
  color: var(--c-text-2);
  padding: 18px 10px;
}

/* ============================================================
   工厂建模表格：范围多选 / 右键菜单 / 底部浮条（2026-10-27）
   ============================================================ */
table.data tbody tr.row-selected > td,
table.table tbody tr.row-selected > td {
  background: var(--c-sel, #dbeafe) !important;
}
table.data tbody tr.row-selected:hover > td,
table.table tbody tr.row-selected:hover > td {
  background: var(--c-sel-2, #e6efff) !important;
}
/* 底部浮动操作条 */
.sel-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .18);
  font-size: 13px;
}
.sel-bar #ms-sel-count { font-weight: 600; margin-right: 4px; }
/* 右键菜单（本模块专用 id，和聊天里的 .ctx-menu 分开写样式） */
#ms-ctx-menu { min-width: 186px; padding: 6px; }
#ms-ctx-menu .ctx-head {
  padding: 4px 8px 6px;
  color: var(--c-text-2);
  font-size: 12px;
}
#ms-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--c-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
#ms-ctx-menu button:hover { background: var(--c-hover, #eaf1ff); }
#ms-ctx-menu button.danger { color: #dc2626; }
#ms-ctx-menu button.danger:hover { background: #fee2e2; }
#ms-ctx-menu .ctx-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--c-line-2, #e6ebf2);
}
/* 深色主题下右键菜单底色（沿用 --c-bg，已随主题变） */
[data-theme="a"] #ms-ctx-menu { background: var(--c-bg); }

/* 表格行不要被选中文字（Shift+单击做范围选择时会误选文字） */
#ms-body tbody tr,
#ms-body tbody td,
#ms-body tbody th {
  -webkit-user-select: none;
  user-select: none;
}
#layer-root table.data tbody tr,
#layer-root table.data tbody td {
  -webkit-user-select: none;
  user-select: none;
}

/* 弹窗/抽屉里的表格：不要最小宽度，撑满容器（否则列会被挤出去、出横向滚动条） */
.modal-body table.data,
.modal-body table.table,
.drawer-body table.data,
.drawer-body table.table {
  min-width: 0 !important;
  width: 100%;
}
.modal-body table.data th.actions,
.modal-body table.data td.actions { width: 1%; white-space: nowrap; }
