/* ==========================================================================
   鸿信科技 ERP 管理系统 —— Apple Design 风格
   设计语言：浅灰底 #f5f5f7 / 苹果蓝 #0071e3 / 墨色 #1d1d1f / 毛玻璃 / 大圆角
   ========================================================================== */

:root {
  /* 品牌与语义色（Apple 色板） */
  --primary:      #0071e3;
  --primary-600:  #0077ed;
  --primary-700:  #006edb;
  --primary-050:  #e8f2fd;
  --ok:           #34c759;
  --ok-bg:        #e9f9ef;
  --warn:         #ff9f0a;
  --warn-bg:      #fff7e6;
  --danger:       #ff3b30;
  --danger-bg:    #fff0ef;
  --info:         #007aff;
  --info-bg:      #e6f2ff;

  /* 中性色（Apple 灰阶） */
  --bg:        #f5f5f7;
  --panel:     #ffffff;
  --ink:       #1d1d1f;
  --text:      #3a3a3c;
  --muted:     #6e6e73;
  --faint:     #86868b;
  --line:      #e5e5ea;
  --line-2:    #f2f2f5;
  --hover:     #f7f7f9;

  /* 侧边栏（毛玻璃浅色） */
  --side-bg:      rgba(250,250,252,.72);
  --side-bg-2:    rgba(250,250,252,.72);
  --side-text:    #3a3a3c;
  --side-active:  #0071e3;
  --side-line:    rgba(0,0,0,.07);

  /* 形状与阴影（Apple 弥散阴影） */
  --r-sm:  9px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  22px;
  --shadow-xs: 0 0 0 1px rgba(0,0,0,.03), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 0 0 1px rgba(0,0,0,.03), 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --shadow-md: 0 0 0 1px rgba(0,0,0,.03), 0 4px 12px rgba(0,0,0,.06), 0 12px 28px rgba(0,0,0,.07);
  --shadow-lg: 0 0 0 1px rgba(0,0,0,.04), 0 12px 28px rgba(0,0,0,.10), 0 30px 70px rgba(0,0,0,.14);
  --ring: 0 0 0 4px rgba(0,113,227,.16);
  --top-bg: rgba(255,255,255,.76);
  --avatar-end: #64d2ff;
  --login-glow-a: rgba(0,113,227,.12);
  --login-glow-b: rgba(88,86,214,.09);
  --login-start: #fbfbfd;
  --login-end: #ebebf0;
}

:root[data-theme="graphite"] {
  --primary:#3a3a3c; --primary-600:#48484a; --primary-700:#2c2c2e; --primary-050:#ededf0;
  --bg:#f2f2f4; --hover:#ececef; --side-active:#3a3a3c;
  --ring:0 0 0 4px rgba(58,58,60,.16); --avatar-end:#8e8e93;
  --login-glow-a:rgba(58,58,60,.12); --login-glow-b:rgba(142,142,147,.11);
  --login-start:#fafafa; --login-end:#e7e7ea;
}
:root[data-theme="sage"] {
  --primary:#25855a; --primary-600:#2b9364; --primary-700:#1f714c; --primary-050:#e8f5ee;
  --bg:#f3f7f4; --hover:#edf4ef; --side-active:#25855a;
  --side-bg:rgba(247,251,248,.76); --ring:0 0 0 4px rgba(37,133,90,.17); --avatar-end:#75d6a5;
  --login-glow-a:rgba(37,133,90,.13); --login-glow-b:rgba(94,175,128,.10);
  --login-start:#fbfdfb; --login-end:#e8f0ea;
}
:root[data-theme="violet"] {
  --primary:#6e5bd5; --primary-600:#7866df; --primary-700:#5f4cc2; --primary-050:#f0edff;
  --bg:#f6f4fa; --hover:#f0edf7; --side-active:#6e5bd5;
  --side-bg:rgba(250,248,253,.76); --ring:0 0 0 4px rgba(110,91,213,.17); --avatar-end:#c084fc;
  --login-glow-a:rgba(110,91,213,.14); --login-glow-b:rgba(192,132,252,.10);
  --login-start:#fcfbfe; --login-end:#ece8f4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

/* ==========================================================================
   苹果风字体：西文/数字用 SF Pro（macOS 原生）或 Inter Variable（Windows 回退，
   与 SF 同源设计），中文用苹方（macOS）/ 微软雅黑（Windows）
   ========================================================================== */
@font-face {
  font-family: 'InterVar';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/vendor/fonts/inter-latin.woff2') format('woff2');
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "InterVar", "Inter", "Helvetica Neue", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "苹方", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  cursor: default;
  user-select: text;
  -webkit-user-select: text;
}

button { font-family: inherit; cursor: pointer; user-select: text; -webkit-user-select: text; }
input, textarea, [contenteditable="true"] {
  font-family: inherit; font-size: 14px;
  cursor: text; user-select: text; -webkit-user-select: text;
}
select { font-family: inherit; font-size: 14px; cursor: default; user-select: text; -webkit-user-select: text; }
.selectable { cursor: text; user-select: text; -webkit-user-select: text; }

/* 原生下拉及禁用字段的复制入口，不影响原表单布局与只读状态。 */
.text-copy-menu {
  position: fixed; z-index: 1000; padding: 4px; min-width: 104px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
.text-copy-menu button {
  display: block; width: 100%; padding: 6px 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-size: 13px; text-align: left;
}
.text-copy-menu button:hover, .text-copy-menu button:focus-visible { background: var(--primary-050); color: var(--primary); }

/* 数字统一等宽 + 西文字形优先 Inter（SF 同源设计），表格/卡片对齐更整齐 */
.num, .cbar-num, .doc-amt, .pur-amt, .di-amt, .stat-card .num, .pager,
.dp-total, .pp-total, .occ-row b, .di-cells, .badge, .status-select {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-family: "InterVar", -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 大数字：苹果 SF Pro Display 风格（更紧的字距、更高的字重） */
.stat-card .num {
  font-family: "InterVar", -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.7px;
}

/* 滚动条（纤细浅灰） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8d8dc; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c1c1c7; background-clip: content-box; }

/* 通用聚焦态 */
:focus-visible { outline: none; box-shadow: var(--ring); }

/* ==========================================================================
   登录页（Apple 风格：浅色渐变 + 玻璃卡片）
   ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1000px 500px at 50% -12%, var(--login-glow-a), transparent 62%),
    radial-gradient(900px 500px at 92% 108%, var(--login-glow-b), transparent 60%),
    linear-gradient(180deg, var(--login-start) 0%, var(--bg) 55%, var(--login-end) 100%);
  transition: background .28s ease;
}
.login-card {
  width: 392px; max-width: 100%;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 20px 60px rgba(0,0,0,.12);
  position: relative;
}
.login-card::before {
  content: ''; position: absolute; top: 17px; left: 20px;
  width: 10px; height: 10px; border-radius: 50%; background: #ff5f57;
  box-shadow: 18px 0 #febc2e, 36px 0 #28c840;
  opacity: .9;
}
.login-brand { text-align: center; margin-bottom: 12px; }
.login-brand-img {
  height: 68px; width: 68px; object-fit: contain;
  margin: 0 auto 16px; display: block;
  border-radius: 19px; background: #fff; padding: 7px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
}
.login-logo {
  font-size: 22px; font-weight: 700; color: var(--ink);
  text-align: center; letter-spacing: .2px;
}
.login-sub {
  text-align: center; color: var(--faint); margin: 8px 0 28px;
  font-size: 11px; letter-spacing: 1.8px; word-break: break-word;
  text-transform: uppercase; font-weight: 500;
}
.theme-switcher {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 7px; border: 1px solid rgba(0,0,0,.07);
  border-radius: 999px; background: rgba(255,255,255,.64);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.theme-switcher-login { display: flex; width: max-content; margin: -14px auto 20px; }
.theme-dot {
  width: 17px; height: 17px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(0,0,0,.13);
  transition: transform .15s ease, box-shadow .15s ease;
}
.theme-dot:hover { transform: scale(1.12); }
.theme-dot.active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--primary); }
.theme-dot[data-theme="ocean"] { background:#0071e3; }
.theme-dot[data-theme="graphite"] { background:#3a3a3c; }
.theme-dot[data-theme="sage"] { background:#25855a; }
.theme-dot[data-theme="violet"] { background:#6e5bd5; }
.login-card label {
  display: block; font-size: 12.5px; color: var(--muted);
  margin: 14px 0 7px; font-weight: 600;
}
.login-card input {
  width: 100%; padding: 11px 14px;
  border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-md);
  outline: none; background: #fff; color: var(--ink);
  transition: border-color .16s, box-shadow .16s;
}
.login-card input::placeholder { color: #b0b0b6; }
.login-card input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ==========================================================================
   按钮（Apple：主按钮实心蓝胶囊，次按钮白底细边）
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.9);
  color: var(--text);
  padding: 7px 15px; border-radius: 980px;
  font-size: 13px; font-weight: 500; line-height: 1.4;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: #fafafa; border-color: rgba(0,0,0,.18); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 10px rgba(0,113,227,.28);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-primary:active { background: var(--primary-700); }
.btn-danger { background: #fff; border-color: rgba(255,59,48,.4); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: rgba(255,59,48,.5); color: #d70015; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; margin-top: 22px; }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 980px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* ==========================================================================
   整体布局（毛玻璃侧边栏 + 毛玻璃顶栏）
   ========================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--side-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  color: var(--side-text);
  border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
}
.side-brand {
  padding: 18px 16px 16px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--side-line);
}
.side-brand-img {
  height: 36px; width: 36px; object-fit: contain;
  border-radius: 10px; background: #fff; padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.side-brand-text {
  font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.35;
  letter-spacing: .1px;
}
.side-welcome {
  padding: 12px 18px 6px; font-size: 11.5px; color: var(--faint);
  letter-spacing: .2px;
}
.side-nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,.16); background-clip: content-box; }
.side-foot { padding: 8px 10px 12px; border-top: 1px solid var(--side-line); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--side-text); text-decoration: none;
  margin-bottom: 2px; font-size: 13.5px; font-weight: 500;
  position: relative; cursor: pointer;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: rgba(0,0,0,.055); color: var(--ink); }
.nav-item.active {
  background: rgba(0,0,0,.07);
  color: var(--primary); font-weight: 600;
  box-shadow: none;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-item.active .nav-ico { opacity: 1; }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; background: var(--top-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(0,0,0,.07);
  display: flex; align-items: center; padding: 0 22px; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.top-title {
  font-weight: 700; font-size: 15.5px; color: var(--ink);
  display: flex; align-items: center; gap: 9px;
}
.top-title::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
}
.top-user {
  margin-left: auto; color: var(--muted); font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
}
.theme-switcher-top { margin-left: auto; }
.theme-switcher-top + .top-user { margin-left: 0; }
.top-user::before {
  content: ''; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--avatar-end));
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.hamburger {
  display: none; background: none; border: none; font-size: 20px;
  color: var(--text); padding: 4px 6px; border-radius: 8px;
}
.hamburger:hover { background: var(--hover); }

.content { padding: 22px; }
.view { max-width: 1440px; margin: 0 auto; }

/* ==========================================================================
   面板 / 卡片（白色大圆角 + 弥散阴影）
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px 22px 22px;
  margin-bottom: 0;
  display: flex; flex-direction: column;
}
.panel h3 {
  margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.panel h3::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}

/* KPI 统计卡：桌面端强制 6 列等宽，整齐一行；窄屏自动换行 */
.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .18s, transform .18s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .sc-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.stat-card .lbl {
  color: var(--muted); font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-card .sc-icon {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
  background: var(--primary-050);
  color: var(--primary);
}
.stat-card .sc-icon svg { width: 20px; height: 20px; display: block; }
.stat-card .num {
  font-size: 28px; font-weight: 700; color: var(--ink);
  line-height: 1.1; letter-spacing: -.6px;
}
/* 语义变体：图标底色 + 数字色 + 图标描边色（currentColor） */
.stat-card.st-pending   .sc-icon { background: var(--info-bg);  color: var(--info); }
.stat-card.st-pending   .num { color: var(--info); }
.stat-card.st-producing .sc-icon { background: var(--warn-bg);  color: #c93400; }
.stat-card.st-producing .num { color: #c93400; }
.stat-card.st-completed,
.stat-card.mat          .sc-icon { background: var(--ok-bg);    color: #1d7a34; }
.stat-card.st-completed .num,
.stat-card.mat          .num { color: #1d7a34; }
.stat-card.overdue      .sc-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.overdue      .num { color: var(--danger); }
.stat-card.near         .sc-icon { background: var(--warn-bg);  color: #c93400; }
.stat-card.near         .num { color: #c93400; }
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==========================================================================
   仪表盘栅格（12 列，排列整齐）
   ========================================================================== */
.dash { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
/* 同行面板等高：grid item 默认 stretch；外层用 flex 让 panel 撑满 */
.dash-12 { grid-column: span 12; min-width: 0; display: flex; flex-direction: column; }
.dash-6  { grid-column: span 6;  min-width: 0; display: flex; flex-direction: column; }
.dash-4  { grid-column: span 4;  min-width: 0; display: flex; flex-direction: column; }
.dash-8  { grid-column: span 8;  min-width: 0; display: flex; flex-direction: column; }
.dash-6 > .panel, .dash-4 > .panel, .dash-8 > .panel, .dash-12 > .panel { flex: 1; min-height: 0; }
@media (max-width: 1180px) {
  .dash-6, .dash-4, .dash-8 { grid-column: span 12; }
}

/* 面板空数据占位 */
.panel-empty {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 13px; padding: 28px 0;
  background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0,113,227,.028) 8px 9px);
  border-radius: var(--r-md);
}

/* 图表 */
.donut-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 26px; flex-wrap: wrap; flex: 1; min-height: 0;
}
.donut-legend { display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text); }
.donut-legend > div {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; background: #fafafa;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.donut-legend b { color: var(--ink); margin-left: auto; font-size: 14px; }
.donut-legend .dot, .chart-legend .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin-right: 0; vertical-align: middle; flex: 0 0 9px;
}
.chart-legend {
  display: flex; gap: 18px; font-size: 12px; color: var(--muted);
  margin-bottom: 12px;
}
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-scroll { overflow-x: auto; padding-bottom: 4px; }
.chart-wrap { width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chart-body { width: 100%; flex: 1; min-height: 0; }
.chart-body .bar { transition: opacity .15s; }
.chart-body .bar:hover { opacity: .82; }

/* 预警条（iOS 风格浅色卡片） */
.warn-banner {
  background: var(--warn-bg); border: 1px solid #ffe1a6; color: #b25000;
  padding: 13px 16px; border-radius: var(--r-lg);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13.5px;
}
.warn-banner.danger { background: var(--danger-bg); border-color: #ffc6c3; color: #d70015; }
.warn-banner b { font-weight: 700; }
.warn-banner .link {
  color: inherit; text-decoration: none; font-weight: 600;
  border: 1px solid currentColor; border-radius: 980px; padding: 2px 12px;
  cursor: pointer; opacity: .85; transition: opacity .16s;
}
.warn-banner .link:hover { opacity: 1; background: rgba(255,255,255,.6); }
.wb-icon { font-size: 15px; }

/* 横向排行条 */
.customer-bars { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.cbar-row { display: flex; align-items: center; gap: 12px; }
.cbar-name {
  flex: 0 0 150px; width: 150px; font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cbar-sub {
  display: block; font-size: 11px; font-weight: 400; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cbar-track {
  flex: 1; min-width: 0; height: 8px; background: #ececee;
  border-radius: 99px; overflow: hidden;
}
.cbar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #0071e3, #64d2ff);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.cbar-fill.occ  { background: linear-gradient(90deg, #ff9f0a, #ffd60a); }
.cbar-fill.warn { background: linear-gradient(90deg, #ff3b30, #ff6961); }
.cbar-num {
  flex: 0 0 58px; width: 58px; text-align: right;
  font-size: 13px; font-weight: 700; color: var(--ink);
}
/* 紧凑模式：4 列场景（三排行榜横排）—— 名称截短、隐藏副标题、数字收窄 */
.cbar-row--compact { gap: 10px; }
.cbar-row--compact .cbar-name {
  flex: 0 0 110px; width: 110px; max-width: 110px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cbar-row--compact .cbar-sub { display: none; }
.cbar-row--compact .cbar-num { flex: 0 0 46px; width: 46px; font-size: 12px; }
.cbar-row--compact .cbar-track { height: 7px; }

/* ==========================================================================
   工具栏
   ========================================================================== */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.toolbar .tl { color: var(--muted); font-size: 13px; white-space: nowrap; }
.toolbar select,
.toolbar input[type=text],
.toolbar input[type=date] {
  padding: 8px 12px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-md);
  outline: none; background: #fff; color: var(--text);
  transition: border-color .16s, box-shadow .16s;
}
.toolbar select:focus,
.toolbar input[type=text]:focus,
.toolbar input[type=date]:focus { border-color: var(--primary); box-shadow: var(--ring); }
.toolbar input[type=text] { min-width: 220px; flex: 1; max-width: 340px; }
.toolbar select { min-width: 130px; max-width: 180px; }
.toolbar .spacer { flex: 1; }
/* 工具栏右侧主操作靠右对齐，整体更整齐 */
.toolbar .btn-primary { margin-left: auto; }
/* 库存工具栏「加工厂管理」：与左侧按钮组（查询/导出/批量删除）对齐 */
.toolbar .btn-primary#btn-mgr-wh { margin-left: 0; }

/* 仪表盘内：表格 / 排行条撑满 panel 高度，删除外层 max-height 限制 */
.dash .table-scroll {
  flex: 1; min-height: 0; max-height: none;
  border-radius: var(--r-md);
  border-color: rgba(0,0,0,.06);
}
.dash .panel > h3 { flex: 0 0 auto; }

/* ==========================================================================
   表格（轻盈：细分隔线 + 浅色表头）
   ========================================================================== */
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 230px);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
}
/* 横向滚动条始终可见，浅灰轨道 + 灰色圆角拇指（原生 webkit 样式，与订单列表一致） */
.table-scroll {
  overflow-x: scroll; overflow-y: auto;
  /* 始终为滚动条预留空间，容器永远显示滑条槽位 */
  scrollbar-gutter: stable;
  box-shadow: var(--shadow-xs);
}
.table-scroll::-webkit-scrollbar { height: 6px; width: 10px; }
.table-scroll::-webkit-scrollbar-track { background: #f1f2f5; border-radius: 3px; }
.table-scroll::-webkit-scrollbar-thumb { background: #c8ccd4; border-radius: 3px; border: 1px solid #f1f2f5; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #a9aeb8; }
.table-scroll::-webkit-scrollbar-corner { background: #f1f2f5; }
.table-scroll > table {
  border-collapse: separate; border-spacing: 0;
  width: 100%; min-width: 760px;
}
/* 产品管理：列较多，强制最小宽度让底部横向滑条始终可见（与订单列表一致） */
#product-list .table-scroll > table { min-width: 1180px; }
#product-list .table-scroll > table.product-archive-table { min-width: 920px; }
.text-ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; text-align: left !important; }
.bom-unit { width: 82px; min-width: 72px; }
.bom-unit-label { min-width: 42px; color: var(--muted); font-size: 13px; }
.nav-sub-heading { padding: 12px 18px 5px; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.archive-settings .seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.archive-settings .cat-code-input { max-width: 150px; }
.product-nav-group { margin: 2px 0 7px; }
.product-nav-heading { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 7px 12px 7px 20px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }
.product-nav-heading:hover { color: var(--text); }
.nav-group-chevron { transition: transform .18s ease; }
.product-nav-group:not(.open) .nav-group-chevron { transform: rotate(-90deg); }
.product-nav-children { display: none; }
.product-nav-group.open .product-nav-children { display: block; }
.product-nav-group .nav-sub-item { padding-left: 48px; }
.nm-manage-row { gap: 7px; }
.nm-row-actions { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.nm-manage-row .nm-row-actions .btn { white-space: nowrap; }
.toolbar-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 13px; }
.nm-inline-add { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, .65fr) auto; gap: 8px; margin: 10px 0 2px 176px; align-items: center; }
.nm-inline-add-single { grid-template-columns: minmax(180px, 1fr) auto; }
.nm-inline-add input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #d2d2d7; border-radius: 10px; background: #fff; color: #1d1d1f; font: inherit; font-size: 13px; outline: none; box-shadow: inset 0 1px 1px rgba(0,0,0,.025); transition: border-color .16s ease, box-shadow .16s ease; }
.nm-inline-add input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
@media (max-width: 760px) { .nm-inline-add { margin-left: 0; grid-template-columns: 1fr; } }
/* 全站滑条巡检（除数据看板外）：以下模块内容自然偏窄，加 min-width 强制横向滑条始终可见 */
#customer-list .table-scroll > table,
#view-inventory .table-scroll > table,
#view-stocktake .table-scroll > table,
#view-logs .table-scroll > table,
#view-users .table-scroll > table { min-width: 1100px; }
.table-scroll th,
.table-scroll td {
  padding: 10px 14px; text-align: center;
  font-size: 13px; vertical-align: middle; white-space: nowrap;
}
.table-scroll th {
  background: #fafafa; font-weight: 600; color: var(--muted);
  font-size: 12.5px; letter-spacing: .15px;
  position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.07);
}
.table-scroll td { background: #fff; color: var(--text); box-shadow: inset 0 -1px 0 rgba(0,0,0,.05); }
.table-scroll tbody tr:last-child td { box-shadow: none; }
.table-scroll tbody tr:hover td { background: #f8f8fa; }
.table-scroll tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.table-scroll tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }

/* 单据列表：固定布局（列宽由表头决定），内容不换行截断；列宽总和超出容器时自动出现底部横向滚动条 */
.table-scroll table.doc-table { table-layout: fixed; }
.table-scroll table.doc-table th { position: relative; overflow: hidden; }
.table-scroll table.doc-table td { overflow: hidden; text-overflow: ellipsis; }
.table-scroll table.doc-table .di-cell-line { overflow: hidden; text-overflow: ellipsis; }

/* 供应商多选 chips（产品表单「所属供应商」）与供应商列表产品小标签 */
.sup-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sup-chips .chip {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: 12.5px; border: 1px solid rgba(0,0,0,.14); background: #fff;
  color: var(--text); cursor: pointer; user-select: text; -webkit-user-select: text; transition: all .12s;
}
.sup-chips .chip:hover { border-color: var(--primary); color: var(--primary); }
.sup-chips .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sup-prod-chip {
  display: inline-block; padding: 2px 8px; margin: 1px 2px; border-radius: 12px;
  font-size: 11.5px; background: var(--info-bg, #eef4ff); color: #0a63d4;
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.sup-prod-chip.more { background: #f0f0f2; color: var(--muted); }
td.sup-addr { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 供应商多选下拉（产品表单「所属供应商」）：已选标签 + 输入检索 + 下拉 */
.sup-combo input { margin-top: 6px; }
.sup-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sup-tags .hint { font-size: 12px; }
.sup-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12.5px;
  background: var(--primary-050, #eef2ff); color: var(--primary);
  border: 1px solid rgba(79,70,229,.25);
}
.sup-tag-x { cursor: pointer; font-weight: 700; font-style: normal; opacity: .65; line-height: 1; }
.sup-tag-x:hover { opacity: 1; color: var(--danger, #d33); }
.sup-dd-item { font-size: 13px; }

tr.row-overdue td { background: #fff0ef !important; color: #c9211a; }
tr.row-overdue td:first-child { border-left: 3px solid #ff3b30; }
tr.row-overdue:hover td { background: #ffe2e0 !important; }
tr.row-near td { background: #fff4e0 !important; color: #b35100; }
tr.row-near td:first-child { border-left: 3px solid #ff9f0a; }
tr.row-near:hover td { background: #ffe8c2 !important; }

.thumb {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid rgba(0,0,0,.08); cursor: pointer;
  transition: transform .16s, box-shadow .16s;
  /* vertical-align:bottom 消除 inline 图片基线间隙：否则行盒被 descender 撑高 ~5px，缩略图在行内偏上 ~2.6px（2026-09-01 库存图片列量尺发现） */
  vertical-align: bottom;
}
.thumb:hover { transform: scale(1.06); box-shadow: var(--shadow-sm); }
.upload-thumb {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid rgba(0,0,0,.08); cursor: pointer;
}
.cell-img { display: inline-flex; gap: 4px; align-items: center; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
/* 预警徽章：实色填充 + 阴影，最显眼（用户要求"明显一点的颜色"） */
.badge.overdue { background: #ff3b30; color: #fff; box-shadow: 0 1px 2px rgba(255,59,48,.32); }
.badge.near    { background: #ff9f0a; color: #fff; box-shadow: 0 1px 2px rgba(255,159,10,.32); }
.badge.normal  { background: var(--ok-bg);     color: #1d7a34; }
.badge.none    { background: #f0f0f2;          color: var(--faint); }
.badge-low     { background: #ff9f0a; color: #fff; margin-left: 6px; box-shadow: 0 1px 2px rgba(255,159,10,.32); }
.badge.warn-occ{ background: #ff9f0a; color: #fff; box-shadow: 0 1px 2px rgba(255,159,10,.32); }

.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 4px; }

/* 回收站与图片空间管理 */
.storage-cards { margin-bottom: 16px; }
.storage-panel { margin-bottom: 16px; padding: 18px; }
.storage-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.storage-head h3 { margin: 0 0 4px; }
.storage-head p { margin: 0; }
.storage-summary { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.orphan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; }
.orphan-item { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.orphan-item > img { width: 100%; height: 96px; object-fit: cover; border-radius: 11px; cursor: pointer; background: var(--soft); }
.orphan-item > div { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.orphan-item small { color: var(--muted); font-size: 11px; }
@media (max-width: 720px) { .storage-head { align-items: flex-start; flex-direction: column; } }

/* 订单状态下拉（iOS 胶囊） */
.status-select {
  padding: 4px 10px; border-radius: 980px; border: 1px solid rgba(0,0,0,.08);
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #fff; outline: none;
}
.status-select:disabled { opacity: .85; cursor: default; }
.st-pending   { background: var(--info-bg);  color: #0a63d4; border-color: transparent; }
.st-producing { background: var(--warn-bg);  color: #b25000; border-color: transparent; }
.st-completed { background: var(--ok-bg);    color: #1d7a34; border-color: transparent; }

/* 复选框 */
.row-cb, #select-all, .doc-ck, .prod-ck, .cus-ck, .inv-ck, .st-ck, .sup-ck, .log-ck {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--primary);
}

/* 分页 */
.pager {
  display: flex; align-items: center; gap: 10px;
  justify-content: flex-end; margin-top: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: 13px;
}

.empty { text-align: center; color: var(--faint); padding: 44px 0; font-size: 13.5px; }

/* ==========================================================================
   表单（Apple：字段块浅灰底、圆角、聚焦蓝环）
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field {
  display: flex; flex-direction: column;
  background: #fafafa; border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-md); padding: 12px 14px;
  transition: border-color .16s, box-shadow .16s;
  min-width: 0;
}
.field:focus-within { border-color: var(--primary); box-shadow: var(--ring); background: #fff; }
.field.col2 { grid-column: span 2; }
.field > label {
  font-size: 11.5px; color: var(--muted); font-weight: 600;
  margin-bottom: 6px; letter-spacing: .2px;
}
.field input[type=text], .field input[type=date], .field input[type=number],
.field input[type=tel], .field input[type=email], .field textarea, .field select {
  padding: 8px 11px; border: 1px solid rgba(0,0,0,.1); border-radius: var(--r-sm);
  outline: none; width: 100%; background: #fff; color: var(--ink);
  transition: border-color .16s, box-shadow .16s; line-height: 1.5;
}
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.14);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: #f2f2f4; color: var(--faint); cursor: not-allowed;
}
.field .hint, .field-hint {
  font-size: 11.5px; color: var(--faint); margin-top: 6px; line-height: 1.6;
}

/* 新增/编辑订单：按业务步骤分区，图片统一集中展示 */
.order-form-sections { display: flex; flex-direction: column; gap: 16px; }
.order-form-section {
  border: 1px solid rgba(0,0,0,.07); border-radius: 16px;
  background: rgba(250,250,250,.78); padding: 16px;
}
.order-form-section > h3 { margin: 0; font-size: 15px; color: var(--ink); }
.order-form-section > p { margin: 4px 0 12px; font-size: 12px; color: var(--faint); }
.order-form-section > .form-grid { margin-top: 12px; }
.order-form-section .field { background: #fff; }
.order-upload-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.order-upload-card {
  min-height: 82px; border: 1px solid rgba(0,0,0,.07); border-radius: 12px;
  background: #fff; padding: 12px; display: flex; flex-direction: column; gap: 9px;
}
.order-upload-card > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.order-parts-section > .hint { margin-top: 6px; }
.upload-multi { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.upload-count { font-size: 12px; color: var(--faint); }
.upload-preview-list { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; }
.upload-preview-item { position: relative; display: inline-flex; }
.upload-remove-one {
  position: absolute; right: -5px; top: -5px; width: 20px; height: 20px; padding: 0;
  border: 1px solid rgba(0,0,0,.12); border-radius: 50%; background: #fff;
  color: var(--danger); font-size: 15px; line-height: 18px; cursor: pointer; box-shadow: var(--shadow-sm);
}

/* 安全库存百分比滑块 */
.safety-range { display: flex; align-items: center; gap: 10px; }
.safety-range input[type="range"] { flex: 1; min-width: 0; accent-color: var(--primary); }
.safety-val {
  font-size: 13px; font-weight: 600; color: var(--primary); min-width: 46px;
  text-align: center; background: var(--primary-050); border-radius: var(--r-sm);
  padding: 2px 6px; flex: 0 0 auto;
}

/* 库存列表及单据选品的成品/配件标记 */
.inv-type-badge {
  display: inline-flex; align-items: center; padding: 2px 7px; margin-left: 7px;
  border-radius: 6px; font-size: 11px; font-weight: 650; line-height: 1.5; white-space: nowrap;
}
.inv-type-badge.finished { color: var(--primary); background: var(--primary-050); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }
.inv-type-badge.material { color: var(--muted); background: #f1f1f4; }
.inv-type-badge.unknown { color: #946200; background: #fff5d9; }
#inv-list .inv-finished-row td:first-child { box-shadow: inset 3px 0 0 var(--primary), inset 0 -1px 0 rgba(0,0,0,.05); }
#inv-list .inv-finished-quantity { color: var(--primary); font-weight: 700; }
.inv-finished-summary {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin: 0 0 14px; padding: 14px 18px; border-radius: 16px;
  background: var(--primary-050); border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
}
.inv-finished-summary[hidden] { display: none; }
.inv-finished-summary strong { font-size: 13px; color: var(--primary); }
.inv-finished-summary > div > span { margin-left: 10px; font-size: 12px; color: var(--muted); }
.inv-finished-totals { display: flex; flex-wrap: wrap; gap: 18px; }
.inv-finished-totals b { margin-left: 6px; color: var(--ink); font-size: 15px; }
.document-product-picker .inv-type-badge { vertical-align: middle; }

/* 库存批量设置弹窗 */
.modal.modal-inventory-safety { width: 560px; }
.inv-safety-summary { margin: 0 0 14px; color: var(--muted); }
.inv-safety-summary b { color: var(--primary); }
.inv-safety-records {
  max-height: 220px; overflow: auto; margin-bottom: 18px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.inv-safety-records table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.inv-safety-records th, .inv-safety-records td {
  padding: 10px 12px; white-space: normal; overflow-wrap: anywhere; text-align: left; border-bottom: 1px solid var(--border);
}
.inv-safety-records th { position: sticky; top: 0; background: #f5f5f7; color: var(--muted); font-size: 12px; font-weight: 600; }
.inv-safety-records th:last-child, .inv-safety-records td:last-child { width: 100px; text-align: right; }
.inv-safety-records tr:last-child td { border-bottom: 0; }
.inv-safety-error { min-height: 18px; margin-top: 6px; color: var(--danger); font-size: 12px; }
@media (max-width: 720px) {
  .modal.modal-inventory-safety {
    width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important;
    left: 12px !important; top: 4vh !important;
    height: 92vh !important; height: 92dvh !important;
  }
}

/* 管理员财务结存导入：只作用于导入窗口。 */
.modal.modal-inventory-import { width: 1080px; max-width: calc(100vw - 32px); }
.modal-inventory-import .modal-body { min-height: 0; }
.modal-inventory-import .modal-foot { flex-wrap: wrap; gap: 8px; }
.inventory-import-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.inventory-import-panel p { margin: 0; line-height: 1.7; }
.ivi-intro { padding: 14px 16px; border: 1px solid rgba(0,113,227,.12); border-radius: 12px; background: var(--primary-050); }
.ivi-intro > strong { color: var(--primary); font-size: 14px; }
.ivi-intro p { margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ivi-upload { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.ivi-upload .field { min-width: 0; }
.ivi-upload input[type="file"] { width: 100%; min-width: 0; max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 12px; }
.ivi-upload .hint { grid-column: 1 / -1; }
.ivi-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ivi-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.ivi-summary { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.ivi-summary b { color: var(--ink); }
.ivi-preview-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.ivi-preview-tools select { min-width: 150px; max-width: 100%; height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.ivi-preview-tools span { margin-left: auto; font-size: 11px; color: var(--faint); }
.ivi-table-scroll { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.ivi-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 12px; line-height: 1.5; }
.ivi-table th, .ivi-table td { padding: 10px; border-bottom: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; }
.ivi-table th { position: sticky; top: 0; background: #f5f5f7; font-weight: 600; white-space: nowrap; color: var(--muted); z-index: 1; }
.ivi-table th:nth-child(-n+3), .ivi-table td:nth-child(-n+3), .ivi-table th:last-child, .ivi-table td:last-child { text-align: left; }
.ivi-table td:nth-child(3) { min-width: 170px; }
.ivi-table td strong { display: inline-block; color: var(--ink); }
.ivi-table .ivi-code { display: block; margin-bottom: 3px; color: var(--muted); }
.ivi-table td small { display: block; margin-top: 3px; color: var(--faint); font-size: 11px; }
.ivi-table tr:last-child td { border-bottom: 0; }
.ivi-table .ivi-target { color: var(--primary); font-weight: 700; }
.ivi-increase { color: #208854; }
.ivi-decrease, .ivi-short .ivi-result { color: #aa6510; }
.ivi-invalid { background: rgba(255,59,48,.045); }
.ivi-invalid .ivi-result, .ivi-error { color: var(--danger); }
.ivi-result { min-width: 140px; max-width: 250px; white-space: normal; overflow-wrap: anywhere; }
.ivi-errors { max-height: 170px; padding: 12px 14px; overflow: auto; border: 1px solid rgba(255,59,48,.16); border-radius: 10px; background: rgba(255,59,48,.045); color: var(--danger); font-size: 12px; line-height: 1.7; }
.ivi-errors ul { margin: 7px 0 0; padding-left: 20px; }
.ivi-pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.ivi-pagination > span { margin-right: auto; color: var(--muted); font-size: 12px; }
.ivi-shortage-ack { display: flex; align-items: flex-start; gap: 8px; padding: 12px; border: 1px solid rgba(170,101,16,.2); border-radius: 10px; background: #fff7eb; color: #946200; font-size: 12px; line-height: 1.7; }
.ivi-shortage-ack input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--primary); }
.ivi-shortage-ack[hidden] { display: none; }
.ivi-error { min-height: 18px; font-size: 12px; }
.ivi-foot-status { margin-right: auto; color: var(--muted); font-size: 12px; line-height: 1.6; }
.inventory-import-modal .sub-modal { width: 1080px; max-width: calc(100vw - 32px); }
.ivi-history-table { min-width: 650px; }
.ivi-history-table th, .ivi-history-table td { text-align: left; overflow-wrap: anywhere; }
.ivi-record-notes { padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
.ivi-record-notes p { margin-top: 5px; }
@media (max-width: 720px) {
  .modal.modal-inventory-import, .inventory-import-modal .sub-modal {
    width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important;
    left: 12px !important; top: 4vh !important; height: 92vh !important; height: 92dvh !important;
  }
  .modal-inventory-import .modal-body, .inventory-import-modal .sub-body { padding: 12px; }
  .modal-inventory-import .modal-foot { padding: 12px; }
  .modal-inventory-import .modal-foot .btn { padding-left: 12px; padding-right: 12px; }
  .ivi-foot-status { flex-basis: 100%; }
  .ivi-upload { grid-template-columns: minmax(0,1fr); padding: 12px; }
  .ivi-preview-tools span { flex-basis: 100%; margin-left: 0; }
  .ivi-table-scroll { max-height: 280px; }
}

/* 日期选择器 */
.date-wrap { position: relative; width: 100%; display: inline-block; }
/* 表单内日期输入框与普通输入框等高 39px（浏览器 UA 结构会把 date 撑到 41px，铁律⑨统一） */
.form-grid .date-wrap input[type="date"] { height: 39px; padding-top: 0; padding-bottom: 0; }
.date-wrap input[type="date"] {
  width: 100%; padding: 8px 34px 8px 11px;
  border: 1px solid rgba(0,0,0,.1); border-radius: var(--r-sm); outline: none;
  background: #fff; color: var(--ink); font-family: inherit; font-size: 14px;
  transition: border-color .16s, box-shadow .16s; cursor: pointer; line-height: 1.5;
}
.date-wrap input[type="date"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.date-wrap input[type="date"]:disabled { background: #f2f2f4; cursor: not-allowed; }
.date-placeholder {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: #b0b0b6; pointer-events: none; font-size: 14px;
  background: #fff; padding-right: 6px; display: none;
}
.date-wrap.date-empty .date-placeholder { display: block; }
.date-wrap input[type="date"]:disabled + .date-placeholder { display: none; }
.date-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute; right: 8px; cursor: pointer; opacity: .55;
}
.date-wrap input[type="date"]:focus::-webkit-calendar-picker-indicator { opacity: 1; }
/* 日期输入框：原生 yyyy-mm-dd 显示（已撤回年月日覆盖层） */
.toolbar-date { width: 150px; }
.toolbar-date .date-input { padding: 7px 32px 7px 10px; min-height: 36px; }
.toolbar-date .date-placeholder { left: 10px; font-size: 13px; }

/* 上传 */
.upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: #fff; color: var(--primary);
  border: 1px solid rgba(0,113,227,.5); border-radius: 980px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .16s;
}
.file-btn:hover { background: var(--primary-050); }
.file-btn:active { transform: translateY(1px); }
.field > label.file-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 0;
  padding: 6px 14px; background: #fff; color: var(--primary) !important;
  border: 1px solid rgba(0,113,227,.5); border-radius: 980px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-shadow: none; transition: .16s; width: auto;
}
.field > label.file-btn:hover { background: var(--primary-050); }
.file-input {
  display: none;
}
.upload .btn-remove {
  padding: 5px 12px; font-size: 12px; background: #fff;
  border: 1px solid rgba(255,59,48,.4); color: var(--danger); border-radius: 980px;
}
.upload .btn-remove:hover { background: var(--danger-bg); }

/* 下拉选项字段 */
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row select { flex: 1; min-width: 0; height: 39px; padding-top: 0; padding-bottom: 0; }
/* 行内按钮与输入框/下拉等高（39px），保证像素级对齐 */
.opt-row > .btn {
  min-height: 39px; padding-top: 0; padding-bottom: 0;
}
/* 标签组合框行（标签 + 输入框两层）：按钮与输入框行底对齐 */
.opt-row.combo-pick-row { align-items: flex-end; }
.opt-mgr-btn {
  white-space: nowrap; background: #fff; border: 1px solid rgba(0,0,0,.12); color: var(--primary);
}
.opt-mgr-btn:hover { background: var(--primary-050); }

/* 拼音检索组合框 */
.combo-wrap { position: relative; }
.combo-wrap input { width: 100%; }
.combo-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  max-height: 200px; overflow-y: auto; background: #fff;
  border: 1px solid rgba(0,0,0,.08); border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: var(--shadow-md); margin-top: -1px;
}
.combo-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.combo-item:hover { background: var(--primary-050); color: var(--primary); }
.combo-item:last-child { border-bottom: none; }

/* 选项管理弹窗 */
.opt-manager { min-width: 300px; }
.opt-add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.opt-add-row input {
  flex: 1; padding: 8px 11px; border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--r-sm); outline: none;
}
.opt-add-row input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.opt-list { max-height: 280px; overflow-y: auto; }
.opt-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-md); margin-bottom: 6px; background: #fff;
}
.opt-item span { font-size: 13px; }
.opt-name { flex: 1; min-width: 0; font-size: 13px; word-break: break-all; }
.opt-acts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.opt-edit-input, .cm-input {
  flex: 1; min-width: 0; padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 13px; outline: none; background: #fff;
}
.opt-edit-input { border: 1px solid var(--primary); }
.cm-input { border: 1px solid rgba(0,0,0,.12); }
.opt-edit-input:focus, .cm-input:focus { box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.opt-item.editing { background: #f8fbff; border-color: var(--primary); }

/* 加工厂管理（全屏视图） */
.modal.modal-wh-mgr { width: 880px; max-width: 96vw; }
.modal.modal-wh-mgr .modal-body { max-height: 70vh; overflow: auto; }
.wh-ref {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted);
  padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,.04);
  flex-shrink: 0;
}
.wh-ref b { color: var(--primary); font-weight: 700; }
.opt-item .wh-ref { flex: 0 0 auto; }
@media (max-width: 720px) {
  .modal.modal-wh-mgr { width: 96vw; }
  .wh-ref { display: none; }
}

/* 客户地址分区 */
.addr-section {
  margin: 16px 0 0; padding: 14px 16px 6px;
  background: #fafafa; border: 1px solid rgba(0,0,0,.06); border-radius: var(--r-lg);
}
.addr-title {
  margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--primary);
  border-bottom: 1px solid rgba(0,0,0,.06); padding-bottom: 8px;
}
.addr-clip {
  display: inline-block; max-width: 200px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.copy-btn {
  padding: 3px 10px; font-size: 12px; border-radius: 980px;
  border: 1px solid rgba(0,113,227,.35); background: var(--primary-050); color: var(--primary);
  line-height: 1.5; cursor: pointer; transition: .16s; font-weight: 500;
}
.copy-btn:hover { background: #dcf0ff; border-color: rgba(0,113,227,.5); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn-row { align-self: flex-start; margin-top: 7px; }

/* 客户导入弹窗 */
.import-panel { display: flex; flex-direction: column; gap: 4px; }
.import-step {
  padding: 12px 14px; background: #fafafa;
  border: 1px solid rgba(0,0,0,.06); border-radius: var(--r-md);
}
.import-step > b { color: var(--primary); font-size: 12.5px; display: block; margin-bottom: 6px; }
.import-step .hint { font-size: 12px; color: var(--faint); line-height: 1.6; }
#import-file { font-size: 13px; max-width: 240px; }
.imp-mode { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 6px 0; cursor: pointer; }
.imp-mode input { cursor: pointer; accent-color: var(--primary); }
.imp-stats { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.imp-chip { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.imp-chip.imp-add    { background: var(--ok-bg);   color: #1d7a34; }
.imp-chip.imp-update { background: var(--info-bg); color: #0a63d4; }
.imp-chip.imp-skip   { background: #f0f0f2;        color: var(--faint); }

/* 权限单元格 */
.perm-cell { display: flex; gap: 12px; flex-wrap: wrap; }
.perm-cell label { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.perm-cell input { accent-color: var(--primary); }

/* ==========================================================================
   弹窗（Apple：大圆角 + 弥散阴影）
   ========================================================================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(28,28,30,.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 12px; overflow: hidden;
}
.modal {
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); width: 720px; max-width: 100%;
  box-shadow: var(--shadow-lg); position: absolute;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,.7);
}
.modal.modal-order {
  width: min(1040px, calc(100vw - 24px));
  height: min(820px, calc(100vh - 24px));
}
.modal-head {
  display: flex; align-items: center; justify-content: center;
  padding: 15px 18px; border-bottom: 1px solid rgba(0,0,0,.07);
  font-weight: 700; font-size: 15px; color: var(--ink);
  position: relative; cursor: default;
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: transparent;
}
.modal-drag {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #c3c3c9; font-size: 13px; letter-spacing: -1px;
  padding: 2px 4px; cursor: grab; border-radius: 4px;
  user-select: none; -webkit-user-select: none;
}
.modal-drag:hover { background: var(--hover); color: var(--muted); }
.modal-brand {
  position: absolute; left: 42px; top: 50%; transform: translateY(-50%);
  height: 24px; width: 24px; object-fit: contain; border-radius: 6px;
}
.modal-back {
  position: absolute; left: 66px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 18px; color: var(--muted);
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-back:hover { color: var(--primary); background: var(--hover); }
.modal-back[hidden] { display: none; }
#modal-title { flex: 1; text-align: center; padding: 0 44px; cursor: text; }
.modal-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 17px; color: var(--muted);
  cursor: pointer; padding: 5px 9px; border-radius: 6px;
}
.modal-close:hover { color: var(--danger); background: var(--danger-bg); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 18px; border-top: 1px solid rgba(0,0,0,.07);
  display: flex; gap: 10px; justify-content: flex-end;
  border-radius: 0 0 var(--r-xl) var(--r-xl); background: transparent;
}

.modal.modal-delete-check { width: 680px; max-width: 94vw; }
.delete-check > p { margin: 0 0 12px; color: var(--muted); }
.delete-check-card { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: #f8f9fb; }
.delete-check-card h3 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.delete-check-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.delete-check-card li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 9px 10px; border-radius: 10px; background: #fff; }
.delete-check-card li span { min-width: 0; overflow-wrap: anywhere; }
.delete-check-card li b { color: var(--danger); font-size: 13px; text-align: right; }
.delete-check-card li small { grid-column: 1 / -1; color: var(--muted); line-height: 1.5; }
.modal.modal-stock-conflict { width: 680px; max-width: 94vw; }
.stock-conflict-lead {
  margin: 0 0 14px; padding: 11px 13px; border-radius: 12px;
  color: #9b3500; background: #fff4e5; border: 1px solid rgba(255,149,0,.24);
}
.stock-conflict-card { padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: #f8f9fb; }
.stock-conflict-card + .stock-conflict-card { margin-top: 12px; }
.stock-conflict-card h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); }
.stock-conflict-grid { display: grid; grid-template-columns: minmax(92px, auto) minmax(0, 1fr); gap: 8px 14px; align-items: center; }
.stock-conflict-grid span { color: var(--muted); font-size: 13px; }
.stock-conflict-grid b { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 13px; }
.stock-conflict-grid b.danger { color: var(--danger); }
.stock-conflict-related { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
.stock-conflict-related p { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
.stock-conflict-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.stock-conflict-related li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 10px; border-radius: 10px; background: #fff; font-size: 13px; }
.stock-conflict-related li b { color: var(--primary); overflow-wrap: anywhere; }
.stock-conflict-message { margin: 12px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
.modal-return { margin-right: auto; }
.modal-resizer {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: se-resize; z-index: 10;
}
.modal-resizer::before {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  width: 10px; height: 10px;
  background: linear-gradient(135deg, transparent 40%, #c3c3c9 40%, #c3c3c9 55%,
    transparent 55%, transparent 70%, #c3c3c9 70%, #c3c3c9 85%, transparent 85%);
  pointer-events: none;
}

.img-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.img-viewer { position: relative; width: min(960px, 94vw); height: min(760px, 90vh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.img-viewer > #img-big { max-width: calc(100% - 100px); max-height: calc(100% - 116px); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); object-fit: contain; background: rgba(255,255,255,.06); }
.img-viewer-close, .img-viewer-nav { position: absolute; border: 0; color: #fff; background: rgba(30,30,32,.68); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.img-viewer-close { right: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 25px; line-height: 1; }
.img-viewer-nav { top: 44%; width: 46px; height: 64px; border-radius: 18px; font-size: 44px; line-height: 54px; }
.img-viewer-prev { left: 0; }
.img-viewer-next { right: 0; }
.img-viewer-bottom { min-height: 88px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.img-viewer-count { color: rgba(255,255,255,.88); font-size: 13px; }
.img-viewer-thumbs { display: flex; justify-content: center; gap: 10px; }
.img-viewer-thumb { width: 58px; height: 58px; padding: 2px; border: 2px solid transparent; border-radius: 13px; background: rgba(255,255,255,.16); cursor: pointer; opacity: .65; }
.img-viewer-thumb.active { border-color: #fff; opacity: 1; }
.img-viewer-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 9px; box-shadow: none; }

/* ==========================================================================
   单据二级分类子标签（iOS 分段控制风格）
   ========================================================================== */
.doc-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-tab {
  border: 1px solid rgba(0,0,0,.12); background: #fff; color: var(--text);
  padding: 7px 15px; border-radius: 980px; font-size: 12.5px; font-weight: 600;
  transition: .16s;
}
.doc-tab:hover { background: var(--hover); border-color: rgba(0,0,0,.2); }
.doc-tab.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 10px rgba(0,113,227,.3);
}

/* 单据明细表格（保留网格线，表单区更清晰） */
.doc-items table { width: 100%; min-width: 480px; margin: 0; border-collapse: collapse; }
.doc-items th, .doc-items td {
  text-align: center; padding: 7px 8px;
  border: 1px solid rgba(0,0,0,.08); white-space: nowrap;
}
.doc-items th { background: #fafafa; font-size: 12px; color: var(--muted); font-weight: 600; }
.doc-items .di-product, .doc-items .di-qty, .doc-items .di-price {
  padding: 6px 8px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm);
}
.doc-items .di-amt { font-weight: 700; color: var(--primary); }
.di-stock { font-size: 12px; color: var(--faint); white-space: nowrap; }
.doc-items .di-product-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.field .doc-items .di-product-input {
  width: 100%; padding: 6px 54px 6px 8px;
  border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm); font-size: 13px;
}
.doc-items .di-pick {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 3px 8px; font-size: 12px; line-height: 1.4; white-space: nowrap;
  background: #fff; color: var(--primary); border: 1px solid rgba(0,113,227,.5);
  border-radius: 6px; cursor: pointer; transition: .16s;
}
.doc-items .di-pick:hover { background: var(--primary-050); }
/* 单据弹窗内约束表格宽度，避免明细撑宽整个表单并遮住删除按钮。 */
#doc-form { width: 100%; min-width: 0; max-width: 100%; }
#doc-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#doc-form .field { min-width: 0; }
#doc-form .doc-items { max-width: 100%; overflow-x: auto; }
#doc-form[data-type="inbound"] .doc-items table { table-layout: fixed; min-width: 0; }
#doc-form[data-type="inbound"] .doc-items th:first-child { width: 38%; }
#doc-form[data-type="inbound"] .doc-items th:nth-child(2) { width: 22%; }
#doc-form[data-type="inbound"] .doc-items th:last-child { width: 56px; }
#doc-form[data-type="inbound"] .doc-items input,
#doc-form[data-type="inbound"] .doc-items select { width: 100% !important; min-width: 0; box-sizing: border-box; }
#doc-form[data-type="inbound"] .di-stock { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  #doc-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  #doc-form[data-type="inbound"] .doc-items table { min-width: 440px; }
}
.doc-product-item { display: flex; flex-direction: column; gap: 2px; }
.dp-name { font-weight: 600; }

/* ===== 单据列表：明细拆成 产品 / 数量 / 单价 三个独立列 ===== */
/* 多明细时同一单元格内纵向排列，行间虚线分隔，保证三列横向对齐 */
.table-scroll td.di-cells {
  text-align: center; white-space: normal;
  vertical-align: top; padding: 8px 12px;
}
.di-cell-line {
  display: flex; align-items: center; justify-content: center;
  padding: 3px 0; min-height: 24px; line-height: 1.5;
}
.di-cell-line + .di-cell-line {
  margin-top: 2px; padding-top: 5px; border-top: 1px dashed rgba(0,0,0,.1);
}
.di-cell-empty { color: var(--faint); }

/* ===== 单据「客户 / 领用收货方」下拉：引用客户管理 ===== */
.partner-combo { position: relative; width: 100%; }
.partner-input { width: 100%; padding-right: 58px !important; }
.partner-combo .pi-pick {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 3px 9px; font-size: 12px; line-height: 1.4; white-space: nowrap;
  background: #fff; color: var(--primary); border: 1px solid rgba(0,113,227,.5);
  border-radius: 6px; cursor: pointer; transition: .16s; z-index: 2;
}
.partner-combo .pi-pick:hover { background: var(--primary-050); }
.partner-dd { max-height: 240px; }
.partner-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.partner-item:last-child { border-bottom: none; }
.partner-item:hover { background: var(--primary-050); }
.pi-name { font-weight: 600; font-size: 13px; color: var(--ink); display: block; }
.pi-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; display: block; }

/* 字段标签右侧的小标记 */
.field-tag {
  margin-left: 6px; padding: 1px 6px; border-radius: 20px;
  background: var(--primary-050); color: var(--primary);
  font-size: 10px; font-weight: 600; letter-spacing: 0;
}

/* 采购明细：列宽可拖动 */
.field .pur-items td input { padding: 6px 6px; font-size: 13px; border-radius: var(--r-sm); }
.pur-items { overflow-x: auto; }
.pur-items table { width: auto; min-width: 0; table-layout: fixed; border-collapse: collapse; }
.pur-items th, .pur-items td {
  border: 1px solid rgba(0,0,0,.08); overflow: hidden; text-overflow: ellipsis;
  padding: 6px 8px; font-size: 13px; text-align: center;
}
.pur-items th { background: #fafafa; position: relative; font-size: 12px; color: var(--muted); }
.pur-col-resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.pur-col-resizer::after {
  content: ''; position: absolute; top: 4px; bottom: 4px; right: 2px;
  width: 2px; background: transparent; border-radius: 2px;
}
.pur-col-resizer:hover::after, .pur-col-resizer.dragging::after { background: var(--primary); }
.pur-resizing { cursor: col-resize !important; }
.pur-resizing * { cursor: col-resize !important; user-select: none !important; -webkit-user-select: none !important; }
.pur-prod-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.pur-prod-wrap .pur-pick {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  padding: 2px 5px; font-size: 11px; line-height: 1.3; white-space: nowrap;
}
.field .pur-items .pur-prod-wrap .di-product-input { width: 100%; min-width: 0; padding: 6px 30px 6px 8px; }
.pur-amt { font-weight: 700; color: var(--primary); }

/* 批量管理工具条 */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--primary-050); border: 1px solid rgba(0,113,227,.2);
  border-radius: var(--r-lg); padding: 10px 14px; margin-bottom: 12px;
}
.batch-count { font-weight: 700; color: var(--primary); font-size: 13px; }

/* ==========================================================================
   模块布局：左侧分类 + 右侧内容
   ========================================================================== */
.product-layout { display: flex; gap: 16px; align-items: flex-start; }
.sub-sidebar {
  width: 196px; flex: 0 0 196px; background: var(--panel);
  border: 1px solid rgba(0,0,0,.05); border-radius: var(--r-lg);
  padding: 12px; position: sticky; top: 82px; box-shadow: var(--shadow-xs);
}
.sub-sidebar-title {
  font-weight: 600; color: var(--muted); font-size: 12.5px;
  margin-bottom: 10px; padding-left: 4px;
  display: flex; align-items: center; gap: 6px;
}
.sub-sidebar-title .btn { padding: 2px 8px; font-size: 12px; line-height: 1.5; }
.sub-sidebar-divider { height: 1px; background: rgba(0,0,0,.07); margin: 10px 0; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-md); cursor: pointer;
  color: var(--text); font-size: 13.5px; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.cat-item:hover { background: var(--hover); }
.cat-item.active {
  background: var(--primary-050); color: var(--primary); font-weight: 600;
}
.cat-item.active::before {
  content: ''; position: absolute; display: none;
}
.cat-num {
  font-size: 11.5px; background: rgba(0,0,0,.06); color: var(--muted);
  border-radius: 20px; padding: 0 8px; flex: 0 0 auto;
}
.cat-item.active .cat-num { background: rgba(0,113,227,.12); color: var(--primary); }
.sub-content { flex: 1; min-width: 0; }

/* 产品 BOM 组成编辑 */
.bom-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.bom-row select { flex: 1; min-width: 0; }
.order-parts-section .bom-row .bom-total-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.order-parts-section .bom-row .bom-auto-reset { white-space: nowrap; }
.field .bom-row .bom-prod,
.field .bom-row .bom-qty,
.order-parts-section .bom-row .bom-prod,
.order-parts-section .bom-row .bom-qty {
  padding: 6px 8px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5; background: #fff; color: var(--ink);
  width: auto; min-width: 0;
}
.field .bom-row .bom-prod, .order-parts-section .bom-row .bom-prod { flex: 1 1 auto; }
.field .bom-row .bom-qty, .order-parts-section .bom-row .bom-qty { flex: 0 0 100px; width: 100px; text-align: center; }
.bom-prod-field { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
/* 订单配件行的库存提示：现存 / 可用 / 本单消耗 / 是否将缺 */
.bom-stock { flex-basis: 100%; width: 100%; font-size: 12px; line-height: 1.6; margin-top: -2px; padding-left: 2px; }
.bom-stock .bs-ok { color: var(--muted); }
.bom-stock .bs-warn { color: var(--danger); font-weight: 600; }
.bom-stock .bs-none { color: var(--faint); }
.field .bom-row .bom-prod-field .bom-prod, .order-parts-section .bom-row .bom-prod-field .bom-prod { width: 100%; padding-right: 54px; }
.bom-pick {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 3px 8px; font-size: 12px; line-height: 1.4; white-space: nowrap;
  background: #fff; color: var(--primary); border: 1px solid rgba(0,113,227,.5);
  border-radius: 6px; cursor: pointer; transition: .16s;
}
.bom-pick:hover { background: var(--primary-050); }
.bom-del { flex: 0 0 auto; }

/* 分类管理器 */
.cat-mgr { min-width: 320px; }
.cm-name { font-size: 14px; font-weight: 600; }
.cm-acts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.cat-mgr .opt-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* 产品规格分组块 */
.spec-block { background: #fafafa; border-left: 3px solid #c7c7cc; padding: 14px; }
.spec-block > label { color: var(--muted); }
.spec-block .form-grid { gap: 12px 14px; }

/* 库存占用信息块 */
.occ-info {
  background: #fafafa; border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-md); padding: 10px 12px; margin-top: 8px;
}
.occ-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; padding: 3px 0;
}
.occ-row span { color: var(--muted); }
.occ-row b { font-size: 14px; color: var(--ink); }
.occ-row b.occ-on { color: #b25000; }
.occ-tip {
  font-size: 12px; color: var(--faint); margin-top: 8px; line-height: 1.6;
  border-top: 1px dashed rgba(0,0,0,.1); padding-top: 8px;
}

/* ==========================================================================
   单据查看（只读模板预览）
   ========================================================================== */
.doc-preview {
  background: #fff; border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-lg); padding: 20px 22px;
}
.doc-preview .dp-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--primary); padding-bottom: 10px; margin-bottom: 12px;
}
.doc-preview .dp-title { font-size: 19px; font-weight: 700; color: var(--ink); }
.doc-preview .dp-no { color: var(--muted); font-size: 13px; }
.doc-preview .dp-meta { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-bottom: 12px; }
.doc-preview .dp-meta > div { font-size: 13px; }
.doc-preview .dp-meta .lbl { color: var(--muted); margin-right: 6px; }
.doc-preview table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.doc-preview table th, .doc-preview table td {
  border: 1px solid rgba(0,0,0,.08); padding: 6px 8px; text-align: center;
}
.doc-preview table th { background: #fafafa; color: var(--muted); font-weight: 600; }
.doc-preview table td.l { text-align: left; }
.doc-preview .dp-total { font-weight: 700; background: #fafafa; }
.doc-preview .dp-remark { margin-top: 10px; font-size: 13px; }
.doc-preview .dp-foot {
  display: flex; justify-content: space-between; margin-top: 28px;
  font-size: 13px; color: var(--muted);
}

/* 单据卡片头部（doc-head / doc-meta 等） */
.doc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc-company { font-weight: 700; color: var(--ink); }
.doc-company-sub { font-size: 12px; color: var(--faint); font-weight: 400; }
.doc-type { font-weight: 700; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; }
.doc-meta-item { font-size: 12.5px; color: var(--text); display: flex; gap: 6px; }
.dm-label { color: var(--faint); }
.dm-val { color: var(--ink); font-weight: 500; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-foot { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.doc-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; font-size: 12.5px; color: var(--muted); }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-remark { font-size: 12.5px; color: var(--muted); }
.doc-total { font-weight: 700; color: var(--ink); }
.doc-sheet { background: #fff; border: 1px solid rgba(0,0,0,.05); border-radius: var(--r-lg); padding: 18px 20px; }
.doc-item-row td { vertical-align: middle; }

/* ==========================================================================
   二级嵌套弹窗
   ========================================================================== */
.sub-mask {
  position: fixed; inset: 0; background: rgba(28,28,30,.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 55;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 12px; overflow: hidden;
}
.sub-modal {
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); width: 620px; max-width: 100%;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  max-height: 84vh; position: absolute;
  border: 1px solid rgba(255,255,255,.7);
}
.sub-head {
  display: flex; align-items: center; justify-content: center;
  padding: 13px 16px; border-bottom: 1px solid rgba(0,0,0,.07);
  font-weight: 700; font-size: 14.5px; color: var(--ink);
  position: relative; cursor: default;
}
.sub-drag {
  color: #c3c3c9; font-size: 13px; letter-spacing: -1px; margin-right: 6px;
  padding: 2px 4px; cursor: grab; border-radius: 4px;
  user-select: none; -webkit-user-select: none;
}
.sub-drag:hover { background: var(--hover); color: var(--muted); }
.sub-title { flex: 1; text-align: center; padding: 0 36px; cursor: text; }
.sub-close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 17px; color: var(--muted);
  cursor: pointer; padding: 5px 9px; border-radius: 6px;
}
.sub-close:hover { color: var(--danger); background: var(--danger-bg); }
.sub-body { padding: 16px; overflow-y: auto; flex: 1; }
.sub-foot {
  padding: 12px 16px; border-top: 1px solid rgba(0,0,0,.07);
  display: flex; gap: 10px; justify-content: flex-end; background: transparent;
}
.sub-resizer { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: se-resize; z-index: 10; }
.sub-resizer::before {
  content: ''; position: absolute; right: 4px; bottom: 4px; width: 10px; height: 10px;
  background: linear-gradient(135deg, transparent 40%, #c3c3c9 40%, #c3c3c9 55%,
    transparent 55%, transparent 70%, #c3c3c9 70%, #c3c3c9 85%, transparent 85%);
  pointer-events: none;
}

/* 选择器（二级弹窗内的 产品/库存 列表） */
.inv-picker { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.picker-toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; position: sticky; top: 0;
  background: transparent; padding: 2px 0 8px; z-index: 2; flex: 0 0 auto;
}
.picker-toolbar input[type="text"] { flex: 1; min-width: 180px; }
.picker-toolbar select { min-width: 120px; }
.picker-toolbar input[type="text"], .picker-toolbar select {
  padding: 7px 10px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm); outline: none;
}
.picker-toolbar input[type="text"]:focus, .picker-toolbar select:focus {
  border-color: var(--primary); box-shadow: var(--ring);
}
.picker-list {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto;
  border: 1px solid rgba(0,0,0,.07); border-radius: var(--r-md);
}
.inv-pick-item, .prod-pick-item {
  padding: 10px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer;
  transition: background .14s;
  /* 勾选框 + 名称 + 附加信息 横排一行，内容过长自动换行 */
  display: flex; align-items: center; flex-wrap: wrap; gap: 3px 10px;
}
.inv-pick-item:last-child, .prod-pick-item:last-child { border-bottom: none; }
.inv-pick-item:hover, .prod-pick-item:hover { background: var(--primary-050); }
.prod-pick-item.is-selected { background: var(--primary-050); box-shadow: inset 3px 0 0 var(--primary); }
.prod-pick-item.is-disabled { cursor: default; opacity: .55; background: #fafafa; }
.inv-pick-item input[type="checkbox"], .prod-pick-item input[type="checkbox"] {
  flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--primary);
}
.picker-selection-count { margin-right: auto; align-self: center; color: var(--muted); font-size: 13px; }
.batch-selection-count { color: var(--muted); font-size: 13px; white-space: nowrap; align-self: center; }
.product-toolbar-stack { margin-bottom: 14px; }
.product-toolbar-stack .toolbar { margin-bottom: 0; }
.product-main-toolbar { min-height: 44px; }
.material-owner-combo { flex: 1; min-width: 0; }
#product-form #pf-material-owner, #product-form #pf-owner-manage { height: 48px; min-height: 48px; }
#product-form #pf-owner-manage { align-self: flex-end; white-space: nowrap; flex-shrink: 0; }
.material-owner-combo input { width: 100%; }
.material-owner-combo .sup-tags { margin-bottom: 8px; }
.material-owner-combo .owner-remove { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; }
#material-owner-filter-wrap[hidden] { display: none; }
#material-owner-filter-wrap .combo-item, .material-owner-combo .combo-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; }
.product-batch-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 12px;
  border: 1px solid rgba(0,122,255,.18); border-radius: var(--r-md);
  background: var(--primary-050);
}
.product-batch-toolbar[hidden] { display: none; }
.product-batch-toolbar .batch-selection-count { color: var(--primary); font-weight: 600; }
.product-batch-toolbar .spacer { flex: 1; }
.batch-move-panel { display: grid; gap: 14px; }
.batch-preview, .integrity-summary { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: #fafafa; }
.batch-preview ul { margin: 8px 0; padding-left: 20px; color: var(--muted); }
.integrity-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ip-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.ip-meta { font-size: 12px; color: var(--faint); margin-top: 0; }
/* 无库存新品（可定做）标注 */
.ip-nostock { color: var(--warn); font-weight: 600; }
/* 单据往来方（客户/供应商/领用方）模态选择器 */
.partner-picker { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; }
.partner-picker .pp-count { font-size: 12px; color: var(--faint); padding: 0 2px; }
.pk-hint {
  font-size: 12.5px; color: var(--muted); background: var(--primary-050);
  border: 1px solid rgba(0,0,0,.06); border-radius: var(--r-md); padding: 8px 12px;
  flex: 0 0 auto;
}

/* 带标签的搜索/筛选区 */
.picker-toolbar-labeled {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  background: #fafafa; border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-md); padding: 10px 12px;
}
.picker-toolbar-labeled .pt-field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.picker-toolbar-labeled .pt-field label {
  font-size: 11.5px; font-weight: 600; color: var(--muted); padding-left: 2px;
}
.picker-toolbar-labeled .pt-field input,
.picker-toolbar-labeled .pt-field select {
  padding: 7px 10px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm);
  font-size: 13px; background: #fff; color: var(--ink); outline: none;
}
.picker-toolbar-labeled .pt-field input:focus,
.picker-toolbar-labeled .pt-field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.14);
}
.picker-toolbar-labeled .pt-search { flex: 1; min-width: 200px; }
.picker-toolbar-labeled .pt-fixed-val {
  padding: 7px 10px; border: 1px dashed rgba(0,0,0,.14); border-radius: var(--r-sm);
  font-size: 13px; color: var(--text); background: #fff; min-height: 34px;
}
@media (max-width: 640px) {
  .picker-toolbar-labeled .pt-field { flex: 1 1 140px; }
  .picker-toolbar-labeled .pt-search { flex-basis: 100%; }
}

/* ==========================================================================
   采购单弹窗
   ========================================================================== */
.modal-purchase { width: 1080px; max-width: 98vw; }
.modal-purchase .form-grid { grid-template-columns: 1fr 1fr; }
.modal-supplier { width: 960px; max-width: 96vw; }
.modal-supplier .form-grid { grid-template-columns: 1fr 1fr; }

/* ==========================================================================
   采购单打印
   ========================================================================== */
@media screen { #print-area { display: none; } }
@media print {
  body > * { display: none !important; }
  #print-area { display: block !important; }
}
.pur-print {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px; color: #000; background: #fff; padding: 24px;
  max-width: 760px; margin: 0 auto;
}
.pur-print .pp-head { text-align: center; border-bottom: 2px solid #333; padding-bottom: 12px; margin-bottom: 16px; }
.pur-print .pp-head h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 2px; }
.pur-print .pp-head p { margin: 0; color: #555; }
.pur-print .pp-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 16px; }
.pur-print .pp-meta div { width: 30%; min-width: 200px; }
.pur-print table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.pur-print table th, .pur-print table td { border: 1px solid #333; padding: 7px 8px; text-align: center; }
.pur-print table th { background: #f2f2f2; }
.pur-print .pp-total { text-align: right; margin-top: 12px; font-size: 14px; }
.pur-print .pp-remark { margin-top: 12px; }
.pur-print .pp-foot { margin-top: 30px; text-align: right; color: #555; font-size: 12px; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1080px) {
  .sub-sidebar { width: 170px; flex-basis: 170px; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1); width: 226px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .field.col2 { grid-column: span 1; }
  .order-upload-grid { grid-template-columns: 1fr; }
  .modal { width: 100%; }
  .top-user { font-size: 12px; }
  .top-user::before { display: none; }
  .content { padding: 14px; }
  .table-scroll { max-height: calc(100vh - 250px); }
  .product-layout { flex-direction: column; }
  .sub-sidebar {
    width: 100%; flex: none; position: static;
    display: flex; flex-wrap: wrap; gap: 6px;
  }
  .sub-sidebar-title { width: 100%; }
  .cat-item { margin-bottom: 0; }
  .cbar-name { flex-basis: 104px; width: 104px; }
  .bom-row { flex-wrap: wrap; }
  .field .bom-row .bom-qty, .order-parts-section .bom-row .bom-qty { flex: 0 0 84px; width: 84px; }
  .toolbar .btn-primary { margin-left: 0; }
}
@media (max-width: 480px) {
  .toolbar input[type=text] { max-width: 100%; min-width: 100%; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-card .num { font-size: 22px; }
  .stat-card .sc-icon { width: 30px; height: 30px; flex-basis: 30px; font-size: 14px; }
  .content { padding: 10px; }
  .panel { padding: 14px 15px 16px; }
}

/* ==========================================================================
   使用手册（内嵌页面）
   ========================================================================== */
.guide-layout { max-width: none; }
.guide-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 104px);
  min-height: 460px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
}
@media (max-width: 900px) {
  .guide-frame { height: calc(100vh - 88px); min-height: 380px; }
}
@media (max-width: 480px) {
  .guide-frame { height: calc(100vh - 80px); min-height: 340px; }
}

/* ==========================================================================
   单据打印模板（简约高级：logo + 公司名 + 靛蓝主色 + 细线表格）
   ========================================================================== */
body.doc-printing > *:not(#print-area) { display: none !important; }
body.doc-printing #print-area { display: block !important; background: #fff; min-height: 100vh; padding-bottom: 40px; }
.pdoc-toolbar {
  position: fixed; top: 14px; right: 18px; z-index: 9999;
  display: flex; gap: 8px; background: #fff;
  padding: 8px 10px; border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.pdoc-settings {
  position: fixed; top: 64px; right: 18px; z-index: 9999;
  width: 460px; max-height: 70vh; overflow-y: auto;
  background: #fff; border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 14px;
}
.ps-group { margin-bottom: 10px; }
.ps-group-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
.ps-items { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ps-item { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.ps-actions { display: flex; gap: 8px; margin-top: 10px; }
.pdoc-sheet {
  width: 210mm; margin: 0 auto; padding: 14mm 15mm;
  background: #fff; color: #1f2430;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.pdoc-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 2px solid #4f46e5; }
.pdoc-brand { display: flex; align-items: center; gap: 10px; }
.pdoc-brand img { width: 46px; height: 46px; object-fit: contain; }
.pdoc-company { font-size: 21px; font-weight: 800; letter-spacing: 1px; color: #1f2430; }
.pdoc-company-en { font-size: 10px; color: #9aa0b0; letter-spacing: 2.5px; margin-top: 3px; }
.pdoc-doctype { text-align: right; }
.pdoc-doctype-name { font-size: 25px; font-weight: 800; color: #4f46e5; letter-spacing: 4px; }
.pdoc-badge {
  display: inline-block; margin-top: 4px; padding: 2px 12px; font-size: 12px;
  border-radius: 20px; color: #16a34a; background: #f0fdf4; border: 1px solid #bbf7d0;
}
.pdoc-badge.draft { color: #d97706; background: #fffbeb; border-color: #fde68a; }
.pdoc-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; margin: 16px 0 14px; }
.pdoc-meta-item { display: flex; flex-direction: column; gap: 2px; }
.pdoc-ml { font-size: 10.5px; color: #9aa0b0; letter-spacing: 1px; }
.pdoc-mv { font-size: 14px; font-weight: 600; }
.pdoc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pdoc-table th { background: #eef2ff; color: #3b3f57; border: 1px solid #d9def0; padding: 8px 8px; font-weight: 600; }
.pdoc-table td { border: 1px solid #e6e9f2; padding: 7px 8px; text-align: center; }
.pdoc-table td.ta-l { text-align: left; }
.pdoc-table td.ta-c { text-align: center; }
.pdoc-sum { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 10px; font-size: 13px; color: #555a6e; }
.pdoc-sum b { font-size: 15px; color: #4f46e5; }
.pdoc-sum-div { width: 1px; height: 14px; background: #d9def0; }
.pdoc-remark { margin-top: 14px; font-size: 12.5px; color: #3b3f57; }
.pdoc-remark b { color: #9aa0b0; font-weight: 600; }
.pdoc-foot { display: flex; justify-content: space-between; margin-top: 28px; font-size: 12.5px; color: #3b3f57; }
.pdoc-foot-sign { margin-top: 44px; }
.pdoc-sign { display: inline-block; min-width: 130px; border-bottom: 1px solid #3b3f57; height: 20px; vertical-align: bottom; }
@media print {
  @page { size: A4; margin: 10mm; }
  body.doc-printing { background: #fff; }
  .pdoc-toolbar, .pdoc-settings { display: none !important; }
  .pdoc-sheet { width: 100%; margin: 0; padding: 0; }
  body.doc-printing #print-area { min-height: auto; padding-bottom: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==========================================================================
   侧栏可展开分组（单据/产品/库存）+ 导航栏管理
   ========================================================================== */
.nav-item.nav-group .nav-chevron { width: 14px; height: 14px; margin-left: auto; transition: transform .15s; opacity: .55; flex-shrink: 0; }
.nav-item.sub-open .nav-chevron { transform: rotate(90deg); }
.nav-sub { display: none; flex-direction: column; padding: 0 0 6px; }
.nav-sub.open { display: flex; }
.nav-sub-item {
  display: block; margin: 1px 10px; padding: 7px 12px 7px 40px;
  font-size: 13px; color: var(--muted); cursor: pointer; border-radius: var(--r-sm);
  transition: color .15s ease, background .15s ease;
}
.nav-sub-item:hover { color: var(--primary); background: var(--primary-050); }
.nav-sub-item.active { color: #fff; background: var(--primary); }
.nav-sub-item.active:hover { color: #fff; background: var(--primary-600); }
.nav-manage { color: #1d1d1f; }
.modal-nav-manage .nm-tree-node { margin:4px 0; }
.modal-nav-manage .nm-tree-node > summary,.modal-nav-manage .nm-tree-leaf > summary { padding:10px; cursor:pointer; border-radius:8px; }
.modal-nav-manage .nm-tree-node > summary:hover,.modal-nav-manage .nm-tree-leaf > summary:hover { background:#eef3fa; }
.modal-nav-manage .nm-tree-node > summary .btn { float:right; margin-top:-4px; }
.modal-nav-manage .nm-tree-node > .nm-tree-node,.modal-nav-manage .nm-tree-node > .nm-section { margin-left:18px; border-left:2px solid #dfe5ed; padding-left:12px; }
.modal-nav-manage .nm-section { background:transparent; border:0; border-radius:0; padding:8px; }
.modal-nav-manage .nm-tree-leaf { margin:6px 0; background:white; border:1px solid #e5e5ea; border-radius:10px; }
.modal-nav-manage .nm-tree-leaf .nm-manage-row { padding:10px; flex-wrap:wrap; }
.modal-nav-manage .nm-tree-node .nm-row { padding:8px; }
.modal-nav-manage [data-nm-panel]:not([data-nm-panel="names"]) { overflow:visible; }
.modal-nav-manage #modal-body { overflow:hidden; display:flex; flex-direction:column; min-height:0; }
.modal-nav-manage .nav-manage { display:flex; flex-direction:column; overflow:hidden; min-height:0; flex:1; }
.modal-nav-manage .nm-tabs { position:static; flex-shrink:0; }
.modal-nav-manage [data-nm-panel] { overflow:auto; min-height:0; padding:2px 8px 16px 2px; }
.modal-nav-manage .nm-nav-group { padding:12px; margin-bottom:10px; border:1px solid #e5e5ea; border-radius:12px; background:#f8f9fb; }
.nm-category-links { margin:4px 0 12px 28px; border-left:2px solid #dce3ed; padding-left:12px; display:grid; gap:4px; }
.nm-category-links button { display:flex; justify-content:space-between; gap:12px; padding:8px 10px; border:0; border-radius:8px; background:white; cursor:pointer; text-align:left; color:var(--text); }
.nm-category-links button span { color:var(--primary); font-size:12px; }
.nav-manage [hidden] { display: none !important; }
.nm-tabs { display:flex; gap:6px; padding:6px; background:#eef0f4; border-radius:12px; margin-bottom:18px; position:sticky; top:0; z-index:2; }
.nm-tabs button { flex:1; border:0; padding:10px; background:transparent; border-radius:9px; cursor:pointer; color:#616168; }
.nm-tabs button[aria-selected="true"] { background:white; color:var(--primary); box-shadow:0 2px 7px #0001; }
.nav-manage .nm-manage-row { display:flex; gap:10px; }
.nav-manage .nm-manage-row input { min-width:0; }
.nav-manage .nm-manage-row .nm-code-input { flex:0 1 110px; }
.nm-columns { display:grid; grid-template-columns:minmax(0,1fr) 120px 210px; gap:10px; padding:12px 0; font-size:12px; color:var(--muted); }
[data-nm-panel="inv"] .nm-columns { grid-template-columns:minmax(0,1fr) 210px; }
.nav-manage .nm-row-actions { flex:0 0 210px; flex-wrap:nowrap; }
.nav-manage .nm-manage-row .nm-row-actions { gap:4px; }
@media(max-width:650px) {
  .nm-tabs { flex-wrap:wrap; }
  .nm-tabs button { flex:1 1 40%; }
  .nm-columns { display:none; }
  .nav-manage .nm-manage-row { flex-wrap:wrap; padding:10px 0; border-bottom:1px solid #ddd; }
  .nav-manage .nm-row-actions { flex-basis:100%; justify-content:flex-end; }
  .nav-manage .nm-row label { width:110px; }
}
.nm-more { position:relative; }
.nm-more summary,.nm-add-expand summary { cursor:pointer; padding:8px; color:var(--primary); }
.nm-more-menu { position:absolute; right:0; top:100%; z-index:5; background:white; padding:10px; border:1px solid #ddd; border-radius:10px; box-shadow:0 6px 18px #0002; display:grid; gap:8px; min-width:130px; }
.nav-manage .nm-inline-add { margin-left:0; }
.nav-manage .nm-section { margin-top:0; }
.nav-manage .nm-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.nav-manage .nm-row label { width: 160px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.nav-manage .nm-row.nm-sub label { color: var(--muted); padding-left: 16px; font-size: 12.5px; }
.nav-manage .nm-row input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #d2d2d7;
  border-radius: 10px; outline: none; background: #fff; color: #1d1d1f; font: inherit; font-size: 13px;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.025); transition: border-color .16s ease, box-shadow .16s ease;
}
.nav-manage .nm-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
/* 分类编码输入框（管理 → 产品分类）：定宽不占满行 */
.nav-manage .nm-row input.nm-code-input {
  flex: 0 0 120px; width: 120px; text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px;
}

/* 非管理员隐藏 ⚙ 选项/分类管理按钮（服务端接口同步限制为管理员） */
body.role-user .opt-mgr-btn { display: none !important; }

/* ==========================================================================
   数据看板 · 交期日历（Apple 日历风格：白卡大圆角 + 靛蓝今天 + 橙/红/绿计数徽章）
   ========================================================================== */
.cal-sub { font-size: 12px; color: #86868b; font-weight: 400; margin-left: 8px; }
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.cal-nav { display: flex; gap: 6px; }
.cal-btn {
  min-width: 30px; height: 30px; padding: 0 10px; border: none; cursor: pointer;
  border-radius: 999px; background: #f5f5f7; color: #1d1d1f; font-size: 15px; line-height: 1;
}
.cal-btn:hover { background: #e8e8ed; }
.cal-btn-today { font-size: 12.5px; color: var(--primary); background: var(--primary-050, #eef2ff); }
.cal-btn-today:hover { background: #e0e7ff; }
.cal-title { font-size: 17px; font-weight: 700; color: #1d1d1f; min-width: 110px; }
.cal-legend { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #86868b; }
.lg-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--primary); display: inline-block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11.5px; color: #86868b; font-weight: 600; padding: 4px 0 6px; }
.cal-cell {
  min-height: 62px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 4px; font-size: 13.5px; color: #1d1d1f;
}
.cal-cell.dim { color: #c7c7cc; }
.cal-cell.has-due { background: #f5f5f7; cursor: pointer; transition: background .12s; }
.cal-cell.has-due:hover { background: #ebebf0; }
.cal-cell.today .cal-day {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 700;
}
.cal-day { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; }
.cal-count {
  display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-align: center; line-height: 18px;
}
.cal-count.orange { background: #fff4e5; color: #c93400; }
.cal-count.red { background: #ffe5e5; color: #d70015; }
.cal-count.green { background: #e8f8ee; color: #1d7a34; }
@media (max-width: 720px) {
  .cal-cell { min-height: 46px; }
  .cal-legend { display: none; }
}

/* 三个模块取消左侧竖栏后：内容占满 + 内边距 */
#view-documents .sub-content, #view-product .sub-content, #view-inventory .sub-content { padding: 16px 18px; }

/* 库存管理：加工厂筛选面板。网格固定对齐，加工厂增多时自动换行。 */
.inv-factory-filter {
  margin: 2px 0 16px; padding: 15px 16px 16px;
  border: 1px solid rgba(0,0,0,.07); border-radius: var(--r-lg);
  background: rgba(255,255,255,.72); box-shadow: var(--shadow-xs);
}
.inv-factory-filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 12px;
}
.inv-factory-filter-title { font-size: 14px; font-weight: 700; color: var(--text); }
.inv-factory-filter-sub { margin-top: 3px; font-size: 12px; color: var(--muted); }
.inv-factory-total {
  flex: 0 0 auto; padding: 4px 10px; border-radius: 999px;
  background: #f2f2f7; color: var(--muted); font-size: 12px; font-weight: 600;
}
.inv-chips {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}
.inv-chip {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px 8px 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: #f5f5f7; color: #1d1d1f; font: inherit; font-size: 13px;
  cursor: pointer; user-select: text; -webkit-user-select: text; transition: background .12s, border-color .12s, box-shadow .12s, transform .12s;
}
.inv-chip:hover { background: #fff; border-color: rgba(0,113,227,.28); box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.inv-chip:active { transform: scale(.985); }
.inv-chip:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--primary); }
.inv-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0,113,227,.2); }
.inv-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.inv-chip .cat-num {
  flex: 0 0 auto; min-width: 25px; padding: 2px 7px; border-radius: 999px;
  background: rgba(0,0,0,.055); color: var(--muted); font-size: 11.5px; font-weight: 700; text-align: center;
}
.inv-chip.active .cat-num { background: rgba(255,255,255,.2); color: #fff; }
@media (max-width: 720px) {
  .inv-factory-filter { padding: 13px; }
  .inv-factory-filter-sub { display: none; }
  .inv-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 看板：每月数据 + 每日数据 同列上下排列（等分高度，间距 16px） */
.dash-stack { gap: 16px; }
.dash-stack > .panel { flex: 1; min-height: 0; }

/* 看板板块拖动排序：手柄 + 拖拽状态 */
.dash-grip {
  display: inline-block; margin-right: 8px; color: #b6bcc9;
  font-size: 14px; cursor: grab; user-select: none; letter-spacing: -1px;
}
.dash-grip:hover { color: var(--primary); }
.dash-grip:active { cursor: grabbing; }
[data-pid].dash-dragging { opacity: .45; outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: var(--r-lg); }
[data-pid][draggable="true"] .panel { cursor: grab; }

/* 看板板块宽度缩放按钮（仅管理员可见，随拖动权限） */
.dash-resize {
  display: inline-block; margin-right: 6px; color: #b6bcc9;
  font-size: 13px; cursor: pointer; user-select: none;
}
.dash-resize:hover { color: var(--primary); }

/* 操作列按钮铁律（永久）：永远单行横排，不许换行；列宽由按钮自然撑开，超出列宽时由 .table-scroll 横向滚动承接。
   ⚠️ .row-actions 是 <td> 本身的类，绝不能设 display:flex/inline-flex —— 会使 td 脱离 table-cell 布局，
   行高被缩略图（.thumb 40px）撑大时 td 不再随行拉伸（行 65px / td 仅 47px），按钮贴顶、下方留白
   （2026-09-01 产品列表图片行操作列错位事故）。单行由 white-space:nowrap 保证，间距用 margin-right。 */
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 4px; }

/* 手机端：二级弹出页（弹窗）高度拉满到 92% 视口，内容区内部滚动 */
@media (max-width: 720px) {
  .theme-switcher-top { gap: 5px; padding: 4px 6px; }
  .theme-switcher-top .theme-dot { width: 15px; height: 15px; }
  .modal { height: 92vh; height: 92dvh; max-height: none; top: 4vh; }
  .modal-mask { padding: 0 6px; align-items: flex-start; }
  .modal-body { flex: 1 1 auto; min-height: 0; }
  .modal-foot { flex-wrap: wrap; }
}

/* 导航栏管理：分组区块 + 分类行布局（新增/删除/改名） */
.nm-section { margin-top: 16px; padding: 16px; border: 1px solid rgba(0,0,0,.06); border-radius: 16px; background: #f5f5f7; }
.nm-sec-title { font-size: 14px; font-weight: 650; color: #1d1d1f; margin-bottom: 10px; }
.nm-lMain { width: 170px; font-size: 13px; flex-shrink: 0; }
.nm-lSub { width: 24px; color: var(--muted); font-size: 12.5px; flex-shrink: 0; text-align: center; }
.nm-row .nm-del-cat { flex-shrink: 0; }

/* 供应商列表：表格宽度由内容撑开（不挤压），超出容器自动出横向滚动条，长度随内容变化 */
#sup-list .table-scroll table { width: auto; min-width: max(100%, 1400px); }
#sup-list .table-scroll th, #sup-list .table-scroll td { white-space: nowrap; }
#sup-list td.sup-addr { max-width: none; }

/* 供应商表单：省/市/区镇 三级下拉一行排列（不换行挤占） */
.addr-cascade { display: flex; gap: 8px; }
.addr-cascade select { flex: 1; min-width: 0; }

/* 供应商列表：所有单元格强制不换行 */
#sup-list td, #sup-list th { white-space: nowrap !important; }

/* 客户列表：操作按钮强制单行（列宽随按钮自动撑开，不再竖排） */
#customer-list .row-actions { white-space: nowrap; }
/* 加工厂停用状态：保留历史记录但弱化展示 */
.wh-item-disabled { opacity: .72; }
.wh-status { color: var(--muted, #8a8f98); font-size: 12px; min-width: 52px; }
.btn-warning { color: #8a5a00; background: #fff4d6; border-color: #f1d28a; }

/* 单据表单与添加明细：保留现有 Apple 风格，仅收紧本业务弹窗。 */
#doc-form .form-grid { gap: 12px 16px; }
#doc-form .field { padding: 10px 12px; background: #fafafa; }
#doc-form .field:focus-within { border-color: rgba(0,0,0,.06); box-shadow: none; background: #fafafa; }
#doc-form .field > label { margin-bottom: 5px; line-height: 1.5; }
#doc-form .field input[type="text"],
#doc-form .field input[type="date"],
#doc-form .field input[type="number"],
#doc-form .field select { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
#doc-form .field .hint { font-size: 11.5px; line-height: 1.5; margin-top: 5px; }
#doc-form .doc-items-label { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--ink); }
#doc-form .doc-items { border-radius: var(--r-sm); }
#doc-form .doc-items th,
#doc-form .doc-items td { padding: 8px 9px; border-color: var(--line); vertical-align: middle; }
#doc-form .doc-items th { background: #f5f5f7; font-size: 11.5px; line-height: 1.5; }
#doc-form .doc-items td:first-child { text-align: left; }
#doc-form .doc-items .di-product-input { height: 38px; min-height: 38px; padding-left: 10px; }
#doc-form .doc-items .di-stock { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
#doc-form .doc-items .di-stock span { margin-left: 8px; }
#doc-form .doc-items .di-stock strong { font-weight: 600; color: var(--primary); }
#doc-form .doc-items .di-stock .is-insufficient { color: var(--danger); }
#doc-form .doc-items .di-qty,
#doc-form .doc-items .di-pieces,
#doc-form .doc-items .di-price { min-height: 38px; height: 38px; text-align: right; font-variant-numeric: tabular-nums; }
#doc-form .di-category-label { display: inline-flex; align-items: center; justify-content: center; padding: 3px 9px; border-radius: 7px; background: #eef0f3; color: var(--muted); font-size: 11.5px; line-height: 1.5; white-space: normal; }
#doc-form .di-unit { color: var(--muted); font-size: 12px; }
#doc-form .di-delete { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; min-height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--faint); box-shadow: none; font-size: 18px; line-height: 1; }
#doc-form .di-delete:hover { color: var(--danger); background: var(--danger-bg); border-color: rgba(255,59,48,.18); }
#doc-form .di-delete:focus-visible { color: var(--danger); box-shadow: var(--ring); }
#doc-form[data-type="inbound"] .doc-items th:first-child { width: 44%; text-align: left; }
#doc-form[data-type="inbound"] .doc-items th:nth-child(2) { width: 20%; }
#doc-form[data-type="inbound"] .doc-items th:nth-child(3) { width: 18%; text-align: right; }
#doc-form[data-type="inbound"] .doc-items th:nth-child(4) { width: 10%; }
#doc-form[data-type="inbound"] .doc-items th:last-child { width: 8%; min-width: 42px; }

/* .document-product-picker 只由单据添加明细使用，其他产品/库存选择器保持现有布局。 */
.document-product-picker { display: flex; flex-direction: column; gap: 12px; height: 100%; min-width: 0; min-height: 0; }
.document-product-picker > .dpp-context,
.document-product-picker > .dpp-tabs,
.document-product-picker > .dpp-controls,
.document-product-picker > .dpp-hint,
.document-product-picker > .dpp-bulk,
.document-product-picker > .dpp-batch-qty { flex: 0 0 auto; }
.document-picker-modal { width: 740px; height: min(84vh, 760px); max-width: calc(100vw - 24px); }
.document-picker-modal .sub-head,
.document-picker-modal .sub-foot { flex: 0 0 auto; }
.document-picker-modal .sub-body { padding: 15px 16px; min-height: 0; overflow-y: auto; }
.document-product-picker .dpp-context { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.document-product-picker .dpp-context strong { color: var(--ink); font-weight: 600; }
.document-product-picker .dpp-tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid rgba(0,0,0,.05); border-radius: 11px; background: #f0f0f3; }
.document-product-picker .dpp-tab { min-height: 34px; padding: 6px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.4; transition: background .14s, color .14s, box-shadow .14s; }
.document-product-picker .dpp-tab:hover { background: rgba(255,255,255,.55); color: var(--ink); }
.document-product-picker .dpp-tab.is-active { background: #fff; color: var(--primary); box-shadow: var(--shadow-xs); }
.document-product-picker .dpp-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 12px; background: transparent; border: 0; padding: 0; min-width: 0; }
.document-product-picker .dpp-controls .pt-field { min-width: 0; }
.document-product-picker .dpp-controls .pt-search { flex: 1 1 240px; min-width: 0; }
.document-product-picker .dpp-controls .pt-field:not(.pt-search) { flex: 0 1 150px; }
.document-product-picker .dpp-controls .pt-search,
.document-product-picker .dpp-controls .pt-category { display: flex; flex-direction: column; gap: 4px; }
.document-product-picker .dpp-controls .pt-category { flex: 0 1 150px; min-width: 0; }
.document-product-picker .dpp-controls input[type="text"],
.document-product-picker .dpp-controls select { width: 100%; min-width: 0; height: 38px; padding: 7px 10px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: 13px; outline: none; }
.document-product-picker .dpp-controls input[type="text"]:focus,
.document-product-picker .dpp-controls select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.document-product-picker .dpp-controls label { font-size: 11.5px; color: var(--muted); }
.document-product-picker .dpp-controls .dpp-show-empty,
.document-product-picker .dpp-controls .dpp-empty-toggle { display: flex; align-items: center; gap: 6px; min-height: 38px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.document-product-picker .dpp-controls input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.document-product-picker .dpp-help,
.document-product-picker .dpp-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.document-product-picker .dpp-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.document-product-picker .dpp-bulk .btn { min-height: 30px; padding: 4px 11px; font-size: 12px; white-space: nowrap; }
.document-product-picker .dpp-bulk > span { margin-left: auto; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.document-product-picker .dpp-batch-qty { padding: 10px 12px; border: 1px solid rgba(0,113,227,.15); border-radius: 10px; background: var(--primary-050); }
.document-product-picker .dpp-batch-qty[hidden] { display: none; }
.document-product-picker .dpp-batch-qty-context { margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 600; }
.document-product-picker .dpp-batch-qty-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.document-product-picker .dpp-batch-qty-controls label { color: var(--muted); font-size: 12px; }
.document-product-picker .dpp-batch-qty-controls input { width: 118px; min-width: 0; height: 34px; padding: 5px 9px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm); background: #fff; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.document-product-picker .dpp-batch-qty-controls input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.document-product-picker .dpp-batch-qty-controls input[aria-invalid="true"] { border-color: var(--danger); }
.document-product-picker .dpp-batch-qty-controls .btn { min-height: 32px; }
.document-product-picker #dpp-batch-qty-help { margin-top: 7px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.document-product-picker #dpp-batch-qty-error { color: var(--danger); font-size: 11.5px; line-height: 1.6; }
.document-product-picker .dpp-list { flex: 1 1 180px; min-width: 0; min-height: 120px; max-height: none; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.document-product-picker .dpp-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) 130px; align-items: center; gap: 6px 12px; padding: 11px 13px; border-bottom: 1px solid var(--line-2); background: #fff; box-shadow: none; }
.document-product-picker .dpp-item:last-child { border-bottom: 0; }
.document-product-picker .dpp-item:hover { background: var(--hover); }
.document-product-picker .dpp-item.is-selected,
.document-product-picker .dpp-item.is-selected:hover { background: var(--primary-050); box-shadow: inset 3px 0 0 var(--primary); }
.document-product-picker .dpp-item.is-disabled,
.document-product-picker .dpp-item.is-disabled:hover { background: #fafafa; box-shadow: none; opacity: 1; cursor: default; }
.document-product-picker .dpp-item.is-disabled .dpp-name { color: var(--faint); }
.document-product-picker .dpp-item > input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.document-product-picker .dpp-main { min-width: 0; }
.document-product-picker .dpp-name { color: var(--ink); font-size: 13.5px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.document-product-picker .dpp-meta { margin-top: 2px; color: var(--faint); font-size: 11.5px; line-height: 1.6; overflow-wrap: anywhere; }
.document-product-picker .dpp-stock { margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.document-product-picker .dpp-stock strong { color: var(--primary); font-weight: 600; }
.document-product-picker .dpp-stock span { margin-left: 9px; }
.document-product-picker .dpp-stock em { display: block; color: var(--warn); font-style: normal; }
.document-product-picker .dpp-stock.is-insufficient,
.document-product-picker .dpp-stock.is-insufficient strong,
.document-product-picker .dpp-stock .is-insufficient { color: var(--danger); }
.document-product-picker .dpp-quantity { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.document-product-picker .dpp-quantity label { width: 100%; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: right; }
.document-product-picker .dpp-quantity > div { display: flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; }
.document-product-picker .dpp-quantity input { width: 92px; max-width: 100%; height: 38px; padding: 7px 9px; border: 1px solid rgba(0,0,0,.12); border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.document-product-picker .dpp-quantity input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.document-product-picker .dpp-quantity input:disabled { color: var(--faint); background: #f2f2f4; }
.document-product-picker .dpp-quantity span { font-size: 11.5px; color: var(--muted); }
.document-product-picker .dpp-preview { display: flex; flex-direction: column; flex: 0 1 auto; grid-column: 2 / -1; min-width: 0; min-height: 128px; max-width: 100%; max-height: 240px; margin-top: 4px; padding: 9px 10px; overflow: hidden; border: 1px solid rgba(0,113,227,.1); border-radius: 9px; background: rgba(255,255,255,.8); cursor: default; }
.document-product-picker .dpp-preview > p { margin: 0 0 7px; font-size: 11.5px; color: var(--muted); }
.document-product-picker .dpp-preview-title { flex: 0 0 auto; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 600; }
.document-product-picker .dpp-preview-title span { margin-left: 8px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.document-product-picker .dpp-preview-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; max-width: 100%; }
.document-product-picker #dpp-issues { flex: 0 0 auto; max-height: 62px; overflow-y: auto; }
.document-product-picker .dpp-preview-table { width: 100%; min-width: 380px; border-collapse: collapse; font-size: 11.5px; line-height: 1.6; }
.document-product-picker .dpp-preview-table th { padding: 3px 5px 6px; text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
.document-product-picker .dpp-preview-table td { padding: 6px 5px; border-bottom: 1px solid var(--line-2); color: var(--text); vertical-align: middle; }
.document-product-picker .dpp-preview-table tr:last-child td { border-bottom: 0; }
.document-product-picker .dpp-preview-table th:nth-child(2),
.document-product-picker .dpp-preview-table td:nth-child(2),
.document-product-picker .dpp-preview-table th:last-child,
.document-product-picker .dpp-preview-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.document-product-picker .dpp-preview-table th:nth-child(3),
.document-product-picker .dpp-preview-table td:nth-child(3) { width: 48px; text-align: center; }
.document-product-picker .dpp-preview-table input { width: 82px; height: 32px; padding: 5px 7px; border: 1px solid rgba(0,0,0,.12); border-radius: 7px; background: #fff; color: var(--ink); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.document-product-picker .dpp-preview-table input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.document-product-picker .dpp-preview-table .is-insufficient { color: var(--danger); }
.document-product-picker .dpp-preview-table .is-short td:last-child { color: var(--danger); font-weight: 600; }
.document-product-picker .dpp-preview-table .is-short input { border-color: rgba(255,59,48,.45); }
.document-product-picker .dpp-issue { margin-top: 7px; color: var(--danger); font-size: 11.5px; line-height: 1.6; }
.document-product-picker .dpp-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.document-picker-modal .dpp-footer-count { margin-right: auto; align-self: center; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.document-picker-modal .dpp-footer-count strong { color: var(--ink); font-weight: 600; }
.document-picker-modal .dpp-clear { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); padding: 7px 9px; }
.document-picker-modal .dpp-clear:hover { background: var(--hover); color: var(--ink); border-color: transparent; }
@media (max-width: 640px) {
  #doc-form .form-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #doc-form .field.col2 { grid-column: auto; }
  #doc-form[data-type="inbound"] .doc-items table { min-width: 430px; }
  .document-product-picker .dpp-tabs { width: 100%; }
  .document-product-picker .dpp-tab { flex: 1 1 0; padding: 7px 8px; font-size: 12px; }
  .document-product-picker .dpp-controls .pt-search { flex-basis: 100%; }
  .document-product-picker .dpp-controls .pt-field:not(.pt-search) { flex: 1 1 140px; }
  .document-product-picker .dpp-controls .pt-category { flex: 1 1 140px; }
  .document-product-picker .dpp-context span { flex-basis: 100%; }
  .document-product-picker .dpp-bulk > span { flex: 1 1 100%; margin-left: 0; }
  .document-product-picker .dpp-batch-qty-controls label { flex-basis: 100%; }
  .document-product-picker .dpp-item { grid-template-columns: 18px minmax(0, 1fr); padding: 10px; gap: 5px 9px; }
  .document-product-picker .dpp-quantity { grid-column: 2; justify-content: flex-start; }
  .document-product-picker .dpp-quantity label { width: auto; text-align: left; margin-right: 3px; }
  .document-product-picker .dpp-quantity > div { width: auto; justify-content: flex-start; }
  .document-product-picker .dpp-preview { grid-column: 1 / -1; padding: 8px; }
  .document-product-picker .dpp-preview-title span { display: block; margin-left: 0; margin-top: 2px; }
  .document-picker-modal .dpp-footer-count { flex: 1 1 100%; }
  .document-picker-modal .sub-foot { flex-wrap: wrap; gap: 7px; }
  .document-picker-modal .sub-foot .btn { padding-left: 13px; padding-right: 13px; }
}
/* 小视口或用户缩小弹窗时，由内容区滚动承接，保证所有控件仍可访问。 */
@media (max-height: 680px) {
  .document-picker-modal .sub-body { overflow-y: auto; }
  .document-product-picker { height: auto; }
  .document-product-picker .dpp-list { flex: 0 0 auto; max-height: 210px; }
  .document-product-picker .dpp-preview { flex: 0 0 auto; }
}

.document-product-picker .dpp-empty-toggle[hidden] { display: none; }

.document-product-picker .dpp-preview[hidden] { display: none; }
