:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1f2733;
  --ink-2: #5b6675;
  --line: #e4e9f0;
  --brand: #2f6bff;
  --brand-d: #1f4fd0;
  --ok: #1faa6b;
  --warn: #d98a00;
  --bad: #e0483b;
  --shadow: 0 1px 3px rgba(20,30,60,.08), 0 6px 20px rgba(20,30,60,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6bff 0%, #1f4fd0 100%); }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 34px 30px;
  box-shadow: 0 18px 50px rgba(10,30,80,.28); }
.login-logo { font-size: 22px; font-weight: 700; color: var(--brand-d); }
.login-sub { color: var(--ink-2); font-size: 12px; letter-spacing: .5px; margin: 4px 0 22px; }
.login-card label { display: block; margin: 12px 0 6px; color: var(--ink-2); font-size: 13px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none; }
.login-card input:focus { border-color: var(--brand); }
.login-card button[type=submit] { width: 100%; margin-top: 20px; padding: 11px;
  background: var(--brand); color: #fff; border: none; border-radius: 8px; font-size: 15px; }
.login-card button[type=submit]:hover { background: var(--brand-d); }
.form-err { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--ink-2); text-align: center; }

/* ---------- 主框架 ---------- */
.app-shell { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #0f1b34; color: #cdd6e6; flex-shrink: 0;
  display: flex; flex-direction: column; }
.brand { padding: 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { padding: 10px 8px; overflow-y: auto; }
.nav-item { padding: 10px 14px; border-radius: 8px; margin: 2px 0; color: #cdd6e6;
  cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 12px; }
.nav-group { font-size: 11px; color: #6b7896; padding: 8px 14px 4px; letter-spacing: .5px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.page-title { font-size: 17px; font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; }
.user-role { background: #eef3ff; color: var(--brand-d); padding: 3px 9px; border-radius: 20px; font-size: 12px; }
.btn-ghost { background: transparent; border: 1px solid var(--line); padding: 6px 12px;
  border-radius: 7px; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.content { padding: 22px; overflow-y: auto; flex: 1; }

/* ---------- 卡片 / 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.stat-card .n { font-size: 28px; font-weight: 700; }
.stat-card .t { color: var(--ink-2); margin-top: 6px; font-size: 13px; }

.panel { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 15px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-2); font-weight: 600; background: #fafbfd; }
tbody tr:hover { background: #f7f9fd; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.b-draft { background: #eef1f6; color: #5b6675; }
.b-pending { background: #fff4e0; color: #b9760a; }
.b-approved { background: #e6f6ee; color: #1faa6b; }
.b-producing { background: #e6f0ff; color: #2f6bff; }
.b-ship { background: #f0e9ff; color: #7a4fd0; }
.b-signed { background: #e6f6ee; color: #1faa6b; }
.b-after { background: #fff0f0; color: #e0483b; }
.b-done { background: #e8eaee; color: #3a4456; }
.b-cancel { background: #f1f1f1; color: #8a94a3; text-decoration: line-through; }

/* ---------- 按钮 ---------- */
.btn { background: var(--brand); color: #fff; border: none; padding: 8px 14px; border-radius: 8px; font-size: 13px; }
.btn:hover { background: var(--brand-d); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-line { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-line:hover { background: #eef3ff; }
.btn-ghost-sm { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost-sm:hover { border-color: var(--ink-2); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.role-hint { font-size: 11px; color: var(--ink-2); margin-left: 6px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,27,52,.45); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; width: 560px; max-width: 92vw; max-height: 86vh; overflow: auto;
  border-radius: 12px; box-shadow: 0 20px 60px rgba(10,30,80,.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-x { background: none; border: none; font-size: 22px; color: var(--ink-2); }
.modal-body { padding: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 13px; }
.field input, .field select { width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; }
.line-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.line-row input, .line-row select { padding: 8px; }
.icon-btn { background: #fff0f0; color: var(--bad); border: 1px solid #f3c9c4; border-radius: 7px; padding: 8px 10px; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: #1f2733;
  color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.ok { background: #1faa6b; }
.toast.err { background: #e0483b; }

.empty { text-align: center; color: var(--ink-2); padding: 40px 0; }
.muted { color: var(--ink-2); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.sec-tip { background: #fafbfd; border: 1px dashed var(--line); border-radius: 10px; padding: 16px; color: var(--ink-2); }
.tag-2 { background:#eef3ff; color:var(--brand-d); padding:2px 8px; border-radius:6px; font-size:12px; }

/* ---------- 网站基础配置表 ---------- */
.cfg-tbl td { vertical-align: middle; }
.cfg-label { width: 220px; color: var(--ink-1); font-weight: 500; }
.cfg-input { padding: 8px 10px; }
.cfg-op { width: 90px; text-align: right; }
.cfg-input input[disabled], .cfg-input textarea[disabled], .cfg-input select[disabled] { background: #f4f5f7; color: var(--ink-2); }

/* ---------- 通知铃铛 / 徽标 ---------- */
.notify-bell { position: relative; margin-right: 4px; }
.notify-badge { position: absolute; top: -6px; right: -8px; background: #e0483b; color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 999px; font-weight: 600; }
.dot-unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #e0483b; margin-right: 7px; vertical-align: middle; }

/* ---------- 报表中心 ---------- */
.report-filter { display: flex; align-items: center; gap: 8px; }
.report-filter input[type="date"] { padding: 5px 8px; border: 1px solid var(--line, #e3e6eb); border-radius: 6px; font-size: 13px; }
.rp-sep { color: #98a1ad; }
.report-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; border-bottom: 1px solid var(--line, #eef0f3); margin-bottom: 14px; }
.report-tab { padding: 6px 14px; border-radius: 999px; font-size: 13px; color: #5b6472; cursor: pointer; border: 1px solid transparent; }
.report-tab:hover { background: #f2f5f9; }
.report-tab.active { background: #2f6bff; color: #fff; font-weight: 600; }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .report-cols { grid-template-columns: 1fr; } }
.bar-box { padding: 4px 0 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bar-label { width: 110px; flex: none; font-size: 13px; color: #3a4250; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 14px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #2f6bff, #6a9bff); border-radius: 4px; }
.bar-value { width: 110px; flex: none; text-align: right; font-size: 13px; color: #1f2733; font-variant-numeric: tabular-nums; }

/* ---------- 系统基础：角色权限矩阵 ---------- */
.role-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .role-layout { grid-template-columns: 1fr; } }
.role-list { border: 1px solid var(--line, #eef0f3); border-radius: 10px; overflow: hidden; }
.role-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f2f4f7; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.role-item:last-child { border-bottom: none; }
.role-item:hover { background: #f6f8fb; }
.role-item.active { background: #eaf0ff; border-left: 3px solid #2f6bff; }
.role-name { font-size: 14px; font-weight: 600; color: #1f2733; }
.role-detail { min-height: 300px; }
.role-side { display: flex; flex-direction: column; gap: 10px; }
.role-side-head { display: flex; gap: 8px; }
.role-ops { display: flex; gap: 4px; flex-shrink: 0; }
.role-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.role-desc { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.perm-group { margin-bottom: 14px; }
.perm-module { font-size: 13px; font-weight: 700; color: #2f6bff; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.perm-module-ops { display: inline-flex; gap: 4px; text-transform: none; letter-spacing: 0; }
.perm-items { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line, #e3e6eb); border-radius: 8px; font-size: 13px; cursor: pointer; background: #fff; }
.perm-item:hover { border-color: #2f6bff; }
.perm-item input { accent-color: #2f6bff; width: 16px; height: 16px; }
.perm-code { color: #98a1ad; font-size: 12px; }
.btn-danger { background: #e0483b; color: #fff; }
.btn-danger:hover { background: #c93a2f; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 5px; }
.btn-danger-text { color: var(--bad); border-color: #f3c9c4; }
.btn-danger-text:hover { border-color: var(--bad); background: #fff5f4; }
.form-hint { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
/* 移动端抽屉：桌面端隐藏开关 */
.nav-toggle { display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  width: 38px; height: 38px; font-size: 18px; color: var(--ink); line-height: 1; flex-shrink: 0; }
.nav-mask { display: none; }

/* ---------- 订单详情 / 附件上传 ---------- */
.link-no { color: #2f6bff; text-decoration: none; cursor: pointer; }
.link-no:hover { text-decoration: underline; }
.req { color: #e0483b; }
.att-upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.att-upload-row input[type="file"] { flex: 1; min-width: 220px; padding: 7px; border: 1px dashed var(--line, #d7dce3); border-radius: 8px; background: #fafbfd; font-size: 13px; }
.att-upload-row select { padding: 8px; border: 1px solid var(--line, #d7dce3); border-radius: 8px; font-size: 13px; background: #fff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 全局搜索（顶栏） ---------- */
.global-search { position: relative; flex: 1; max-width: 460px; margin: 0 18px; }
.global-search input {
  width: 100%; padding: 9px 34px 9px 14px; border: 1px solid var(--line, #d7dce3);
  border-radius: 20px; font-size: 13.5px; background: #f7f9fd; outline: none;
}
.global-search input:focus { border-color: var(--brand, #2f6bff); background: #fff; box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.gs-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .55; pointer-events: none; }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line, #d7dce3); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20,40,80,.16); padding: 6px; z-index: 60;
}
.search-results .gs-group-title { font-size: 12px; color: var(--ink-2, #5b6675); padding: 8px 10px 4px; font-weight: 600; }
.search-results .gs-empty { padding: 18px 10px; color: var(--ink-2, #5b6675); text-align: center; font-size: 13px; }
.search-results .gs-item {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.search-results .gs-item:hover { background: #f2f6ff; }
.search-results .gs-item .t { font-size: 13.5px; font-weight: 600; color: #1c2530; }
.search-results .gs-item .s { font-size: 12px; color: var(--ink-2, #5b6675); }

/* ---------- 列表筛选 / 排序工具条 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px;
  background: #fafbfd; border: 1px solid var(--line, #d7dce3); border-radius: 10px; padding: 10px 12px;
}
.filter-bar input.fb-q {
  flex: 1; min-width: 200px; padding: 8px 12px; border: 1px solid var(--line, #d7dce3);
  border-radius: 8px; font-size: 13px; background: #fff; outline: none;
}
.filter-bar input.fb-q:focus { border-color: var(--brand, #2f6bff); }
.filter-bar select {
  padding: 8px 10px; border: 1px solid var(--line, #d7dce3); border-radius: 8px; font-size: 13px; background: #fff;
}
.filter-bar .fb-dir, .filter-bar .fb-clear {
  padding: 8px 12px; border: 1px solid var(--line, #d7dce3); border-radius: 8px; font-size: 13px;
  background: #fff; cursor: pointer; color: #1c2530;
}
.filter-bar .fb-dir:hover, .filter-bar .fb-clear:hover { border-color: var(--brand, #2f6bff); color: var(--brand, #2f6bff); }
.filter-bar .fb-dir.asc { color: var(--brand, #2f6bff); border-color: var(--brand, #2f6bff); }
.filter-bar .fb-count { margin-left: auto; font-size: 12.5px; color: var(--ink-2, #5b6675); }


/* ===== 三期改造：仪表盘图表 / 生产看板 / 自定义报表 / 采购 ===== */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart-box { height: 240px; width: 100%; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.board-card { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px; background: var(--card, #fff); }
.board-card.late { border-color: #e05252; background: #fdf3f3; }
.bc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.bc-sub { font-size: 12.5px; color: var(--ink-2, #5b6675); margin-bottom: 8px; }
.bc-bar { height: 8px; border-radius: 4px; background: #eef1f6; overflow: hidden; }
.bc-bar-in { height: 100%; border-radius: 4px; background: var(--brand, #2f6bff); transition: width .3s; }
.bc-bar-in.late { background: #e05252; }
.bc-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2, #5b6675); margin-top: 6px; }
.late-text { color: #e05252; font-weight: 600; }
.cr-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cr-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.cr-checks label { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.cr-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.po-item-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.po-item-row select { flex: 2; }
.po-item-row input { flex: 1; }
.doc-qr { width: 92px; height: 92px; }
.doc-tpl-header, .doc-tpl-footer { padding: 6px 0; }
/* BOM 零件清单（产品编辑弹窗内嵌小表格） */
table.mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
table.mini th, table.mini td { border: 1px solid #e3e8ef; padding: 5px 8px; text-align: left; }
table.mini th { background: #f5f7fa; color: #5b6675; font-weight: 600; }
table.mini td.num, table.mini th.num { text-align: right; }
.bom-add input { padding: 5px 7px; border: 1px solid #d4dae3; border-radius: 5px; }

/* ============================================================
   新建订单 · 主辅分栏
   ① 产品栏（主区域）= 全站产品目录，承担选品
   ② 产品明细栏（附属区域）= 已选产品补充明细，不承担选品
   视觉层级：主区域用更重的边框/阴影/品牌色标签，附属区域弱化处理
   ============================================================ */
.modal-box.modal-wide { width: 1280px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ord-zones { display: grid; grid-template-columns: 420px 1fr; gap: 12px; align-items: start; margin-bottom: 16px; }

.zone { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.zone-main { border-color: #b9cdf5; box-shadow: 0 2px 12px rgba(47,107,255,.10); }
.zone-sub { border-color: var(--line); background: #fcfdff; box-shadow: none; }

.zone-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f5f8ff; }
.zone-sub .zone-head { background: #fafbfd; }
.zone-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.zone-tag { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.tag-main { background: #e6efff; color: var(--brand-d); }
.tag-sub { background: #eef1f5; color: var(--ink-2); }
.zone-meta { font-size: 12px; color: var(--ink-2); white-space: nowrap; }

.zone-tools { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.zone-tools input[type="search"] { width: 100%; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 12px;
  font-size: 12px; color: var(--ink-2); }
.chip:hover { border-color: var(--brand); color: var(--brand-d); }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.zone-body { max-height: 384px; overflow: auto; }
.zone-foot { padding: 10px 12px; border-top: 1px solid var(--line); background: #fafbfd;
  text-align: right; font-size: 13px; display: flex; justify-content: flex-end; gap: 10px; align-items: baseline; }
.zone-foot strong { font-size: 15px; }

/* —— 产品栏条目 —— */
.prod-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid #f0f2f5; }
.prod-item:hover { background: #f7faff; }
.prod-item.is-off { opacity: .6; }
.pi-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pi-off { font-size: 10px; background: #ffe9e7; color: var(--bad); padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.pi-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-side { text-align: right; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.pi-price { display: block; font-weight: 600; color: var(--ink); }
.pi-add { white-space: nowrap; }
.pi-used { font-size: 11px; background: #e6efff; color: var(--brand-d); border-radius: 10px; padding: 1px 7px; white-space: nowrap; }

/* —— 产品明细栏表格（附属区域，信息密度高、弱化视觉） —— */
.dt-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.dt-tbl th { position: sticky; top: 0; z-index: 1; background: #f5f7fa; color: var(--ink-2);
  font-weight: 600; padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt-tbl td { padding: 6px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.dt-tbl .c-seq { width: 42px; text-align: center; color: var(--ink-2); }
.dt-tbl .c-pname { width: 132px; }
.dt-tbl .c-spec { width: 230px; }
.dt-tbl .c-num { width: 66px; text-align: right; }
.dt-tbl .c-qty { width: 62px; }
.dt-tbl .c-amt { width: 96px; }
.dt-tbl .c-actual { width: 72px; }
.dt-tbl .c-remark { width: 118px; }
.dt-tbl .c-act { width: 44px; text-align: center; }
.dt-tbl input { width: 100%; padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.dt-tbl .c-num input { text-align: right; }
.dt-tbl input:focus { outline: none; border-color: var(--brand); }
.dt-amt { font-weight: 600; white-space: nowrap; }
.dt-tbl .c-pname .dp-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-tbl .c-pname .dp-sku { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 11px; }
.dt-tbl .c-pname .dp-sku .sku-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 空态：保留表头骨架 + 一行居中提示，列宽与有数据态完全一致 */
.dt-tbl-empty tbody:empty { display: none; }
.dt-tbl-empty .dt-empty { padding: 26px 8px; text-align: center; color: var(--ink-2); font-size: 12.5px;
  background: #fcfdfe; border-bottom: none; }
/* —— 零件层级：产品行（套）之下缩进展示零件构成（件） —— */
.dt-parts > .dt-parts-cell { padding: 0 6px 8px 20px; border-bottom: 1px solid #f0f2f5; background: #fbfcfe; }
.parts-box { padding: 6px 8px 2px; }
.parts-head { font-size: 11px; color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }
.part-row { display: grid; grid-template-columns: 58px 100px 1fr auto 72px 110px auto;
  gap: 8px; align-items: center; padding: 3px 0; font-size: 12px; color: var(--ink); }
.part-row .pt-no { color: var(--ink-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-row .pt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-row .pt-spec { color: var(--ink-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-row .pt-calc { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.part-row .pt-calc .pt-qty { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.part-row .pt-price { font-size: 11.5px; text-align: right; white-space: nowrap; }
.part-row .pt-remark { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-row .pt-proc { font-size: 10.5px; color: var(--brand-d); background: #eef3ff;
  border-radius: 8px; padding: 0 6px; text-align: center; white-space: nowrap; }
.part-row .pt-acts { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.parts-empty { padding: 6px 2px; font-size: 11.5px; color: var(--ink-2); }
.parts-act { margin: 6px 0 2px; }
/* 订单详情中的零件层级（同样缩进，弱化底色） */
.od-parts > td { padding: 0 8px 8px 22px !important; background: #fbfcfe; }

/* 超小号按钮：零件行内编辑/删除，与 .btn-row 内按钮同族（6px 间距） */
.btn-xs { font-size: 11px; padding: 2px 8px; line-height: 16px; border-radius: 5px; }

/* —— 零件明细表单（新增/编辑共用弹窗） —— */
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.pf-grid .field { margin-bottom: 12px; }
.pf-grid .field-wide { grid-column: 1 / -1; }
.pf-grid .field .req { color: var(--bad); margin-right: 2px; }
@media (max-width: 720px) { .pf-grid { grid-template-columns: 1fr; } }

/* —— 订单列表「零件明细」可展开子表格 —— */
.oparts-row > td { padding: 0 !important; background: #fafbfd; }
.oparts-box { padding: 10px 14px 12px 22px; border-left: 3px solid var(--brand); margin: 4px 0; }
.oparts-item { margin-bottom: 10px; }
.oparts-item:last-child { margin-bottom: 0; }
.oparts-item-head { font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.oparts-tbl { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; }
.oparts-tbl th { background: #f5f7fa; color: var(--ink-2); font-weight: 600; text-align: left;
  padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.oparts-tbl td { padding: 5px 8px; border-bottom: 1px solid #f0f2f5; }
.oparts-tbl tr:last-child td { border-bottom: none; }
.oparts-tbl .num { text-align: right; white-space: nowrap; }
/* 自定义行标记：不影响列宽与对齐，仅在编码后追加一枚小标签 */
.dt-tbl .c-pname .dp-tag { flex: none; background: #eef3ff; color: var(--brand-d); border-radius: 8px;
  padding: 0 5px; font-size: 10px; font-weight: 600; line-height: 15px;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }

/* ============================================================
   产品明细栏 · 「自定义添加」
   ① 入口按钮：与列表页「编辑 / 删除」同族（.btn.btn-sm），间距同 .btn-row（6px）
   ② 叠加弹窗：新建订单弹窗之上再开一层表单，关闭不影响下层订单表单
   ③ 字段级错误：输入框下方红字 + 输入框描边高亮；首个错误字段自动聚焦
   ============================================================ */
.zone-actions { display: flex; align-items: center; gap: 6px; }

/* 按钮禁用态：与现有按钮 hover 规则并存，禁用时不响应 hover 变色 */
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { background: var(--brand); }
.btn-line:disabled:hover { background: #fff; color: var(--brand); border-color: var(--brand); }

/* 叠加弹窗：z-index 高于基础弹窗（50），低于 toast（100） */
.modal-mask-stack { z-index: 60; }
.modal-stack-box { width: 540px; max-width: 94vw; }
.modal-stack-box .field-row { margin-bottom: 0; }
.modal-stack-box .field-row .field { margin-bottom: 14px; }

/* 字段级错误提示 */
.field-err { color: var(--bad); font-size: 12px; line-height: 1.35; margin-top: 4px; min-height: 16px; }
.field.has-err input, .field.has-err select { border-color: var(--bad); background: #fff9f8; }
.field.has-err input:focus, .field.has-err select:focus { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(224,72,59,.12); }

/* 表单级错误（接口异常）：顶部整条横幅 */
.ci-form-err { display: none; background: #fff0f0; border: 1px solid #f3c9c4; color: var(--bad);
  padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* 重复项提示（允许但不阻断） */
.ci-dup.is-warn { background: #fff8ec; border-color: #f0d3a0; color: #b9760a; }
.ci-dup-act { margin-top: 8px; display: flex; gap: 8px; }

/* 表单底部：左侧必填说明 + 右侧取消/确认 */
.ci-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ci-foot .btn-row { flex-wrap: nowrap; }

/* 窄屏降级：主辅区域改为上下堆叠 */
@media (max-width: 1080px) {
  .modal-box.modal-wide { width: 92vw; }
  .ord-zones { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

/* =====================================================================
   移动端自适应（≤768px：手机 / 小尺寸平板）
   —— 修复前：侧边栏固定 220px 不折叠，375px 屏幕内容区仅剩 155px，
      页面整体横向溢出 206px，表格与权限矩阵错位、按钮点不到
   ===================================================================== */
@media (max-width: 768px) {
  /* ---- 侧边栏改为抽屉 ---- */
  .app-shell { display: block; height: 100vh; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: 68vw; max-width: 280px; flex-shrink: 0;
    transform: translateX(-102%); transition: transform .24s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .nav-mask {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(15,27,52,.45);
  }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main { width: 100%; height: 100vh; }

  /* ---- 顶栏：两行布局（第一行 菜单/标题/用户，第二行 搜索） ---- */
  .topbar {
    height: auto; min-height: 52px; padding: 8px 12px; gap: 8px;
    flex-wrap: wrap; align-items: center; position: sticky; top: 0; z-index: 30;
  }
  .page-title { font-size: 15px; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .global-search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .global-search input { padding: 8px 32px 8px 12px; }
  .user-box { gap: 6px; }
  .user-name, .user-role { display: none; }
  .user-box .btn-ghost { padding: 7px 9px; font-size: 12px; }

  /* ---- 内容区 ---- */
  .content { padding: 12px; }
  .panel { padding: 12px; border-radius: 10px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head h3 { font-size: 14px; }
  .sec-tip { padding: 10px; font-size: 12.5px; }

  /* ---- 表格：横向滚动，不再撑破页面 ---- */
  .panel table, .content > table, table {
    display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .panel table thead, .panel table tbody,
  .content > table thead, .content > table tbody {
    display: table; width: max-content; min-width: 100%;
  }
  th, td { padding: 9px 10px; }

  /* ---- 统计卡 / 栅格 ---- */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 12px; }
  .stat-card .n { font-size: 22px; }
  .report-cols { grid-template-columns: 1fr; }
  .pf-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  /* ---- 页签：横向滚动 ---- */
  .report-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 0 12px 12px; -webkit-overflow-scrolling: touch; }
  .report-tab { flex: 0 0 auto; }

  /* ---- 角色权限 ---- */
  .role-layout { grid-template-columns: 1fr; gap: 12px; }
  .role-item { padding: 10px 12px; }
  .role-name { font-size: 13.5px; }
  .perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .perm-item { padding: 8px 10px; font-size: 12.5px; }
  .perm-module { font-size: 12.5px; margin-bottom: 8px; }
  .perm-module-ops .btn-xs { padding: 5px 10px; font-size: 11.5px; }

  /* ---- 弹窗：接近全屏，底部按钮铺满 ---- */
  .modal-box { width: 96vw; max-width: 96vw; max-height: 90vh; border-radius: 12px; }
  .modal-head { padding: 12px 14px; }
  .modal-body { padding: 14px; }
  .modal-box .btn-row .btn { flex: 1; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .line-row input, .line-row select { width: 100%; }

  /* ---- 触摸友好：按钮/输入不小于 38px ---- */
  .btn, .btn-sm { padding: 9px 14px; }
  .btn-xs { padding: 6px 10px; }
  .field input, .field select { padding: 10px 12px; }
}

/* 超小屏（≤360px）进一步收敛 */
@media (max-width: 360px) {
  .content { padding: 8px; }
  .panel { padding: 10px; }
  .perm-items { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* 窄屏（≤480px）：权限项改单列，避免「查看/编辑」等动作名被折行 */
@media (max-width: 480px) {
  .perm-items { grid-template-columns: 1fr; }
  .perm-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .perm-item .perm-code { overflow: hidden; text-overflow: ellipsis; }
}

/* 打印时强制展开抽屉、隐藏移动端控件 */
@media print {
  .sidebar, .nav-mask, .nav-toggle, .topbar { display: none !important; }
  .content { overflow: visible !important; }
}
