/* ============================================================
 * StockDrive v0.4 — UI 样式（SeekDeals 设计样板）
 * 视觉 token 对齐 sd.la：靛蓝主色 + slate 灰阶 + 径向渐变登录
 * ============================================================ */
:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --primary-subtle: rgba(79, 70, 229, 0.08);
  --accent-grad: linear-gradient(135deg, #4F46E5, #7C3AED);
  --bg-main: #F5F7FA;
  --card-bg: #FFFFFF;
  --text-heading: #1E293B;
  --text-body: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --danger: #EF4444; --danger-light: #FDECEA;
  --ok: #10B981; --ok-light: #ECFDF5;
  --warn: #D97706; --warn-light: #FFFBEB;
  --side-bg: #FFFFFF;      /* 浅色侧栏 */
  --side-hover: #F1F5F9;
  --side-text: #475569;
  --side-text-muted: #94A3B8;
  --side-active-bg: #EEF2FF;
  --side-active-text: #4F46E5;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-main); color: var(--text-body); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============ 登录页 (SeekDeals 样板) ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(640px 420px at 88% 12%, rgba(79,70,229,.10), transparent 62%),
    radial-gradient(520px 380px at 8% 88%, rgba(67,56,202,.08), transparent 60%),
    var(--bg-main);
}
.login-card {
  width: 396px; max-width: 100%; background: var(--card-bg);
  border-radius: 18px; box-shadow: 0 18px 50px rgba(30,41,59,.10), 0 2px 8px rgba(30,41,59,.04);
  border: 1px solid var(--border-light); padding: 38px 36px 26px;
  position: relative; overflow: hidden;
  animation: lcIn .5s cubic-bezier(.22,.61,.36,1);
}
@keyframes lcIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #4F46E5, #7C3AED, #A78BFA);
}
/* 登录页品牌区: 图标 + 名称 + 一句主张, 居中堆叠 */
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 2px 0 26px; }
.login-brand img { width: 58px; height: 58px; border-radius: 17px; box-shadow: 0 10px 26px rgba(79,70,229,.26); }
.login-brand h1 { font-size: 24px; font-weight: 700; color: var(--text-heading); margin-top: 14px; letter-spacing: -.2px; }
.lb-slogan { font-size: 13px; color: var(--text-muted); margin-top: 6px; letter-spacing: .5px; }
.login-card input[type=text], .login-card input[type=password] {
  width: 100%; padding: 13px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 14.5px; color: var(--text-body);
  background: #FBFCFE; transition: .18s; outline: none; margin-bottom: 14px;
}
.login-card input::placeholder { color: #AAB6C6; }
.login-card input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-subtle); background: #fff;
}
.login-card .btn.primary { background: var(--accent-grad); border: none; box-shadow: 0 6px 16px rgba(79,70,229,.26); }
.login-card .btn.primary:hover { background: var(--accent-grad); color: #fff; box-shadow: 0 10px 24px rgba(79,70,229,.34); transform: translateY(-1px); }
/* 登录按钮: 收窄并居中(不再通栏) */
.login-card .btn.primary.login-btn {
  display: flex; justify-content: center; width: 62%; min-width: 168px; max-width: 240px;
  margin: 6px auto 0; padding: 12px 18px; font-size: 15px; border-radius: 12px; letter-spacing: 3px;
}
.login-msg { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; text-align: center; }
.login-foot { margin-top: 18px; border-top: 1px solid var(--border-light); padding-top: 14px; }
.login-ver { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11.5px; color: var(--text-muted); }
.login-ver b { color: var(--text-body); font-weight: 600; }
.login-ver .lv-sep { color: var(--border); }
/* 首屏加载骨架 */
.boot-wrap { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(640px 420px at 88% 12%, rgba(79,70,229,.10), transparent 62%), radial-gradient(520px 380px at 8% 88%, rgba(67,56,202,.08), transparent 60%), var(--bg-main); }
.boot-wrap img { width: 56px; height: 56px; border-radius: 16px; box-shadow: 0 10px 26px rgba(79,70,229,.24); }
.boot-name { font-size: 19px; font-weight: 700; color: var(--text-heading); letter-spacing: .2px; }
.boot-spin { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: bootspin .7s linear infinite; }
@keyframes bootspin { to { transform: rotate(360deg); } }

/* ============ 主框架 左右式 ============ */
#mainView { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 235px; background: var(--side-bg); color: var(--side-text); flex-shrink: 0;
  display: flex; flex-direction: column; transition: transform .25s; z-index: 50;
  border-right: 1px solid var(--border-light);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 16px; border-bottom: 1px solid var(--border-light); }
.side-brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 3px 8px rgba(79,70,229,.25); }
.side-brand b { color: var(--text-heading); font-size: 16px; letter-spacing: .3px; }
.side-nav { flex: 1; padding: 10px 8px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.side-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.nav-group { font-size: 10.5px; color: var(--side-text-muted); padding: 12px 12px 5px; letter-spacing: 1px; font-weight: 600; }
.nav-items { display: block; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: none;
  background: transparent; color: var(--side-text); padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; cursor: pointer; margin-bottom: 1px; transition: all .15s;
}
.nav-item .nav-ic { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--text-muted); }
.nav-item:hover { background: var(--side-hover); color: var(--text-heading); }
.nav-item:hover .nav-ic { color: var(--primary); }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active-text); font-weight: 600; }
.nav-item.active .nav-ic { color: var(--primary); }
.side-user { padding: 12px 14px; border-top: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 6px; justify-content: center; align-items: center; }
.side-user .mini-btn { width: 100%; justify-content: center; padding: 7px 0; }
.su-name { font-size: 12.5px; color: #64748B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .mini-btn { border-color: var(--border); color: var(--text-muted); background: #fff; }
.side-user .mini-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.side-toggle { display: none; }

.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.main-head {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 18px;
  background: var(--card-bg); border-bottom: 1px solid var(--border-light);
}
.head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 顶栏站点标识 */
.head-brand { display: flex; align-items: center; gap: 8px; flex: none; text-decoration: none; padding: 3px 6px; border-radius: 8px; transition: background .15s; }
.head-brand:hover { background: var(--primary-light, #EEF2FF); }
.head-brand img { width: 22px; height: 22px; border-radius: 6px; box-shadow: 0 2px 5px rgba(79,70,229,.25); flex: none; }
.head-brand b { font-size: 13.5px; font-weight: 700; color: var(--text-heading); letter-spacing: .2px; white-space: nowrap; }
.head-sep { width: 1px; height: 16px; background: var(--border-light, #E2E8F0); flex: none; }
.head-title { font-size: 15px; font-weight: 600; color: var(--text-heading); white-space: nowrap; }
/* 顶栏用户区: 用户名 + 账户类别 (纯展示; 退出登录走侧栏/抽屉) */
.head-right { display: flex; align-items: center; gap: 8px; flex: none; }
.head-user { display: inline-flex; align-items: center; gap: 7px; }
.hu-name { font-size: 13px; font-weight: 600; color: var(--text-heading); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-toggle {
  display: none; /* 桌面隐藏, 移动端在顶栏显示 */
  width: 34px; height: 34px; flex-shrink: 0; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-body);
  font-size: 16px; line-height: 1; cursor: pointer; transition: all .15s; user-select: none;
}
.side-toggle:hover { border-color: var(--primary); color: var(--primary); }
.side-toggle:active { background: var(--primary-light); }
/* 移动端抽屉遮罩 */
#sideMask { display: none; }
main#viewHost { flex: 1; overflow-y: auto; padding: 18px 20px; }

/* 全局顶部 toast (fixed 高于弹窗, 表单错误也可见) */
.msgbar {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 500;
  padding: 10px 20px; border-radius: 10px; font-size: 13.5px; display: none; max-width: min(640px, 92vw);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14); border: 1px solid transparent;
  align-items: center; gap: 8px; line-height: 1.5;
  animation: toastIn .18s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.msgbar.ok { display: flex; background: #fff; color: #047857; border-color: #A7F3D0; }
.msgbar.err { display: flex; background: #fff; color: #C0392B; border-color: #FECACA; }
.msgbar .ic { width: 15px; height: 15px; flex-shrink: 0; }
.msgbar.ok .ic { color: var(--ok); }
.msgbar.err .ic { color: var(--danger); }

/* ============ 通用组件 ============ */
.panel {
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow-card); border: 1px solid var(--border-light); margin-bottom: 14px;
}
.panel h3 { font-size: 15px; color: var(--text-heading); margin-bottom: 10px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.hint { color: var(--text-muted); font-size: 12.5px; line-height: 1.55; max-width: 820px; }
.tip { color: var(--text-muted); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.muted { color: var(--text-muted); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
/* ===== 统一检索条(销售单 / 采购单) ===== */
.flt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flt-bar > input, .flt-bar > select { height: 36px; min-height: 36px; padding-top: 0; padding-bottom: 0; }
.flt-bar .fb-kw { flex: 1 1 220px; min-width: 150px; }
.flt-bar .sb-pick { flex: 1 1 220px; min-width: 150px; }
.flt-bar .fb-dates { display: flex; align-items: center; gap: 6px; flex: none; }
.flt-bar .fb-dates input { width: 145px; height: 36px; }
.flt-bar .fb-sep { font-size: 12px; color: var(--text-muted); flex: none; }
.flt-bar .fb-sel { flex: 0 1 170px; min-width: 118px; }
.flt-bar .btn { flex: none; height: 36px; min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.row label { font-weight: 600; white-space: nowrap; font-size: 13px; color: var(--text-body); }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-body); padding: 7px 15px;
  border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); color: #fff; box-shadow: 0 4px 10px rgba(79,70,229,.25); }
.btn.danger { color: var(--danger); border-color: #F5D4D0; }
.btn.danger:hover { background: var(--danger-light); }
.btn.big { padding: 11px 24px; font-size: 15px; }

/* —— 表单控件（统一高度/圆角/聚焦）—— */
input:not([type]), input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  border: 1px solid #D9E0EA; border-radius: 8px; padding: 9px 12px; font-size: 14px;
  background: #FBFCFE; color: var(--text-body); transition: border .15s, box-shadow .15s, background .15s;
  height: 40px; font-family: inherit;
}
input:hover, select:hover, textarea:hover { border-color: #B9C2D0; }
input:not([type]):focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); background: #fff;
}
input::placeholder, textarea::placeholder { color: #A5B0C0; }
textarea { height: auto; min-height: 72px; resize: vertical; line-height: 1.6; }
select {
  appearance: auto; -webkit-appearance: auto; cursor: pointer; padding-right: 8px;
}
/* 表格内小输入框不受全局高度影响 */
input.cell {
  border: 1px solid var(--border-light); padding: 4px 6px; border-radius: 6px; font-size: 13px;
  background: #fff; color: var(--text-body); transition: border .12s; height: auto; min-height: 26px;
}
input.cell:hover { border-color: var(--border); }
input.cell:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
input.cell.num { text-align: right; }
input.cell[type=number] { width: 80px; }

.mini-btn {
  border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 12px;
  padding: 4px 8px; border-radius: 7px; color: var(--text-muted); line-height: 1.6; transition: .13s;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.mini-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.mini-btn.del:hover { color: var(--danger); border-color: #F5D4D0; background: var(--danger-light); }
.grid .mini-btn + .mini-btn, .mini-btn + .mini-btn { margin-left: 4px; }
.grid td .mini-btn { font-size: 12px; }

/* 盘点实盘输入框 (盘点单中逐行录入) */
.act-input {
  width: 92px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; text-align: right; background: #fff; color: var(--text-heading);
  font-variant-numeric: tabular-nums; transition: border .12s, box-shadow .12s;
  height: 34px;
}
.act-input:hover { border-color: #CBD5E1; }
.act-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.act-input::placeholder { color: var(--text-muted); font-size: 12px; }

/* 勾选框 (标签选择/全选) */
input[type=checkbox].lab-chk, .grid input[type=checkbox] {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle;
}

.chip {
  border: 1px solid var(--border); background: #fff; padding: 5px 13px; border-radius: 20px;
  cursor: pointer; font-size: 13px; color: var(--text-body); transition: .13s;
  display: inline-flex; align-items: center;
}
.chip:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 6px rgba(79,70,229,.25); }
.chip-mini { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 20px; background: var(--primary-light); color: #4338CA; }
.r-admin { background: var(--danger-light); color: #C0392B; }
.r-keeper { background: var(--warn-light); color: #92400E; }
.r-worker { background: var(--ok-light); color: #047857; }
.r-viewer { background: var(--border-light); color: var(--text-muted); }

.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 20px; background: var(--border-light); color: var(--text-muted); }
.badge.red { background: var(--danger-light); color: #C0392B; }
.badge.orange { background: var(--warn-light); color: #92400E; }
.badge.green { background: var(--ok-light); color: #047857; }
.up { color: var(--danger); font-weight: 600; }
.down { color: var(--ok); font-weight: 600; }
.flat { color: var(--text-muted); }

/* ============ 表格 ============ */
.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
}
.grid { width: 100%; border-collapse: collapse; min-width: 0; }
.grid th {
  background: #F8FAFC; color: var(--text-body); font-weight: 600; font-size: 12.5px;
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
  letter-spacing: .02em;
}
.grid td {
  padding: 9px 14px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; font-size: 13px;
  color: var(--text-body); line-height: 1.5;
}
.grid tbody tr { transition: background .12s; }
.grid tbody tr:hover td { background: #F6F8FC; }
/* 斑马纹: 排除带语义底色行(分类/低库存/可编辑行) 避免冲突 */
.grid tbody tr:nth-child(even):not(.row-led):not(.row-exp):not(.row-cons):not(.row-low):not(.editing) td { background: #FAFBFC; }
.grid tbody tr:nth-child(even):not(.row-led):not(.row-exp):not(.row-cons):not(.row-low):hover td { background: #F3F6FB; }
.grid .c { text-align: center; }
.grid .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid tbody td.num { font-variant-numeric: tabular-nums; }
.grid tfoot td { font-weight: 700; background: #F8FAFC; border-top: 1px solid var(--border); color: var(--text-heading); }
.grid tbody tr:last-child td { border-bottom: none; }
.row-exp td { background: #FFFBEB !important; }
.row-cons td { background: #ECFDF5 !important; }
.row-low td { background: #FEF2F2 !important; }
.row-exp:hover td, .row-cons:hover td, .row-low:hover td { filter: brightness(.965); }
.empty-tip {
  color: var(--text-muted); text-align: center; padding: 44px 10px; font-size: 13px; line-height: 1.8;
}
.type-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.prod-picker { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ 卡片 ============ */
.cost-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cost-card {
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 14px 16px;
  box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
  border-top: 3px solid var(--primary); transition: box-shadow .15s;
}
.cost-card:hover { box-shadow: var(--shadow-lg); }
.cost-card.gold { border-top-color: #D97706; }
.cost-card.green { border-top-color: var(--ok); }
.cost-card.warn { border-top-color: var(--danger); }
.cost-card .label { font-size: 12px; color: var(--text-muted); }
.cost-card .value { font-size: 21px; font-weight: 700; color: var(--text-heading); margin-top: 2px; }
.cost-card .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ===== 仪表盘: 分段标题 / KPI 主卡 / 趋势胶囊 / 对照表 ===== */
.sec-title { font-size: 13px; font-weight: 600; color: var(--text-heading); margin: 16px 0 9px; display: flex; align-items: center; gap: 7px; }
.sec-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); }
.sec-title .st-note { font-weight: 400; font-size: 11.5px; color: var(--text-muted); }
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head-row h3 { margin: 0 !important; }
.h3-note { font-weight: 400; font-size: 11.5px; color: var(--text-muted); }

.kpi-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hero-main {
  grid-column: span 2; border-radius: var(--radius-lg); padding: 16px 20px; color: #fff;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  box-shadow: 0 6px 18px rgba(79, 70, 229, .26);
}
.hero-main .hm-label { font-size: 12.5px; opacity: .88; }
.hero-main .hm-value { font-size: 32px; font-weight: 700; letter-spacing: -.5px; margin: 5px 0 9px; line-height: 1.1; }
.hero-main .hm-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12px; }
.hero-main .hm-cmp { opacity: .88; }
.hero-main .hm-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; margin: 13px 0 8px; }
.hero-main .hm-bar i { display: block; height: 100%; border-radius: 999px; background: #fff; transition: width .5s ease; }
.hero-main .hm-goal-txt { font-size: 12px; opacity: .94; }
.hero-main .hm-goal-txt b { font-weight: 700; }
.hero-ref { background: #FBFCFE; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 14px 16px; }
.hero-ref .label { font-size: 12px; color: var(--text-muted); }
.hero-ref .value { font-size: 20px; font-weight: 700; color: #475569; margin-top: 3px; }
.hero-ref .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.tr-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tr-chip.up { background: rgba(16, 185, 129, .14); color: #047857; }
.tr-chip.down { background: rgba(239, 68, 68, .12); color: #B91C1C; }
.tr-chip.flat { background: rgba(100, 116, 139, .1); color: var(--text-muted); }
.hero-main .tr-chip { background: rgba(255, 255, 255, .22) !important; color: #fff !important; }

.dash-chart-col { display: flex; flex-direction: column; min-width: 0; }
.dash-chart-col .chart-box { height: 268px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-height: 26px; }
.chart-head .ch-title { font-size: 12.5px; font-weight: 600; color: var(--text-heading); }
.chart-tabs { display: inline-flex; gap: 3px; background: var(--primary-light); border-radius: 999px; padding: 3px; }
.chart-tabs button { border: none; background: transparent; padding: 4px 13px; border-radius: 999px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; font-family: inherit; }
.chart-tabs button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }

.dash-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-side .wh-stock { min-width: 0; overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th { font-weight: 600; font-size: 11.5px; color: var(--text-muted); padding: 0 4px 7px; text-align: right; border-bottom: 1px solid var(--border-light); }
.cmp-table th:first-child { text-align: left; }
.cmp-table td { padding: 9px 4px; border-bottom: 1px dashed var(--border-light); text-align: right; }
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table td:first-child { text-align: left; color: var(--text-body); }
.cmp-table th, .cmp-table td { white-space: nowrap; }
.cmp-table td:first-child { white-space: normal; }
.cmp-table td.this { font-weight: 700; color: var(--text-heading); }
.cmp-table td.last { color: var(--text-muted); }
.cmp-table tr.key td { background: var(--primary-light); }
.cmp-table tr.key td:first-child { border-radius: 8px 0 0 8px; padding-left: 8px; }
.cmp-table tr.key td:last-child { border-radius: 0 8px 8px 0; padding-right: 8px; }


/* ============ 采购 ============ */
.plan-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.plan-row select { min-width: 210px; }
.summary-box {
  display: flex; gap: 18px; flex-wrap: wrap; background: var(--primary-light);
  padding: 10px 16px; border-radius: 10px; margin-bottom: 10px; align-items: center;
}
.summary-box .sb { font-size: 13px; color: var(--text-body); }
.summary-box .sb b { font-size: 15px; }
.summary-box .sb.total b { color: var(--primary); font-size: 20px; }
.warn-box { padding: 8px 12px; border-radius: 8px; background: var(--warn-light); color: #92400E; font-size: 13px; margin: 8px 0; }
.warn-box:empty { display: none; }

/* ============ 扫码页 hero（清爽版）============ */
.scan-hero { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.scan-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.scan-tt { display: inline-flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 700; color: var(--text-heading); }
.scan-tt .ic { color: var(--primary); }
.scan-sub { font-size: 12px; color: var(--text-muted); }
.scan-search { display: flex; align-items: center; gap: 8px; margin-top: 14px;
  background: var(--border-light); border: 1.5px solid transparent; border-radius: 14px; padding: 6px;
  transition: border-color .15s, background .15s, box-shadow .15s; }
.scan-search:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-subtle); }
.scan-cam { flex: none; width: 44px; height: 44px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--primary-light); font-size: 21px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s, background .15s; }
.scan-cam:hover { background: #E0E7FF; }
.scan-cam:active { transform: scale(.9); }
.scan-cam .ic { width: 20px; height: 20px; color: var(--primary); }
.scan-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--text-body); height: 44px; padding: 0 4px 0 6px; }
.scan-search input::placeholder { color: var(--text-muted); }
.scan-go { flex: none; height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; }
.scan-go .ic { width: 15px; height: 15px; }
/* 物料确认卡 */
.mat-card { padding: 16px 18px; }
.mat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mat-stock { display: inline-flex; align-items: baseline; gap: 6px; color: var(--text-heading); }
.mat-stock b { font-size: 18px; font-variant-numeric: tabular-nums; }
.mat-stock .muted { font-size: 12px; }
.mat-stock .badge { vertical-align: 1px; }
.mat-name { font-size: 17px; font-weight: 700; color: var(--text-heading); margin: 8px 0 2px; }
.mat-sub { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.picker-name { font-size: 14px; color: var(--text-heading); font-weight: 600; }
/* 数量步进 */
.qty-stepper { display: flex; align-items: center; gap: 8px; }
.qty-stepper input {
  width: 74px; text-align: center; font-size: 17px; font-weight: 700; height: 42px;
  font-variant-numeric: tabular-nums;
}
.q-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; color: var(--text-heading); font-size: 19px; line-height: 1; cursor: pointer;
  transition: all .13s; display: inline-flex; align-items: center; justify-content: center;
}
.q-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.q-btn:active { transform: scale(.94); }
.issue-btn { width: 100%; height: 50px; font-size: 16px; margin-top: 16px; justify-content: center; }
.rec-panel h3 { font-size: 14px; }
.pick-id input { width: 100%; }
/* —— 录入表单 (ERP 票据式) —— */
.form-grid { display: grid; grid-template-columns: 118px 1fr; gap: 14px 16px; align-items: center; }
.form-grid label {
  font-size: 13px; color: #475569; font-weight: 600; text-align: right; white-space: nowrap;
  padding-right: 2px; letter-spacing: .02em;
}
.form-grid label::after { content: '：'; color: #94A3B8; font-weight: 400; }
.form-grid input, .form-grid select { width: 100%; }
.form-grid > .tip { grid-column: 2; }
.form-grid .fg-hint { grid-column: 2; font-size: 12px; color: var(--text-muted); margin-top: -8px; }
/* 表单内的复选框行: 避免被 .form-grid input{width:100%} 撑破、避免加粗右对齐+冒号 */
.form-grid .fg-check { display: flex; align-items: center; min-height: 40px; }
.form-grid .fg-check label { display: inline-flex; align-items: center; gap: 7px; text-align: left; font-weight: 400; color: var(--text-body); white-space: normal; cursor: pointer; font-size: 13.5px; }
.form-grid .fg-check label::after { content: none; }
.form-grid .fg-check input[type=checkbox] { width: 16px; height: 16px; flex: none; margin: 0; }
@media (max-width: 600px) { .form-grid .fg-check { min-height: 0; } }
.form-sec {
  grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--primary);
  letter-spacing: .06em; padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 4px;
}
.form-sec:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-grid input[required], .form-grid .req { border-color: #E4E9F2; }

/* ============ 标签打印 ============ */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
.lab-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; background: #fff; }
.lab-qr { display: flex; justify-content: center; margin-bottom: 6px; }
.lab-qr img, .lab-qr canvas { image-rendering: pixelated; }
.lab-code { font-weight: 700; font-size: 14px; color: var(--text-heading); }
.lab-name { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 曲线 ============ */
.curve-wrap {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 10px; overflow-x: auto; min-height: 220px;
}
.curve-wrap svg { display: block; }

/* 弹窗标题栏内的操作按钮(移动端压成一行) */
.modal-head > b { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-head > .btn { padding: 7px 11px; font-size: 13px; flex-shrink: 0; }
.modal-head > .btn .ic { width: 14px; height: 14px; }

/* 弹窗头部「返回列表」(详情弹窗统一入口; 电脑端带文字, 移动端只留图标) */
.mh-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; flex-shrink: 0; }
.mh-back .ic { width: 14px; height: 14px; }
.mh-back .mb-mini { display: none; }   /* 手机端才用短文案 */
.modal-head:has(.mh-back) { justify-content: flex-start; gap: 10px; }
.modal-head:has(.mh-back) > b { flex: 1 1 auto; min-width: 0; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(30,41,59,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal {
  background: #fff; border-radius: var(--radius-lg); max-width: 680px; width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: modalIn .16s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translateY(28px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal:has(.form-grid) { max-width: 600px; }
.modal:has(.grid) { max-width: 900px; }
.modal:has(.form-grid):has(.grid) { max-width: 900px; }
/* 含行式明细录入(.sl-items)的弹窗 —— 采购单/销售单/报价单: 电脑端加宽, 数量·单价·金额一行放得下 */
.modal:has(.sl-items) { max-width: 1040px; }
.modal-head {
  padding: 15px 20px; border-bottom: 1px solid var(--border-light); display: flex;
  justify-content: space-between; align-items: center; font-size: 15px; color: var(--text-heading);
}
.modal-head b { font-weight: 700; letter-spacing: .02em; }
.modal-head .mini-btn {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border-radius: 7px; color: var(--text-muted);
}
.modal-head .mini-btn .ic { width: 14px; height: 14px; }
.modal-head .mini-btn:hover { background: var(--border-light); border-color: var(--border); color: var(--text-heading); }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { padding: 13px 22px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; background: #FAFBFC; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot .btn { min-width: 88px; justify-content: center; }
.count-scroll { max-height: 46vh; overflow-y: auto; }
.count-scroll thead th { position: sticky; top: 0; background: #F8FAFC; z-index: 2; }

/* ============ 细节 ============ */
.wh-card { cursor: pointer; }
.wh-card:hover { box-shadow: var(--shadow-lg); }
code { background: var(--border-light); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ============ 打印 ============ */
@media print {
  body { background: #fff; }
  .sidebar, .main-head, .msgbar, .panel h3, .toolbar, .btns, .cost-cards, #tabs { display: none !important; }
  .table-scroll { overflow: visible; box-shadow: none; border: none; }
  main#viewHost { padding: 0; overflow: visible; }
  .lab-card { break-inside: avoid; page-break-inside: avoid; }
}

/* ============ 移动端 ============ */
@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); width: 240px; z-index: 60; transition: transform .25s; }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  #sideMask.open { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; }
  .side-toggle { display: inline-flex; }
  .main-head { padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); }
  /* 窄屏: 站标退场 —— 品牌在抽屉里已有 36px logo + 站名完整展示,
     顶栏再放 22px 图标会与 ☰(34px 描边方) 形成两个方块并排的冲突, 且主次倒挂 */
  .head-brand { display: none; }
  .head-sep { display: none; }
  /* 窄屏: 顶栏标题是唯一导航位标 → 保持醒目, 并因站标让位而放宽 */
  .head-title { font-size: 16px; font-weight: 700; max-width: 60vw; }
  main#viewHost { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px 0; }
  .form-grid label { text-align: left; }
  .form-grid label::after { content: none; }
  .scan-input-row { flex-direction: column; }
  .scan-sub { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .grid { font-size: 12px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }
  /* 单列布局下 form-grid 的提示行归位(原 grid-column:2 会溢出到隐式列) */
  .form-grid .tip, .form-grid .fg-hint { grid-column: 1; }
}

/* 超窄屏(≤420px): 用户名收窄, 把空间让给页面标题 */
@media (max-width: 420px) {
  .hu-name { max-width: 66px; }
  .head-title { max-width: 52vw; }
}

/* ============ SVG 线性图标 ============ */
.ic {
  width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-xs { width: 13px; height: 13px; vertical-align: -2px; stroke-width: 2; }
.ic-lg { width: 20px; height: 20px; stroke-width: 1.7; }
.nav-item .nav-ic .ic { width: 17px; height: 17px; stroke-width: 1.9; }
.mini-btn .ic { width: 13px; height: 13px; vertical-align: -2px; }
.btn .ic { width: 15px; height: 15px; }
.btn.big .ic { width: 16px; height: 16px; }
.warn-box .ic, .hint .ic { vertical-align: -2px; }

/* ============ 物料类别徽章 ============ */
.tbadge {
  display: inline-block; font-size: 11.5px; line-height: 1; padding: 4px 9px;
  border-radius: 6px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.tb-part { background: #EEF2FF; color: #4338CA; }
.tb-cons { background: #ECFDF5; color: #047857; }
.tb-exp  { background: #FFFBEB; color: #92400E; }

/* chip 类型筛选按钮加类别点 */
.chip .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.chip .dot.d-part { background: #4F46E5; }
.chip .dot.d-cons { background: #10B981; }
.chip .dot.d-exp { background: #D97706; }

/* ============ 单据详情页 ============ */
.dt-state .badge, .dt-state .chip-mini { margin-left: 2px; }
.doc-head { padding: 14px 18px; }
.dmeta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 18px; margin: 2px 0 0;
}
.dm .dm-k { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; letter-spacing: .02em; }
.dmeta .dm-wide { grid-column: 1 / -1; }          /* 备注等长文本: 单独占整行 */
.dmeta .dm-wide .dm-v { font-weight: 400; line-height: 1.6; }
.dm .dm-v { font-size: 13.5px; color: var(--text-heading); font-weight: 600; word-break: break-all; }
.doc-head h3 { margin-bottom: 8px; }
/* 列表主链接(单号/名称, 含 <a class="btn-link">): 统一主色文字, 无下划线、无浏览器默认蓝; hover 变色 */
.btn-link {
  border: none; background: none; padding: 0; color: var(--primary); font-weight: 600;
  cursor: pointer; font-size: 13px; font-family: inherit; text-decoration: none;
}
.btn-link:hover { color: var(--primary-hover); }
.no-print { }
@media print {
  .no-print { display: none !important; }
  .doc-head, .panel { box-shadow: none !important; border-color: #CBD5E1 !important; }
  .grid th { background: #fff !important; }
}

/* ============ 单据打印版式 ============ */
.print-only { display: none; }
.p-head { text-align: center; padding: 6px 0 14px; border-bottom: 2px solid #1E293B; margin-bottom: 14px; }
.p-co { font-size: 15px; font-weight: 700; letter-spacing: 2px; color: #1E293B; }
.p-title { font-size: 26px; font-weight: 800; letter-spacing: 10px; margin: 6px 0 2px; color: #000; }
.p-no { font-size: 13px; color: #475569; margin-top: 4px; letter-spacing: 1px; }
.p-date { font-size: 12px; color: #94A3B8; margin-top: 2px; }
.p-foot { margin-top: 26px; padding-top: 10px; font-size: 12px; color: #64748B; border-top: 1px solid #CBD5E1; }
.p-foot .p-foot-main { display: flex; justify-content: space-between; }
.p-foot .p-foot-sub { margin-top: 4px; text-align: center; font-size: 11px; color: #94A3B8; letter-spacing: .04em; }
@media print {
  @page { size: A4; margin: 13mm 12mm; }
  body { background: #fff !important; }
  main#viewHost { padding: 0 !important; overflow: visible !important; }
  .print-only { display: block !important; }
  .doc-head { border: 1px solid #CBD5E1 !important; border-radius: 0 !important; margin-bottom: 10px !important; }
  .panel { box-shadow: none !important; border: none !important; page-break-inside: avoid; }
  .table-scroll { border: 1px solid #CBD5E1 !important; border-radius: 0 !important; }
  .grid th { background: #fff !important; color: #000 !important; border-bottom: 1.5px solid #000 !important; }
  .grid td, .grid th { border-bottom-color: #CBD5E1 !important; }
  .grid tbody tr:nth-child(even) td { background: #fff !important; }
  .grid tbody tr:hover td { background: #fff !important; }
  .grid tfoot td { background: #fff !important; border-top: 1.5px solid #000 !important; }
  .dm .dm-k { color: #64748B !important; }
  .dm .dm-v { color: #000 !important; }
  .btn, .msgbar, .side-toggle { display: none !important; }
}

/* ============ 弹窗打印(标签等) ============ */
@media print {
  body.print-modal #mainView, body.print-modal .msgbar { display: none !important; }
  body.print-modal .modal-mask { position: static !important; display: block !important; padding: 0 !important; background: #fff !important; }
  body.print-modal .modal { max-width: none !important; box-shadow: none !important; border: none !important; max-height: none !important; }
  body.print-modal .modal-head, body.print-modal .modal-foot, body.print-modal .modal-bar { display: none !important; }
  body.print-modal .modal-body { padding: 0 !important; overflow: visible !important; }
}

/* ============ 紧凑双列表头 (销售/报价等新单据) ============ */
.fg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 16px; align-items: end; }
.f2 label { display: block; font-size: 12px; color: #64748B; font-weight: 600; margin-bottom: 5px; letter-spacing: .02em; }
.f2 .fg-tip { font-weight: 400; color: #94A3B8; font-size: 11px; margin-left: 2px; }
.f2-full { grid-column: 1 / -1; }
.f2 select, .f2 input { width: 100%; }
@media (max-width: 600px) { .fg2 { grid-template-columns: 1fr; } }

/* ===== 扫码页: 相机扫码 ===== */
.cam-box { position: relative; margin-top: 14px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4/3; max-height: 50vh; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-mask { position: absolute; inset: 0; pointer-events: none; }
.cam-mask::before, .cam-mask::after { content: ''; position: absolute; width: 78px; height: 78px; border: 3px solid rgba(52,199,89,.95); }
.cam-mask::before { left: 6%; top: 24%; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.cam-mask::after { right: 6%; bottom: 20%; border-left: none; border-top: none; border-radius: 0 0 10px 0; }
.cam-line { position: absolute; left: 10%; right: 10%; top: 30%; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(52,199,89,.95), transparent);
  box-shadow: 0 0 14px rgba(52,199,89,.9); animation: camScan 2.4s ease-in-out infinite; }
@keyframes camScan { 0%, 100% { top: 26%; } 50% { top: 70%; } }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 4px rgba(0,0,0,.8); background: rgba(0,0,0,.35); padding: 4px 0; }
.cam-close { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: .92; }

/* ============ 自适应兜底 ============ */
img { max-width: 100%; }
main#viewHost { overflow-x: hidden; }
.head-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.head-title + .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 超窄屏(<600px 手机) 收紧留白与触控 */
@media (max-width: 600px) {
  main#viewHost { padding: 10px; }
  .panel { padding: 14px; }
  .modal-mask { padding: 8px; }
  .modal-body { padding: 14px 14px 16px; }
  .modal-foot { padding: 11px 14px; }
  .cost-cards { gap: 10px; }
  .cost-card { padding: 12px 14px; }
  .cost-card .value { font-size: 18px; }
  .form-grid { gap: 12px 0; }
  .scan-search { gap: 6px; padding: 5px; }
  .scan-cam { width: 42px; height: 42px; }
  .scan-cam .ic { width: 20px; height: 20px; }
  .scan-search input { height: 42px; }
  .scan-go { height: 42px; padding: 0 14px; }
}

/* ===== 通用相机扫码弹层 ===== */
.cam-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.72); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: default; }
.cam-panel { position: relative; width: 100%; max-width: 520px; }
.cam-panel video { width: 100%; aspect-ratio: 4/3; max-height: 60vh; object-fit: cover;
  display: block; border-radius: 14px; background: #000; }
/* ===== 通用物料选择(搜索框 + 内嵌左侧扫码按钮) ===== */
.mat-pick { position: relative; display: block; flex: 1 1 240px; min-width: 200px; }
.mat-pick input { width: 100%; height: 44px; padding-left: 46px; }
.mat-pick .mp-cam { position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; padding: 0; border: none; cursor: pointer;
  border-radius: 9px; background: transparent; color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s; }
.mat-pick .mp-cam:hover { background: var(--primary-light); }
.mat-pick .mp-cam:active { transform: translateY(-50%) scale(.9); }
.mat-pick .mp-cam .ic { width: 20px; height: 20px; color: var(--primary); }
/* 顶部检索框(框内扫码): 高度与同排按钮一致(36px) */
.mat-pick.sb-pick { flex: 1 1 220px; min-width: 160px; }
@media (max-width: 600px) { .mat-pick.sb-pick { flex: 1 1 100%; } }
.mat-pick.sb-pick input { height: 36px; min-height: 36px; padding: 0 34px 0 40px; }
.mat-pick.sb-pick .mp-cam { width: 28px; height: 28px; border-radius: 8px; }
.mat-pick.sb-pick .mp-cam .ic { width: 17px; height: 17px; }
.mat-pick .mp-clr { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px;
  border: none; background: transparent; border-radius: 8px; padding: 0; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; }
.mat-pick .mp-clr:hover { background: var(--border-light); color: var(--text-heading); }
.mat-pick .mp-clr[hidden] { display: none; }
.mat-pick .mp-clr .ic { width: 14px; height: 14px; }
.side-brand b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 采购单列表: 数字列不换行, 内容列可换行, 窄屏横滑 */
.po-table { min-width: 880px; }
.po-table th, .po-table td { white-space: nowrap; }
.po-table td.po-items { white-space: normal; }
/* 采购内容: 多行紧凑展示(前3项 + 还有N项) */
.po-items { display: flex; flex-direction: column; gap: 2px; }
.po-it { font-size: 12.5px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.po-more { font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 600px) { .po-it { max-width: 100%; white-space: normal; } }

/* ===== 页面页签(菜单分组) ===== */
.page-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.page-tab { border: 1px solid var(--border); background: #fff; color: var(--text-body);
  padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: .13s; }
.page-tab:hover { border-color: var(--primary); color: var(--primary); }
.page-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ===== 窄屏隐藏次要列(列表自适应) ===== */
@media (max-width: 900px) { .hide-sm { display: none !important; } }
.sup-table { min-width: 640px; }

/* ===== 分页条 ===== */
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 4px; flex-wrap: wrap; }
.pager .btn { padding: 5px 12px; font-size: 13px; }
.pager .btn[disabled] { opacity: .45; cursor: not-allowed; }
.pager .muted { font-size: 13px; }

/* ===== 仪表盘: 销量看板 ===== */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 16px; margin-top: 14px; align-items: stretch; }
.chart-box { width: 100%; height: 300px; }
.wh-stock { background: #FBFCFE; border: 1px solid var(--border-light); border-radius: 12px; padding: 12px 14px; }
.wh-stock .ws-title { font-size: 13px; font-weight: 600; color: var(--text-heading); margin-bottom: 10px; }
.wh-stock .ws-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border-light); font-size: 13px; }
.wh-stock .ws-row:last-of-type { border-bottom: none; }
.wh-stock .ws-row b { color: var(--primary); font-size: 15px; }
.wh-stock .ws-note { margin-top: 10px; font-size: 11px; color: var(--text-muted); line-height: 1.6; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } .chart-box { height: 260px; } }

/* ===== 系统信息页 ===== */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.info-item { background: #FBFCFE; border: 1px solid var(--border-light); border-radius: 10px; padding: 10px 13px; }
.info-item .k { font-size: 11.5px; color: var(--text-muted); }
.info-item .v { font-size: 14px; color: var(--text-heading); margin-top: 3px; word-break: break-all; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border-light); }
.tl-item { position: relative; padding: 0 0 16px 8px; }
.tl-item::before { content: ''; position: absolute; left: -16px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.tl-item .tl-h { font-size: 13.5px; font-weight: 600; color: var(--text-heading); }
.tl-item .tl-h .tl-date { font-weight: 400; font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.tl-item ul { margin: 6px 0 0; padding-left: 16px; }
.tl-item li { font-size: 12.5px; color: var(--text-body); line-height: 1.85; }
.bk-list { font-size: 13px; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border-light); }
.bk-row:last-child { border-bottom: none; }
.bk-row .bk-name { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-body); }
.code-box { background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #475569; word-break: break-all; margin-top: 6px; }

/* ============================================================
 * 移动端统一规范 (2026-09-12) —— 治「字太小、信息太散」
 * 断点: ≤900 平板/窄窗 | ≤600 手机(列表卡片化·弹窗全屏) | ≤400 小屏
 * 核心: ① 字号整体放大 ② 列表由「横滑表格」改为「纵向卡片」(字段名+值)
 *       ③ 详情信息聚合(键值两栏/大字) ④ 触控目标 ≥42px
 * ============================================================ */

/* 窄屏隐藏次要列: 补 hide-xs(此前 list.js 会输出 hide-xs 但无对应样式, 属无效类) */
@media (max-width: 900px) { .hide-sm { display: none !important; } }
@media (max-width: 600px) { .hide-xs { display: none !important; } }

/* ---------- ≤900px 平板 / 窄窗口 ---------- */
@media (max-width: 900px) {
  main#viewHost { padding: 14px 16px 20px; }
  .head-title { max-width: 62vw; }   /* 站标退场后放宽(原 46vw) */
  /* 未卡片化的宽表横滑时固定首列 + 吸附表头, 滑走后才认得出是哪条记录 */
  .grid:not(.card) td:first-child,
  .grid:not(.card) th:first-child {
    position: sticky; left: 0; z-index: 2; background: #fff;
    box-shadow: 1px 0 0 var(--border-light);
  }
  .grid:not(.card) thead th:first-child { background: #F8FAFC; z-index: 4; }
  .grid:not(.card) tbody tr:nth-child(even) td:first-child { background: #FAFBFC; }
  .grid:not(.card) tbody tr:hover td:first-child { background: #F6F8FC; }
}

/* ---------- ≤600px 手机 ---------- */
@media (max-width: 600px) {
  /* ===== 0. 全局字号放大 ===== */
  body { font-size: 15px; }
  .muted, .tip, .hint { font-size: 13px; }
  main#viewHost { padding: 12px 14px 18px; }
  .panel { padding: 12px; border-radius: 12px; }
  .panel h3 { font-size: 15px; }

  /* ===== 1. 列表: 表格 → 纵向卡片 ===== */
  .grid.card {
    display: block; width: 100% !important; min-width: 0 !important;
    background: transparent; border: none; border-radius: 0; box-shadow: none;
    border-collapse: separate; border-spacing: 0;
  }
  .grid.card thead { display: none; }
  .grid.card tbody, .grid.card tfoot { display: block; }
  .grid.card tr {
    display: grid; grid-template-columns: 1fr 1fr; position: relative;
    background: #fff; border: 1px solid var(--border-light); border-radius: 11px;
    box-shadow: var(--shadow-card); margin: 0 0 6px; padding: 0; overflow: hidden;
  }
  .grid.card tbody tr:last-child { margin-bottom: 0; }
  .grid.card td {
    grid-column: 1 / -1;                    /* 默认整行 */
    display: flex; align-items: baseline; justify-content: flex-start; gap: 0;
    padding: 4px 12px; border: none; border-bottom: 1px dashed var(--border-light);
    font-size: 14.5px; line-height: 1.45; text-align: left !important;
    white-space: normal !important; color: var(--text-heading); word-break: break-word;
  }
  .grid.card td.ci { grid-column: span 1; }               /* 相邻两列并排(数量+金额) */
  .grid.card td.ci + td.ci { border-left: 1px dashed var(--border-light); }
  .grid.card td:last-child { border-bottom: none; }
  .grid.card td::before {
    content: attr(data-label); flex: 0 0 76px; color: var(--text-muted);
    font-size: 12.5px; font-weight: 500; text-align: left; padding-right: 10px;
    box-sizing: border-box;
  }
  .grid.card td:not([data-label])::before,
  .grid.card td[data-label=""]::before { display: none; }

  /* 卡片标题(主信息)置顶: 大号加粗 + 底部分隔 */
  .grid.card td[data-primary] {
    order: -1; display: block; padding: 8px 96px 7px 12px; text-align: left !important;
    position: relative; font-size: 15.5px; font-weight: 700; color: var(--text-heading);
    background: #FBFCFE; border-bottom: 1px solid var(--border-light);
  }
  /* 浮到卡片标题行右侧的状态标签(客户分类/供应商状态/单据状态) */
  .grid.card tr > td.cf {
    position: absolute; top: 8px; right: 12px; padding: 0; border: none; background: none;
    font-size: 12px; line-height: 1.6; z-index: 1; grid-column: auto;
  }
  .grid.card tr > td.cf::before { display: none; }
  /* 有星级打标的列表(销售/采购): 状态让出星级位置, 两者并排不重叠 */
  .grid.card tr:has(td.stars-cell) > td.cf { right: 114px; }
  .grid.card td[data-primary]::before { display: none; }
  .grid.card td[data-primary] .muted { font-size: 13px; font-weight: 400; }
  .grid.card td[data-primary] a, .grid.card td[data-primary] .btn-link { font-size: 16px; }

  /* 优先级: 与单号同行(卡片右上角), 触控目标加大 */
  .grid.card tr { position: relative; }
  .grid.card td.stars-cell {
    position: absolute; top: 6px; right: 10px; z-index: 1;
    display: flex; align-items: center; padding: 0; margin: 0;
    border: none; background: none; order: initial;
  }
  .grid.card td.stars-cell::before { display: none; }
  /* 星级收紧: 16px 图标 + 4px/2px 内距 → 5 颗约 100px(原约 140px), 腾出空间给左边单号 */
  .stars { gap: 0; }
  .stars b { padding: 4px 2px; }                          /* 保留可点热区, 但不再横向铺开 */
  .stars b svg { width: 16px; height: 16px; }
  .grid.card td[data-primary] { padding-right: 116px; }   /* 5 颗星 ~100px + 右偏 10px */
  .grid.card tr:has(td.stars-cell) td[data-primary] { padding-right: 188px; }   /* 再给「状态」让位 */
  /* 星星占满整个单元格: 点在星星区域的边角也不会误触「进详情」 */
  .grid.card td.stars-cell .stars { width: 100%; height: 100%; justify-content: flex-end; }

  /* ===== 详情头部(两段式) 移动端适配 ===== */
  .dt-title { padding-bottom: 8px; }
  .dt-title > b { font-size: 16px; }
  .sum-bar { margin-top: 10px; padding-top: 9px; gap: 6px 12px; }
  .sum-bar > b { font-size: 16px; }
  .dt-bar, .modal-bar { padding: 6px 0; gap: 6px; }
  .dt-bar > .dt-state, .modal-bar > .mb-state { gap: 6px; padding: 0 10px; }
  .dt-bar > .btns .btn, .modal-bar > .mb-acts .btn { min-height: 36px; padding: 7px 10px; font-size: 13px; }
  .mh-back { padding: 7px 7px; margin-left: -4px; }
  .mh-back .mb-full { display: none; }
  .mh-back .mb-mini { display: inline; }
  .modal-bar { margin: 0 0 12px; }

  /* ===== 借鉴 Odoo: 列表只导航, 操作进详情 ===== */
  /* 整卡可点进详情 */
  .grid.card tbody tr[data-cardlink] { cursor: pointer; }
  .grid.card tbody tr[data-cardlink]:active { background: #F1F4F9; }
  /* 不再加 › 箭头: 标题行右侧已有优先级星星, 避免视觉重复 */
  /* 详情页: 只留主操作, 其余收进「操作」抽屉 */
  .btns .d-sec { display: none !important; }
  .btns .d-more { display: inline-flex !important; }
  /* 操作抽屉: 底部弹出半屏 */
  .modal.sheet {
    height: auto !important; max-height: 74vh !important;
    border-radius: 15px 15px 0 0 !important;
    animation: sheetUp .18s ease-out;
  }
  .modal.sheet .modal-foot { display: none; }
  .modal.sheet .modal-head { border-radius: 15px 15px 0 0; }

  /* 操作列: 移动端不显示(操作移到详情页), 卡片整卡可点 */
  .grid.card td[data-ops] { display: none !important; }

  /* 空态 */
  .grid.card td[colspan] {
    display: block; text-align: center !important; padding: 22px 12px;
    color: var(--text-muted); font-size: 14px;
  }
  .grid.card td[colspan]::before { display: none; }

  /* 合计行: 保持横向并排(不被通用 tr 规则拉成纵向堆叠) */
  .grid.card tfoot tr {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 4px 14px; padding: 8px 12px;
    border-color: var(--border); background: #F8FAFC;
  }
  .grid.card tfoot td {
    display: block; flex: 0 0 auto; width: auto; padding: 2px 0; border: none;
    font-size: 14.5px; font-weight: 700; color: var(--text-heading); background: transparent;
  }
  .grid.card tfoot td::before { display: none; }

  /* 卡片遵循列显隐: 窄屏次要列不进卡片(保持精简、信息不散); 标题列永不隐藏 */
  .grid.card td.card-hide { display: none !important; }
  .grid.card td:empty { display: none !important; }   /* 空单元格不占行(如已到齐时隐藏「待收」) */
  .grid.card td[data-primary] { display: block !important; }
  /* 去掉外层表格白框 —— 卡片自带边框/圆角 */
  .table-scroll:has(> .grid.card) {
    background: transparent; border: none; box-shadow: none; border-radius: 0;
    overflow: visible; padding: 0;
  }

  /* 未卡片化的表格(.no-card)保持紧凑+横滑 */
  .grid:not(.card) th { padding: 9px 9px; font-size: 12.5px; }
  .grid:not(.card) td { padding: 9px 9px; font-size: 14px; }
  .table-scroll { border-radius: 12px; -webkit-overflow-scrolling: touch; }

  /* ===== 2. 弹窗: 全屏化 ===== */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal,
  .modal:has(.form-grid),
  .modal:has(.grid),
  .modal:has(.form-grid):has(.grid) {
    max-width: 100% !important; width: 100%; border-radius: 0;
    height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
  }
  .modal-head {
    padding: 13px 14px; position: sticky; top: 0; z-index: 5; background: #fff;
    border-bottom: 1px solid var(--border-light); border-radius: 0;
  }
  .modal-head b { font-size: 16px; padding-right: 8px; }
  .modal-head .mini-btn { width: 36px; height: 36px; border-radius: 9px; }
  .modal-head .mini-btn .ic { width: 17px; height: 17px; }
  .modal-body { flex: 1 1 auto; min-height: 0; padding: 14px 14px 18px; font-size: 15px; -webkit-overflow-scrolling: touch; }
  .modal-foot {
    padding: 10px 12px; gap: 8px; flex-wrap: wrap; border-radius: 0;
    position: sticky; bottom: 0; z-index: 5;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .modal-foot .btn { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 12px 10px; font-size: 15px; justify-content: center; }
  .modal-foot .btn:only-child { flex: 1 1 100%; }
  .count-scroll { max-height: none; }

  /* ===== 3. 表单: 单列 + 大控件 ===== */
  .form-grid, .fg2 { grid-template-columns: 1fr !important; gap: 2px 0 !important; align-items: stretch; }
  .form-grid label, .f2 label { text-align: left; padding: 9px 0 3px; white-space: normal; font-size: 13px; }
  .form-grid label::after { content: ''; }
  .form-grid > .tip, .form-grid .fg-hint, .form-grid .form-sec, .f2-full { grid-column: 1 !important; }
  .form-sec { margin-top: 10px; padding-top: 8px; font-size: 13px; }
  input:not([type]), input[type=text], input[type=number], input[type=date],
  input[type=password], select, textarea { font-size: 16px !important; height: 46px; }
  textarea { height: auto; min-height: 76px; }
  .grid input.cell, .grid .cell, .act-input { font-size: 15px !important; height: 38px; }
  input[type=checkbox], input[type=radio] { width: 19px; height: 19px; }

  /* ===== 4. 详情页: 信息聚合 + 工具栏重排 ===== */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar > .btn:first-child { align-self: flex-start; }
  .toolbar .btns { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .toolbar .btns .btn { flex: 1 1 46%; justify-content: center; min-height: 44px; padding: 11px 12px; font-size: 14.5px; }
  .doc-head { padding: 14px; }
  .dmeta { grid-template-columns: 1fr 1fr; gap: 11px 12px; }
  .dm .dm-k { font-size: 12.5px; }
  .dm .dm-v { font-size: 15px; }

  /* ===== 5. 工具栏 / 筛选 / 按钮 ===== */
  .btns { width: 100%; }
  .btn { padding: 11px 14px; font-size: 14.5px; min-height: 44px; }
  .mini-btn { padding: 7px 11px; font-size: 13.5px; }
  .toolbar .row { width: 100%; gap: 8px; flex-wrap: wrap; }
  .toolbar .row > input, .toolbar .row > select, .toolbar .row > .mat-pick, .toolbar .row > .scan-search {
    width: 100% !important; min-width: 0 !important; flex: 1 1 100%;
  }
  .flt { width: 100% !important; flex: 1 1 100%; }
  .flt-size { width: auto !important; }
  /* 检索条: 手机端紧凑网格 —— 关键词全宽 / 日期区间一行 / 下拉一行 / 查询·重置一行 */
  .toolbar .row.flt-bar, .flt-bar {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 6px 8px; align-items: center; width: 100%;
  }
  .flt-bar .fb-kw, .flt-bar .sb-pick, .flt-bar .scan-search { grid-column: 1 / -1; }
  .flt-bar .fb-dates { display: contents; }
  .flt-bar .fb-dates input { width: 100% !important; min-width: 0 !important; }
  .flt-bar .fb-sep { font-size: 12px; text-align: center; }
  /* 下拉与查询同占一行: 下拉跨前两列, 查询落第三列 */
  .flt-bar .fb-sel { grid-column: 1 / 3; }
  .flt-bar .fb-go { grid-column: 3 / 4; }
  .flt-bar .fb-reset { grid-column: 3 / 4; }
  /* 仅「搜索+查询」的筛选条(如物料): 两者同行 */
  .flt-bar.flt-single .sb-pick, .flt-bar.flt-single .scan-search, .flt-bar.flt-single .fb-kw { grid-column: 1 / 3; }
  .flt-bar.flt-single .fb-go { grid-column: 3 / 4; }
  .flt-bar input, .flt-bar select { width: 100% !important; height: 42px; min-height: 42px; }
  .flt-bar .btn { min-height: 42px; padding: 0 12px; }
  /* 分页条: 单行紧凑(隐藏首页/末页), 小按钮 */
  .pager {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: nowrap; gap: 6px; padding: 6px 0;
  }
  .pager .btn { flex: none; min-height: 32px; padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
  .pager .btn:first-of-type, .pager .btn:last-of-type { display: none; }
  .pager .muted { flex: 1 1 auto; text-align: center; font-size: 12.5px; white-space: nowrap; }
  .pager select.flt-size { flex: none; height: 32px; font-size: 12.5px; padding: 0 6px; }
  .page-tabs { gap: 6px; }
  .page-tab { padding: 9px 14px; font-size: 13.5px; }
  .chip { padding: 7px 15px; font-size: 13.5px; }

  /* ===== 6. 卡片 / 看板 / 标签 ===== */
  .cost-cards { grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)) !important; gap: 9px; }
  .cost-card { padding: 13px 14px; }
  .cost-card .value { font-size: 20px; }
  .dash-grid { grid-template-columns: 1fr !important; }
  .chart-box { height: 240px !important; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .lab-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
  .colset { grid-template-columns: 1fr 1fr; }
}

/* ---------- ≤400px 小屏 ---------- */
@media (max-width: 400px) {
  .grid.card td { font-size: 14px; padding: 4px 10px; }
  .grid.card td::before { flex: 0 0 66px; font-size: 12px; padding-right: 8px; }
  .grid.card td[data-primary] { font-size: 15px; }
  .dmeta { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .cost-cards { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)) !important; }
  .modal-foot .btn { font-size: 14px; }
  .page-tab { padding: 8px 11px; }
  .toolbar .btns .btn { flex: 1 1 100%; }
}

/* ===== 列设置弹窗 ===== */
.colset { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; }
.colset label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-body); cursor: pointer; }
.colset input[type=checkbox] { width: 16px; height: 16px; }
@media (max-width: 600px) { .colset { grid-template-columns: 1fr 1fr; } .grid th[data-sort] { white-space: nowrap; } }

/* ===== 成品详情(主数据全览) ===== */
/* (产品详情 dn-head/dn-sec/dn-grid 已废弃, 统一用 .dmeta/.dm + h3) */

/* ===== 新销售单: 头部紧凑 + 明细卡片式录入 ===== */
.sl-head { display: flex; flex-direction: column; gap: 9px; }
.sl-h-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sl-lb { font-size: 12.5px; color: #64748B; font-weight: 600; white-space: nowrap; }
.sl-grow { flex: 1 1 220px; min-width: 0; }
.sl-sm { width: auto; min-width: 84px; }
.sl-xs { width: 66px; }
.sl-date { width: auto; min-width: 150px; }
.sl-chips { display: flex; gap: 4px; flex: none; }
.sl-chip { border: 1px solid var(--border); background: #fff; color: var(--text-body); border-radius: 20px;
  padding: 7px 13px; font-size: 13px; cursor: pointer; transition: .13s; font-family: inherit; line-height: 1.4; }
.sl-chip:hover { border-color: var(--primary); color: var(--primary); }
.sl-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.sl-sec { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; }
.sl-sec b { font-size: 14px; color: var(--text-heading); }
.sl-defwh { font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.sl-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 10px; min-width: 0; }
.sl-item { border: 1px solid var(--border-light); border-radius: 12px; padding: 12px 14px; background: #FCFDFF; min-width: 0; max-width: 100%; }
.sl-item-top { display: flex; gap: 8px; align-items: center; min-width: 0; }
.sl-item-top .sl-prod { flex: 1; min-width: 0; }
.sl-item-top .mini-btn { flex: none; }
.sl-item-mid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.15fr); gap: 8px; margin-top: 8px; align-items: end; }
.sl-item-bot { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.35fr); gap: 8px; margin-top: 8px; }
.sl-item label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-muted); min-width: 0; }
.sl-item input, .sl-item select, .sl-item input.cell[type=number] { width: 100%; min-width: 0; max-width: 100%; }
.sl-amt-box { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-muted); }
.sl-amt-box b { font-size: 15px; color: var(--text-heading); font-variant-numeric: tabular-nums; padding-bottom: 3px; }
/* 单据头部行内复选框(如「含税价」) */
.sl-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.sl-chk input[type=checkbox] { width: 15px; height: 15px; flex: none; margin: 0; }
@media (max-width: 700px) {
  .sl-items { grid-template-columns: 1fr; }
  .sl-grow { flex: 1 1 100%; }
  .sl-h-row:first-child { row-gap: 8px; }
  .sl-chips { flex: 1 1 100%; }
  .sl-chip { flex: 1 1 auto; text-align: center; }
  .sl-lb { font-size: 12px; }
  .sl-date, .sl-sm { flex: 1 1 auto; }
}
@media (max-width: 400px) {
  .sl-item-mid { grid-template-columns: 1fr 1fr; }
  .sl-item-bot { grid-template-columns: 1fr; }
}

/* 销售单头部第二行: 结算/预付/交货 网格对齐(避免日期被挤到下一行) */
.sl-h-row.sl-h2 { display: grid; grid-template-columns: auto minmax(78px, 112px) auto 62px auto minmax(150px, 1fr); gap: 8px; align-items: center; }
@media (max-width: 700px) {
  .sl-h-row.sl-h2 { grid-template-columns: auto 1fr auto 1fr; gap: 8px; }
  .sl-h-row.sl-h2 .sl-lb-d { grid-column: 1 / 2; }
  .sl-h-row.sl-h2 .sl-date { grid-column: 2 / -1; }
}

/* 卡片模式下的可编辑控件: 与字段名同行, 占满剩余宽度 */
.grid.card td > input, .grid.card td > select { flex: 1 1 auto; min-width: 0; width: auto; max-width: 100%; }
.grid.card td > .row { width: 100%; }
.grid.card td input.cell, .grid.card td select.cell, .grid.card td .act-input { width: 100% !important; max-width: 100%; }

/* ===== BOM 工作台 / 盘点录入: 卡片式一物一行 + 检索筛选 ===== */
.toolbar.bom-flt { justify-content: flex-start; }
.bom-flt .row { margin: 0; flex: 1 1 auto; gap: 8px; }
.bom-kw { flex: 1 1 240px; min-width: 0; }
.bom-flt .type-filter { flex: none; }
.bom-flt .muted { font-size: 12px; white-space: nowrap; }

.bom-name, .cnt-name { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }

/* ===== 规格/型号 chip (紧跟物料名) ===== */
/* 物料备注列: 单行截断, hover 看全文(title) */
.pe-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.pe-row-foot .pe-ref { font-size: 11.5px; color: var(--text-muted); }
.pe-row-foot .pe-stk { font-variant-numeric: tabular-nums; }
.pe-row-foot .pe-stk.warn { color: var(--danger); font-weight: 600; }
.pe-row-foot .pe-stk.onway { color: #B45309; font-weight: 600; }
.pe-row-foot .pe-acts { display: flex; gap: 6px; flex: none; }
.pe-row-foot .mini-btn { font-size: 11.5px; padding: 2px 8px; }
.mat-remark { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-muted); }
.m-spec {
  display: inline-block; font-style: normal; font-size: 11.5px; line-height: 1.6;
  color: #64748B; background: #F1F5F9; border: 1px solid #E2E8F0; border-radius: 5px;
  padding: 0 6px; margin-left: 6px; vertical-align: middle;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) { .m-spec { font-size: 11px; padding: 0 5px; margin-left: 5px; } }
.bom-name b, .cnt-name b { font-size: 14px; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bom-name i, .cnt-name i { font-style: normal; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sl-item-top .tbadge, .sl-item-top .badge { flex: none; }

/* ===== BOM 详情头部: 单行紧凑 ===== */
.bom-head { margin-bottom: 10px; }
.bh-main { display: flex; align-items: center; gap: 8px; width: 100%; }
.bh-back { flex: none; }
.bh-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 7px; overflow: hidden; }
.bh-title b { font-size: 15px; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-title i { font-style: normal; font-size: 12px; color: var(--text-muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.bh-btns { flex: none; display: flex; gap: 6px; }
@media (max-width: 600px) {
  .toolbar.bom-head { flex-direction: row; align-items: center; gap: 6px; }
  .bh-title b { font-size: 14px; }
  .bom-head .btn { min-height: 38px; padding: 8px 12px; font-size: 13.5px; }
  .bom-head #btnPrint { padding: 8px 10px; }
}

/* ===== BOM 详情头部: 成本数据条(一体化) ===== */
.bom-stat { display: flex; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 14px; box-shadow: var(--shadow-card); margin-bottom: 12px; overflow: hidden; }
.bs-main { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 11px 16px; min-width: 150px; border-left: 3px solid #D97706; }
.bs-k { font-size: 12px; color: var(--text-muted); }
.bs-v { font-size: 24px; font-weight: 700; color: #B45309; line-height: 1.15; font-variant-numeric: tabular-nums; }
.bs-note { font-style: normal; font-size: 11px; color: var(--text-muted); }
.bs-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); border-left: 1px solid var(--border-light); }
.bs-i { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; padding: 10px 8px; border-left: 1px solid var(--border-light); }
.bs-i:first-child { border-left: none; }
.bs-i span { font-size: 12px; color: var(--text-muted); }
.bs-i b { font-size: 16px; color: var(--text-heading); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .bom-stat { flex-direction: column; }
  .bs-main { flex-direction: row; align-items: baseline; gap: 8px; padding: 10px 14px; min-width: 0; flex-wrap: wrap; }
  .bs-v { margin-left: auto; font-size: 21px; }
  .bs-note { flex: 1 1 100%; }
  .bs-grid { border-left: none; border-top: 1px solid var(--border-light); }
  .bs-i { padding: 9px 6px; }
}

.bom-val { font-size: 14px; color: var(--text-heading); font-variant-numeric: tabular-nums; padding: 3px 0 5px; }
.bom-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.bom-cost { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.bom-cost b { font-size: 14.5px; color: var(--primary); font-variant-numeric: tabular-nums; margin-left: 2px; }
.bom-sub { font-size: 11.5px; color: var(--text-muted); text-align: right; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cnt-mid { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.cnt-book { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.cnt-book b { font-size: 15px; color: var(--text-heading); font-variant-numeric: tabular-nums; margin-left: 2px; }
.cnt-act { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); flex: none; }
.cnt-act .act-input { width: 120px; }
.cnt-time { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.cnt-item.hl { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.cnt-item[data-diff="1"] { background: #FFFBEB; border-color: #FDE68A; }

@media (max-width: 600px) {
  .bom-kw { flex: 1 1 100%; }
  .bom-flt .type-filter { flex: 1 1 100%; }
  .bom-flt .type-filter .chip { flex: 1 1 auto; text-align: center; }
  .cnt-mid { flex-wrap: wrap; }
  .cnt-act { flex: 1 1 100%; }
  .cnt-act .act-input { width: 100%; }
  .bom-foot { gap: 4px; }
  .bom-cost { flex: 1 1 100%; }
  .bom-sub { text-align: left; white-space: normal; }
}

/* ===== 仪表盘: 平板/窄屏(含安卓平板横屏 1024~1280) 图表独占一行, 下方两卡并排 ===== */
@media (max-width: 1100px) and (min-width: 601px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dash-chart-col .chart-box { height: 250px; }
  .dash-side { flex-direction: row; align-items: stretch; }
  .dash-side > .wh-stock { flex: 1 1 0; }
}

/* 窄屏 KPI 改两列, 避免主卡/去年卡数字挤压 */
@media (max-width: 1100px) {
  .kpi-hero { grid-template-columns: 1fr 1fr; gap: 11px; }
  .hero-main { grid-column: span 2; }
}

/* ===== 仪表盘 KPI 响应式 ===== */
@media (max-width: 900px) {
  .kpi-hero { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-main { grid-column: span 2; }
}
@media (max-width: 600px) {
  .kpi-hero { gap: 9px; }
  .hero-main { padding: 14px 16px; }
  .hero-main .hm-value { font-size: 26px; }
  .hero-ref { padding: 12px 14px; }
  .hero-ref .value { font-size: 17px; }
  .cmp-table { font-size: 12.5px; }
  .cmp-table td { padding: 8px 3px; }
}

/* ===== 流转记录: 时间为主导, 操作人紧随同行 ===== */
.flow-log .fl-op { font-weight: 400; font-size: 12.5px; color: var(--text-muted); }
.flow-log .fl-op::before { content: '·'; margin: 0 6px; color: var(--border); }   /* 时间与操作人之间用中点分隔 */
.flow-log .fl-when { white-space: nowrap; }            /* 时间·操作人·状态 强制同一行(不被拆行) */
/* 卡片模式下 .grid.card td 带 `white-space: normal !important`, 必须同权覆盖,
   否则状态胶囊会被挤到第二行; 用 flex(默认不换行) + 同权 !important 双保险 */
.flow-log .grid.card td.fl-when { display: flex; align-items: center; flex-wrap: nowrap; white-space: nowrap !important; }
.flow-log .fl-when > b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.flow-log .fl-when .st { font-size: 11.5px; vertical-align: middle; margin-left: 8px; }
.flow-log .grid.card td[data-primary] b { font-size: 13.5px; }
/* 备注超长: 默认折为 2 行, 点击展开/收起 */
.flow-log .fl-rmk { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.flow-log .fl-rmk.open { -webkit-line-clamp: 99; }
/* 记录较多: 默认只展示最近 N 条, 其余收起 */
.flow-log tr.fl-extra { display: none; }
.flow-log.fl-open tr.fl-extra { display: table-row; }
@media (max-width: 600px) { .flow-log.fl-open tr.fl-extra { display: flex; flex-direction: column; } }
.flow-log .fl-more { display: block; width: 100%; margin-top: 8px; padding: 8px 0; border: 1px dashed var(--border-light, #E2E8F0);
  border-radius: 8px; background: none; color: var(--text-muted); font-size: 12.5px; font-family: inherit; cursor: pointer; transition: all .15s; }
.flow-log .fl-more:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light, #EEF2FF); }

/* 详情页底部「制单信息」栏: 制单:xx  创建:xx  操作:xx —— 精简一行 */
.doc-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 16px; margin-top: 4px; padding: 12px 2px 4px; border-top: 1px solid var(--border-light, #E2E8F0); }
.doc-foot .df-item { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.doc-foot .df-k { font-size: 11px; color: var(--text-muted); }
.doc-foot .df-k::after { content: ':'; }
.doc-foot .df-v { font-size: 12px; color: var(--text-body, #334155); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 窄屏: 折行会参差 → 改为纵向两项, 标签固定宽使冒号垂直对齐 */
@media (max-width: 900px) {
  .doc-foot { flex-direction: column; align-items: stretch; gap: 3px; }
  .doc-foot .df-item { display: flex; }
  .doc-foot .df-k { flex: 0 0 34px; }
}

/* 工单·物料需求卡片 (一物一卡: 编码+补货同行; 需求/可用/缺口/在途 2×2) */
.mreq-list { display: grid; gap: 10px; }
.mreq-card { border: 1px solid var(--border-light, #E2E8F0); border-radius: 10px; padding: 10px 12px; background: #fff; }
.mreq-top { display: flex; align-items: center; gap: 8px; }
.mreq-code { flex: none; display: inline-block; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft, #EEF2FF); padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.mreq-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--text-heading); }
.mreq-buy { flex: none; margin-left: auto; }
.mreq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 9px; }
.mreq-f { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; background: #F8FAFC; border-radius: 7px; padding: 5px 10px; }
.mreq-k { flex: none; font-size: 11.5px; color: var(--text-muted); }
.mreq-v { font-size: 13px; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.mreq-v.up { color: #DC2626; }
.mreq-v.down { color: #059669; }
.mreq-v.muted { color: var(--text-muted); font-weight: 500; }
/* 补货页·物料卡附加: 供应商 / 补货数量行 */
.rs-sup { flex: none; font-size: 11.5px; color: var(--text-muted); border: 1px solid var(--border-light, #E2E8F0); border-radius: 6px; padding: 1px 7px; }
.rs-buy { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-light, #E2E8F0); }
.rs-buy-k { font-size: 12px; color: var(--text-muted); }
.rs-buy input { width: 110px; }
.rs-buy-u { font-size: 12px; color: var(--text-muted); }
.rs-remark { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.rs-remark label { font-size: 13px; color: var(--text-muted); flex: none; }
.rs-remark input { flex: 1; }
@media (max-width: 600px) {
  .mreq-card { padding: 9px 10px; }
  .mreq-name { font-size: 13px; }
  .mreq-grid { gap: 5px 8px; }
  .mreq-f { padding: 5px 8px; }
}

/* ===== 明细合计摘要条(替代 tfoot, 紧凑右对齐, 不与卡片混淆) ===== */
.sum-bar {
  display: flex; align-items: baseline; justify-content: flex-end; flex-wrap: wrap;
  gap: 8px 14px; margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border-light);
  font-size: 12.5px; color: var(--text-muted);
}
.sum-bar > span { white-space: nowrap; }
.sum-bar .sum-lb { font-size: 13px; color: var(--text-body); }
.sum-bar > b {
  font-size: 17px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}

/* ===== 弹窗内的详情小节标题(与页面型详情统一: h3, 15px) ===== */
.modal-body h3 { font-size: 15px; color: var(--text-heading); margin: 16px 0 10px; }
.modal-body .dmeta { margin: 0 0 4px; }
.modal-body .dmeta + .form-grid, .modal-body .dmeta + .sl-head, .modal-body .dmeta + .table-scroll { margin-top: 12px; }

/* ===== 状态胶囊(语义色) ===== */
.st {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 12px; font-weight: 600; line-height: 1.5; letter-spacing: .2px;
  padding: 3px 11px; border-radius: 999px; white-space: nowrap;
  border: none; color: #fff;
}
.st.gray   { background: #64748B; }
.st.blue   { background: #2563EB; }
.st.orange { background: #EA580C; }
.st.green  { background: #059669; }
.st.red    { background: #DC2626; }
.st.slate  { background: #94A3B8; }

/* ===== 详情头部(两段式): 第一行标题, 第二行操作栏[返回 | 状态(居中) | 操作] ===== */
.dt-head { margin-bottom: 12px; }
.dt-title { display: flex; align-items: center; gap: 8px; padding: 0 2px 10px; }
.dt-title .dt-ic { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft, #EEF2FF); color: var(--primary); flex: none; }
.dt-title .dt-ic .ic { width: 15px; height: 15px; }
.dt-title > span { font-size: 13px; color: var(--text-muted); }
.dt-title > span:empty { display: none; }
.dt-title > b { font-size: 17px; font-weight: 700; color: var(--text-heading); letter-spacing: .01em; }

/* 操作栏: 开放式线条隔离 —— 仅上下细线分界, 无底色/无边框/无圆角
   三区 —— 左(返回) 中(状态·真居中) 右(操作) */
.dt-bar, .modal-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 8px;
  padding: 6px 0;
  background: none; border: none; border-radius: 0; box-shadow: none;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
}
.dt-bar > .mh-back, .modal-bar > .mh-back { justify-self: start; }
.dt-bar > .dt-state, .modal-bar > .mb-state {
  justify-self: center; min-width: 0; max-width: 100%;
  display: flex; align-items: center; gap: 8px; overflow: hidden;
  padding: 0 12px;
  border-left: 1px solid #E2E8F0;
  border-right: 1px solid #E2E8F0;
}
.dt-bar > .dt-state .muted, .modal-bar > .mb-state .muted {
  font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dt-bar > .btns, .modal-bar > .mb-acts {
  justify-self: end; margin: 0; width: auto;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.dt-bar > .btns .btn, .modal-bar > .mb-acts .btn {
  padding: 5px 11px; font-size: 12.5px; flex: none; font-weight: 500;
}
.dt-bar > .btns .btn.primary, .modal-bar > .mb-acts .btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
/* 空状态区不占位(仍保持三栏对称) */
.dt-bar > .dt-state:empty, .modal-bar > .mb-state:empty { visibility: hidden; }

/* 返回列表: 导航行为弱化 —— 无边框纯文字(开放式), hover 才浮出浅底 */
.mh-back {
  background: none; border-color: transparent; color: #5B6B80;
  box-shadow: none; padding: 5px 8px; margin-left: -2px;
}
.mh-back:hover { background: #F1F5F9; border-color: transparent; color: var(--primary); }

/* 有操作栏时: 标题行去掉底线, 分隔交给操作栏的上下线(避免双线) */
.modal:has(.modal-bar) .modal-head { border-bottom: none; }

/* 操作栏在 .modal-body 内部 → 与内容卡共用同一宽度基准(含滚动条) */
.modal-bar { margin: 0 0 14px; }
.dt-bar { margin: 0; }

/* ===== 「操作」下拉菜单(从按钮下方右对齐展开) ===== */
.dropdown {
  position: fixed; z-index: 300; min-width: 172px; max-width: min(86vw, 290px);
  max-height: 62vh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 5px;
  background: #fff; border: 1px solid var(--border-light);
  border-radius: 11px; box-shadow: 0 10px 28px rgba(15,23,42,.16);
  animation: ddIn .12s ease-out;
}
@keyframes ddIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.dropdown .dd-head {
  padding: 7px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border-light); margin-bottom: 4px;
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 12px; border: none; background: none; border-radius: 7px;
  font-size: 14.5px; color: var(--text-heading); text-align: left; cursor: pointer;
  transition: background .1s;
}
.dropdown-item:hover, .dropdown-item:active { background: #F3F5F9; }
.dropdown-item .ic { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.dropdown-item span { flex: 1 1 auto; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger .ic { color: var(--danger); }

/* ===== 移动端「操作」抽屉(无锚点时的兜底) ===== */
.d-more { display: none !important; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-list .sheet-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  min-height: 48px; padding: 11px 14px; font-size: 15px; text-align: left;
}
.sheet-list .sheet-item .ic { width: 18px; height: 18px; flex-shrink: 0; }
.sheet-list .sheet-item.danger { color: var(--danger); border-color: #FCA5A5; }
.sheet-list .sheet-item.danger .ic { color: var(--danger); }
.sheet-list .sheet-item span { flex: 1 1 auto; }

/* ===== 单据优先级星级(1-5, 圆角星形图标) ===== */
.stars { display: inline-flex; align-items: center; gap: 0; line-height: 1; }
.stars b {
  display: inline-flex; color: #cfd4da; cursor: pointer; font-weight: 400;
  transition: color .12s, transform .12s; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.stars b svg { width: 15px; height: 15px; vertical-align: 0; stroke-width: 1.7; }
.stars b.on { color: #f59e0b; }
.stars b.on svg { fill: #f59e0b; stroke: #f59e0b; }
.stars b:hover { color: #fbbf24; transform: scale(1.18); }
.stars b:hover svg { fill: #fbbf24; stroke: #fbbf24; }
.stars.ro b { cursor: default; }
.stars.ro b:hover { transform: none; color: #cfd4da; }
.stars.ro b:hover svg { fill: none; stroke: currentColor; }
.stars.ro b.on, .stars.ro b.on:hover { color: #f59e0b; }
.stars.ro b.on:hover svg { fill: #f59e0b; stroke: #f59e0b; }
.stars.lg b svg { width: 20px; height: 20px; }
.stars-cell { white-space: nowrap; }

/* ===== 扫码报损 ===== */
.sc-list { display: flex; flex-direction: column; gap: 10px; }
.sc-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; background: var(--card-bg); overflow: hidden; }
.sc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-nm { font-weight: 600; color: var(--text-heading); }
.sc-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; color: #fff; background: #64748B; }
.sc-tag.mat { background: #2563EB; }
.sc-tag.prod { background: #7C3AED; }
.sc-top .mini-btn.del { margin-left: auto; }
.sc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.sc-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); gap: 3px; min-width: 0; }
.sc-grid input, .sc-grid select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: #fff; }
.sc-grid input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.sc-grid input[type="number"]::-webkit-outer-spin-button,
.sc-grid input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sc-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.sc-foot .sc-stk { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-amt { color: #DC2626; font-weight: 600; white-space: nowrap; }
.stat-h { margin: 16px 0 6px; font-size: 14px; color: var(--text-heading); }
@media (max-width: 600px) {
  .sc-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== 企微推送 ===== */
.wp-evs { display: flex; flex-direction: column; gap: 6px; }
.wp-ev { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.45; padding: 7px 10px; border: 1px solid var(--border-light, #F1F5F9); border-radius: 8px; }
.wp-ev input { margin-top: 3px; flex: none; }
.wp-ev span { min-width: 0; }
/* 定时播报(宝塔配置) */
.wp-url { display: inline-block; max-width: 100%; padding: 3px 8px; border: 1px solid #E2E8F0; border-radius: 6px; background: #F8FAFC; color: #334155; font-size: 12px; line-height: 1.5; word-break: break-all; cursor: pointer; user-select: all; }
.wp-url:hover { border-color: var(--primary, #4F46E5); background: #EEF2FF; }
.wp-steps { margin: 10px 0 0; padding-left: 20px; font-size: 13px; color: #475569; line-height: 1.95; }
.wp-steps li { margin: 0; }
.wp-cron { display: flex; flex-direction: column; gap: 8px; }
.wp-cron-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #334155; }
.wp-cron-lb { flex: none; width: 68px; color: #64748B; }
.wp-k { display: inline-block; padding: 1px 6px; border: 1px solid #E2E8F0; border-radius: 4px; background: #F1F5F9; font-size: 12px; color: #334155; word-break: break-all; }
.wp-cron td { vertical-align: middle; }

/* ===== 报表中心 ===== */
.rep-kpi { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.rep-kpi .rk { flex: 1 1 150px; min-width: 140px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-bg); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rep-kpi .rk span { font-size: 12px; color: #64748B; }
.rep-kpi .rk b { font-size: 18px; line-height: 1.25; color: var(--text-heading); font-weight: 700; }
.rep-kpi .rk b.hl { color: #059669; }
.rep-kpi .rk i { font-size: 11px; color: #94A3B8; font-style: normal; }
.rep-rate.up { color: #059669; font-weight: 600; }
.rep-rate.down { color: #DC2626; font-weight: 600; }
.rep-bar-h, .rep-bar { width: 92px; }
.rep-bar i { display: block; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #4F46E5, #7C3AED); }
.rep-quick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.rep-th { font-size: 13px; color: #475569; white-space: nowrap; }
.rep-th input { width: 72px; padding: 3px 6px; }
.rep-idle-w { background: #FFFBEB !important; }
.rep-idle-x { background: #FEF2F2 !important; }
.rep-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: #E0E7FF; color: #4338CA; font-size: 11px; }
/* 应收对账: 客户行展开 */
.rep-exp { display: inline-block; width: 12px; color: #94A3B8; transition: transform .15s; }
.rep-crow { cursor: pointer; }
.rep-crow.open .rep-exp { transform: rotate(90deg); }
.rep-cdet > td { padding: 0 !important; background: #F8FAFC; }
.rep-inner { margin: 8px 0; }
.rep-inner th { font-size: 12px; color: #64748B; }
@media (max-width: 600px) {
  .rep-kpi .rk { flex: 1 1 44%; min-width: 0; }
  .rep-kpi .rk b { font-size: 16px; }
  .rep-bar-h { display: none; }
  .rep-bar { display: none; }
}

/* ===== CSV 批量导入弹窗 ===== */
.imp-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.imp-prev { max-height: 240px; overflow: auto; margin-top: 8px; }
.imp-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.imp-t th, .imp-t td { border: 1px solid #E2E8F0; padding: 5px 8px; text-align: left; white-space: nowrap; }
.imp-t th { background: #F8FAFC; color: #475569; font-weight: 600; }
.imp-ok { padding: 8px 12px; border-radius: 8px; background: #ECFDF5; color: #047857; font-size: 13px; }
.imp-err { padding: 8px 12px; border-radius: 8px; background: #FEF2F2; color: #B91C1C; font-size: 13px; margin-top: 8px; }
.imp-err ul { padding-left: 16px; }
@media (max-width: 600px) {
  .imp-bar .btn { flex: 1 1 46%; justify-content: center; }
}

/* ===== h3 位置/颜色工具类(替代行内样式) ===== */
.h3-tight { margin: 0; }
.h3-sec { margin-top: 18px; }
.h3-note .neg { color: #DC2626; }
.h3-note .pos { color: #059669; }

/* ===== 采购退货：明细行 ===== */
.pr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 6px; }
.pr-head h3 { margin: 0; }
.pr-row { display: grid; grid-template-columns: 1fr 92px 108px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #E2E8F0; }
.pr-row select, .pr-row input { width: 100%; min-width: 0; }
.pr-row .pr-ret { font-size: 12px; color: #64748B; white-space: nowrap; }
@media (max-width: 600px) {
  .pr-row { grid-template-columns: 1fr 1fr; }
  .pr-row select, .pr-row input[data-f="reason"] { grid-column: 1 / -1; }
  .pr-head { flex-wrap: wrap; }
}

/* ===== 小节标题行(标题 + 右侧操作) ===== */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-gap { margin: 14px 0 10px; }   /* 无 secTitle 前缀的小节标题行: 补上下间距 */
.sec-head h3 { margin: 0; }
/* ---------- 多币种(单据级) 标记 ---------- */
.fx-tag { display: inline-block; font-size: 11px; color: #4338CA; background: var(--primary-light); border-radius: 10px; padding: 0 6px; margin-left: 2px; }
.fx-hint { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.fx-r { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

/* ===== 装箱：明细行(一物一行) ===== */
.pl-row { display: grid; grid-template-columns: minmax(200px,1.5fr) 92px minmax(150px,1fr) 160px auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #E2E8F0; }
.pl-row .mat-pick { min-width: 0; }
.pl-row input[data-f="qty"] { width: 100%; min-width: 0; }
.pl-row .pl-calc { font-size: 12px; color: #475569; text-align: right; white-space: nowrap; }
.pl-row-add { padding: 10px 0 2px; }
@media (max-width: 600px) {
  .pl-row { grid-template-columns: 1fr 1fr; }
  .pl-row .pl-prod { grid-column: 1 / -1; }
  .pl-row select[data-f="spec"] { grid-column: 1 / -1; }
  .pl-row .pl-calc { text-align: left; }
}

/* ===== 装箱单 A4 中英双语打印 ===== */
.pl-doc { color: #000; font-size: 11px; line-height: 1.35; }
.pl-doc .pl-co { text-align: center; font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.pl-doc .pl-co-en { text-align: center; font-size: 11px; letter-spacing: .5px; }
.pl-doc .pl-co-sub { text-align: center; font-size: 9.5px; color: #333; margin-bottom: 4px; }
.pl-doc .pl-title { text-align: center; font-size: 18px; font-weight: 800; letter-spacing: 3px; margin: 2px 0 10px; }
.pl-doc table { width: 100%; border-collapse: collapse; }
.pl-doc .pl-info { margin-bottom: 8px; }
.pl-doc .pl-info td { border: 1px solid #333; padding: 4px 6px; }
.pl-doc .pl-info .pl-k { width: 17%; background: #f2f4f8; font-weight: 600; white-space: nowrap; }
.pl-doc .pl-info .pl-v { width: 33%; }
.pl-doc .pl-tb th, .pl-doc .pl-tb td { border: 1px solid #333; padding: 3px 4px; vertical-align: top; word-break: break-word; }
.pl-doc .pl-tb th { background: #f2f4f8; text-align: center; font-size: 10px; line-height: 1.2; font-weight: 700; }
.pl-doc .pl-tb .c { text-align: center; }
.pl-doc .pl-tb .r { text-align: right; }
.pl-doc .pl-tb .pl-en { color: #555; font-size: 10px; }
.pl-doc .pl-tb .pl-sum td { font-weight: 700; background: #fafbfd; }
.pl-doc .pl-foot { display: flex; justify-content: space-between; margin-top: 24px; font-size: 11px; }
@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  body.print-pl #mainView, body.print-pl .msgbar, body.print-pl .sidebar, body.print-pl .main-head, body.print-pl .toolbar { display: none !important; }
  body.print-pl .modal-mask { position: static !important; display: block !important; padding: 0 !important; background: #fff !important; }
  body.print-pl .modal { max-width: none !important; width: auto !important; box-shadow: none !important; border: none !important; max-height: none !important; background: #fff !important; }
  body.print-pl .modal-head, body.print-pl .modal-foot, body.print-pl .modal-bar { display: none !important; }
  body.print-pl .modal-body { padding: 0 !important; overflow: visible !important; }
  body.print-pl .pl-doc { width: 186mm; font-size: 9pt; }
  body.print-pl .pl-doc .pl-tb thead { display: table-header-group; }
  body.print-pl .pl-doc tr { page-break-inside: avoid; }
}

/* ===== 产品介绍 / 使用帮助 ===== */
.intro-hero { text-align: center; padding: 26px 16px 22px; background: linear-gradient(135deg,#EEF2FF,#F5F3FF); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 14px; }
.intro-logo { font-size: 30px; font-weight: 800; letter-spacing: 1px; color: var(--primary); }
.intro-sub { margin-top: 6px; font-size: 14px; color: var(--text-heading); }
.intro-tags { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); letter-spacing: .5px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.feat-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.feat-card b { display: block; font-size: 13.5px; color: var(--text-heading); margin-bottom: 4px; }
.feat-card span { font-size: 12.5px; color: var(--text-body); line-height: 1.55; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mod-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mod-card b { display: block; margin-bottom: 6px; color: var(--primary); font-size: 13px; }
.mod-card ul { margin: 0; padding-left: 18px; }
.mod-card li { font-size: 12.5px; color: var(--text-body); line-height: 1.7; }
.help-steps { margin-top: 4px; }
.help-step { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.help-step:last-child { border-bottom: none; padding-bottom: 0; }
.help-n { flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.help-step b { font-size: 13.5px; color: var(--text-heading); }
.help-step p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-body); line-height: 1.6; }
.help-mod { margin-bottom: 12px; }
.help-mod:last-child { margin-bottom: 0; }
.help-mod > b { display: inline-block; font-size: 13px; color: var(--primary); background: var(--primary-light); border-radius: 6px; padding: 2px 9px; margin-bottom: 6px; }
.help-mod ul { margin: 0; padding-left: 18px; }
.help-mod li { font-size: 12.5px; color: var(--text-body); line-height: 1.75; }
.faq-q { font-size: 13.5px; font-weight: 600; color: var(--text-heading); margin-top: 10px; }
.faq-a { font-size: 12.5px; color: var(--text-body); line-height: 1.65; margin-top: 2px; }
@media (max-width: 600px) {
  .intro-logo { font-size: 25px; }
  .feat-grid, .mod-grid { grid-template-columns: 1fr; }
}
.login-anon { text-align: center; margin: 12px 0 2px; }
.login-anon a { font-size: 12.5px; color: var(--primary); text-decoration: none; }
.login-anon a:hover { text-decoration: underline; }

/* ===== 统一「扫码」按钮 =====
   图标统一: 同一枚线性 scan 图标 + 主色(--primary) + 协调的相对尺寸。
   容器按场景分层:
     · 页面主入口(扫码领料/扫码报损) .scan-cam   → 浅底实心按钮
     · 列表明细行 .mini-btn.cam                  → 浅底实心按钮
     · 检索框内嵌 .mat-pick .mp-cam              → 保持通透贴合框体(不加重底色),
       只统一图标颜色, 避免在输入框内形成突兀色块、并与框内清空按钮保持一致
   注意: 内嵌按钮用绝对定位 + translateY(-50%) 垂直居中, 任何 :active 规则都必须
   带上 translateY(-50%), 否则按下时会丢掉居中而"跳出"输入框。 */
.scan-cam,
.mini-btn.cam {
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
  transition: background .15s, transform .12s;
}
.scan-cam:hover,
.mini-btn.cam:hover { background: #E0E7FF; }
.scan-cam:active,
.mini-btn.cam:active { transform: scale(.92); }
.scan-cam .ic,
.mini-btn.cam .ic { color: var(--primary); }
.scan-cam { width: 44px; height: 44px; border-radius: 12px; }
.scan-cam .ic { width: 20px; height: 20px; }
.mini-btn.cam { width: 30px; height: 30px; padding: 0; border-radius: 8px; }
.mini-btn.cam .ic { width: 16px; height: 16px; }
/* 检索框内嵌: 仅统一图标(颜色/尺寸仍由原有 .mat-pick 规则定位与定尺) */
.mat-pick .mp-cam .ic { color: var(--primary); }
@media (max-width: 600px) {
  .scan-cam { width: 42px; height: 42px; border-radius: 11px; }
  .scan-cam .ic { width: 19px; height: 19px; }
  .mini-btn.cam { width: 32px; height: 32px; }
}
