/* ============================================================
 * SIM-MES · 浅色 SaaS 主题(风格参考 PingCode / WorkTile)
 * 白卡片 · 蓝主色 · 分组图标侧栏 · 系统字体 · 轻阴影
 * ============================================================ */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --soft: #fafbfc;
  --line: #e9ebf0;
  --line2: #dcdfe6;
  --ink: #1f2329;
  --dim: #646a73;
  --faint: #8f959e;
  --brand: #475569;
  --brand-dk: #384454;
  --brand-bg: #eef1f5;
  --ok: #2ca34e;
  --ok-bg: #e8f6ec;
  --warn: #d97b06;
  --warn-bg: #fdf1df;
  --bad: #e04545;
  --bad-bg: #fdeaea;
  --idle: #646a73;
  --idle-bg: #f0f1f4;
  --purple: #6a4fe8;
  --purple-bg: #f0edff;
  --teal: #0a8f66;
  --teal-bg: #e3f6ef;
  --shadow: 0 1px 2px rgba(31, 35, 41, 0.05);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --font-m: 'SF Mono', ui-monospace, 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, 'PingFang SC', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-color: #d5d8de var(--bg); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(120, 120, 140, 0.18); }
b, strong { font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
button { font-family: var(--font); }

/* ---------- 侧栏 ---------- */
.side {
  position: fixed; left: 0; top: 0; bottom: 0; width: 216px; z-index: 40;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); height: 56px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #64748b, #384454);
  display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(51, 112, 255, 0.28);
}
.logo-mark svg { width: 16px; height: 16px; }
.logo-txt b { display: block; font-size: 15px; letter-spacing: 0.5px; line-height: 1.15; }
.logo-txt span { display: block; font-size: 11px; color: var(--faint); }
.nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-g {
  font-size: 11px; color: var(--faint); letter-spacing: 1px;
  padding: 12px 16px 5px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 36px; margin: 1px 10px; padding: 0 10px;
  color: var(--dim); border-radius: 6px; font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.nav a svg {
  width: 16px; height: 16px; flex: none; opacity: 0.9;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav a:hover { background: #f2f3f5; color: var(--ink); }
.nav a.on { background: var(--brand-bg); color: var(--brand); font-weight: 500; }
.side-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--dim); line-height: 1.7;
}
.side-foot .dim { color: var(--faint); }
.side-foot .mono { font-size: 10px; }
.dot-live {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(44, 163, 78, 0.15);
}

/* ---------- 顶栏 ---------- */
.top {
  position: fixed; left: 216px; right: 0; top: 0; height: 56px; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumb { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.crumb::before { content: ''; display: none; }
.top-sp { flex: 1; }
.search {
  display: flex; align-items: center; gap: 7px; width: 250px; height: 32px;
  background: #f2f3f5; border-radius: 6px; padding: 0 10px;
  border: 1px solid transparent; transition: all 0.15s;
}
.search svg { width: 14px; height: 14px; stroke: var(--faint); fill: none; stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.1); }
.search input { border: none; outline: none; background: none; flex: 1; font-size: 13px; color: var(--ink); font-family: var(--font); }
.search input::placeholder { color: var(--faint); }
.icon-btn {
  position: relative; width: 32px; height: 32px; border-radius: 6px; border: none;
  background: none; cursor: pointer; display: grid; place-items: center; color: var(--dim);
  transition: all 0.12s;
}
.icon-btn:hover { background: #f2f3f5; color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  background: #f04545; color: #fff; font-size: 10px; font-style: normal;
  border-radius: 8px; display: grid; place-items: center; padding: 0 3px;
  font-family: var(--font-m);
}
.clock { text-align: right; line-height: 1.25; }
#clock-time { font-family: var(--font-m); font-size: 14px; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
#clock-date { display: block; font-size: 11px; color: var(--faint); }
.top-plant {
  font-size: 12px; color: var(--dim); padding: 4px 10px;
  background: var(--soft); border: 1px solid var(--line); border-radius: 6px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #64748b, #384454);
  color: #fff; font-size: 13px; font-weight: 500;
  display: grid; place-items: center; cursor: pointer;
}

/* ---------- 主区 / 页头 ---------- */
.main { position: relative; z-index: 1; margin: 56px 0 0 216px; padding: 20px 24px 56px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
.page-head p { font-size: 13px; color: var(--dim); margin-top: 3px; }
.ph-actions { display: flex; gap: 10px; align-items: center; flex: none; }

/* ---------- 卡片 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.p-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.p-head h3 { font-size: 14.5px; font-weight: 600; }
.reveal { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 标签 / 状态 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; line-height: 1; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; font-weight: 400;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag-ok { color: var(--ok); background: var(--ok-bg); }
.tag-warn { color: var(--warn); background: var(--warn-bg); }
.tag-bad { color: var(--bad); background: var(--bad-bg); }
.tag-idle { color: var(--idle); background: var(--idle-bg); }
.tag-info { color: var(--brand); background: var(--brand-bg); }
.tag-purple { color: var(--purple); background: var(--purple-bg); }
.tag-teal { color: var(--teal); background: var(--teal-bg); }
.tag-plain { color: var(--dim); background: var(--idle-bg); }
.tag-plain::before { display: none; }
.mono { font-family: var(--font-m); font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.sm { font-size: 12px; }
.hl { color: var(--brand); }
.empty { text-align: center; color: var(--faint); padding: 28px 0; }
.empty-hint { padding: 26px 4px; color: var(--faint); }
.foot-note { margin-top: 12px; color: var(--faint); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  height: 34px; padding: 0 16px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; transition: all 0.13s;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn-ghost { background: #fff; color: var(--dim); border-color: var(--line2); }
.btn-ghost:hover { background: #f7f8fa; color: var(--ink); border-color: #c9cdd4; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f3b3b3; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-sm { height: 27px; padding: 0 11px; font-size: 12.5px; border-radius: 5px; }
.btn-text { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.btn-text:hover { text-decoration: underline; }

/* ---------- 分段选择器 / 页签 ---------- */
.seg { display: inline-flex; gap: 2px; background: #f0f1f4; border-radius: 8px; padding: 3px; }
.seg button {
  border: none; background: none; cursor: pointer; color: var(--dim);
  font-size: 13px; padding: 6px 14px; border-radius: 6px;
  display: inline-flex; gap: 8px; align-items: baseline; transition: all 0.12s;
}
.seg button b { font-weight: 600; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31, 35, 41, 0.1); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs .tab {
  background: none; border: none; cursor: pointer; color: var(--dim);
  font-size: 14px; padding: 8px 2px 10px; position: relative;
  display: inline-flex; align-items: center; gap: 7px;
}
.tabs .tab em {
  font-style: normal; font-size: 12px; color: var(--faint);
  background: var(--idle-bg); border-radius: 9px; padding: 1px 7px; line-height: 1.4;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.on { color: var(--brand); font-weight: 500; }
.tabs .tab.on em { background: var(--brand-bg); color: var(--brand); }
.tabs .tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 0; }
.k-ico {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.k-ico svg { width: 19px; height: 19px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.k-ico.ico-blue { background: var(--brand-bg); color: var(--brand); }
.k-ico.ico-green { background: var(--ok-bg); color: var(--ok); }
.k-ico.ico-orange { background: var(--warn-bg); color: var(--warn); }
.k-ico.ico-purple { background: var(--purple-bg); color: var(--purple); }
.kpi .k-body { min-width: 0; flex: 1; }
.k-k { font-size: 12.5px; color: var(--dim); }
.k-v { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.k-v b { font-size: 26px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.k-v i { font-style: normal; font-size: 13px; color: var(--faint); }
.k-delta { font-size: 12px; padding: 1px 7px; border-radius: 4px; line-height: 1.5; }
.k-delta.up { color: var(--ok); background: var(--ok-bg); }
.k-delta.dn { color: var(--bad); background: var(--bad-bg); }
.k-note { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ---------- 产线卡 ---------- */
.line-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.line-card { margin-bottom: 0; }
.lc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lc-head b { font-size: 15px; }
.lc-head .sub { font-size: 12px; color: var(--faint); margin-left: 8px; font-weight: 400; }
.lc-mid { display: flex; gap: 16px; align-items: center; }
.lc-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lc-info em { font-style: normal; font-size: 13.5px; }
.prog { height: 6px; background: #eef1f5; border-radius: 3px; margin-top: 4px; overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 3px; background: var(--brand); transition: width 0.6s ease; }
.pipe { display: flex; align-items: center; margin-top: 14px; }
.pipe-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; cursor: help; }
.pd-ok { background: var(--ok); }
.pd-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.pd-bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.pd-idle { background: #d5d8de; }
.pipe-ln { flex: 1; height: 2px; background: #eef1f5; border-radius: 1px; }
.pipe-label { text-align: center; margin-top: 8px; color: var(--faint); font-size: 12px; }

/* ---------- 环形 OEE ---------- */
.donut {
  width: 84px; height: 84px; flex: none; border-radius: 50%; position: relative;
  display: grid; place-items: center;
  background: conic-gradient(var(--dc, var(--brand)) calc(var(--p) * 1%), #eef1f5 0);
}
.donut::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.donut b, .donut i { position: relative; }
.donut b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.donut i { position: absolute; bottom: 14px; font-style: normal; font-size: 9px; letter-spacing: 2px; color: var(--faint); }
.donut-ok { --dc: #3fb950; } .donut-warn { --dc: #f0a020; } .donut-bad { --dc: #f0524f; }

/* ---------- 看板底部 / 图表通用 ---------- */
.dash-bottom { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.dash-bottom .panel { margin-bottom: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--faint); font-size: 10px; }
.chart .bar { fill: var(--brand); opacity: 0.82; transform-box: fill-box; transform-origin: bottom; animation: barIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.chart .bar:hover { opacity: 1; }
.chart .bar-off { fill: #eef1f5; animation: none; }
@keyframes barIn { from { transform: scaleY(0); } }
.chart .gridline { stroke: #f0f2f5; stroke-width: 1; }
.chart .cline { stroke: var(--brand); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .cline.target { stroke: #f0a020; stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .carea { fill: url(#gradBlue); }
.alarms { list-style: none; }
.al {
  display: grid; grid-template-columns: 46px 50px 1fr; gap: 10px; align-items: baseline;
  padding: 9px 10px; border-left: 3px solid var(--line2); border-radius: 6px;
  margin-bottom: 6px; background: var(--soft); font-size: 13px;
}
.al p { display: inline; color: var(--ink); }
.al-high { border-left-color: var(--bad); } .al-high .al-sev { color: var(--bad); }
.al-mid { border-left-color: var(--warn); } .al-mid .al-sev { color: var(--warn); }
.al-low { border-left-color: #b3b8c0; } .al-low .al-sev { color: var(--dim); }
.al-sev { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.al-time { font-size: 12px; color: var(--faint); }

/* ---------- 工位流水线 ---------- */
.stations { display: flex; align-items: stretch; gap: 10px; }
.stn {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 11px;
  display: flex; flex-direction: column; gap: 3px; position: relative;
  background: var(--soft);
}
.stn::before { content: ''; position: absolute; left: 12px; right: 12px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: #d5d8de; }
.stn-ok::before { background: var(--ok); }
.stn-warn::before { background: var(--warn); }
.stn-bad::before { background: var(--bad); }
.stn-idle { opacity: 0.72; }
.stn b { font-size: 13px; }
.stn-i { position: absolute; top: 9px; right: 11px; font-size: 10px; color: var(--faint); font-family: var(--font-m); }
.stn-arrow { align-self: center; color: #c4c9d0; font-size: 13px; flex: none; }

/* ---------- 供料槽位 ---------- */
.feeders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fdr {
  text-align: left; cursor: pointer; border-radius: 8px;
  background: var(--soft); border: 1px solid var(--line); border-left: 3px solid var(--ok);
  padding: 10px 12px; color: var(--ink); display: flex; flex-direction: column; gap: 5px;
  transition: all 0.13s;
}
.fdr:hover { border-color: #c9cdd4; border-left-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.f-slot { position: absolute; top: 9px; right: 10px; font-size: 11px; color: var(--faint); }
.fdr { position: relative; }
.fdr b { font-size: 13px; padding-right: 32px; }
.fdr-warn { border-left-color: var(--warn); }
.fdr-bad { border-left-color: var(--bad); background: var(--bad-bg); }
.f-usage { display: block; height: 4px; background: #e8ebef; border-radius: 2px; overflow: hidden; }
.f-usage i { display: block; height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.4s; }
.f-usage i.fu-warn { background: var(--warn); }
.f-usage i.fu-bad { background: var(--bad); }
.f-meta { display: flex; justify-content: space-between; align-items: center; }

/* ---------- 表格 / 物料 ---------- */
.mat-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); padding: 5px 12px; font-size: 12.5px; color: var(--dim); background: #fff; border-radius: 6px; }
.chip b { color: var(--ink); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip-warn { border-color: #f3d9ae; background: #fffdf8; } .chip-warn b { color: var(--warn); }
.chip-bad { border-color: #f3bcbc; background: #fffafa; } .chip-bad b { color: var(--bad); }
.chip-btn { cursor: pointer; color: var(--brand); font-family: var(--font-m); font-size: 11.5px; }
.chip-btn:hover { border-color: var(--brand); }
.toolbar { display: flex; gap: 8px; }
input, select {
  background: #fff; border: 1px solid var(--line2); color: var(--ink);
  font-family: var(--font); font-size: 13px; padding: 7px 12px; outline: none; border-radius: 6px;
  transition: border-color 0.13s, box-shadow 0.13s;
}
input.mono { font-family: var(--font-m); }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.1); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 12px;
  color: var(--faint); padding: 7px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid #f2f3f5; vertical-align: top; }
.tbl tr { transition: background 0.1s; }
.tbl tbody tr:hover { background: #f7f9fd; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tr.rowclick { cursor: pointer; }
.strong { color: var(--ink); font-weight: 600; }
.mini-bar { width: 110px; height: 5px; background: #eef1f5; border-radius: 3px; margin: 4px 0 5px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.tag-fifo {
  font-style: normal; font-size: 10px; letter-spacing: 0.5px; color: var(--warn);
  border: 1px solid #f3d9ae; background: #fffdf8; padding: 1px 5px; border-radius: 3px; vertical-align: 2px; margin-left: 6px;
}
.life { font-family: var(--font-m); font-size: 12.5px; padding: 2px 8px; display: inline-block; border-radius: 4px; font-variant-numeric: tabular-nums; }
.life-ok { color: var(--ok); background: var(--ok-bg); }
.life-warn { color: var(--warn); background: var(--warn-bg); }
.life-bad { color: var(--bad); background: var(--bad-bg); }

/* ---------- 追溯 ---------- */
.tr-form { display: flex; gap: 10px; max-width: 560px; }
.tr-form input { flex: 1; letter-spacing: 0.5px; }
.tr-samples { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tr-samples .chip { font-size: 11.5px; }
.tr-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tr-sum > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--soft); }
.tr-sum i { font-style: normal; }
.tr-sum b { font-size: 14.5px; }
.tr-flow { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.tr-flow .panel { margin-bottom: 0; }
.tl { list-style: none; margin-left: 6px; }
.tl-i { display: flex; gap: 14px; padding: 0 0 16px; position: relative; }
.tl-i::before { content: ''; position: absolute; left: 4px; top: 14px; bottom: -2px; width: 2px; background: #eef1f5; }
.tl-last::before { display: none; }
.tl-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-bg); margin-top: 5px; flex: none; z-index: 1;
}
.tl-time { font-size: 11.5px; color: var(--faint); margin-top: 4px; flex: none; width: 62px; font-variant-numeric: tabular-nums; }
.tl-i b { font-size: 13.5px; }
.tr-reels { list-style: none; }
.tr-reels li { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.tr-reels li:last-child { border-bottom: none; }

/* ---------- 排产甘特 ---------- */
.gantt { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.g-row { display: grid; grid-template-columns: 150px 1fr; }
.g-row + .g-row { border-top: 1px solid var(--line); }
.g-line {
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 0 14px; background: var(--soft); font-size: 13px;
}
.g-line b { font-size: 13.5px; }
.g-line span { font-size: 11.5px; color: var(--faint); }
.g-head { background: #fff; }
.g-head .g-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.g-head .g-day { padding: 8px 10px; font-size: 12px; color: var(--dim); border-left: 1px solid var(--line); }
.g-head .g-day b { display: block; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-head .g-day.today { background: var(--brand-bg); color: var(--brand); }
.g-head .g-day.today b { color: var(--brand); }
.g-track { position: relative; height: 58px; background: repeating-linear-gradient(90deg, #fff 0, #fff calc(100% / 7 - 1px), var(--line) calc(100% / 7 - 1px), var(--line) calc(100% / 7)); }
.g-block {
  position: absolute; top: 9px; height: 40px; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; line-height: 1.3; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; cursor: default;
  border: 1px solid transparent; border-left-width: 3px;
}
.g-block b { font-size: 12px; font-weight: 600; }
.g-block span { font-size: 11px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.g-block b, .g-block span {
  display: block; min-width: 0; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gb-A1 { background: var(--brand-bg); border-color: #bcd2ff; border-left-color: var(--brand); color: #2860dd; }
.gb-B2 { background: var(--purple-bg); border-color: #d6ccff; border-left-color: var(--purple); color: #5c3fe0; }
.gb-C3 { background: var(--teal-bg); border-color: #b2e5d3; border-left-color: #0a8f66; color: #087a57; }
.g-block.g-done { opacity: 0.62; }
.g-block.g-plan { background: #f7f8fa; border: 1px dashed #c4c9d0; border-left: 3px solid #b3b8c0; color: var(--dim); }
.g-block.g-paused { background: var(--warn-bg); border-color: #f3d9ae; border-left-color: var(--warn); color: #b56603; }
.g-now {
  position: absolute; top: 0; bottom: 0; width: 0; z-index: 2;
  border-left: 2px dashed #f0524f; pointer-events: none;
}
.g-now.g-first::after {
  content: '今天'; position: absolute; top: 2px; left: -16px;
  font-size: 10px; color: #fff; background: #f0524f;
  padding: 1px 5px; border-radius: 3px;
}
.gantt-legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--dim); }
.gantt-legend i { display: inline-flex; align-items: center; gap: 6px; font-style: normal; }
.gantt-legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.wk-meta { display: flex; align-items: center; gap: 12px; }

/* ---------- 质量图表 ---------- */
.qc-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; margin-bottom: 16px; }
.qc-grid .panel { margin-bottom: 0; }
.spc-lim { stroke: #f0524f; stroke-width: 1.2; stroke-dasharray: 6 4; }
.spc-cl { stroke: #3fb950; stroke-width: 1.2; stroke-dasharray: 6 4; }
.spc-pt { fill: #fff; stroke: var(--brand); stroke-width: 1.5; }
.spc-pt-bad { fill: #f0524f; stroke: #f0524f; }
.spc-lbl { font-size: 10.5px; font-weight: 500; }
.pareto-bar { fill: #7ba0ff; }
.pareto-bar:hover { fill: var(--brand); }
.pareto-cum { stroke: #f0a020; stroke-width: 2; fill: none; stroke-linecap: round; }
.conf { font-variant-numeric: tabular-nums; }

/* ---------- 设备 ---------- */
.eq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.eq-card { margin-bottom: 0; }
.eq-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.eq-ico {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: var(--brand-bg); color: var(--brand); display: grid; place-items: center;
}
.eq-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eq-ico.warn { background: var(--warn-bg); color: var(--warn); }
.eq-ico.bad { background: var(--bad-bg); color: var(--bad); }
.eq-head .eq-t { flex: 1; min-width: 0; }
.eq-head b { font-size: 14px; display: block; }
.eq-head .eq-t span { font-size: 11.5px; color: var(--faint); display: block; font-family: var(--font-m); }
.eq-stats { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.eq-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.eq-row .lb { color: var(--dim); flex: none; }
.hb { width: 120px; height: 5px; background: #eef1f5; border-radius: 3px; overflow: hidden; flex: 1; max-width: 150px; }
.hb i { display: block; height: 100%; border-radius: 3px; }
.hb-ok i { background: var(--ok); } .hb-warn i { background: var(--warn); } .hb-bad i { background: var(--bad); }

/* ---------- 报表 ---------- */
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rep-grid .panel { margin-bottom: 0; }
.rep-grid2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.rep-grid2 .panel { margin-bottom: 0; }

/* ---------- 模型页 ---------- */
.model-note p { margin-top: 6px; font-size: 13.5px; }
.model-note b.hl { font-size: 15px; }
.er-wrap { overflow-x: auto; padding: 10px; }
.erdiagram { width: 100%; min-width: 760px; height: auto; }
.erd-h { font-family: var(--font); font-size: 11px; letter-spacing: 3px; fill: var(--faint); }
.erb rect { fill: #fafbfc; stroke: #d5d8de; stroke-width: 1; rx: 8; }
.erb-t { font-family: var(--font-m); font-size: 15px; font-weight: 600; fill: var(--ink); }
.erb-s { font-family: var(--font); font-size: 10.5px; fill: var(--dim); }
.erb-run rect { stroke: #9db9f5; } .erb-run .erb-t { fill: var(--brand-dk); }
.erb-prod rect { stroke: #f0c98c; } .erb-prod .erb-t { fill: var(--warn); }
.erb-mat rect { stroke: #a5e3cf; } .erb-mat .erb-t { fill: var(--teal); }
.erb-trc rect { stroke: #c9baff; } .erb-trc .erb-t { fill: var(--purple); }
.ere { fill: none; stroke: #c4c9d0; stroke-width: 1.2; }
.ere-l { font-family: var(--font); font-size: 10px; fill: var(--faint); }
.ent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ent { margin-bottom: 0; border-top: 3px solid var(--line2); }
.ent-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ent-head b { font-size: 15px; }
.ent-head span { color: var(--dim); font-size: 12px; }
.ent-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ent-fields code {
  font-family: var(--font-m); font-size: 10.5px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; background: var(--soft);
}
.ent-run { border-top-color: #9db9f5; }
.ent-prod { border-top-color: #f0c98c; }
.ent-mat { border-top-color: #a5e3cf; }
.ent-trc { border-top-color: #c9baff; }

/* ---------- 抽屉 / Toast ---------- */
#drawer-mask {
  position: fixed; inset: 0; z-index: 70; background: rgba(31, 35, 41, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.22s;
}
#drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 92vw; z-index: 71;
  background: #fff; border-left: 1px solid var(--line);
  transform: translateX(105%); transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  padding: 20px 22px; overflow-y: auto; box-shadow: -12px 0 40px rgba(31, 35, 41, 0.1);
}
.drawer.open { transform: translateX(0); }
#drawer-body { display: none; }
.drawer.open #drawer-body { display: block; }
.d-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.d-head b { font-size: 17px; }
.d-sub { color: var(--dim); font-size: 13px; margin: -10px 0 16px; }
.d-list { display: grid; grid-template-columns: auto 1fr; gap: 11px 14px; font-size: 13px; }
.d-list dt { color: var(--dim); letter-spacing: 0.5px; white-space: nowrap; }
.d-list dd { min-width: 0; overflow-wrap: break-word; }
.d-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 90px); z-index: 80;
  background: #1f2329; border-radius: 8px; color: #fff;
  font-size: 13px; padding: 11px 18px; max-width: 620px;
  opacity: 0; transition: all 0.3s ease; box-shadow: 0 8px 30px rgba(31, 35, 41, 0.35);
  line-height: 1.5;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .line-row { grid-template-columns: 1fr; }
  .dash-bottom, .tr-flow, .qc-grid, .rep-grid { grid-template-columns: 1fr; }
  .feeders, .eq-grid, .rep-grid2 { grid-template-columns: repeat(2, 1fr); }
  .ent-grid { grid-template-columns: repeat(2, 1fr); }
  .stations { flex-wrap: wrap; }
  .stn-arrow { display: none; }
  .stn { min-width: 150px; }
}
@media (max-width: 880px) {
  .side { display: none; }
  .top { left: 0; padding: 0 14px; }
  .search { display: none; }
  .main { margin-left: 0; padding: 16px 14px 48px; }
  .kpi-row, .ent-grid, .tr-sum, .eq-grid, .rep-grid2, .feeders { grid-template-columns: 1fr; }
  .top-plant, .clock { display: none; }
}
