/* ============================================================
   MSKING MES · Apple 设计语言
   ============================================================ */
:root {
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-press: #006edb;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --hairline: rgba(0, 0, 0, 0.10);
  --hairline-light: rgba(0, 0, 0, 0.06);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #7856ff;
  --teal: #30b0c7;
  --pink: #ff2d55;
  --indigo: #5856d6;
  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 10px;
  /* 语义化填充色（深色模式整体覆盖） */
  --panel: #ffffff;
  --panel-2: #f5f5f7;
  --panel-3: #fafafc;
  --border: rgba(0, 0, 0, 0.12);
  --hover-bg: rgba(0, 0, 0, 0.05);
  --ctrl-bg: rgba(0, 0, 0, 0.06);
  --ctrl-bg-hover: rgba(0, 0, 0, 0.10);
  --placeholder: #b0b0b6;
  --mask: rgba(0, 0, 0, 0.32);
  --scroll: rgba(0, 0, 0, 0.16);
  --scroll-hover: rgba(0, 0, 0, 0.28);
  --serial-color: #0b5fbf;
  --serial-bg: rgba(0, 113, 227, 0.09);
  --tag-green: #248a3d;
  --tag-orange: #b25a00;
  --tag-red: #d1241b;
  --tag-purple: #5b34c4;
  --login-bg:
    radial-gradient(1200px 700px at 50% -10%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, #fbfbfd 0%, #eef0f4 100%);
  --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-m: 0 8px 28px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-l: 0 24px 60px rgba(0, 0, 0, 0.13), 0 4px 14px rgba(0, 0, 0, 0.05);
  --nav-h: 52px;
  --side-w: 236px;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.022em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--login-bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-solid);
  border-radius: 28px;
  box-shadow: var(--shadow-l);
  padding: 48px 44px 40px;
  animation: rise 0.6s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(145deg, #1d1d1f, #43434a);
  color: #fff; display: grid; place-items: center;
  font-size: 26px; margin-bottom: 22px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.login-card h1 { font-size: 30px; line-height: 1.15; }
.login-sub { color: var(--text-2); margin-top: 8px; font-size: 15px; }
.login-tip { margin-top: 26px; font-size: 12.5px; color: var(--text-3); background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px 14px; line-height: 1.7; }
.err-box { background: rgba(255, 59, 48, 0.08); color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-top: 14px; }

/* 登录页：记住账号 */
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.chk input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; margin: 0; }
/* 订单流水线：多选工单的复选框（深色/浅色主题下均清晰） */
.chk-row, #chkAll { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; margin: 0; vertical-align: middle; }
table.tbl-row th:first-child, table.tbl-row td:first-child { padding-right: 4px; }
.acc-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 10px; font-size: 12.5px; color: var(--text-1); transition: all .15s;
}
.acc-chip:hover { background: var(--ctrl-bg-hover); border-color: var(--blue); color: var(--blue); }
.acc-chip b { color: var(--text-3); font-weight: 400; font-size: 11px; padding: 0 2px; }
.acc-chip b:hover { color: var(--red); }

.acc-combo { position: relative; display: flex; align-items: stretch; gap: 8px; }
.acc-combo .input { flex: 1; }
.acc-toggle {
  width: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  color: var(--text-2); cursor: pointer; font-size: 13px; line-height: 1; font-family: inherit;
}
.acc-toggle:hover { border-color: var(--blue); color: var(--blue); }
.acc-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.18)); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.acc-menu-head { padding: 8px 12px; font-size: 11.5px; color: var(--text-3); background: var(--panel-2); }
.acc-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; border-top: 1px solid var(--border); }
.acc-item:first-of-type { border-top: 0; }
.acc-item:hover { background: var(--ctrl-bg-hover, var(--panel-2)); }
.acc-item-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.acc-item-main b { font-size: 13.5px; color: var(--text-1); }
.acc-item-main span { font-size: 12px; color: var(--text-3); font-family: ui-monospace, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-del { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.acc-del:hover { color: var(--red); }

/* 新建工单：导入区 */
.import-tabs { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; gap: 2px; }
.import-tabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; font-family: inherit; }
.import-tabs button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.dropzone-multi { border: 1.5px dashed var(--border); border-radius: 14px; padding: 22px; text-align: center; background: var(--panel-3); cursor: pointer; transition: all .15s; }
.dropzone-multi:hover, .dropzone-multi.over { border-color: var(--blue); background: rgba(0,113,227,.04); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); margin-top: 8px; font-size: 13px; }
.file-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serial-tag { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; font-weight: 600; color: var(--serial-color); background: var(--serial-bg); border-radius: 6px; padding: 2px 8px; }
table.tbl-row tbody tr:hover { background: var(--hover-bg); }

/* ============ 表单控件 ============ */
.field { margin-top: 18px; }
.label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel);
  transition: border-color .18s, box-shadow .18s; outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23868' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ============ 按钮 ============ */
.btn {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; border-radius: 980px; padding: 9px 18px;
  background: var(--blue); color: #fff;
  transition: background .18s var(--ease), transform .12s, opacity .18s;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap;
}
.btn:hover { background: var(--blue-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; padding: 14px; font-size: 16px; margin-top: 24px; border-radius: 14px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-ghost { background: transparent; color: var(--blue); border: 1px solid rgba(0, 113, 227, .35); }
.btn-ghost:hover { background: rgba(0, 113, 227, .07); }
.btn-secondary { background: var(--ctrl-bg); color: var(--text); }
.btn-secondary:hover { background: var(--ctrl-bg-hover); }
.btn-dark { background: #1d1d1f; }
.btn-dark:hover { background: #000; }
.btn-danger { background: rgba(255, 59, 48, .1); color: var(--red); }
.btn-danger:hover { background: rgba(255, 59, 48, .18); }
.btn-solid-danger { background: var(--red); color: #fff; }
.btn-solid-danger:hover { background: #d92c22; }

/* ============ 布局 ============ */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 100;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; padding: 0 22px; gap: 18px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.nav-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(145deg, #1d1d1f, #4a4a52); color: #fff; display: grid; place-items: center; font-size: 14px; }
.nav-sub { color: var(--text-3); font-size: 12px; font-weight: 400; border-left: 1px solid var(--hairline); padding-left: 14px; margin-left: 2px; }
.nav-spacer { flex: 1; }
.nav-clock { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.nav-ver { font-size: 11px; color: var(--text-3); opacity: .75; user-select: none; }
.nav-user { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 5px 12px 5px 5px; border-radius: 980px; transition: background .18s; }
.nav-user:hover { background: var(--hover-bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(145deg, #0071e3, #5ac8fa); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.nav-user .nm { font-size: 13px; font-weight: 500; }
.nav-user .rl { font-size: 11px; color: var(--text-3); }

.side {
  position: fixed; top: var(--nav-h); bottom: 0; left: 0; width: var(--side-w); z-index: 90;
  padding: 14px 12px; overflow-y: auto;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--hairline-light);
}
.side-group { font-size: 11px; color: var(--text-3); padding: 14px 12px 6px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.side-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); cursor: pointer; font-size: 13.5px; font-weight: 500;
  transition: background .16s, color .16s; margin-bottom: 2px; user-select: none;
}
.side-item .ic { width: 20px; text-align: center; font-size: 15px; opacity: .85; }
.side-item:hover { background: var(--hover-bg); }
.side-item.active { background: var(--blue); color: #fff; }
.side-item.active .ic { opacity: 1; }
.side-item .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; font-weight: 600; }
.side-item.active .badge { background: rgba(255, 255, 255, .28); }

.main {
  position: relative; margin-left: var(--side-w); padding-top: var(--nav-h);
  min-height: 100vh;
}
.page { padding: 34px 40px 80px; max-width: 1400px; animation: fade .45s var(--ease) both; }
/* v15：订单流水线列多，1920 屏也被 1400 上限挤到横向滚动；该页单独放开宽度并收紧单元格 */
/* v15/v16：订单流水线列多，单页放开 1400 上限并收紧单元格；
   操作列固定在最右侧，窄屏横向滚动时「工艺」入口也不会滑出视野 */
.page.page-wide { max-width: none; padding-left: 24px; padding-right: 24px; }
.page.page-wide table { font-size: 13px; }
.page.page-wide thead th, .page.page-wide tbody td { padding-left: 8px; padding-right: 8px; }
.page.page-wide table.tbl-row .status-cell { white-space: normal; }
.page.page-wide table.tbl-row .status-cell > .wrap-gap { max-width: 138px; }
.page.page-wide table.tbl-row thead th:last-child,
.page.page-wide table.tbl-row tbody td:last-child {
  position: sticky; right: 0; z-index: 2; background: var(--surface-solid);
  border-left: 1px solid var(--hairline-light);
}
.page.page-wide table.tbl-row thead th:last-child { background: var(--panel-3); z-index: 3; }
.page.page-wide table.tbl-row tbody tr:hover td:last-child { background: var(--panel-3); }
.page.page-wide .tbl-actions .btn { padding-left: 9px; padding-right: 9px; }
@media (max-width: 1180px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 26px; }
.page-title { font-size: 34px; letter-spacing: -0.028em; }
.page-desc { color: var(--text-2); font-size: 15px; margin-top: 6px; }
.head-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head-row .grow { flex: 1; min-width: 200px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; padding: 8px 12px; font-size: 13.5px; border-radius: 9px; }

/* v19：报工页搜索框（图号 / 流水号 / 工单号） */
.task-search { position: relative; display: flex; align-items: center; flex: 0 0 250px; width: 250px; }
.task-search .input { width: 100%; padding-right: 32px; }
.task-search input[type="search"]::-webkit-search-cancel-button,
.task-search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.ts-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: none; padding: 3px 7px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-3); font-size: 12px; line-height: 1; cursor: pointer;
}
.task-search .input:not(:placeholder-shown) ~ .ts-clear { display: block; }
.ts-clear:hover { background: var(--hover-bg); color: var(--text); }
.kw-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -4px 0 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--hairline-light);
  font-size: 12.5px; color: var(--text-2);
}
.kw-bar[hidden] { display: none; }
.kw-bar .kw-txt b { color: var(--text); }

/* ============ 卡片 ============ */
.card {
  background: var(--surface-solid); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-s); padding: 22px 24px; border: 1px solid var(--hairline-light);
}
.card-pad-sm { padding: 16px 18px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 780px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } .page { padding: 24px 18px 60px; } }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.kpi .l { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .d { font-size: 12px; color: var(--text-3); }
.kpi .icon { font-size: 20px; opacity: .9; }
.kpi-row { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi.accent .v { color: var(--blue); }
.kpi.green .v { color: var(--green); }
.kpi.orange .v { color: var(--orange); }
.kpi.red .v { color: var(--red); }

/* Hero */
.hero {
  background: linear-gradient(160deg, #1d1d1f 0%, #3a3a41 55%, #4c4c55 100%);
  color: #fff; border-radius: 26px; padding: 34px 38px; margin-bottom: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -80px; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, .45), transparent 62%);
}
.hero h1 { font-size: 32px; letter-spacing: -0.03em; }
.hero p { color: rgba(255, 255, 255, .7); font-size: 15px; margin: 8px 0 22px; }
.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stats .n { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-stats .t { font-size: 12.5px; color: rgba(255, 255, 255, .62); margin-top: 2px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px;
  padding: 10px 14px; background: var(--panel-3); border-bottom: 1px solid var(--hairline);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--hairline-light); vertical-align: middle; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--hover-bg); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-actions { display: flex; gap: 6px; justify-content: flex-end; }
.link { color: var(--blue); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
/* v16：工艺版本徽标兼作工艺编辑器入口 */
.rt-link { cursor: pointer; display: inline-flex; border-radius: 980px; }
.rt-link:hover .tag { box-shadow: 0 0 0 2px rgba(0, 113, 227, .28); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .em { font-size: 40px; opacity: .35; margin-bottom: 10px; }

/* ============ 徽标 ============ */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 980px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
}
.tag-dot { width: 6px; height: 6px; border-radius: 50%; }
.t-gray { background: rgba(0, 0, 0, .06); color: var(--text-2); }
.t-blue { background: rgba(0, 113, 227, .12); color: var(--blue); }
.t-green { background: rgba(52, 199, 89, .14); color: var(--tag-green); }
.t-orange { background: rgba(255, 149, 0, .16); color: var(--tag-orange); }
.t-red { background: rgba(255, 59, 48, .13); color: var(--tag-red); }
.t-purple { background: rgba(120, 86, 255, .14); color: var(--tag-purple); }
.t-amber { background: rgba(255, 179, 0, .18); color: #a3650a; }
:root[data-theme="dark"] .t-amber { background: rgba(255, 179, 0, .2); color: #ffce54; }
.t-teal { background: rgba(0, 199, 190, .16); color: #00736d; }
:root[data-theme="dark"] .t-teal { background: rgba(0, 199, 190, .2); color: #4fd8d1; }
.t-indigo { background: rgba(88, 86, 214, .14); color: #3f3db0; }
:root[data-theme="dark"] .t-indigo { background: rgba(88, 86, 214, .24); color: #a5a3ff; }

/* 工序胶囊 */
.step-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #fff;
}
/* 工序流程链 */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.flow-arrow { color: var(--text-3); font-size: 12px; }

/* 进度条 */
.bar { height: 6px; border-radius: 4px; background: var(--ctrl-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--blue); transition: width .6s var(--ease); }

/* ============ 弹层 ============ */
.mask {
  position: fixed; inset: 0; background: var(--mask); z-index: 200;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  animation: fadeIn .22s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--panel); border-radius: 22px; width: 100%; max-width: 520px; border: 1px solid var(--hairline-light);
  box-shadow: var(--shadow-l); max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .3s var(--ease) both;
}
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: min(1240px, 95vw); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96) } to { opacity: 1; transform: none } }
.modal-head { padding: 22px 26px 16px; border-bottom: 1px solid var(--hairline-light); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 19px; }
.modal-body { padding: 22px 26px; overflow-y: auto; }
.modal-foot { padding: 16px 26px 20px; border-top: 1px solid var(--hairline-light); display: flex; gap: 10px; justify-content: flex-end; }
.x { cursor: pointer; width: 28px; height: 28px; border-radius: 50%; background: var(--ctrl-bg); display: grid; place-items: center; color: var(--text-2); font-size: 15px; border: none; }
.x:hover { background: var(--ctrl-bg-hover); }

/* Toast */
.toasts { position: fixed; top: 66px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  background: rgba(29, 29, 31, .92); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 13.5px;
  box-shadow: var(--shadow-m); animation: slideIn .32s var(--ease) both; max-width: 380px;
  backdrop-filter: blur(10px);
}
.toast.ok { background: rgba(36, 138, 61, .95); }
.toast.err { background: rgba(209, 36, 27, .95); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px) } to { opacity: 1; transform: none } }

/* 任务卡片 */
.task-card {
  background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-s);
  border: 1px solid var(--hairline-light); padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.task-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-m); }
.task-card.running { border-left: 4px solid var(--orange); }
.task-card.ready { border-left: 4px solid var(--blue); }
.task-card.outs { border-left: 4px solid var(--purple); }
.tc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-no { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tc-name { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.tc-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tc-bar { display: flex; align-items: center; gap: 10px; }
.tc-bar .bar { flex: 1; }
.tc-bar .t { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============ 报工界面：横向长条任务行（一行 = 一道工序） ============
   v17：改成固定列宽 + 每列统一「主行 / 次行」两行结构，各行左缘对齐；
        不再显示图纸名称与进度条，改为 图纸编号 + 流水号 + 材质 + 已交接/计划 */
.task-rows { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  background: var(--panel); border: 1px solid var(--hairline-light); border-left: 3px solid var(--blue);
  border-radius: var(--radius); padding: 10px 16px 10px 13px; cursor: pointer;
  display: grid;
  /* 列宽按内容定死、剩余空间由 space-between 均分，各列间距才一致（v17） */
  grid-template-columns: 296px 116px 152px 104px 104px 156px;
  justify-content: space-between;
  gap: 14px; align-items: center;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.task-row:hover { box-shadow: var(--shadow-m); transform: translateY(-1px); }
.task-row.running { border-left-color: var(--orange); }
.task-row.outs { border-left-color: var(--purple); }
/* v18：等上道的工序能看到但不可操作——灰边 + 主信息降一级，避免和能干的活抢注意力 */
.task-row.waiting { border-left-color: #c7c7cc; background: var(--panel-2); }
.task-row.waiting .tr-pn { color: var(--text-2); }
.task-row.waiting .tr-qty .n { color: var(--text-2); }
:root[data-theme="dark"] .task-row.waiting { border-left-color: #48484a; }
.task-row .tr-main { min-width: 0; }
.task-row .tr-no { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.task-row .tr-pn {
  font-size: 15px; font-weight: 600; letter-spacing: -.005em; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-row .tr-sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.task-row .tr-sub .serial-tag { font-size: 11px; padding: 1px 6px; font-weight: 600; }
.task-row .tr-dot { opacity: .45; }
.task-row .tr-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.task-row .tr-col .ln { display: flex; align-items: center; gap: 6px; min-height: 20px; white-space: nowrap; }
.task-row .tr-col .ln2 { display: flex; align-items: center; gap: 6px; min-height: 18px; font-size: 11.5px; white-space: nowrap; color: var(--text-3); }
.task-row .tr-qty { font-variant-numeric: tabular-nums; }
.task-row .tr-qty .n { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.task-row .tr-qty .n .sep { color: var(--text-3); font-weight: 400; margin: 0 4px; }
.task-row .tr-qty .t { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.task-row .tr-due .ln { font-variant-numeric: tabular-nums; }
.task-row .tr-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.task-row .tr-extra {
  grid-column: 1 / -1; font-size: 12px; color: var(--text-2);
  background: var(--panel-2); border-radius: 8px; padding: 7px 10px;
}
@media (max-width: 1340px) {
  .task-row { grid-template-columns: minmax(200px, 1fr) 112px 144px 100px 100px 148px; gap: 12px; }
}
@media (max-width: 1190px) {
  /* 窄屏：图纸信息独占一行，下面一行并排 工序 / 状态 / 数量 / 交期 / 操作 */
  .task-row { grid-template-columns: 118px minmax(110px, 1fr) 92px 96px auto; row-gap: 10px; }
  .task-row .tr-main { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .task-row { grid-template-columns: 1fr; }
  .task-row .tr-main { grid-column: auto; }
  .task-row .tr-actions { grid-column: auto; }
}

/* 文件上传 */
.dropzone {
  border: 1.5px dashed rgba(0, 113, 227, .35); border-radius: var(--radius); padding: 26px;
  text-align: center; cursor: pointer; background: rgba(0, 113, 227, .03); transition: .18s;
}
.dropzone:hover, .dropzone.over { background: rgba(0, 113, 227, .07); border-color: var(--blue); }
.dropzone .dz-ic { font-size: 30px; opacity: .5; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius-sm); }
.viewer { background: var(--panel-2); border-radius: var(--radius); min-height: 420px; display: grid; place-items: center; overflow: hidden; }
.viewer img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.viewer iframe { width: 100%; height: 72vh; border: none; background: #fff; }

/* 分段控件 */
.seg { display: inline-flex; background: var(--hover-bg); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 6px 14px; border-radius: 7px; cursor: pointer; transition: .18s; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-s); }

/* 工序编辑器 */
.step-row { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: var(--radius); background: var(--panel-3); border: 1px solid var(--hairline-light); margin-bottom: 6px; transition: box-shadow .12s, opacity .12s; }
.step-idx { width: 26px; height: 26px; border-radius: 8px; background: #1d1d1f; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; cursor: grab; user-select: none; }
.step-idx:active { cursor: grabbing; }
.step-row.dragging { opacity: .35; }
.step-row.drop-before { box-shadow: inset 0 2px 0 var(--blue); }
.step-row.drop-after { box-shadow: inset 0 -2px 0 var(--blue); }
.step-fields { flex: 1; display: grid; grid-template-columns: 108px 1fr 96px; gap: 8px; }
.step-fields .input, .step-fields .select { padding: 8px 10px; font-size: 13px; }
.step-del { border: none; background: rgba(255, 59, 48, .1); color: var(--red); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; flex: none; }
.step-del:hover { background: rgba(255, 59, 48, .2); }
.palette { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.palette .step-chip { cursor: pointer; transition: transform .15s; }
.palette .step-chip:hover { transform: translateY(-2px); }

/* 图表 */
.chart { width: 100%; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

/* 流转时间线 */
.timeline { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 8px; }
.tl-item { min-width: 132px; flex: 1; position: relative; text-align: left; padding-right: 12px; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 15px; right: -6px; height: 2px; background: var(--hairline); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; position: relative; z-index: 1; }
.tl-name { font-size: 13px; font-weight: 600; margin-top: 8px; }
.tl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }

.stat-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline-light); }
.stat-line:last-child { border-bottom: none; }
.stat-line .bar { flex: 1; }
.stat-line .nm { width: 86px; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-line .vv { width: 78px; text-align: right; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--hairline-light); margin: 16px 0; }

/* v18 工序详情：当前道高亮 + 折叠的完整工艺路线 */
tr.step-cur td { background: rgba(0, 113, 227, .07); }
tr.step-cur td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
details.fold { border: 1px solid var(--hairline-light); border-radius: var(--radius); padding: 10px 14px; background: var(--panel-2); }
details.fold > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '▸ '; color: var(--text-3); }
details.fold[open] > summary::before { content: '▾ '; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; } .mt-28 { margin-top: 28px; }
.mb-8 { margin-bottom: 8px; } .mb-14 { margin-bottom: 14px; }
.flex-1 { flex: 1; } .center { display: flex; align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.loading { text-align: center; padding: 60px; color: var(--text-3); }
.spinner { width: 26px; height: 26px; border: 3px solid rgba(0, 0, 0, .1); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ============================================================
   深色主题（data-theme="dark" 时整体覆盖；跟随系统由 JS 解析后写入）
   ============================================================ */
:root[data-theme="dark"] {
  --blue: #0a84ff;
  --blue-hover: #409cff;
  --blue-press: #006edb;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8e8e93;
  --bg: #000000;
  --surface: rgba(28, 28, 30, 0.72);
  --surface-solid: #1c1c1e;
  --hairline: rgba(255, 255, 255, 0.14);
  --hairline-light: rgba(255, 255, 255, 0.08);
  --panel: #1c1c1e;
  --panel-2: #2c2c2e;
  --panel-3: #242426;
  --border: rgba(255, 255, 255, 0.16);
  --hover-bg: rgba(255, 255, 255, 0.08);
  --ctrl-bg: rgba(255, 255, 255, 0.10);
  --ctrl-bg-hover: rgba(255, 255, 255, 0.16);
  --placeholder: #636366;
  --mask: rgba(0, 0, 0, 0.55);
  --scroll: rgba(255, 255, 255, 0.24);
  --scroll-hover: rgba(255, 255, 255, 0.36);
  --serial-color: #7db8ff;
  --serial-bg: rgba(10, 132, 255, 0.20);
  --tag-green: #30d158;
  --tag-orange: #ffb340;
  --tag-red: #ff6961;
  --tag-purple: #ac8dff;
  --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.4);
  --shadow-m: 0 8px 28px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-l: 0 24px 60px rgba(0, 0, 0, 0.65), 0 4px 14px rgba(0, 0, 0, 0.4);
  --login-bg:
    radial-gradient(1200px 700px at 50% -10%, #161617 0%, transparent 60%),
    linear-gradient(180deg, #000000 0%, #101012 100%);
}

/* 深色下少数组件的微调 */
:root[data-theme="dark"] .login-logo {
  background: linear-gradient(145deg, #2c2c2e, #48484e);
  border: 1px solid var(--hairline);
}
:root[data-theme="dark"] .nav-mark { background: linear-gradient(145deg, #3a3a3c, #54545c); }
:root[data-theme="dark"] .btn-dark { background: #3a3a3c; color: #fff; }
:root[data-theme="dark"] .btn-dark:hover { background: #48484e; }
:root[data-theme="dark"] .step-idx { background: #3a3a3c; }
:root[data-theme="dark"] .hero { box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .toast { border: 1px solid var(--hairline); }
:root[data-theme="dark"] .spinner { border-color: rgba(255, 255, 255, .14); border-top-color: var(--blue); }
:root[data-theme="dark"] .modal { box-shadow: var(--shadow-l); }

/* 主题切换 segmented（账号弹窗内） */
.theme-seg { display: flex; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.theme-seg button {
  flex: 1; border: none; background: transparent; color: var(--text-2);
  padding: 7px 0; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-family: inherit; transition: all .15s;
}
.theme-seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow-s); }

/* ============ 列表分页 ============ */
.pager {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 18px; margin-top: 14px; padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-s); font-size: 13px; color: var(--text-2);
}
.pager-side, .pager-main, .pager-jump { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* v4 Q1B：左侧留信息，页码组 + 跳转合并靠右下角 */
.pager-side { margin-right: auto; }
.pager-main, .pager-jump { margin-left: 0; }
.pager b { color: var(--text); }
.pager-sep { color: var(--text-3); }
.pager .select.pager-size {
  width: auto; min-width: 0; padding: 5px 30px 5px 10px; font-size: 12.5px;
  border-radius: 8px; background-position: right 8px center;
}
.pager-main button {
  min-width: 30px; height: 30px; padding: 0 8px; font: inherit; font-size: 12.5px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2);
  border-radius: 8px; cursor: pointer; transition: border-color .15s, color .15s;
}
.pager-main button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pager-main button:disabled { opacity: .38; cursor: not-allowed; }
.pager-main button.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.pager-ell { color: var(--text-3); padding: 0 2px; user-select: none; }
.pager-jump .input { width: 68px; padding: 5px 8px; font-size: 12.5px; border-radius: 8px; text-align: center; }
.pager-jump .btn { height: 30px; }
.pager-note { font-size: 12px; color: var(--text-3); }

/* 搜索框：避免浏览器密码管理器把用户名误填进来 */
.input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
/* 账号弹窗的自动填充锚点：不可见但能被浏览器识别 */
.autofill-anchor { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ============ v20：扫码 / 图号复制 ============ */
/* 图号是拿来复制的：这一格不触发弹窗，鼠标保持文本光标，可拖选 */
.no-open { cursor: text; }
/* 扫到的行闪一下，车间远距离也能确认扫对了 */
@keyframes scanHit {
  0%, 55% { background-color: rgba(0, 113, 227, 0.16); }
  100% { background-color: transparent; }
}
tr.scan-hit, .task-row.scan-hit { animation: scanHit 2.4s ease-out 1; }
tr.scan-hit > td { background-color: transparent; }
