/* ==========================================================================
   生产管理 MES · 设计系统
   --------------------------------------------------------------------------
   设计取向：车间优先（Shopfloor first）
   - 密度优先：34px 行高，一屏看得到 20 张工单，而不是 8 张
   - 数字等宽：数量、工时、达成率必须能对齐比较
   - 状态有语义色：生产中=青，待开工=藏青，暂停=琥珀，逾期=红
   - 配色与壳层 / CRM 同源：纸白底 + 墨色字 + 藏青主色
   ========================================================================== */

:root {
  /* 表面（与壳层 / CRM 同源：纸白底，不用冷灰） */
  --gy-bg: #f8f8f7;
  --gy-bg-deep: #f2f2f0;
  --gy-surface: #ffffff;
  --gy-surface-2: #fbfbfa;
  --gy-surface-3: #f4f4f2;

  /* 文字（墨色系） */
  --gy-ink: #1b1b1f;
  --gy-ink-2: #3d3d44;
  --gy-ink-3: #5f5f68;
  --gy-muted: #8b8b93;

  /* 线 */
  --gy-line: #e8e8e5;
  --gy-line-strong: #d9d9d5;

  /* 主色与信号色（藏青主色，与 CRM 同调） */
  --gy-brand: #2f4a75;
  --gy-brand-2: #24395c;
  --gy-brand-soft: #eef1f7;
  --gy-cyan: #256a7a;
  --gy-cyan-soft: #edf4f6;
  --gy-green: #2c6b45;
  --gy-green-soft: #ecf5ef;
  --gy-amber: #96631a;
  --gy-amber-soft: #fbf3e4;
  --gy-red: #a63a2b;
  --gy-red-soft: #fbeeeb;
  --gy-purple: #5a4680;
  --gy-purple-soft: #f2eff8;
  --gy-gray: #52565e;
  --gy-gray-soft: #f1f1ef;

  /* 形状与节奏 */
  --gy-r-xs: 4px;
  --gy-r-sm: 8px;
  --gy-r-md: 12px;
  --gy-r-lg: 16px;
  --gy-shadow-sm: 0 1px 2px rgba(24, 24, 27, .04);
  --gy-shadow-md: 0 8px 24px -14px rgba(24, 24, 27, .18), 0 2px 6px rgba(24, 24, 27, .04);
  --gy-shadow-lg: 0 24px 60px -28px rgba(24, 24, 27, .3);

  /* 字体 */
  --gy-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --gy-mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html.mes-in-iframe body { background: var(--gy-bg); }

/* 在壳层 iframe 内：标题由壳层顶栏负责，页面只留操作按钮，避免「两层标题」 */
html.mes-in-iframe .mes-page { padding: 0 0 8px; max-width: none; }
html.mes-in-iframe .mes-head { margin-bottom: 10px; justify-content: flex-end; }
html.mes-in-iframe .mes-head-l { display: none; }
html.mes-in-iframe .mes-head-r .mes-btn { height: 32px; }

body.mes {
  margin: 0;
  background: var(--gy-bg);
  color: var(--gy-ink);
  font-family: var(--gy-font);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 页面骨架 ---------- */
.mes-page { padding: 14px 16px 22px; max-width: 1680px; margin: 0 auto; }
.mes-page.tight { padding: 10px 12px 14px; }

.mes-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 12px; flex-wrap: wrap;
}
.mes-head-l { min-width: 0; }
.mes-eyebrow {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gy-muted); font-weight: 700; margin-bottom: 3px;
}
.mes-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--gy-ink); }
.mes-sub { font-size: 12px; color: var(--gy-muted); margin-top: 3px; }
.mes-head-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.mes-card {
  background: var(--gy-surface);
  border: 1px solid var(--gy-line);
  border-radius: var(--gy-r-md);
  box-shadow: var(--gy-shadow-sm);
}
.mes-card + .mes-card { margin-top: 12px; }
.mes-card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--gy-line);
  min-height: 44px;
}
.mes-card-hd h3 { margin: 0; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.mes-card-hd h3 .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gy-brand); }
.mes-card-hd .tools { display: flex; align-items: center; gap: 6px; }
.mes-card-bd { padding: 14px; }
.mes-card-bd.flush { padding: 0; }

/* ---------- 按钮 ---------- */
.mes-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; padding: 0 12px; border-radius: var(--gy-r-sm);
  border: 1px solid var(--gy-line-strong); background: var(--gy-surface);
  color: var(--gy-ink-2); font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: all .14s ease;
}
.mes-btn:hover { border-color: var(--gy-brand); color: var(--gy-brand); background: var(--gy-brand-soft); }
.mes-btn:active { transform: translateY(1px); }
.mes-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.mes-btn-primary { background: var(--gy-brand); border-color: var(--gy-brand); color: #fff; }
.mes-btn-primary:hover { background: var(--gy-brand-2); border-color: var(--gy-brand-2); color: #fff; }
.mes-btn-danger { background: var(--gy-red); border-color: var(--gy-red); color: #fff; }
.mes-btn-danger:hover { background: #a92323; border-color: #a92323; color: #fff; }
.mes-btn-ghost { background: transparent; border-color: transparent; color: var(--gy-ink-3); }
.mes-btn-ghost:hover { background: var(--gy-surface-3); color: var(--gy-ink); }
.mes-btn-sm { height: 26px; padding: 0 9px; font-size: 11px; }
.mes-btn-lg { height: 36px; padding: 0 18px; font-size: 13px; }
.mes-btn-block { width: 100%; }
.mes-btn-group { display: inline-flex; }
.mes-btn-group .mes-btn { border-radius: 0; margin-left: -1px; }
.mes-btn-group .mes-btn:first-child { border-radius: var(--gy-r-sm) 0 0 var(--gy-r-sm); margin-left: 0; }
.mes-btn-group .mes-btn:last-child { border-radius: 0 var(--gy-r-sm) var(--gy-r-sm) 0; }

/* ---------- 控件 ---------- */
.mes-input, .mes-select, .mes-textarea {
  height: 30px; padding: 0 9px; border: 1px solid var(--gy-line-strong);
  border-radius: var(--gy-r-sm); background: var(--gy-surface); color: var(--gy-ink);
  font-size: 12px; font-family: inherit; outline: none; transition: border-color .14s, box-shadow .14s;
}
.mes-textarea { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.5; }
.mes-input:focus, .mes-select:focus, .mes-textarea:focus {
  border-color: var(--gy-brand); box-shadow: 0 0 0 3px rgba(11, 107, 203, .1);
}
.mes-input::placeholder, .mes-textarea::placeholder { color: #aab4c2; }
.mes-select { padding-right: 26px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238894a4' d='M6 8.5 1.8 4.3l.9-.9L6 6.7l3.3-3.3.9.9z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.mes-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mes-field > label { font-size: 11px; font-weight: 600; color: var(--gy-ink-3); }
.mes-field .req { color: var(--gy-red); }
.mes-hint { font-size: 11px; color: var(--gy-muted); }
.mes-invalid { border-color: var(--gy-red) !important; box-shadow: 0 0 0 3px rgba(198, 47, 47, .1) !important; }

/* ---------- 工具栏 ---------- */
.mes-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--gy-surface);
  border: 1px solid var(--gy-line); border-radius: var(--gy-r-md);
  box-shadow: var(--gy-shadow-sm); margin-bottom: 12px;
}
.mes-toolbar .sep { flex: 1; }
.mes-toolbar .lbl { font-size: 11px; color: var(--gy-muted); font-weight: 600; }

/* ---------- 状态徽标 ---------- */
.mes-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; border-radius: 11px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--gy-gray-soft); color: var(--gy-gray);
}
.mes-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.mes-pill.blue { background: var(--gy-brand-soft); color: var(--gy-brand); }
.mes-pill.cyan { background: var(--gy-cyan-soft); color: var(--gy-cyan); }
.mes-pill.green { background: var(--gy-green-soft); color: var(--gy-green); }
.mes-pill.orange { background: var(--gy-amber-soft); color: var(--gy-amber); }
.mes-pill.red { background: var(--gy-red-soft); color: var(--gy-red); }
.mes-pill.purple { background: var(--gy-purple-soft); color: var(--gy-purple); }
.mes-pill.gray { background: var(--gy-gray-soft); color: var(--gy-gray); }
.mes-pill.plain::before { display: none; }

.mes-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--gy-r-sm); background: var(--gy-surface-3);
  font-size: 11px; color: var(--gy-ink-3); border: 1px solid transparent;
}
.mes-chip b { font-family: var(--gy-mono); font-weight: 600; color: var(--gy-ink); }
.mes-chip.clickable { cursor: pointer; }
.mes-chip.clickable:hover { border-color: var(--gy-brand); color: var(--gy-brand); background: var(--gy-brand-soft); }

/* ---------- KPI ---------- */
.mes-kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.mes-kpi {
  position: relative; background: var(--gy-surface); border: 1px solid var(--gy-line);
  border-radius: var(--gy-r-md); padding: 11px 13px 10px; overflow: hidden;
  box-shadow: var(--gy-shadow-sm); transition: border-color .15s, transform .15s;
  cursor: default;
}
.mes-kpi.link { cursor: pointer; }
.mes-kpi.link:hover { border-color: var(--gy-brand); transform: translateY(-1px); box-shadow: var(--gy-shadow-md); }
.mes-kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gy-brand); opacity: .85;
}
.mes-kpi.k-cyan::after { background: var(--gy-cyan); }
.mes-kpi.k-green::after { background: var(--gy-green); }
.mes-kpi.k-amber::after { background: var(--gy-amber); }
.mes-kpi.k-red::after { background: var(--gy-red); }
.mes-kpi.k-purple::after { background: var(--gy-purple); }
.mes-kpi.k-gray::after { background: var(--gy-gray); }
.mes-kpi-label { font-size: 11px; color: var(--gy-muted); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mes-kpi-value {
  font-family: var(--gy-mono); font-size: 24px; font-weight: 700; line-height: 1.15;
  letter-spacing: -.02em; margin-top: 3px; color: var(--gy-ink);
  font-variant-numeric: tabular-nums;
}
.mes-kpi-value small { font-size: 12px; font-weight: 600; color: var(--gy-muted); margin-left: 2px; font-family: var(--gy-font); }
.mes-kpi-foot { font-size: 11px; color: var(--gy-muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.mes-kpi-foot .up { color: var(--gy-green); }
.mes-kpi-foot .down { color: var(--gy-red); }

/* ---------- 表格 ---------- */
.mes-table-wrap { overflow: auto; border-radius: 0 0 var(--gy-r-md) var(--gy-r-md); }
.mes-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.mes-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--gy-surface-2); color: var(--gy-ink-3);
  font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap;
  padding: 8px 10px; border-bottom: 1px solid var(--gy-line);
}
.mes-table tbody td {
  padding: 7px 10px; border-bottom: 1px solid var(--gy-line);
  vertical-align: middle; color: var(--gy-ink-2); height: 34px;
}
.mes-table tbody tr { background: var(--gy-surface); transition: background .12s; }
.mes-table tbody tr:hover { background: var(--gy-surface-2); }
.mes-table tbody tr.is-clickable { cursor: pointer; }
.mes-table tbody tr.is-overdue { background: #fffafa; }
.mes-table tbody tr.is-overdue:hover { background: #fff5f5; }
.mes-table tbody tr:last-child td { border-bottom: none; }
.mes-table .num { font-family: var(--gy-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mes-table .mono { font-family: var(--gy-mono); font-size: 11px; }
.mes-table .strong { font-weight: 700; color: var(--gy-ink); }
.mes-table .muted { color: var(--gy-muted); }
.mes-table .nowrap { white-space: nowrap; }
.mes-table .actions { white-space: nowrap; text-align: right; }
.mes-table a.link { color: var(--gy-brand); text-decoration: none; font-weight: 600; }
.mes-table a.link:hover { text-decoration: underline; }

/* 工单号列 */
.wo-no { font-family: var(--gy-mono); font-size: 12px; font-weight: 700; color: var(--gy-ink); }
.wo-no:hover { color: var(--gy-brand); }
.wo-pn { font-family: var(--gy-mono); font-size: 11px; color: var(--gy-ink-2); }
.wo-pname { font-size: 11px; color: var(--gy-muted); }

/* ---------- 进度 ---------- */
.mes-progress { height: 6px; border-radius: 3px; background: var(--gy-surface-3); overflow: hidden; position: relative; }
.mes-progress > i { display: block; height: 100%; border-radius: 3px; background: var(--gy-brand); transition: width .4s ease; }
.mes-progress.green > i { background: var(--gy-green); }
.mes-progress.cyan > i { background: var(--gy-cyan); }
.mes-progress.amber > i { background: var(--gy-amber); }
.mes-progress.red > i { background: var(--gy-red); }
.mes-progress-inline { display: flex; align-items: center; gap: 7px; min-width: 110px; }
.mes-progress-inline .val { font-family: var(--gy-mono); font-size: 11px; color: var(--gy-ink-3); min-width: 34px; text-align: right; }

/* ---------- 空态 / 加载 ---------- */
.mes-empty { padding: 44px 20px; text-align: center; color: var(--gy-muted); }
.mes-empty .ico { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.mes-empty h4 { margin: 0 0 4px; font-size: 13px; color: var(--gy-ink-3); font-weight: 600; }
.mes-empty p { margin: 0; font-size: 12px; }
.mes-skeleton { background: linear-gradient(90deg, var(--gy-surface-3) 25%, #f8fafc 37%, var(--gy-surface-3) 63%); background-size: 400% 100%; animation: mesShimmer 1.3s ease infinite; border-radius: var(--gy-r-xs); }
@keyframes mesShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.mes-loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 9999; display: none; }
.mes-loading-bar.show { display: block; }
.mes-loading-bar::after { content: ''; display: block; height: 100%; width: 36%; background: var(--gy-brand); animation: mesBar 1s ease infinite; }
@keyframes mesBar { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }

/* ---------- 分页 ---------- */
.mes-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--gy-line); flex-wrap: wrap; }
.mes-pager .info { font-size: 11px; color: var(--gy-muted); }
.mes-pager .pages { display: flex; gap: 4px; }
.mes-pager .pages button {
  min-width: 26px; height: 26px; border-radius: var(--gy-r-xs); border: 1px solid var(--gy-line);
  background: var(--gy-surface); color: var(--gy-ink-3); font-size: 11px; cursor: pointer; font-family: var(--gy-mono);
}
.mes-pager .pages button:hover { border-color: var(--gy-brand); color: var(--gy-brand); }
.mes-pager .pages button.on { background: var(--gy-brand); border-color: var(--gy-brand); color: #fff; }

/* ---------- 工单详情 ---------- */
.wo-hero {
  background: var(--gy-surface); border: 1px solid var(--gy-line); border-radius: var(--gy-r-md);
  box-shadow: var(--gy-shadow-sm); overflow: hidden; margin-bottom: 12px;
}
.wo-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 16px 10px; flex-wrap: wrap; }
.wo-hero-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wo-hero-no { font-family: var(--gy-mono); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.wo-hero-part { font-size: 13px; color: var(--gy-ink-2); font-weight: 600; }
.wo-hero-part span { font-family: var(--gy-mono); color: var(--gy-brand); margin-right: 4px; }
.wo-hero-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.wo-hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--gy-line); border-top: 1px solid var(--gy-line);
}
.wo-hero-stat { background: var(--gy-surface); padding: 9px 14px; }
.wo-hero-stat .k { font-size: 10px; color: var(--gy-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.wo-hero-stat .v { font-family: var(--gy-mono); font-size: 15px; font-weight: 700; margin-top: 1px; }
.wo-hero-stat .v small { font-size: 11px; color: var(--gy-muted); font-weight: 500; }
.wo-hero-stat.warn .v { color: var(--gy-red); }

.wo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 12px; align-items: start; }
@media (max-width: 1180px) { .wo-layout { grid-template-columns: 1fr; } }
.wo-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
@media (max-width: 1180px) { .wo-side { position: static; } }

/* 工序流转 */
.op-flow { display: flex; flex-direction: column; }
.op-item { display: flex; gap: 0; position: relative; }
.op-rail { width: 46px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.op-seq {
  width: 26px; height: 26px; border-radius: 50%; background: var(--gy-surface-3);
  color: var(--gy-ink-3); font-family: var(--gy-mono); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; z-index: 1;
  border: 2px solid var(--gy-surface); box-shadow: 0 0 0 1px var(--gy-line);
}
.op-item.s-ready .op-seq { background: var(--gy-brand-soft); color: var(--gy-brand); box-shadow: 0 0 0 1px var(--gy-brand); }
.op-item.s-running .op-seq { background: var(--gy-brand); color: #fff; box-shadow: 0 0 0 1px var(--gy-brand), 0 0 0 4px rgba(11,107,203,.14); }
.op-item.s-done .op-seq { background: var(--gy-green); color: #fff; box-shadow: 0 0 0 1px var(--gy-green); }
.op-item.s-paused .op-seq { background: var(--gy-amber); color: #fff; box-shadow: 0 0 0 1px var(--gy-amber); }
.op-line { flex: 1; width: 2px; background: var(--gy-line); margin: 2px 0; }
.op-item:last-child .op-line { display: none; }
.op-body { flex: 1; min-width: 0; padding: 0 0 16px 4px; }
.op-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.op-name { font-size: 13px; font-weight: 700; color: var(--gy-ink); }
.op-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--gy-muted); }
.op-meta b { font-family: var(--gy-mono); color: var(--gy-ink-2); font-weight: 600; }
.op-actions { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.op-bar { margin-top: 5px; max-width: 320px; }

/* 物料齐套 */
.kit-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--gy-line); font-size: 12px; }
.kit-row:last-child { border-bottom: none; }
.kit-row .pn { font-family: var(--gy-mono); font-weight: 600; min-width: 96px; }
.kit-row .qty { margin-left: auto; font-family: var(--gy-mono); font-size: 11px; white-space: nowrap; }
.kit-row .qty b { color: var(--gy-ink); }
.kit-row.short .qty b { color: var(--gy-red); }

/* 时间轴（日志） */
.mes-timeline { position: relative; padding-left: 14px; }
.mes-timeline::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1px; background: var(--gy-line); }
.tl-item { position: relative; padding: 0 0 11px 10px; font-size: 12px; }
.tl-item::before { content: ''; position: absolute; left: -14px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gy-surface); border: 2px solid var(--gy-line-strong); }
.tl-item.hl::before { border-color: var(--gy-brand); background: var(--gy-brand); }
.tl-time { font-family: var(--gy-mono); font-size: 10px; color: var(--gy-muted); }
.tl-text { color: var(--gy-ink-2); margin-top: 1px; }
.tl-actor { color: var(--gy-muted); font-size: 11px; }

/* ---------- 弹层 ---------- */
.mes-modal-mask {
  position: fixed; inset: 0; background: rgba(15, 22, 32, .42); z-index: 2100;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.mes-modal-mask.show { display: flex; animation: mesFade .16s ease; }
@keyframes mesFade { from { opacity: 0; } to { opacity: 1; } }
.mes-modal {
  background: var(--gy-surface); border-radius: var(--gy-r-lg); box-shadow: var(--gy-shadow-lg);
  width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column;
  animation: mesPop .18s cubic-bezier(.2,.9,.3,1.2);
}
.mes-modal.wide { max-width: 780px; }
.mes-modal.narrow { max-width: 420px; }
@keyframes mesPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.mes-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--gy-line); }
.mes-modal-hd h3 { margin: 0; font-size: 14px; font-weight: 700; }
.mes-modal-x { border: none; background: none; font-size: 18px; color: var(--gy-muted); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: var(--gy-r-xs); }
.mes-modal-x:hover { background: var(--gy-surface-3); color: var(--gy-ink); }
.mes-modal-bd { padding: 16px; overflow: auto; }
.mes-modal-ft { padding: 11px 16px; border-top: 1px solid var(--gy-line); display: flex; justify-content: flex-end; gap: 8px; background: var(--gy-surface-2); border-radius: 0 0 var(--gy-r-lg) var(--gy-r-lg); }

.mes-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mes-form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .mes-form-grid { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
.mes-toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.mes-toast {
  min-width: 200px; max-width: 420px; padding: 8px 14px; border-radius: var(--gy-r-sm);
  background: #1b2330; color: #fff; font-size: 12px; box-shadow: var(--gy-shadow-md);
  display: flex; align-items: center; gap: 7px; animation: mesToastIn .2s ease;
}
.mes-toast.ok { background: #0f5c3a; }
.mes-toast.err { background: #8f2222; }
.mes-toast.warn { background: #7a4700; }
@keyframes mesToastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- 排产负荷 ---------- */
.load-grid { width: 100%; border-collapse: collapse; font-size: 12px; }
.load-grid th, .load-grid td { border: 1px solid var(--gy-line); padding: 0; text-align: center; }
.load-grid th { background: var(--gy-surface-2); font-size: 10px; font-weight: 700; color: var(--gy-ink-3); padding: 7px 4px; }
.load-grid th.corner, .load-grid td.row-hd { text-align: left; padding: 8px 10px; background: var(--gy-surface-2); min-width: 130px; }
.load-grid td.row-hd { font-weight: 600; color: var(--gy-ink); }
.load-grid td.row-hd small { display: block; font-size: 10px; color: var(--gy-muted); font-weight: 500; }
.load-cell { position: relative; height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; }
.load-cell .h { font-family: var(--gy-mono); font-size: 12px; font-weight: 700; line-height: 1.1; }
.load-cell .p { font-family: var(--gy-mono); font-size: 9px; opacity: .85; }
.load-cell.l0 { background: #fbfcfe; color: var(--gy-muted); }
.load-cell.l1 { background: #eaf3fe; color: var(--gy-brand); }
.load-cell.l2 { background: #cfe5fd; color: var(--gy-brand-2); }
.load-cell.l3 { background: #ffe9c7; color: var(--gy-amber); }
.load-cell.l4 { background: #fbd5d5; color: var(--gy-red); }
.load-cell:hover { outline: 2px solid var(--gy-brand); outline-offset: -2px; }
.load-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--gy-muted); }
.load-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* 甘特 */
.gantt { padding: 4px 0; }
.gantt-row { display: grid; grid-template-columns: 210px 1fr; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--gy-line); }
.gantt-row:last-child { border-bottom: none; }
.gantt-label { min-width: 0; }
.gantt-label .no { font-family: var(--gy-mono); font-size: 11px; font-weight: 700; }
.gantt-label .pn { font-size: 10px; color: var(--gy-muted); }
.gantt-track { position: relative; height: 18px; background: var(--gy-surface-3); border-radius: 3px; overflow: hidden; }
.gantt-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--gy-brand); min-width: 3px; }
.gantt-bar .fill { position: absolute; inset: 0; background: rgba(255,255,255,.35); width: 0; }
.gantt-bar.cyan { background: var(--gy-cyan); }
.gantt-bar.orange { background: var(--gy-amber); }
.gantt-bar.green { background: var(--gy-green); }
.gantt-bar.red { background: var(--gy-red); }

/* ---------- 车间看板 ---------- */
.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
.kanban-col { background: var(--gy-surface-2); border: 1px solid var(--gy-line); border-radius: var(--gy-r-md); display: flex; flex-direction: column; min-height: 300px; }
.kanban-col-hd { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--gy-line); }
.kanban-col-hd h3 { margin: 0; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.kanban-col-hd .n { font-family: var(--gy-mono); font-size: 11px; background: var(--gy-surface); border: 1px solid var(--gy-line); border-radius: 9px; padding: 0 7px; }
.kanban-col-bd { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: calc(100vh - 220px); }
.kanban-card {
  background: var(--gy-surface); border: 1px solid var(--gy-line); border-left: 3px solid var(--gy-brand);
  border-radius: var(--gy-r-sm); padding: 9px 10px; cursor: pointer; transition: all .14s;
}
.kanban-card:hover { border-color: var(--gy-brand); box-shadow: var(--gy-shadow-md); transform: translateY(-1px); }
.kanban-card.cyan { border-left-color: var(--gy-cyan); }
.kanban-card.orange { border-left-color: var(--gy-amber); }
.kanban-card.green { border-left-color: var(--gy-green); }
.kanban-card.red { border-left-color: var(--gy-red); }
.kanban-card .top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kanban-card .no { font-family: var(--gy-mono); font-size: 12px; font-weight: 700; }
.kanban-card .pn { font-size: 11px; color: var(--gy-ink-3); margin-top: 1px; }
.kanban-card .op { font-size: 11px; color: var(--gy-muted); margin-top: 3px; }
.kanban-card .bar { margin-top: 6px; }
.kanban-card .foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--gy-muted); margin-top: 3px; font-family: var(--gy-mono); }

/* ---------- 工作台 ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: 1fr; } }

/* 顶部：今天的状态 + 一句话说明「这套系统怎么用」 */
.dash-hero {
  position: relative; overflow: hidden;
  background: var(--gy-surface); border: 1px solid var(--gy-line);
  border-radius: var(--gy-r-lg); box-shadow: var(--gy-shadow-sm);
  padding: 16px 18px; margin-bottom: 12px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
}
.dash-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gy-brand), var(--gy-cyan));
}
.dash-hero-l { min-width: 0; }
.dash-hero .eyebrow {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gy-muted); font-weight: 700; margin-bottom: 2px;
}
.dash-hero h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.dash-hero p { margin: 4px 0 0; font-size: 12px; color: var(--gy-ink-3); max-width: 640px; }
.dash-hero p b { color: var(--gy-ink); font-weight: 600; }
.dash-hero .hero-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.dash-hero .hero-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px;
  border-radius: 13px; background: var(--gy-surface-2); border: 1px solid var(--gy-line);
  font-size: 11px; color: var(--gy-ink-3); cursor: pointer; transition: all .14s ease;
}
.dash-hero .hero-chip:hover { background: #fff; border-color: var(--gy-brand); color: var(--gy-brand); }
.dash-hero .hero-chip b { font-family: var(--gy-mono); color: var(--gy-ink); }
.dash-hero .hero-chip.alert { background: var(--gy-red-soft); border-color: #f0d6d0; color: var(--gy-red); }
.dash-hero .hero-chip.alert b { color: var(--gy-red); }

.dash-hero-r {
  display: grid; grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 8px 20px; flex-shrink: 0; padding-left: 20px;
  border-left: 1px dashed var(--gy-line);
}
.hero-stat .k { font-size: 10.5px; color: var(--gy-muted); font-weight: 600; }
.hero-stat .v {
  font-family: var(--gy-mono); font-size: 19px; font-weight: 700;
  color: var(--gy-ink); line-height: 1.25; letter-spacing: -.02em;
}
.hero-stat .v small { font-size: 11px; font-weight: 600; color: var(--gy-muted); margin-left: 2px; font-family: var(--gy-font); }

/* 生产主线：一张工单的六步走法（首页的「使用顺序」） */
.flow {
  background: var(--gy-surface); border: 1px solid var(--gy-line);
  border-radius: var(--gy-r-lg); box-shadow: var(--gy-shadow-sm);
  margin-bottom: 12px; overflow: hidden;
}
.flow-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--gy-line);
}
.flow-hd h2 { margin: 0; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.flow-hd h2 .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gy-brand); }
.flow-hd .hint { font-size: 11px; color: var(--gy-muted); }

.flow-steps { display: grid; grid-template-columns: repeat(6, 1fr); padding: 4px 6px 8px; }
.flow-step {
  position: relative; display: block; text-decoration: none; color: inherit;
  padding: 10px 10px 8px 12px; border-radius: var(--gy-r-md);
  transition: background .14s ease; cursor: pointer;
}
.flow-step:hover { background: var(--gy-surface-2); }
.flow-step + .flow-step::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 1px; background: var(--gy-line);
}
.flow-step-top { display: flex; align-items: center; gap: 7px; }
.flow-no {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--gy-mono); font-size: 11px; font-weight: 700;
  background: var(--gy-gray-soft); color: var(--gy-gray);
}
.flow-title { font-size: 12.5px; font-weight: 700; color: var(--gy-ink); }
.flow-desc {
  font-size: 11px; color: var(--gy-muted); line-height: 1.5; margin-top: 5px;
  min-height: 32px;
}
.flow-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.flow-count { font-size: 11px; color: var(--gy-muted); display: flex; align-items: baseline; gap: 3px; }
.flow-count em {
  font-style: normal; font-family: var(--gy-mono); font-size: 16px; font-weight: 700;
  color: var(--gy-ink); letter-spacing: -.02em;
}
.flow-go { font-size: 11px; font-weight: 600; color: var(--gy-brand); white-space: nowrap; }

.flow-step.is-todo .flow-no { background: var(--gy-amber-soft); color: var(--gy-amber); }
.flow-step.is-warn .flow-no { background: var(--gy-red-soft); color: var(--gy-red); }
.flow-step.is-warn .flow-count em { color: var(--gy-red); }
.flow-step.is-busy .flow-no { background: var(--gy-cyan-soft); color: var(--gy-cyan); }
.flow-step.is-ok .flow-no { background: var(--gy-green-soft); color: var(--gy-green); }
.flow-step.is-ok .flow-count em { color: var(--gy-green); }
.flow-step.is-idle .flow-no { background: var(--gy-gray-soft); color: var(--gy-muted); }
.flow-step.is-idle .flow-count em { color: var(--gy-muted); }

@media (max-width: 1380px) {
  .flow-steps { grid-template-columns: repeat(3, 1fr); }
  .flow-step + .flow-step:nth-child(4)::before,
  .flow-step:nth-child(4)::before { display: none; }
  .flow-step:nth-child(n+4) { border-top: 1px dashed var(--gy-line); }
}
@media (max-width: 900px) {
  .dash-hero { flex-direction: column; }
  .dash-hero-r { border-left: none; padding-left: 0; border-top: 1px dashed var(--gy-line); padding-top: 10px; width: 100%; }
  .flow-steps { grid-template-columns: repeat(2, 1fr); }
  .flow-step:nth-child(odd)::before { display: none; }
}

.todo-list { display: flex; flex-direction: column; }
.todo-item { display: flex; align-items: center; gap: 9px; padding: 8px 2px; border-bottom: 1px dashed var(--gy-line); cursor: pointer; }
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--gy-surface-2); }
.todo-tag { flex-shrink: 0; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: var(--gy-gray-soft); color: var(--gy-gray); }
.todo-tag.blue { background: var(--gy-brand-soft); color: var(--gy-brand); }
.todo-tag.cyan { background: var(--gy-cyan-soft); color: var(--gy-cyan); }
.todo-tag.green { background: var(--gy-green-soft); color: var(--gy-green); }
.todo-tag.orange { background: var(--gy-amber-soft); color: var(--gy-amber); }
.todo-tag.red { background: var(--gy-red-soft); color: var(--gy-red); }
.todo-main { min-width: 0; flex: 1; }
.todo-main .t { font-size: 12px; font-weight: 600; color: var(--gy-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-main .s { font-size: 11px; color: var(--gy-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-go { font-size: 11px; color: var(--gy-brand); font-weight: 600; white-space: nowrap; }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 92px; padding-top: 6px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.spark-bar { width: 100%; border-radius: 2px 2px 0 0; background: var(--gy-brand); min-height: 2px; transition: height .4s; position: relative; }
.spark-bar .bad { position: absolute; bottom: 0; left: 0; right: 0; background: var(--gy-red); border-radius: 2px 2px 0 0; }
.spark-lbl { font-size: 9px; color: var(--gy-muted); font-family: var(--gy-mono); }

.center-load { display: flex; flex-direction: column; gap: 9px; }
.center-load-row { display: flex; flex-direction: column; gap: 3px; }
.center-load-row .l { display: flex; justify-content: space-between; font-size: 11px; }
.center-load-row .l b { font-family: var(--gy-mono); }

/* ---------- AI 面板 ---------- */
.mes-ai { border: 1px solid var(--gy-line); border-radius: var(--gy-r-md); background: var(--gy-surface); overflow: hidden; }
.mes-ai-hd {
  display: flex; align-items: center; gap: 8px; padding: 10px 13px;
  background: linear-gradient(100deg, #101720 0%, #1a3546 100%); color: #fff;
}
.mes-ai-hd .ai-dot { width: 7px; height: 7px; border-radius: 50%; background: #4bd6c4; box-shadow: 0 0 0 3px rgba(75,214,196,.2); }
.mes-ai-hd h4 { margin: 0; font-size: 12px; font-weight: 700; flex: 1; }
.mes-ai-hd .tag { font-size: 9px; padding: 1px 6px; border-radius: 8px; background: rgba(255,255,255,.14); color: rgba(255,255,255,.85); letter-spacing: .04em; }
.mes-ai-bd { padding: 12px 13px; }
.mes-ai-headline { font-size: 14px; font-weight: 700; color: var(--gy-ink); line-height: 1.35; }
.mes-ai-summary { font-size: 12px; color: var(--gy-ink-3); margin-top: 4px; line-height: 1.6; }
.mes-ai-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mes-ai-badge { font-size: 10px; padding: 2px 7px; border-radius: 3px; background: var(--gy-surface-3); color: var(--gy-ink-3); font-weight: 600; }
.mes-ai-section { margin-top: 11px; }
.mes-ai-section .st { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gy-muted); margin-bottom: 4px; }
.mes-ai-section ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.mes-ai-section li { position: relative; padding-left: 12px; font-size: 12px; color: var(--gy-ink-2); line-height: 1.5; }
.mes-ai-section li::before { content: ''; position: absolute; left: 2px; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--gy-line-strong); }
.mes-ai-section li.lv-high::before { background: var(--gy-red); }
.mes-ai-section li.lv-mid::before { background: var(--gy-amber); }
.mes-ai-section li.lv-low::before { background: var(--gy-green); }
.mes-ai-ft { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-top: 1px solid var(--gy-line); background: var(--gy-surface-2); }
.mes-ai-ft .meta { font-size: 10px; color: var(--gy-muted); flex: 1; }
.mes-ai-skeleton { display: flex; flex-direction: column; gap: 7px; }
.mes-ai-skeleton i { display: block; height: 10px; }

/* ---------- 工具 ---------- */
.mes-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mes-col { display: flex; flex-direction: column; gap: 8px; }
.mes-spacer { flex: 1; }
.mes-divider { height: 1px; background: var(--gy-line); margin: 10px 0; }
.mes-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gy-line); }
.mes-tab { padding: 8px 13px; font-size: 12px; font-weight: 600; color: var(--gy-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.mes-tab:hover { color: var(--gy-ink); }
.mes-tab.on { color: var(--gy-brand); border-bottom-color: var(--gy-brand); }
.mes-mini { font-size: 11px; color: var(--gy-muted); }
.mes-right { text-align: right; }
.mes-nowrap { white-space: nowrap; }
.mes-hidden { display: none !important; }
.mes-scroll-x { overflow-x: auto; }

/* 打印：工单流转卡 */
@media print {
  body.mes { background: #fff; }
  .mes-toolbar, .wo-hero-actions, .op-actions, .mes-btn, .mes-ai, .mes-side { display: none !important; }
  .mes-page { max-width: none; padding: 0; }
  .mes-card { box-shadow: none; break-inside: avoid; }
}

/* =====================================================================
   设备综合效率 OEE
   ===================================================================== */
.oee-hero {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr) minmax(0, 190px);
  gap: 18px; align-items: center;
  background: var(--gy-surface); border: 1px solid var(--gy-line);
  border-radius: var(--gy-r-lg); padding: 18px 20px; margin-bottom: 14px;
  box-shadow: var(--gy-shadow-sm);
}
.oee-hero-main { display: flex; align-items: center; gap: 16px; }
.oee-ring { position: relative; width: 116px; height: 116px; flex: none; }
.oee-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.oee-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.oee-ring circle.bg { stroke: var(--gy-bg-deep); }
.oee-ring circle.fg {
  stroke: var(--gy-green); transition: stroke-dashoffset .6s cubic-bezier(.4, 0, .2, 1), stroke .3s;
}
.oee-ring.is-cyan circle.fg  { stroke: var(--gy-cyan); }
.oee-ring.is-amber circle.fg { stroke: var(--gy-amber); }
.oee-ring.is-red circle.fg   { stroke: var(--gy-red); }
.oee-ring.is-gray circle.fg  { stroke: var(--gy-line-strong); }
.oee-ring-txt {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
}
.oee-ring-txt b {
  font-family: var(--gy-mono); font-size: 27px; line-height: 1;
  letter-spacing: -.5px; color: var(--gy-ink);
}
.oee-ring-txt span { font-size: 10.5px; letter-spacing: 1px; color: var(--gy-muted); }
.oee-hero-meta { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.oee-grade {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700; width: fit-content;
  background: var(--gy-gray-soft); color: var(--gy-gray);
}
.oee-grade.is-green { background: var(--gy-green-soft); color: var(--gy-green); }
.oee-grade.is-cyan  { background: var(--gy-cyan-soft);  color: var(--gy-cyan); }
.oee-grade.is-amber { background: var(--gy-amber-soft); color: var(--gy-amber); }
.oee-grade.is-red   { background: var(--gy-red-soft);   color: var(--gy-red); }
.oee-hero-note {
  font-size: 11.5px; line-height: 1.6; color: var(--gy-muted);
  max-height: 54px; overflow: hidden;
}

.oee-factors { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.oee-factor-hd {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12px; color: var(--gy-muted); margin-bottom: 4px;
}
.oee-factor-hd b { font-family: var(--gy-mono); font-size: 15px; color: var(--gy-ink); }
.oee-meter { height: 6px; border-radius: 3px; background: var(--gy-bg-deep); overflow: hidden; }
.oee-meter i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--gy-brand); transition: width .55s cubic-bezier(.4, 0, .2, 1);
}
.oee-factor.is-p .oee-meter i { background: var(--gy-cyan); }
.oee-factor.is-q .oee-meter i { background: var(--gy-green); }
.oee-factor-ft { font-size: 11px; color: var(--gy-muted); margin-top: 4px; }

.oee-side {
  border-left: 1px solid var(--gy-line); padding-left: 16px;
  display: flex; flex-direction: column; gap: 7px;
}
.oee-side-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; color: var(--gy-muted);
}
.oee-side-row b { font-family: var(--gy-mono); font-size: 12.5px; color: var(--gy-ink-2, var(--gy-ink)); }

/* 四段损失 */
.oee-loss {
  display: flex; height: 30px; border-radius: var(--gy-r-sm);
  overflow: hidden; background: var(--gy-bg-deep); gap: 2px;
}
.oee-loss i { display: block; height: 100%; min-width: 0; }
.oee-loss i.down    { background: var(--gy-red); }
.oee-loss i.speed   { background: var(--gy-amber); }
.oee-loss i.quality { background: var(--gy-purple); }
.oee-loss i.value   { background: var(--gy-green); }
.oee-loss-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 16px; margin-top: 13px; }
.oee-lg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--gy-muted); }
.oee-lg .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.oee-lg.is-down .dot    { background: var(--gy-red); }
.oee-lg.is-speed .dot   { background: var(--gy-amber); }
.oee-lg.is-quality .dot { background: var(--gy-purple); }
.oee-lg.is-value .dot   { background: var(--gy-green); }
.oee-lg .lab { flex: 1; min-width: 0; }
.oee-lg b { font-family: var(--gy-mono); color: var(--gy-ink-2, var(--gy-ink)); font-size: 12px; }
.oee-lg .pc { width: 46px; text-align: right; font-family: var(--gy-mono); font-size: 11px; }

/* 表格里的 OEE 单元格 */
.oee-cell { display: flex; align-items: center; gap: 8px; }
.oee-cell-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--gy-bg-deep); overflow: hidden; min-width: 60px; }
.oee-cell-bar i { display: block; height: 100%; border-radius: 3px; background: var(--gy-gray); }
.oee-cell-bar i.is-green { background: var(--gy-green); }
.oee-cell-bar i.is-cyan  { background: var(--gy-cyan); }
.oee-cell-bar i.is-amber { background: var(--gy-amber); }
.oee-cell-bar i.is-red   { background: var(--gy-red); }
.oee-cell b { font-family: var(--gy-mono); font-size: 12px; width: 48px; text-align: right; }

/* 趋势柱 */
.spark-val { font-family: var(--gy-mono); font-size: 9.5px; color: var(--gy-muted); line-height: 1; }
.spark-bar.ok   { background: var(--gy-green); }
.spark-bar.mid  { background: var(--gy-amber); }
.spark-bar.low  { background: var(--gy-red); }
.spark-bar.none { background: var(--gy-line); }

/* 双栏布局 */
.dash-grid-2 {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; margin-bottom: 14px;
}
tr.is-link { cursor: pointer; }
tr.is-link:hover { background: var(--gy-brand-soft); }

@media (max-width: 1180px) {
  .oee-hero { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
  .oee-side { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--gy-line);
    padding: 10px 0 0; flex-direction: row; flex-wrap: wrap; gap: 8px 22px; }
}
@media (max-width: 860px) {
  .oee-hero { grid-template-columns: minmax(0, 1fr); }
  .dash-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* 表单：<label class="mes-field"><span>标题</span><input></label> 这种写法也要一起对齐 */
.mes-field > span { font-size: 11px; font-weight: 600; color: var(--gy-ink-3); }
.mes-field > .mes-input, .mes-field > .mes-select, .mes-field > .mes-textarea, .mes-field > input, .mes-field > select { width: 100%; }

/* 表格操作列 */
.mes-table .ops { display: flex; gap: 5px; flex-wrap: nowrap; align-items: center; }

/* 生产统计：OEE 小结条 */
.oee-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.oee-stat {
  border: 1px solid var(--gy-line); border-radius: var(--gy-r-md);
  padding: 11px 13px; background: var(--gy-surface);
  display: flex; flex-direction: column; gap: 6px;
}
.oee-stat > span { font-size: 11px; color: var(--gy-muted); }
.oee-stat > b { font-family: var(--gy-mono); font-size: 21px; line-height: 1; color: var(--gy-ink); letter-spacing: -.5px; }
.oee-mini-bar { display: block; height: 4px; border-radius: 2px; background: var(--gy-bg-deep); overflow: hidden; }
.oee-mini-bar em { display: block; height: 100%; background: var(--gy-cyan); border-radius: 2px; transition: width .5s ease; }
.oee-strip-foot { margin-top: 10px; font-size: 11.5px; color: var(--gy-muted); line-height: 1.7; }
.oee-strip-foot b { font-family: var(--gy-mono); }
@media (max-width: 760px) { .oee-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
