/* ============================================================================
   组件样式 Components
   ----------------------------------------------------------------------------
   规则：页面只允许用这里的类，禁止在页面里写自定义样式。
   需要新样式 → 在这里加组件，不要在页面里临时写。
   ========================================================================== */

/* ==========================================================================
   1. 应用骨架
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* 侧边导航（桌面 / 平板横屏 / 收银机） */
.side-nav {
  width: var(--sidebar-w);
  height: 100vh;              /* 显式高度，避免 inset 在某些环境失效 */
  flex-shrink: 0;
  background: #121a2b;
  color: #c8d2e4;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-nav);
  overflow: hidden;
  transition: width var(--t-base) var(--ease);
}
.side-nav__brand {
  padding: var(--sp-md);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  min-height: 64px;
  text-decoration: none;
}
.side-nav__items { flex: 1; padding: var(--sp-sm); overflow-y: auto; }
.side-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  /* 二级：比一级小一号、比一级淡。
     未选中保持安静，选中的那个加粗提白，眼睛直接落到"我正在哪一页"。 */
  color: #9aa8bf;
  font-size: var(--fs-table);
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background var(--t-fast), color var(--t-fast);
  min-height: 40px;
}
.side-nav__item:hover { background: rgba(255,255,255,.06); color: #eef2f9; }
/* 选中：高亮底色 + 加粗 + 纯白。这是整个侧栏唯一的"实心块"，
   扫一眼就知道当前在哪——这条要保留。 */
.side-nav__item.is-active {
  background: var(--c-primary);
  color: #fff;
  font-weight: 600;
}
.side-nav__item.is-active .side-nav__icon { opacity: 1; }
.side-nav__icon { width: 20px; text-align: center; flex-shrink: 0; opacity: .85; }

/* 侧栏菜单文字：默认显示全称；平板窄栏切简称（见文件后面的媒体查询） */
.side-nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav__short { display: none; white-space: nowrap; }

/* ---- 侧栏分组 ----
   一级（分组标题）和二级（菜单项）原来几乎一个样，只能靠字号猜。
   现在三招叠加区分：
     1. 分组标题：更小、更淡、全大写字母间距，左侧带一条竖色条；
     2. 每个分组上方留一条渐变色带做"分界"，这是最快的视觉落点；
     3. 二级项整体往右缩进，形成明显的从属关系。
   不靠颜色本身区分（有人色弱），明暗 + 缩进 + 分隔条三重保险。 */
.nav-group + .nav-group {
  margin-top: 6px;
  padding-top: 8px;
  /* 分界线做成两头淡、中间实：像一条渐隐的横线，比纯色硬线柔和，
     但又能一眼看出"这里换了一组" */
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .16) 18%,
    rgba(255, 255, 255, .16) 82%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: top center;
}
.nav-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px 8px 12px;
  margin-bottom: 3px;
  background: none;
  border: 0;
  border-radius: var(--r-md);
  /* 一级菜单：字比二级大一号、更亮、更重。
     标题小、菜单项大是反的——眼睛会先落在二级上，层级就乱了。
     配色仍然比选中项暗一点，避免抢走"当前在哪"的视觉焦点。 */
  color: #d3dcec;
  font-size: var(--fs-lg);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
}
/* 标题左侧竖色条，是分组的"锚点" */
.nav-group__head::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .3);
  flex-shrink: 0;
  margin-right: 9px;
}
.nav-group__head:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-group__head:hover::before { background: var(--c-primary); }
/* 「你在这里」：当前页所属的一级分组常亮——竖条变主题色、
   标题提白加大一号，跟二级的蓝底高亮上下呼应，位置一眼定位 */
.nav-group__head.is-here { color: #fff; }
.nav-group__head.is-here::before { background: var(--c-primary); height: 18px; }
.nav-group__head.is-here .nav-group__label { font-size: calc(var(--fs-lg) + 1px); }
.nav-group__head.is-here .nav-group__sign { background: rgba(79, 124, 240, .4); }
/* 二级选中项：字号同步加大一号，跟一级的强调幅度一致 */
.side-nav__item.is-active .side-nav__label,
.side-nav__item.is-active .side-nav__short { font-size: calc(var(--fs-table) + 1px); }
.nav-group__label { flex: 1; text-align: left; }
/* 加号/减号做在一个圆圈里，点起来目标更大，触摸屏不容易点空 */
.nav-group__sign {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  flex-shrink: 0;
}
.nav-group__head:hover .nav-group__sign { background: rgba(255,255,255,.16); }
.nav-group__body { padding-bottom: 2px; }
/* 二级项右缩进，跟一级标题错开，从属关系一眼分明。
   有折叠头的分组才缩（平板只剩图标时标题藏了，缩进反而浪费宽度）。 */
.nav-group:has(.nav-group__head) .nav-group__body { padding-left: 10px; }
@media (max-width: 1023px) {
  .nav-group:has(.nav-group__head) .nav-group__body { padding-left: 0; }
}

/* "做"= 功能开发中。挂个浅色小角标，避免点进去才发现没内容。 */
.side-nav__soon {
  margin-left: auto;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,.1);
  color: #8b9bb4;
  font-size: 10px;
  line-height: 1.5;
  flex-shrink: 0;
}
/* 平板窄栏 / 手机横屏（96px）：分组标题显示、折叠加号藏掉（宽度不够并排） */
@media (min-width: 640px) and (max-width: 1023px),
       (max-height: 500px) and (orientation: landscape) {
  .nav-group__sign { display: none; }
}
/* 手机横屏走窄栏档，分组标题正常显示（原 64px 图标模式的隐藏规则已删） */

/* 主内容区 */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: var(--page-pad);
  min-width: 0;              /* 防止 flex 子项撑破 */
  max-width: var(--content-max);
  transition: margin-left var(--t-base) var(--ease);
}

/* 手机：隐藏侧栏，改底部导航 */
@media (max-width: 639px) {
  .side-nav { display: none; }
  .app-main { margin-left: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* 设备显隐（双视图页面用：同一份数据，两套 DOM） */
.show-mobile { display: none !important; }
@media (max-width: 639px) {
  .show-desktop { display: none !important; }
  .show-mobile  { display: block !important; }
}

/* 平板（640~1023）：侧栏收成图标，只留符号。
   具体规则写在 .side-nav__* 组件定义之后（文件靠后位置）——媒体查询不加特异度，
   同特异度比的是先后，写在这里会被后面的 .side-nav__logout{display:flex} 盖掉。
   这坑踩过一次：1000px 宽下登出按钮没藏住，挤在 64px 侧栏底部。 */

/* 横屏手机：左栏收成图标 */
/* 手机横屏：不再压缩成纯图标栏。宽度 740+ 足够「图标+两字简称」，
   直接套用平板窄栏规则（--sidebar-w: 96px）；高度不够就整体滚动，
   不影响使用。 */

/* 底部导航（只在手机） */
.bottom-nav {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  background: var(--c-card);
  border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom);   /* iPhone 底部安全区 */
  z-index: var(--z-nav);
}
@media (max-width: 639px) {
  .bottom-nav { display: flex; flex-direction: column; }

  /* ---- 上行：二级菜单，一行，放不下左右滑 ---- */
  .bottom-nav__row--sub {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 1px solid var(--c-border);
    /* 零间距：每项只靠右侧竖线分隔 */
    padding: 0;
  }
  .bottom-nav__row--sub::-webkit-scrollbar { display: none; }
  .bottom-sub__item {
    flex: 0 0 auto;             /* 不压缩，超过屏宽就滚 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 60px;
    height: 38px;
    padding: 0 10px;
    font-size: 13px;
    color: var(--c-text-2);
    text-decoration: none;
    border-right: 1px solid var(--c-border);
    white-space: nowrap;
    position: relative;
  }
  .bottom-sub__item:last-child { border-right: 0; }
  .bottom-sub__item.is-active {
    color: var(--c-primary);
    font-weight: 600;
    background: rgba(79, 124, 240, .08);
  }
  .bottom-sub__item.is-active::after {
    content: "";
    position: absolute;
    left: 14px; right: 14px; bottom: 0;
    height: 2px; border-radius: 2px;
    background: var(--c-primary);
  }
  .bottom-sub__soon {
    font-size: 9px; line-height: 1.4;
    padding: 0 3px; border-radius: 3px;
    border: 1px solid var(--c-border);
    color: var(--c-text-3);
  }

  /* ---- 下行：一级菜单，固定一行，字号尽量大 ---- */
  .bottom-nav__row--main {
    display: flex;
    height: 46px;
  }
  .bottom-main__item {
    flex: 1;
    /* 17px 够认、不抢戏。之前 21px 粗体，四个字块比内容区还显眼 */
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--c-text);
    background: none;
    border: 0;
    border-right: 1px solid var(--c-border);
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-main__item.is-active {
    color: var(--c-primary);
    background: rgba(79, 124, 240, .08);
  }
  /* 房子/全屏：窄格，纯图标 */
  .bottom-main__icon {
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-2);
    background: none;
    border: 0;
    border-right: 1px solid var(--c-border);
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-main__icon:last-child { border-right: 0; }
  .bottom-main__icon.is-active { color: var(--c-primary); }
}

/* 分组二级菜单弹出层（手机底部） */
.sheet-mask {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(10, 14, 24, .45);
  display: flex; align-items: flex-end;
}
.sheet {
  background: var(--c-card);
  width: 100%;
  border-radius: 16px 16px 0 0;
  padding: var(--sp-md) var(--sp-md) calc(var(--sp-md) + env(safe-area-inset-bottom));
}
.sheet__title { font-size: var(--fs-head); font-weight: 600; margin-bottom: var(--sp-md); }
/* 一行 5 个：方块和字号整体收一号，主菜单（底部导航）比它醒目 */
.sheet__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-xs); }
.sheet__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--sp-xs) 2px;
  border-radius: var(--r-md);
  color: var(--c-text-2);
}
.sheet__item.is-active { background: rgba(79, 124, 240, .1); color: var(--c-primary); }
.sheet__char {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 600;
}
.sheet__item:nth-child(4n + 1) .sheet__char { background: #4f7cf0; }
.sheet__item:nth-child(4n + 2) .sheet__char { background: #e8622c; }
.sheet__item:nth-child(4n + 3) .sheet__char { background: #2e9e5b; }
.sheet__item:nth-child(4n + 4) .sheet__char { background: #8e5bd6; }
.sheet__name { font-size: var(--fs-xs); }
.sheet__soon {
  position: absolute; top: 4px; right: 8px;
  padding: 0 4px; border-radius: 4px;
  background: var(--c-border); color: var(--c-text-3);
  font-size: 10px; line-height: 1.5;
}
/* 顶部拖动条：代替「收起」按钮。点面板外任意处收起。 */
.sheet__grab {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--c-border);
  margin: 0 auto var(--sp-sm);
}

/* 全屏引导（一次性）：居中小卡片 */
.a2hs-mask {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(10,14,24,.55);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-md);
}
.a2hs-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  max-width: 380px;
  width: 100%;
  display: flex; flex-direction: column; gap: var(--sp-md);
}
.a2hs-card__title { font-size: var(--fs-lg); font-weight: 600; }
.a2hs-card__text { font-size: var(--fs-table); color: var(--c-text-2); line-height: 1.7; }

/* ==========================================================================
   2. 页面结构
   ========================================================================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
  flex-wrap: wrap;
}
.page-head__title { font-size: var(--fs-title); font-weight: 600; }
.page-head__desc { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 2px; }
.page-head__actions { display: flex; gap: var(--sp-sm); flex-wrap: wrap; }

/* 工具栏：搜索 + 筛选 + 操作 */
.toolbar {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  margin-bottom: var(--sp-md);
  flex-wrap: wrap;
}
.toolbar__search { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar__spacer { flex: 1; }

/* 平板及更窄：搜索框独占一行。
   800 宽时侧栏 64 + 三个筛选控件挤在一起，输入框只剩 200px，
   占位文字被截成「名称 / 品牌 / 型号 / 编……」，看着像坏了。 */
@media (max-width: 1023px) {
  .toolbar__search { max-width: none; flex-basis: 100%; }
}
@media (max-width: 639px) {
  .page-head { margin-bottom: var(--sp-sm); }
}

/* 有固定底部操作条的页面，内容要给操作条让位，否则最后一行被压住 */
@media (max-width: 639px) {
  .has-action-bar { padding-bottom: calc(var(--nav-h, 60px) + 86px); }
}

/* ==========================================================================
   3. 卡片
   ========================================================================== */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md);
  margin-bottom: var(--sp-md);
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
}
.card__body { padding: var(--sp-md); }

/* 统计卡（首页看板） */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}
@media (max-width: 639px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-sm); }
  /* 28px 的数字在 184px 格子里放不下 ¥391,280.00，会把整页顶宽 4~8px */
  .stat__value { font-size: 22px; }
}
/* 平板竖屏 800px：auto-fit 会排出 3 列 + 1 个孤儿，四张卡排成 2×2 才齐 */
@media (min-width: 640px) and (max-width: 1023px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  /* grid 子项默认 min-width:auto，内容（比如 ¥391,280.00）会把列撑破，
     整页跟着横向溢出。允许收缩，数字自己再想别的办法。 */
  min-width: 0;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-md);
  border-left: 3px solid var(--c-border);
}
.stat--primary { border-left-color: var(--c-primary); }
.stat--success { border-left-color: var(--c-success); }
.stat--warning { border-left-color: var(--c-warning); }
.stat--danger  { border-left-color: var(--c-danger); }
.stat__label { font-size: var(--fs-xs); color: var(--c-text-2); margin-bottom: var(--sp-xs); }
.stat__value { font-size: var(--fs-stat); font-weight: 700; letter-spacing: -.5px; }
.stat__value small { font-size: var(--fs-head); font-weight: 500; color: var(--c-text-3); margin-left: 4px; }
.stat__hint { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 2px; }

/* ==========================================================================
   4. 按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--h-btn);
  padding: 0 var(--sp-md);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-text);
  font-size: var(--fs-lg);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
  min-height: var(--touch-min);
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--c-hover); border-color: var(--c-border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn--primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }

.btn--danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn--danger:hover:not(:disabled) { opacity: .9; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--c-text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--c-hover); color: var(--c-primary); }

.btn--sm {
  height: var(--h-btn-sm);
  padding: 0 12px;
  font-size: var(--fs-table);
  border-radius: var(--r-sm);
}

.btn--block { width: 100%; }
.btn:disabled { opacity: .45; }

/* 手机：主操作按钮固定底部（不随内容滚动） */
.action-bar {
  display: none;
}
@media (max-width: 639px) {
  .action-bar {
    display: flex;
    gap: var(--sp-sm);
    position: fixed;
    /* 底部导航有两行（二级菜单 + 主导航），高度不固定：由 app.js 量出来
       写进 --nav-h。写死 60px 会把「生成退货单」压在二级菜单底下点不到。 */
    inset: auto 0 calc(var(--nav-h, 60px) + 2px) 0;
    padding: var(--sp-sm) var(--page-pad);
    background: var(--c-card);
    border-top: 1px solid var(--c-border);
    padding-bottom: calc(var(--sp-sm) + env(safe-area-inset-bottom));
    z-index: var(--z-sticky);
  }
  .action-bar .btn { flex: 1; }
}

/* ==========================================================================
   5. 表单
   ========================================================================== */
.field { margin-bottom: var(--sp-md); }
.field__label {
  display: block;
  font-size: var(--fs-head);
  color: var(--c-text-2);
  font-weight: 500;
  margin-bottom: 6px;
}
.field__label .req { color: var(--c-danger); margin-left: 2px; }
.field__hint { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 4px; }

/* 错误提示：预留固定高度，出现时不推挤下方元素（防布局跳动） */
.field__error {
  font-size: var(--fs-xs);
  color: var(--c-danger);
  margin-top: 4px;
  min-height: 17px;
  line-height: 17px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.field__error.show { opacity: 1; }
/* 紧凑表单可关掉预留高度 */
.field--compact .field__error { min-height: 0; }

.input, .select, .textarea {
  width: 100%;
  height: var(--h-input);
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-card);
  font-size: var(--fs-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: var(--touch-min);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(30,94,255,.12);
}
.input:disabled, .select:disabled {
  background: var(--c-bg);
  color: var(--c-text-3);
}
.input.is-error { border-color: var(--c-danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px rgba(232,64,42,.12); }

.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }

/* 表单行：桌面多列，手机单列 */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-md);
}
@media (max-width: 639px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* 数字输入（进销存专用：− 数字 +） */
.qty-input {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  height: var(--h-input);
  min-height: var(--touch-min);
}
.qty-input__btn {
  width: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--c-text-2);
  background: var(--c-bg);
  transition: background var(--t-fast);
}
.qty-input__btn:hover { background: var(--c-border); }
.qty-input__btn:disabled { color: var(--c-border-strong); }
.qty-input__field {
  width: 80px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
  background: var(--c-card);
}
.qty-input__field:focus { outline: none; background: var(--c-hover); }

/* 搜索框 */
.search-box { position: relative; }
.search-box .input { padding-left: 36px; }
.search-box__icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-3);
  pointer-events: none;
}

/* ==========================================================================
   6. 表格（桌面 / 平板）
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 底部渐变遮罩：暗示"下面还有内容" */
  position: relative;
}
.table-wrap--scrollable::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 24px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--c-card));
  pointer-events: none;
}

.data-table {
  width: 100%;
  font-size: var(--fs-table);
}
.data-table th {
  text-align: left;
  font-size: var(--fs-head);
  font-weight: 500;
  color: var(--c-text-2);
  background: var(--c-hover);
  padding: 10px var(--sp-sm);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table td {
  /* 上下留 6px：名称下面还有一行规格，不留白两行字会贴在一起 */
  padding: 6px var(--sp-sm);
  height: var(--h-row);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  line-height: 1.4;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--c-hover); }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* 平板：隐藏次要列（由页面给列加 .col-secondary） */
@media (max-width: 1279px) {
  .data-table .col-secondary { display: none; }
}

/* ==========================================================================
   7. 移动卡片列表（表格的手机形态）
   ========================================================================== */
.card-list { display: flex; flex-direction: column; gap: var(--sp-sm); }

.list-item {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  transition: background var(--t-fast);
}
.list-item:active { background: var(--c-hover); }
.list-item__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}
.list-item__sub {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  margin-bottom: var(--sp-sm);
}
.list-item__body {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-md);
  font-size: var(--fs-table);
  padding-top: var(--sp-sm);
  border-top: 1px dashed var(--c-border);
}
.list-item__meta { color: var(--c-text-2); }
.list-item__meta strong { color: var(--c-text); font-weight: 600; }
.list-item__actions {
  display: flex;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--c-border);
}

/* ==========================================================================
   8. 徽章 / 状态
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}
/* 语义固定：同一状态全站同一个颜色，不许改 */
.badge--danger  { background: var(--c-danger-light);  color: var(--c-danger); }
.badge--warning { background: var(--c-warning-light); color: var(--c-warning); }
.badge--success { background: var(--c-success-light); color: var(--c-success); }
.badge--info    { background: var(--c-info-light);    color: var(--c-primary); }
.badge--muted   { background: var(--c-bg);            color: var(--c-text-2); }

/* 状态点 */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot--danger  { background: var(--c-danger); }
.dot--warning { background: var(--c-warning); }
.dot--success { background: var(--c-success); }
.dot--muted   { background: var(--c-text-3); }

/* ==========================================================================
   9. 弹窗
   ========================================================================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: var(--c-mask);
  z-index: var(--z-mask);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-md);
}
.modal-mask.is-open { display: flex; }

.modal {
  background: var(--c-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-mask);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modal-in var(--t-base) var(--ease);
}
.modal--wide { max-width: 900px; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-lg);
  font-weight: 600;
  flex-shrink: 0;
}
.modal__close {
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  font-size: 22px;
  border-radius: var(--r-md);
}
.modal__close:hover { background: var(--c-hover); color: var(--c-text); }
.modal__body { padding: var(--sp-md); overflow-y: auto; flex: 1; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* 手机：底部抽屉，拇指够得到 */
@media (max-width: 639px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none;
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-in var(--t-base) var(--ease);
  }
  .modal__foot .btn { flex: 1; }
  @keyframes sheet-in {
    from { transform: translateY(100%); }
    to   { transform: none; }
  }
}

/* ==========================================================================
   10. 提示 Toast
   ========================================================================== */
.toast-wrap {
  position: fixed;
  /* 右下角，不是右上角：右上角是「新建商品」这类主操作的位置，
     提示盖上去正好挡住要去点的地方。 */
  bottom: calc(var(--sp-md) + 8px);
  right: var(--sp-md);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}
@media (max-width: 639px) {
  .toast-wrap { top: auto; bottom: 80px; left: var(--page-pad); right: var(--page-pad); }
  /* 页面底部还有一条快捷操作条时（新建商品/保存/确认导入），提示要让开它，
     否则「保存成功」的提示正好盖在「保存」按钮上，下一次就点错了。 */
  body:has(.action-bar) .toast-wrap { bottom: calc(80px + 64px); }
  /* 开单页的提交条也是吸底的，同样要让开 */
  body:has(.submit-bar) .toast-wrap { bottom: calc(80px + 76px); }
}
/* 桌面和平板上提交条一样在底部，提示要抬到它上面 */
@media (min-width: 640px) {
  body:has(.submit-bar) .toast-wrap { bottom: 104px; }
}
.toast {
  padding: 10px var(--sp-md);
  border-radius: var(--r-md);
  color: #fff;
  font-size: var(--fs-table);
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  animation: toast-in var(--t-base) var(--ease);
}
.toast--success { background: var(--c-success); }
.toast--error   { background: var(--c-danger); }
.toast--info    { background: var(--c-primary); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   11. 空状态 / 加载
   ========================================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px var(--sp-md);
  color: var(--c-text-3);
  text-align: center;
}
.empty__icon { font-size: 40px; opacity: .4; margin-bottom: var(--sp-sm); }
.empty__text { font-size: var(--fs-table); margin-bottom: var(--sp-md); }

/* 骨架屏（不要用转圈） */
.skeleton {
  background: linear-gradient(90deg, var(--c-bg) 25%, #e9eef5 37%, var(--c-bg) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--r-sm);
  height: 16px;
}
@keyframes skeleton {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}

/* ==========================================================================
   12. 分页
   ========================================================================== */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) 0 0;
  font-size: var(--fs-table);
  color: var(--c-text-2);
}
.pager__pages { display: flex; align-items: center; gap: var(--sp-xs); }
.pager__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-2);
}
.pager__btn:hover { background: var(--c-hover); }
.pager__btn.is-active { background: var(--c-primary); color: #fff; }
.pager__btn:disabled { color: var(--c-border-strong); }

@media (max-width: 639px) {
  .pager { justify-content: center; }
  .pager__total { display: none; }
}

/* ==========================================================================
   13. 列表内滚动提示（电脑端专用）
   ========================================================================== */
/* 只在鼠标设备显示"共 N 条"的提示，触摸设备靠直觉滑动 */
.scroll-hint {
  display: none;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  text-align: center;
  padding: var(--sp-xs);
}
@media (pointer: fine) {
  .scroll-hint { display: block; }
}

/* ==========================================================================
   14. 输入校验状态
   --------------------------------------------------------------------------
   三态：idle 无痕 / valid 轻量确认 / invalid 红框+文案
   设计取舍：valid 不放大面积绿色，只用细边框+对勾，避免满屏花花绿绿
   ========================================================================== */

/* 通过：细绿边 + 右侧对勾 */
.input.is-valid {
  border-color: #86d0a4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2316a34a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}
.input.is-valid:focus {
  border-color: var(--c-success);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

/* 错误：红边加粗一点，误差更醒目 */
.input.is-error,
.select.is-error {
  border-color: var(--c-danger);
  background-color: #fffafa;
}
.input.is-error:focus,
.select.is-error:focus {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(232,64,42,.14);
}

/* 校验中的输入框：统一去掉浏览器自带校验气泡 */
.input:invalid { box-shadow: none; }

/* ==========================================================================
   15. 输入框前缀 / 后缀（币种、单位）
   --------------------------------------------------------------------------
   关键：¥ 是视觉装饰，不是 value 的一部分。
   用户复制走的是纯数字，不会把符号带进数据库。
   ========================================================================== */
.affix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.affix-wrap .input { padding-left: 30px; }
.affix-wrap__prefix {
  position: absolute;
  left: 12px;
  font-size: var(--fs-lg);
  color: var(--c-text-2);
  pointer-events: none;      /* 点击穿透到 input */
  user-select: none;
}
.affix-wrap--suffix .input {
  padding-left: 12px;
  padding-right: 44px;
}
.affix-wrap__suffix {
  position: absolute;
  right: 12px;
  font-size: var(--fs-head);
  color: var(--c-text-3);
  pointer-events: none;
  user-select: none;
}
/* 数字类输入统一等宽数字，位数对齐好核对 */
.input--num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: .2px;
}

/* ==========================================================================
   16. 快捷值按钮（能点击就不打字）
   --------------------------------------------------------------------------
   用在：数量 1/5/10、日期 今天/昨天、付款方式、常见规格
   规则：一行最多 5 个，超出换行；点击即填，再点取消
   ========================================================================== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-card);
  font-size: var(--fs-table);
  color: var(--c-text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  font-family: inherit;
}
.chip:hover { border-color: var(--c-border-strong); background: var(--c-hover); }
.chip.is-active {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 500;
}
@media (pointer: coarse), (any-pointer: coarse) {
  .chip { min-height: 44px; padding: 0 18px; }
}

/* ==========================================================================
   17. 联想下拉（打字时实时检索）
   --------------------------------------------------------------------------
   用法：输入 ≥1 字触发，200ms 防抖，支持拼音首字母与错别字纠错
   ========================================================================== */
.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(20,32,60,.14));
  z-index: var(--z-sticky);
  display: none;
  /* 容器不拦截点击：点空白处可穿透到下方控件，避免遮挡操作 */
  pointer-events: none;
}
.suggest.show { display: block; }
.suggest__item,
.suggest__correct,
.suggest__empty { pointer-events: auto; }
.suggest__item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  cursor: pointer;
  font-size: var(--fs-table);
  border-bottom: 1px solid #f2f5fa;
}
.suggest__item:last-child { border-bottom: none; }
.suggest__item:hover,
.suggest__item.is-active { background: var(--c-primary-light); }
.suggest__main { flex: 1; min-width: 0; }
.suggest__title {
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest__title mark {
  background: #fff2b8;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.suggest__meta {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest__side {
  font-size: var(--fs-xs);
  color: var(--c-text-2);
  text-align: right;
  white-space: nowrap;
}
.suggest__empty {
  padding: 18px var(--sp-md);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
}
/* 纠错提示条：输入"健盘"时提示"您是不是想找：键盘" */
.suggest__correct {
  padding: 8px var(--sp-md);
  background: var(--c-warning-light);
  font-size: var(--fs-xs);
  color: #8a5a00;
  border-bottom: 1px solid #f5e2c0;
}
.suggest__correct b { color: var(--c-warning); }

/* ==========================================================================
   18. 步进器（数量 −/+）
   --------------------------------------------------------------------------
   手机上调数量最难，两侧按钮 48×48，中间可直接输入
   ========================================================================== */
.stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-card);
}
.stepper__btn {
  width: var(--h-input);
  flex-shrink: 0;
  border: none;
  background: var(--c-hover);
  color: var(--c-text-2);
  font-size: 20px;
  cursor: pointer;
  transition: background var(--t-fast);
  font-family: inherit;
  line-height: 1;
}
.stepper__btn:hover { background: #eef2f8; color: var(--c-primary); }
.stepper__btn:active { background: #e4eaf4; }
.stepper__btn:disabled { color: var(--c-text-3); cursor: not-allowed; opacity: .5; }
.stepper .input {
  border: none;
  border-radius: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.stepper .input:focus { box-shadow: none; }

/* ==========================================================================
   19. 只读展示值（详情页用，区别于可编辑输入框）
   ========================================================================== */
.readonly-value {
  min-height: var(--h-input);
  display: flex;
  align-items: center;
  padding: 0 2px;
  font-size: var(--fs-lg);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.readonly-value--money { font-weight: 500; }

/* 下方空间不足时向上展开（列表底部、弹窗内常见） */
.suggest--up {
  top: auto;
  bottom: calc(100% + 4px);
}
.suggest__correct { cursor: pointer; }
.suggest__correct:hover { background: #fdf0d8; }
.suggest__fix {
  margin-left: 6px;
  color: var(--c-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* 步进器内不显示对勾：两边按钮已提供足够的操作反馈 */
.stepper .input.is-valid {
  background-image: none;
  padding-right: 0;
}

/* ==========================================================================
   18. 登录页 / 详情页 / 库位网格 / 导入（0.4 新增）
   --------------------------------------------------------------------------
   只加这一节。页面里仍然不许写自定义样式。
   ========================================================================== */

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-md);
  background:
    radial-gradient(900px 500px at 15% 0%, #e9f0ff 0%, transparent 60%),
    radial-gradient(700px 500px at 100% 100%, #eef3f9 0%, transparent 55%),
    var(--c-bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-xl);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: -.3px;
}
.login-brand__logo {
  width: 34px; height: 34px;
  flex-shrink: 0;
}
/* 侧栏品牌位：矢量 logo。logo 自带白色圆角方卡（1024 画布、圆角 210），
   这里只按同比例收圆角（28px × 210/1024 ≈ 6px），不要再裁成圆形——
   裁圆会把白卡的四角切掉，品牌规范明确要求保留方卡。 */
.side-nav__logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}
/* 手机横屏/平板窄栏品牌文字隐藏时，logo 独自居中 */
.login-brand__mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.login-sub {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  margin: 6px 0 var(--sp-lg);
}
.login-foot {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  margin-top: var(--sp-md);
  line-height: var(--lh-base);
}
/* ---------- 登录页：账号历史 / 密码显示 / 自动登录 ---------- */
.login-user { position: relative; }
.login-user__wrap { position: relative; }
.login-user__caret {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer;
  color: var(--c-text-3);
  border-radius: var(--r-sm);
}
.login-user__caret:hover { color: var(--c-text); background: var(--c-hover); }
/* 下拉列表面板 */
.login-user__drop {
  position: absolute; z-index: 20;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.login-user__drop-title {
  font-size: var(--fs-xs); color: var(--c-text-3);
  padding: 4px 8px 6px;
}
.login-user__opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.login-user__opt:hover { background: var(--c-hover); }
.login-user__opt.is-cur { background: rgba(79, 124, 240, .08); }
.login-user__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.login-user__name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.login-user__name > span:first-child {
  font-size: var(--fs-table); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.login-user__uname { font-size: var(--fs-xs); color: var(--c-text-3); }
.login-user__del {
  width: 26px; height: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer;
  color: var(--c-text-3); border-radius: var(--r-sm);
}
.login-user__del:hover { color: var(--c-danger, #d7281f); background: var(--c-hover); }

.login-pwd { position: relative; }
.login-pwd .input { padding-right: 42px; }
.login-pwd__eye {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer;
  color: var(--c-text-3); border-radius: var(--r-sm);
}
.login-pwd__eye:hover { color: var(--c-text); }

.login-auto {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-sm);
  margin: calc(var(--sp-sm) * -1) 0 var(--sp-md);
}
.login-auto__check {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-table); color: var(--c-text-2);
  cursor: pointer;
  min-height: 32px;
}
.login-auto__check input { width: 17px; height: 17px; accent-color: var(--c-primary); }
.login-auto__days {
  height: 32px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-card);
  color: var(--c-text);
  font-size: var(--fs-table);
  font-family: inherit;
  padding: 0 6px;
}

@media (max-width: 639px) {
  .login-page { align-items: flex-start; padding-top: 12vh; }
  .login-card { padding: var(--sp-lg) var(--sp-md); box-shadow: none; }}

/* ---------- 侧栏底部账号 ---------- */
.side-nav__user {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-head);
  color: #a9b6cc;
  min-height: 56px;
}
.side-nav__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
/* 名字和角色要上下排。它们都是 span，不显式改成列会挤成一行
   「管理员管理员」——看不出哪个是名字哪个是角色。 */
.side-nav__user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.side-nav__user-name {
  color: #fff; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-nav__user-role {
  font-size: var(--fs-xs); color: #7e8ca3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 全屏按钮：跟右侧两个图标按钮同款，只有它带 margin-left:auto 负责把
   这一排按钮推到最右；修改密码/退出跟在后面 */
.side-nav__fs {
  margin-left: auto;
  color: #7e8ca3;
  padding: 6px;
  border-radius: var(--r-sm);
  display: flex;
  background: none;
  border: none;
  cursor: pointer;
}
.side-nav__fs:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav__logout {
  margin-left: 0;
  color: #7e8ca3;
  padding: 6px;
  border-radius: var(--r-sm);
  display: flex;
}
.side-nav__logout:hover { background: rgba(255,255,255,.08); color: #fff; }

/* 平板窄栏 / 手机横屏（96px）：图标 + 两字简称，左对齐；
   品牌文字 5 个字放不下继续藏，分组标题正常横排显示。
   手机横屏虽然 CSS 宽度可能过 1024，但高度矮，同样收窄栏。 */
@media (min-width: 640px) and (max-width: 1023px),
       (max-height: 500px) and (orientation: landscape) {
  .side-nav__brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .side-nav__brand span:not(.side-nav__icon),
  .side-nav__item .side-nav__label,
  .side-nav__user-info,
  .side-nav__logout { display: none; }
  .side-nav__item { justify-content: flex-start; padding: 10px 8px; }
  .side-nav__short { display: inline; }
  /* 「做」角标在 96px 栏里会把简称挤成竖排，藏掉（悬停 title 仍有全称） */
  .side-nav__soon { display: none; }
  /* 只留头像，居中；gap 归零，不然头像会被 gap 顶偏 */
  .side-nav__user { justify-content: center; gap: 0; padding: var(--sp-sm) 0; }
}
/* （手机横屏原compressed规则已删：横屏宽度足够，统一走平板窄栏样式，
   侧栏自身 overflow-y:auto 负责高度滚动。） */

/* ---------- 键值列表（详情页） ---------- */
/* 键值列表限宽：桌面整卡 1200 宽时，键在左值在右，中间空一大片反而难对 */
.kv { display: flex; flex-direction: column; max-width: 680px; }
.kv__row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 10px 0;
  border-bottom: 1px dashed var(--c-border);
  font-size: var(--fs-table);
}
.kv__row:last-child { border-bottom: none; }
.kv__k { color: var(--c-text-2); flex-shrink: 0; }
.kv__v { color: var(--c-text); text-align: right; word-break: break-all; }
.kv__v.num { font-variant-numeric: tabular-nums; }
/* 值是一整句话时右对齐会把句子拆得七零八落，改成键上值下 */
.kv--text .kv__row { flex-direction: column; gap: 2px; }
.kv--text .kv__v { text-align: left; color: var(--c-text-2); }

/* ---------- 库位网格 ---------- */
/* 按排分组：一排一块，块头写排号。库位本来就是一排一排摆的，
   平铺成一大片之后找个位得数半天。 */
.loc-row { margin-bottom: var(--sp-md); }
.loc-row__head {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}
.loc-row__title {
  font-size: var(--fs-table);
  font-weight: 600;
  color: var(--c-text-2);
}
.loc-row__head .btn { margin-left: auto; }

/* 按排改名的面板 */
.loc-rename {
  margin-bottom: var(--sp-sm);
  padding: var(--sp-md);
  border: 1px solid var(--c-primary);
  border-radius: var(--r-md);
  background: var(--c-primary-weak, #f2f6ff);
}
.loc-rename__presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: 10px;
}
.loc-rename__preview {
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}

/* 回收站：已删除的库位。一行一个，淡淡的，不抢主列表的眼 */
.arch-list { display: flex; flex-direction: column; }
.arch-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border);
}
.arch-item:last-child { border-bottom: 0; }
.arch-item > div:first-child { flex: 1; min-width: 0; }
.arch-item .mono { color: var(--c-text-3); text-decoration: line-through; }

.loc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--sp-sm);
}
.loc-cell {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  text-align: center;
  background: var(--c-card);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.loc-cell:hover {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}
.loc-cell.is-editing { border-color: var(--c-primary); background: #eef4ff; }
/* 只读（业务员查库位）：格子是 div 不是 button，得自己把 button 的默认样式补回来 */
.loc-cell.is-readonly {
  cursor: default;
  /* div 没有 button 的 font 归一，不写会继承浏览器默认字体，跟旁边按钮对不上 */
  font-family: inherit;
  font-size: inherit;
  color: var(--c-text);
}
.loc-cell.is-readonly:hover {
  border-color: var(--c-border);
  box-shadow: none;
}
/* 选择模式（批量删除）：选中 = 蓝边 + 右上角对勾角标 */
.loc-cell.is-selected {
  border-color: var(--c-primary);
  background: #eef4ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.loc-cell__tick {
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--c-border);
  background: var(--c-card);
  color: transparent;
  font-size: 11px; line-height: 16px; text-align: center;
  pointer-events: none;             /* 点勾选框就是点格子本身，别拦截 */
}
.loc-cell.is-selected .loc-cell__tick {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: #fff;
}
/* 选择模式下格子必须可定位，角标才挂得住 */
.loc-grid { position: relative; }
.loc-cell { position: relative; }
/* 排标题的勾选框（勾一整排） */
.loc-row__pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 28px;                 /* 触控目标：手指能点中 */
}
.loc-cell__code {
  font-size: var(--fs-table);
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: .2px;
}
/* 名称才是人真正记的东西：给足行高，最多两行，超出省略 */
.loc-cell__name {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--c-text-2);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.loc-cell__meta { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 3px; }
.loc-cell.is-empty { border-style: dashed; }
.loc-cell.is-empty .loc-cell__code { color: var(--c-text-3); }
.loc-cell.is-empty .loc-cell__name { color: var(--c-text-3); }
.loc-cell.is-used { border-color: #bcd2ff; background: #f5f9ff; }
@media (max-width: 639px) {
  .loc-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .loc-cell { padding: 8px 6px; }
}

/* ---------- 提示条（导入页/表单说明） ---------- */
.notice {
  border-radius: var(--r-md);
  padding: 10px var(--sp-md);
  font-size: var(--fs-table);
  line-height: var(--lh-base);
  border: 1px solid var(--c-border);
  background: var(--c-hover);
  color: var(--c-text-2);
}
.notice--warn { background: var(--c-warning-light); border-color: #f3ddb5; color: #8a5a05; }
.notice--danger { background: var(--c-danger-light); border-color: #f6c9c2; color: #a12b1c; }
.notice--info { background: var(--c-primary-light); border-color: #cfdcff; color: #17408f; }
.notice b { color: inherit; }

/* ---------- 上传区 ---------- */
.upload-box {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-xl) var(--sp-md);
  text-align: center;
  background: var(--c-card);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-box:hover, .upload-box.is-drag {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.upload-box__title { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 4px; }
.upload-box__hint { font-size: var(--fs-xs); color: var(--c-text-3); }
.upload-box input[type=file] { display: none; }

/* ---------- 表格内的行状态 ---------- */
.data-table tbody tr.is-error { background: #fff7f6; }
.data-table tbody tr.is-error:hover { background: #feeff0; }
.cell-err { color: var(--c-danger); font-size: var(--fs-xs); }
.cell-warn { color: var(--c-warning); font-size: var(--fs-xs); }

/* ---------- 移动端页面返回 ---------- */
.page-back {
  display: none;
  align-items: center;
  gap: 4px;
  color: var(--c-text-2);
  font-size: var(--fs-table);
  margin-bottom: var(--sp-sm);
  min-height: var(--touch-min);
}
@media (max-width: 639px) {
  .page-back { display: inline-flex; }
}

/* 卡片列表底部操作条（手机） */
.list-foot { margin-top: var(--sp-md); }

/* 底部操作条占位：内容末尾垫一下，最后一行不会被固定条压住 */
.action-bar-spacer { display: none; }
@media (max-width: 639px) {
  .action-bar-spacer { display: block; height: 76px; }
}

/* 手机：分类下拉可压缩，两个筛选 chip 和它挤在一行里 */
@media (max-width: 639px) {
  .toolbar .select { flex: 1 1 96px; min-width: 0; }
  .toolbar .chip { padding: 0 12px; }
}

/* 分页按钮在触摸设备上要够点：36px 是鼠标尺寸，手指点不准 */
@media (pointer: coarse), (any-pointer: coarse) {
  .pager__btn { min-width: 44px; height: 44px; }
}

/* ==========================================================================
   19. 开单与单据
   ========================================================================== */

/* 单据类型：六个 chip 会换行，行距别贴着 */
.order-types { margin-bottom: var(--sp-md); }
.order-types .chip:disabled { opacity: .45; cursor: not-allowed; }

.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1023px) { .form-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .form-row--3 { grid-template-columns: 1fr; gap: 0; } }

/* ---------- 扫码 / 搜索条 ---------- */
.scan-bar {
  position: relative;             /* 搜索下拉挂在这上面 */
  display: flex;
  gap: var(--sp-sm);
  padding: 0 var(--sp-md) var(--sp-md);
}
@media (max-width: 639px) {
  .scan-bar { padding: 0 var(--sp-md) var(--sp-sm); }
  .scan-bar .btn { padding: 0 12px; }
}

.search-pop {
  position: absolute;
  top: calc(100% - 8px);
  left: var(--sp-md);
  right: var(--sp-md);
  z-index: 30;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 316px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.search-pop__row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  min-height: var(--touch-min);
}
.search-pop__row:last-child { border-bottom: none; }
.search-pop__row.is-active { background: var(--c-primary-light); }
/* 检索行挪到了清单最下面：候选列表要往上弹，
   否则会顶到页面外面去（下面是金额区和提交条） */
.search-pop--up {
  top: auto;
  bottom: calc(100% - 8px);
  box-shadow: 0 -12px 28px rgba(16, 24, 40, .16);
}
.search-pop__main { flex: 1; min-width: 0; }
.search-pop__name { font-weight: 500; }
.search-pop__side { text-align: right; flex-shrink: 0; }
.search-pop__side .num { font-weight: 600; }

/* ---------- 明细行 ---------- */
.line-head,
.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px 128px 104px 104px 34px;
  gap: var(--sp-sm);
  align-items: center;
}
.line-head--transfer,
.line--transfer {
  grid-template-columns: minmax(0, 1fr) 100px 100px 120px 92px 96px 34px;
}
.line-head {
  padding: 8px var(--sp-md);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
  font-size: var(--fs-head);
  color: var(--c-text-2);
}
.line {
  padding: 10px var(--sp-md);
  border-bottom: 1px solid var(--c-border);
}
.line:last-of-type { border-bottom: none; }
.line__name { min-width: 0; }
.line__title { font-weight: 500; word-break: break-word; }
.line__lb { display: none; font-size: var(--fs-xs); color: var(--c-text-3); margin-bottom: 2px; }
.line__amount { text-align: right; font-weight: 600; white-space: nowrap; }
.line__del {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--c-text-3);
  background: transparent;
}
.line__del:hover { background: var(--c-danger-light); color: var(--c-danger); }

/* 序列号：横跨整行，单独一块 */
.line__serials {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: var(--sp-sm);
  background: var(--c-bg);
  border-radius: var(--r-md);
}
.line__serials-head {
  display: flex; align-items: center; gap: var(--sp-sm);
  font-size: var(--fs-table);
  color: var(--c-text-2);
  margin-bottom: var(--sp-sm);
  flex-wrap: wrap;
}
.line__serials .chips { margin-bottom: var(--sp-sm); }
.line__serials .input { width: 100%; }

/* 数量：− 数字 ＋，比裸输入框好点，仓管一只手也能改 */
.qty-step {
  display: flex;
  align-items: stretch;
  height: 36px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-card);
}
.qty-step__btn {
  width: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-2);
  background: var(--c-bg);
  flex-shrink: 0;
}
.qty-step__btn:hover { background: var(--c-border); }
.qty-step .input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-left: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  border-radius: 0;
  text-align: center;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}

/* 可删的标签（序列号） */
.chip--tag { gap: 4px; padding-right: 6px; }
.chip__x {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--c-text-3);
  font-size: 14px;
  line-height: 1;
}
.chip__x:hover { background: var(--c-danger-light); color: var(--c-danger); }

/* ---------- 提交条：所有尺寸都吸底，不只手机 ---------- */
.submit-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0 -4px 18px rgba(20, 32, 60, .08);
}
.submit-bar__sum { flex: 1; min-width: 0; }
.submit-bar__count { font-size: var(--fs-xs); color: var(--c-text-3); }
.submit-bar__money { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.submit-bar__actions { display: flex; gap: var(--sp-sm); }
@media (max-width: 639px) {
  .submit-bar {
    /* 底部导航是上下两排（二级 38 + 一级 46 + 分隔线），60px 只够盖住一排 */
    bottom: calc(86px + env(safe-area-inset-bottom));
    border-radius: var(--r-md);
    padding: 10px var(--sp-md);
  }
  .submit-bar__money { font-size: 18px; }
  .submit-bar__actions .btn { padding: 0 14px; }
}

/* 明细行在窄屏改成两列堆叠。860 是关键线：
   再窄下去，六个固定列会把商品名压成一条缝。 */
@media (max-width: 860px) {
  .line-head { display: none; }
  .line,
  .line--transfer {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "loc loc"
      "qty price"
      "amt del";
    gap: var(--sp-sm) var(--sp-md);
    padding: var(--sp-md);
    align-items: end;
  }
  .line--transfer {
    grid-template-areas:
      "name name"
      "loc loc"
      "to to"
      "qty price"
      "amt del";
  }
  .line__name { grid-area: name; }
  .line__loc { grid-area: loc; }
  .line__to { grid-area: to; }
  .line__qty { grid-area: qty; }
  .line__price { grid-area: price; }
  .line__amount { grid-area: amt; text-align: left; }
  .line__del { grid-area: del; justify-self: end; width: var(--touch-min); height: var(--touch-min); }
  .line__lb { display: block; }
}

/* ---------- 扫码弹层 ---------- */
.modal--scan { max-width: 460px; width: calc(100% - 32px); }
.scan-stage {
  position: relative;
  background: #000;
  overflow: hidden;
  height: 260px;
}
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute;
  inset: 22% 10%;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .38);
  pointer-events: none;
}
.scan-tip {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  padding: 6px 12px;
  font-size: var(--fs-xs);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  line-height: 1.5;
}
.scan-tip--err {
  top: 0; bottom: auto;
  background: rgba(232, 64, 42, .92);
  text-align: left;
  padding: 10px 12px;
  font-size: var(--fs-table);
  text-shadow: none;
  min-height: 100%;
  display: flex;
  align-items: center;
}

/* ---------- 打印页工具条 ---------- */
.print-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  flex-wrap: wrap;            /* 手机上份数框 + 打印按钮会顶出去 */
}
.print-toolbar__spacer { flex: 1; }
.print-toolbar__lbl {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-table); color: var(--c-text-2);
}
@media (max-width: 639px) {
  .print-toolbar__spacer { display: none; }
  .print-toolbar__lbl { flex: 1; }
  .print-toolbar__lbl .select { flex: 1; min-width: 0; }
}

/* 打印页这类「裸页面」：不留侧栏位置，让 A4 在正中间 */
.app-main--bare { margin-left: 0; max-width: none; }

/* ==========================================================================
   20. 盘点
   现场是站着单手操作的：一行一件事，输入框要大，差异要显眼。
   ========================================================================== */

/* 选货架：48 个库位排成一片，比下拉框快得多——人知道自己要盘 A-01，
   下拉框里找 48 项要滑半天。 */
.loc-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--sp-sm);
  max-height: 260px;
  overflow: auto;
  padding: var(--sp-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg);
}
.loc-pick__item {
  padding: 10px 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--fs-table);
  color: var(--c-text-2);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: .12s;
}
.loc-pick__item:hover { border-color: var(--c-primary); }
.loc-pick__item.is-active {
  color: #fff;
  background: var(--c-primary);
  border-color: var(--c-primary);
}

/* 实盘输入框窄一点：数字短，留宽了手要伸更远 */
.check-table .js-real { text-align: right; font-variant-numeric: tabular-nums; }
.check-table tr.is-diff td { background: var(--c-warning-light); }
.check-table .js-reason { font-size: var(--fs-table); }

/* 扫码定位后闪一下，告诉人"就是这一行"。
   只闪背景不闪边框：边框动会带着整行抖。 */
@keyframes flash-row {
  0%   { background: var(--c-primary-light); }
  100% { background: transparent; }
}
.is-flash { animation: flash-row 1.2s ease-out; }

/* 手机上的盘点卡：一眼看到货、三个数并排 */
.check-card {
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-card);
}
.check-card + .check-card { margin-top: var(--sp-sm); }
.check-card.is-diff { border-color: var(--c-warning); background: var(--c-warning-light); }
.check-card__head { display: flex; justify-content: space-between; align-items: center; }
.check-card__name { margin-top: 4px; font-size: var(--fs-base); font-weight: 500; }
.check-card__spec { margin-top: 2px; }
.check-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
  align-items: end;
}
.check-card__label { font-size: var(--fs-xs); color: var(--c-text-3); }
.check-card__val {
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* 收付款行的右侧是「金额 + 作废按钮」，手机上并排放不下，
   会把整页顶宽 46px。窄屏改成上下两行。 */
@media (max-width: 639px) {
  .pay-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pay-row .kv__v { text-align: left; }
}


/* ==========================================================================
   21. 项目与报价（0.7）
   ========================================================================== */

/* 三列信息格。桌面一行三个，窄屏一列——项目名长，两列会把名字挤成竖排。 */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--sp-md);
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.row { display: flex; align-items: center; }

/* 页签。横向可滚，不换行——换行会让内容整体往下跳一格。 */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--sp-sm);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
/* 手机上页签允许换行：横滑没有任何提示，「员工账号」「库存压了多少钱」
   会被裁掉一半，看起来像少了字。换行虽然多占一行，但每个页签都看得全。 */
@media (max-width: 639px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; gap: 0 var(--sp-sm); }
}
.tab {
  position: relative;
  flex: none;
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 0;
  background: none;
  font-size: var(--fs-base);
  color: var(--c-text-2);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--c-text); }
.tab.is-active { color: var(--c-primary); font-weight: 500; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--c-primary);
}
.tab__count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--c-bg);
  color: var(--c-text-3);
  font-size: var(--fs-xs);
  line-height: 18px;
  text-align: center;
}

/* 成本构成条。三块钱挤在一条上，比饼图好读——饼图在小屏上
   分不清哪块是人工，而人工恰恰是小项目亏钱的主因。 */
.cost-bar {
  display: flex;
  height: 10px;
  margin: var(--sp-md) 0 var(--sp-sm);
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--c-bg);
}
.cost-bar__seg { display: block; height: 100%; }
.cost-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm) var(--sp-lg);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}
.cost-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.cost-legend__dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex: none;
}

/* 报价单明细：手机上一行一条，桌面走表格 */
.quote-line {
  display: grid;
  grid-template-columns: 1fr 88px 96px 96px 32px;
  gap: var(--sp-sm);
  align-items: center;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--c-border);
}
.quote-line__amount { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .quote-line {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: var(--sp-md) 0;
  }
  .quote-line__amount { text-align: left; }
}

/* 打印页复用 A4 三分的尺寸，报价单只印一份 */
.quote-print-line td { padding: 3pt 4pt; }

/* ==========================================================================
   22. 操作手册与备份（0.7）
   ========================================================================== */

.manual-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}
@media (max-width: 1100px) {
  .manual-wrap { grid-template-columns: 1fr; }
}

/* 目录吸在顶部。手册很长，没有目录只能靠浏览器搜索。 */
.manual-toc {
  position: sticky;
  top: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-card);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.manual-toc__item {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--c-text-2);
  font-size: var(--fs-table);
  text-align: left;
  cursor: pointer;
  line-height: 1.4;
}
.manual-toc__item:hover { background: var(--c-hover); color: var(--c-text); }
.manual-toc__item.is-active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 500;
}

.manual__mobile-toc { margin-bottom: var(--sp-md); }

/* 手册正文里有宽表格，grid 子项必须能收缩，否则整页横向滚 */
.manual { min-width: 0; }

.manual__body {
  padding: var(--sp-lg) var(--sp-xl);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-card);
  color: var(--c-text);
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
}
@media (max-width: 639px) {
  .manual__body { padding: var(--sp-md); }
}

.manual__body h1 {
  margin: 0 0 var(--sp-md);
  font-size: var(--fs-title);
  font-weight: 600;
}
.manual__body h2 {
  margin: var(--sp-xl) 0 var(--sp-sm);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-lg);
  font-weight: 600;
  scroll-margin-top: 72px;      /* 顶部工具条高度，跳转后标题不被盖住 */
}
.manual__body h2:first-of-type { border-top: 0; padding-top: 0; }
.manual__body h3 { margin: var(--sp-lg) 0 var(--sp-sm); font-size: var(--fs-base); }
.manual__body p { margin: var(--sp-sm) 0; }
.manual__body ul, .manual__body ol { margin: var(--sp-sm) 0; padding-left: 1.4em; }
.manual__body li { margin: 4px 0; }
.manual__body strong { font-weight: 600; }
.manual__body a { color: var(--c-primary); }
.manual__body hr {
  margin: var(--sp-lg) 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}
.manual__body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--c-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
}
.manual__body pre {
  margin: var(--sp-sm) 0;
  padding: var(--sp-md);
  border-radius: var(--r-md);
  background: var(--c-bg);
  overflow-x: auto;
}
.manual__body pre code { padding: 0; background: none; }
.manual__body blockquote {
  margin: var(--sp-sm) 0;
  padding: 6px var(--sp-md);
  border-left: 3px solid var(--c-border-strong);
  color: var(--c-text-2);
}

/* 手册里的表格：小屏允许横向滚，不要压成两列 */
.manual__body table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: var(--sp-md) 0;
  border-collapse: collapse;
  overflow-x: auto;
  font-size: var(--fs-table);
}
.manual__body th, .manual__body td {
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.manual__body th { background: var(--c-bg); font-weight: 600; }

/* ---------- 备份列表 ---------- */
.backup-list { border-top: 1px solid var(--c-border); }
.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}

.code-block {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(20, 32, 60, .06);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm);
  overflow-x: auto;
  white-space: pre;
}

/* 组合配置一行：名称 / 用量 / 金额 / 删除 */
.bom-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 96px 34px;
  gap: var(--sp-sm);
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
@media (max-width: 639px) {
  .bom-line { grid-template-columns: minmax(0, 1fr) 76px 34px; }
  .bom-line > span.num { display: none; }
}

/* ==========================================================================
   23. 报表与待办（0.8）
   ========================================================================== */

/* 三列统计：报表页固定三张（销售额 / 单数 / 单值），
   用 auto-fit 在 700px 会掉成 2+1，不如直接按断点写死。 */
.stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* 只有三张卡，2 列必留一个孤儿，平板竖屏维持三列（每格约 200px 放得下金额） */
@media (max-width: 639px) {
  .stat-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 第三张单独占一行，否则右边空半格 */
  .stat-grid--3 > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* 横条：表格里比大小用它，比柱状图省地方，也不用引图表库。
   宽度由行内 style 给，这里只管高度和圆角。 */
.bar {
  height: 5px;
  border-radius: 3px;
  background: var(--c-bg);
  overflow: hidden;
}
.bar__fill {
  display: block;
  height: 100%;
  min-width: 2px;               /* 金额极小时也留一点，别看不见 */
  border-radius: 3px;
  background: var(--c-primary);
  transition: width .25s ease;
}
.bar__fill--danger { background: var(--c-danger); }

/* 待办：两张一排，最后一张奇数就自己占满 */
.todo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-md);
}
@media (max-width: 1023px) {
  .todo-grid { grid-template-columns: minmax(0, 1fr); }
}
.todo-card { min-width: 0; }
/* 五张卡排两列会剩下一个孤零零的半张，让它自己占满一行 */
.todo-grid > .todo-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* 空的那张淡下去，一眼看到"这里没事" */
.todo-card--empty { opacity: .62; }

.todo-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 7px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-sm);
}
.todo-line:last-of-type { border-bottom: 0; }
.todo-line > .ellipsis { min-width: 0; }
.todo-line > .num { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
/* 只有能点进去的行才有手型，纯数据行别给假的可点感 */
.todo-line.is-link { cursor: pointer; border-radius: var(--r-sm); }
.todo-line.is-link:hover { background: var(--c-bg); }

.todo-more {
  margin-top: var(--sp-sm);
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-sm);
}
.todo-more a { color: var(--c-primary); }

/* ==========================================================================
   24. 全局搜索（0.8）
   ========================================================================== */

/* 侧栏里的入口。做成"长得像输入框的按钮"——
   看起来能打字，点下去真的能打字，比一个小放大镜图标好找。 */
.side-nav__search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  margin: 4px 8px 8px;
  padding: 8px 10px;
  /* 触摸目标：42px 的高度用手指点会点空，按 44 来 */
  min-height: var(--touch-min);
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .78);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.side-nav__search:hover { background: rgba(255, 255, 255, .17); color: #fff; }
.side-nav__search > span { flex: 1; }
.side-nav__search kbd {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .16);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
}
/* 平板侧栏只剩图标，搜索按钮跟着收窄 */
@media (min-width: 640px) and (max-width: 1023px),
       (max-height: 500px) and (orientation: landscape) {
  .side-nav__search { justify-content: flex-start; padding: 10px 8px; }
  .side-nav__search { min-height: var(--touch-min); }
  .side-nav__search kbd { display: none; }
}

/* 手机上侧栏没有了，搜索入口改成吸在页面顶部的一条栏。
   为什么不用右下角浮动球：
     1. 会盖住列表最后一条的右半边，点最后一条得先滚一下；
     2. 开单页会压住"保存并过账"主按钮。
   吸顶栏在滚到任何位置都能点，而且不占任何操作位置。
   高度 44px：比输入框稍大，拇指点得准，又不至于像输入框那样
   让人以为点上去能直接打字（点了是打开搜索弹层）。 */
.mobile-search {
  display: none;
}
@media (max-width: 639px) {
  .mobile-search {
    /* 吸顶由 .mobile-top 容器负责，搜索条本身只占一行剩余宽度 */
    position: static;
    z-index: auto;
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    flex: 1;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-text-3);
    font-size: var(--fs-table);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  /* 内部画一个"假输入框"，看着像搜索框、点下去是真的弹层 */
  .mobile-search > span {
    flex: 1;
    min-width: 0;
    height: 34px;
    display: flex;
    align-items: center;
    padding: 0 var(--sp-md);
    border-radius: var(--r-md);
    background: var(--c-card);
    border: 1px solid var(--c-border);
  }
  .mobile-search:active > span { background: var(--c-hover); }
  /* 顶部吸顶条容器：搜索条 + 右侧齿轮（系统入口） */
  .mobile-top {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 44px;
    margin: 0 0 var(--sp-md);
    margin-left: calc(var(--page-pad) * -1);
    margin-right: calc(var(--page-pad) * -1);
    padding: 0 var(--page-pad);
    border-bottom: 1px solid var(--c-border);
    background: var(--c-bg);
  }
  .mobile-gear {
    flex: 0 0 42px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    color: var(--c-text-2);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-gear:active { color: var(--c-primary); }
  /* 只为这个栏出现的页面收紧顶部留白，免得空出一截 */
  .app-main:has(> .mobile-top) { padding-top: var(--sp-sm); }
}

/* ---------- 弹层 ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh var(--sp-md) var(--sp-md);
  background: rgba(20, 32, 60, .42);
}
.search-modal__panel {
  width: 100%;
  max-width: 560px;
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--c-card);   /* 原来写的 --c-surface 没定义，弹层整个透明 */
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-modal__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-3);
}
.search-modal__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: var(--fs-lg);
  color: var(--c-text-1);
}
.search-modal__input::placeholder { color: var(--c-text-3); }
.search-modal__esc {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--c-border-strong);
  border-radius: 5px;
  background: var(--c-card);
  color: var(--c-text-3);
  font-size: 11px;
  cursor: pointer;
}
.search-modal__body { overflow-y: auto; padding: 6px 0 var(--sp-sm); }
.search-modal__hint {
  padding: var(--sp-lg) var(--sp-md);
  color: var(--c-text-3);
  font-size: var(--fs-sm);
  text-align: center;
}
.search-group { padding-top: 6px; }
.search-group__title {
  padding: 6px var(--sp-md);
  color: var(--c-text-3);
  font-size: 11px;
  letter-spacing: .04em;
}
.search-hit {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px var(--sp-md);
  cursor: pointer;
}
.search-hit:hover, .search-hit:focus { background: var(--c-bg); }
.search-hit__main {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.search-hit__sub {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text-3);
  font-size: var(--fs-sm);
}
.search-hit__val {
  flex: 0 0 auto;
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
/* 手机上弹层贴着顶部，键盘弹起时不至于被推到看不见的地方 */
@media (max-width: 639px) {
  .search-modal { padding: 0; align-items: stretch; }
  .search-modal__panel {
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
  .search-hit { padding: 12px var(--sp-md); }   /* 手指点得准 */
}

/* ==========================================================================
   25. 系统设置与向导（0.9）
   ========================================================================== */

/* 提示条补两个语义色。原来只有 warn，写页面时很自然会敲 --warning */
.notice--warning { background: var(--c-warning-light); border-color: #f3ddb5; color: #8a5a05; }
.notice--success { background: var(--c-success-light); border-color: #bfe3cd; color: #16653a; }

/* ---------- 权限矩阵 ---------- */
.perm-table th, .perm-table td { padding-top: 8px; padding-bottom: 8px; }
/* 分组行：整行灰底，把十六个页面切成四块，不然一屏全是勾 */
.perm-group td {
  background: var(--c-bg);
  color: var(--c-text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .04em;
}
.perm-cell {
  width: 34px;
  height: 34px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: var(--c-card);
  color: var(--c-text-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.perm-cell.is-on {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 700;
}
/* 管理员那一列不给点：灰掉，点上去也没反应，别让人以为是坏了 */
.perm-cell.is-locked { cursor: not-allowed; opacity: .55; }
.perm-cell.is-locked.is-on { background: var(--c-bg); border-color: var(--c-border); color: var(--c-text-2); }

/* 手机上矩阵会挤成一条线。允许横滑，比拆成四张卡好读—— 
   横着看能一眼比出"这个人比那个人多看了哪几页" */
/* 手指点的设备要 44px：34px 的勾选框点十次能中三次。
   按宽度判断不够——12 寸 Windows 平板 1368 宽但照样用手指点，
   所以用 pointer: coarse，宽度那条留着兜老浏览器。 */
@media (pointer: coarse), (max-width: 1023px) {
  .perm-cell { width: var(--touch-min); height: var(--touch-min); }
}
@media (max-width: 639px) {
  .perm-table { min-width: 420px; }
}

/* ---------- 初始化向导 ---------- */
.step-list { padding: 0; }
.step {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border-bottom: 1px solid var(--c-border);
}
.step:last-child { border-bottom: 0; }
.step__no {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-bg);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.step.is-done .step__no { background: var(--c-success-light); color: var(--c-success); }
.step__body { flex: 1; min-width: 0; }
.step__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  font-weight: 600;
}
/* 手机上按钮不换行会把这行顶宽，让它自己掉到下一行 */
@media (max-width: 639px) {
  .step { flex-wrap: wrap; }
  .step__body { flex: 1 1 calc(100% - 30px - var(--sp-md)); }
  .step > .btn { margin-left: calc(30px + var(--sp-md)); }
}

/* ---------------------------------------------------------------------------
   库位平面图（013）。一张通用画布：子分组 + 库位两种方块，点分组下钻。
   格子 120×76px，跟后端 x,y 坐标一一对应（1 格 = 1 组坐标）。
--------------------------------------------------------------------------- */
.plan-canvas-outer {
  overflow: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(0deg, transparent 0 75px, var(--c-bg) 75px 76px),
    repeating-linear-gradient(90deg, transparent 0 119px, var(--c-bg) 119px 120px),
    var(--c-card);
  max-height: 65vh;
}
.plan-canvas {
  position: relative;
  min-width: 520px;
  min-height: 320px;
  touch-action: pan-x pan-y;        /* 默认允许滚动；摆位模式改掉 */
}
.plan-canvas.is-editing { touch-action: none; }
.plan-tile {
  position: absolute;
  width: 112px;
  min-height: 68px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--c-border);
  background: var(--c-card);
  padding: 6px 8px;
  user-select: none;
}
.plan-tile.is-group {
  border-color: #b7cdf5;
  background: #eef4ff;
  cursor: pointer;
}
.plan-tile.is-group:hover { border-color: var(--c-primary); }
.plan-tile.is-loc { cursor: default; }
.plan-tile.is-loc.is-used { border-color: #bcd2ff; background: #f5f9ff; }
.plan-tile.is-loc.is-hit {
  animation: loc-hit 0.55s ease-in-out 4;
  border-color: var(--c-primary);
}
@keyframes loc-hit {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .35); }
  50%      { box-shadow: 0 0 0 10px rgba(37, 99, 235, .18); }
}
.plan-tile.is-dragging {
  opacity: .85;
  z-index: 5;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
  cursor: grabbing;
}
.plan-canvas.is-editing .plan-tile { cursor: grab; }
.plan-tile__name {
  font-size: var(--fs-table);
  font-weight: 600;
  line-height: 1.25;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plan-tile.is-loc .plan-tile__name { font-weight: 600; }
.plan-tile__sub {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plan-tile__ops {
  position: absolute;
  top: 4px; right: 4px;
  display: none;
  gap: 4px;
}
.plan-tile:hover .plan-tile__ops { display: flex; }
.plan-tile__op {
  border: none;
  background: rgba(255, 255, 255, .92);
  border-radius: 6px;
  font-size: 12px;
  padding: 2px 7px;
  cursor: pointer;
  color: var(--c-text-2);
}
.plan-tile__op.is-danger { color: #b91c1c; }
.plan-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  font-size: var(--fs-sm);
  pointer-events: none;
}
.plan-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin: 8px 0;
}
.plan-crumb {
  border: none;
  background: none;
  color: var(--c-text-2);
  font-size: var(--fs-table);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 28px;
}
.plan-crumb:hover { background: var(--c-bg); }
.plan-crumb.is-here {
  color: var(--c-primary);
  font-weight: 600;
  background: #eef4ff;
}
.plan-crumb__sep { color: var(--c-text-3); }
/* 搜索定位 */
.plan-search { position: relative; margin-bottom: 4px; max-width: 480px; }
.plan-search__drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: var(--z-pop, 30);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
  max-height: 320px;
  overflow: auto;
}
.plan-search__item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}
.plan-search__item:hover { background: var(--c-bg); }
.plan-search__item + .plan-search__item { border-top: 1px solid var(--c-border); }

/* ---------- 公共选择器弹窗（pickers.js）---------- */
/* 弹窗里的可选行列表：一行商品/一个往来单位 */
.pick-list { max-height: 46vh; overflow: auto; }
.pick-list__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; border-top: 1px solid var(--c-border);
  background: none; cursor: pointer;
}
.pick-list__row:first-child { border-top: none; }
.pick-list__row:hover { background: var(--c-bg); }
.pick-list__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-list__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list__side { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; gap: 2px; }

/* ==========================================================================
   开单页 · 小票式商品清单 + 两行金额区（2026-11 按老板实测反馈重做）
   原则：手机上版面全部让给商品行；库位这类"偶尔要看"的信息
   收进宽屏，横过来自然出现。不做弹窗，行内直接改。
   ========================================================================== */

/* --- 客户行：输入框 + 下拉 + 新增，右边一个项目勾选 --- */
.buyer-row {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-md);
}
.buyer-row .field { flex: 1; min-width: 0; margin-bottom: 0; }
.combo { display: flex; gap: 6px; }
.combo .input { flex: 1; min-width: 0; }
.combo__btn {
  flex-shrink: 0;
  width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-text-2);
  border-radius: var(--r-md);
  cursor: pointer;
}
.combo__btn:active { background: var(--c-hover); }
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
  cursor: pointer;
  user-select: none;
}
.check-inline input { accent-color: var(--c-primary); }
.buyer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}
.buyer-meta a { color: var(--c-primary); text-decoration: none; }
.buyer-meta__addr { flex-basis: 100%; }

/* --- 小票式清单 --- */
.receipt { border-top: 1px solid var(--c-border); }
/* 数量/单价/金额三列：贴紧排，中间用反色竖线分界，宽度 auto 收到最窄。
   老板原话「多余的宽度都留给商品名称」。auto 列在支持 field-sizing 的
   浏览器里跟着内容缩，不支持时回落到 min-content。 */
.receipt__head,
.receipt__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 92px auto auto auto;
  align-items: center;
  gap: 0;
}
.receipt__qty, .receipt__price, .receipt__amt,
.receipt__head .receipt__qty, .receipt__head .receipt__price, .receipt__head .receipt__amt {
  padding: 0 7px;
  border-left: 2px solid var(--c-border-strong);
}
.receipt__price .input {
  /* 单价跟着内容缩：支持 field-sizing 的浏览器（Chrome 123+）逐字变宽，
     老浏览器回落到 3.2em，够放 ¥12345 */
  field-sizing: content;
  width: auto;
  min-width: 3.2em;
  max-width: 5.5em;
}
.receipt__qty { min-width: 2.2em; }
.receipt__head {
  padding: 5px 10px;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  background: var(--c-hover);
  position: sticky;
  top: 0;
  z-index: 1;
}
/* 窄屏列宽：商品名是这一行最重要的信息，宽度优先给它。
   序号压到 14px；数量步进器 46px（按钮 20+20，数字居中）；
   单价 48、金额 54 刚好放下 ¥1234.56；省下的全给品名。 */
.receipt--narrow .receipt__head,
.receipt--narrow .receipt__row {
  /* 三列固定窄宽：表头和数据行是两个网格容器，auto 列各算各的
     会对不齐；固定值（且足够窄）才能既对齐又省宽度 */
  grid-template-columns: 14px minmax(0, 1fr) 34px 44px 58px;
  gap: 0;
  padding: 6px 4px 6px 8px;
}
/* 手机上竖线更醒目：两像素在暗色主题下看着是一条白线 */
.receipt--narrow .receipt__qty, .receipt--narrow .receipt__price, .receipt--narrow .receipt__amt,
.receipt--narrow .receipt__head .receipt__qty,
.receipt--narrow .receipt__head .receipt__price,
.receipt--narrow .receipt__head .receipt__amt {
  padding: 0 5px;
}
.receipt--narrow .receipt__price .input {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0 2px;
}
.receipt--narrow .qty-hit { padding: 4px 1px; }
.receipt--narrow .receipt__no { font-size: 10px; }
/* 副行编码：参考信息，缩到 10px，不再跟品名抢宽度 */
.receipt--narrow .receipt__sub { font-size: 10px; }
/* 金额一列用小一号的粗体，数字再长也放得下 */
.receipt--narrow .receipt__amt { font-size: var(--fs-sm); }

/* 平板竖屏（641–1100）：这一档最尴尬——既没走到手机的五列，
   又还没到电脑的宽。原来固定列（序号 34 + 库位 92 + 三个数字列约 176）
   一共吃掉 302px，品名只剩 47%，40 多个字的长品名只露出小半截。
   库里真正的名字就是这么长（「联想拯救者R7000P 2024 R7 8845H 16G1TSSD8G RTX4060」），
   而库位只是次要信息，不该占一整列。
   做法：库位缩成品名第二行右侧的小下拉，省下的 92px 全给品名；
   品名允许折两行——行高多出来的这点地方，给名字比给空白值。 */
.receipt--mid .receipt__head,
.receipt--mid .receipt__row {
  grid-template-columns: 30px minmax(0, 1fr) 38px 64px 78px;
  gap: 0;
  padding: 7px 10px;
}
.receipt--mid .receipt__qty,
.receipt--mid .receipt__price,
.receipt--mid .receipt__amt,
.receipt--mid .receipt__head .receipt__qty,
.receipt--mid .receipt__head .receipt__price,
.receipt--mid .receipt__head .receipt__amt {
  padding: 0 5px;
}
/* 数字列在这里是固定窄宽，里面的控件必须跟着列宽走，不能按内容撑开 */
.receipt--mid .receipt__qty { min-width: 0; }
.receipt--mid .receipt__price .input {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0 2px;
}
.receipt--mid .receipt__title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 品名第二行：编码·规格 靠左占满，库位小下拉靠右 */
.receipt__subline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.receipt__subline > .receipt__sub { flex: 1 1 auto; min-width: 0; }
/* 表头里的「库位」跟着小下拉一起右对齐，替那个被砍掉的整列做个说明。
   没有这个字，行尾孤零零一个 B-02-01 没人知道是库位。 */
.receipt__loc-head { display: none; }
.receipt--mid .receipt__head .receipt__name {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.receipt--mid .receipt__loc-head { display: inline; }
/* 表头「库位」和小下拉都贴右边，跟「数量」的分隔线留一点空，不然两个词黏成一串 */
.receipt--mid .receipt__name { padding-right: 10px; }
.receipt__loc-inline {
  flex: none;
  width: auto;
  max-width: 84px;
  height: 22px;
  min-height: 22px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 20px;
  color: var(--c-text-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--c-hover);
}
.receipt__loc-inline:focus {
  border-color: var(--c-primary);
  background: var(--c-card);
}
.receipt__no { text-align: center; color: var(--c-text-3); font-size: var(--fs-xs); }
.receipt__head .receipt__no { text-align: center; }
.receipt__qty, .receipt__price, .receipt__amt { text-align: right; }
.receipt__head .receipt__amt { text-align: right; }
.receipt__amt { font-weight: 600; }

.receipt__row-wrap { border-bottom: 1px solid var(--c-border); overflow: hidden; position: relative; }
.receipt__row {
  padding: 7px 10px;
  background: var(--c-card);
  position: relative;
  z-index: 1;
  transition: transform .18s ease;
  /* 手指左滑把行推出去，露出下面两个按钮 */
  touch-action: pan-y;
}
.receipt__row.is-open { transform: translateX(-136px); }
.receipt__row.is-editing { background: var(--c-hover); }

.receipt__name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.receipt__title {
  font-size: var(--fs-base);
  line-height: 1.25;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt__sub {
  font-size: var(--fs-xs);
  line-height: 1.2;
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt__loc { display: flex; gap: 4px; min-width: 0; }
.select--sm { padding: 4px 6px; font-size: var(--fs-xs); min-width: 0; }

.qty-step--sm { height: 30px; }
.qty-step--sm .input--num { width: 38px; font-size: var(--fs-sm); }
.qty-step--sm .qty-step__btn { width: 26px; height: 28px; }
.input--plain {
  border-color: transparent;
  background: transparent;
  padding-left: 2px;
  padding-right: 2px;
  text-align: right;
}
.input--plain:focus { border-color: var(--c-primary); background: var(--c-card); }
.receipt__price .input--num { width: 100%; text-align: right; }

/* 左滑后露出的动作区：垫在行底下，行滑开才露出来 */
.receipt__swipe {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  z-index: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  overflow: hidden;
}
.receipt__row-wrap {
  /* 不设 min-height：之前 56px 是跟着大行高定的，
     行收紧之后它会把底下的左滑按钮露出一条来 */
  min-height: 0;
}
.swipe-btn {
  width: 68px;
  border: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--fs-xs);
  color: #fff;
  cursor: pointer;
}
.swipe-btn--edit { background: var(--c-primary); }
.swipe-btn--del { background: var(--c-danger); }

.receipt__serials {
  padding: 8px 12px 10px;
  background: var(--c-hover);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.receipt__serials-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--c-text-2);
}
.receipt__editbar {
  padding: 8px 12px;
  background: var(--c-hover);
  display: flex;
  justify-content: flex-end;
}
/* 修改态里的数量输入框：跟平时的数字一模一样大，
   只多一条实线告诉人"这里能改" */
.qty-inp {
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  font-size: var(--fs-base);
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--c-primary);
}
.receipt--narrow .qty-inp { font-size: var(--fs-base); padding: 2px 0; }

/* 加货两个大按钮 */
.add-bar {
  display: flex;
  gap: var(--sp-sm);
  padding: 8px 10px;
  border-top: 1px solid var(--c-border);
}
.add-bar__btn {
  flex: 1;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--c-border-strong);
  background: transparent;
  border-radius: var(--r-md);
  color: var(--c-primary);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.add-bar__btn:active { background: var(--c-hover); }

/* --- 两行金额区 --- */
.sum-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.sum-row + .sum-row { border-top: 1px dashed var(--c-border); }
.sum-row__lb {
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  flex-shrink: 0;
  white-space: nowrap;
}
.sum-row__val {
  font-size: var(--fs-base);
  color: var(--c-text);
  margin-right: auto;
  white-space: nowrap;
}
.sum-row__val--strong { color: var(--c-danger); font-weight: 700; }
.sum-row__input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.sum-row__input .input { width: 100%; min-width: 0; text-align: right; }
.sum-row__mode {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-text-2);
  font-size: var(--fs-xs);
  cursor: pointer;
}
.sum-row--note .input { flex: 1; text-align: left; }

@media (max-width: 640px) {
  .receipt__head, .receipt__row { padding-left: 8px; padding-right: 8px; gap: 4px; }
  /* 手机竖屏：金额两行各占一行，不许折行折成四行 */
  .sum-row { flex-wrap: nowrap; gap: 6px; }
  .sum-row__lb { font-size: var(--fs-xs); }
  .sum-row__val { font-size: var(--fs-sm); }
  .sum-row__input .input { width: 56px; padding: 6px 4px; }
  .sum-row .select--sm { width: 76px; flex-shrink: 0; }
  .sum-row--pay .sum-row__input .input { width: 72px; }
  .sum-row--pay .input--plain { width: 64px !important; }
  .sum-row--note .input { flex: 1; width: auto !important; text-align: left; }
  .card--tight .card__body { padding: 10px 12px; }
}

/* ---------------- 确认弹窗里的账单明细 ----------------
   开单欠款确认要用：应收 / 实收 / 欠款 三行对齐，
   光给一句话「实收少于应收」看不出少了多少。 */
.ask-rows {
  margin-top: 4px;
  border-top: 1px dashed var(--c-border);
}
.ask-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--c-border);
}
.ask-row:last-child { border-bottom: 0; }
.ask-row__k { font-size: var(--fs-sm); color: var(--c-text-3); }
.ask-row__v {
  font-size: var(--fs-base);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.ask-row.is-strong .ask-row__k { color: var(--c-text-2); font-weight: 600; }
.ask-row.is-strong .ask-row__v {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-danger);
}

/* 窄屏删冗余提示词：客户/总金额/账户/收款人/备注 这些一看就懂的字
   在手机竖屏上藏掉，省出宽度给数字。「优惠/应收/实收」有歧义，保留。 */
@media (max-width: 640px) {
  .lbl-wide { display: none; }
}

/* ---------------- 手机端整体收一档 ----------------
   老板的反馈原话：「字体大得不真实，字体大、间距大、图标大，
   真实需要的信息显示区反而变小」。
   前一版把手机字号和控件一路放大到 17px / 48px，方向错了。
   这里统一收回来：图标 18 → 16，卡片内边距 16 → 10，区块间距 16 → 10。
   触摸目标仍然 ≥ 44px，不影响点按。 */
@media (max-width: 639px) {
  .card > svg, .page svg, .btn svg, .chip svg { flex-shrink: 0; }
  .bottom-main__icon svg { width: 20px !important; height: 20px !important; }

  /* 图标统一下调一档：18/20/24 → 16/17/20 */
  .page svg[width="18"] { width: 16px !important; height: 16px !important; }
  .page svg[width="20"] { width: 17px !important; height: 17px !important; }
  .page svg[width="24"] { width: 20px !important; height: 20px !important; }

  /* 卡片：内边距收紧，卡片间距收紧，把高度还给清单 */
  .card { border-radius: 8px; }
  .card__body { padding: 10px; }
  .card + .card, .card + .notice, .notice + .card { margin-top: 10px; }
  .card__head { padding: 10px; font-size: var(--fs-sm); }

  /* 顶栏：手机上的搜索框不需要那么高 */
  .topbar { padding-top: 6px; padding-bottom: 6px; }

  /* 按钮：字号跟着正文走，别单独放大 */
  .btn { font-size: var(--fs-sm); }
  .btn--sm { font-size: var(--fs-xs); }
}

/* 小票行内的输入框：行高要跟着行，不跟全局控件走。
   全局 --h-input 是给表单字段用的（44px 触摸友好），
   塞进 56px 的清单行里就把整行撑开了，一屏少看两行货。 */
.receipt__row .input,
.receipt__row .select,
.receipt .qty-step {
  height: 32px;
  min-height: 32px;
}
@media (max-width: 639px) {
  .receipt__row .input,
  .receipt__row .select,
  .receipt .qty-step { height: 30px; min-height: 30px; }
  .receipt__row { padding: 5px 8px; }
  .receipt__name { gap: 1px; }
}

/* ---------------- 显示设置：1~10 级选择器 ----------------
   不用滑块：滑块在手机上很难精确停到某一级，而且看不出每级差多少。
   用一排方块，等级和百分比都写在上面，点一下就到位。 */
.scale-picker {
  display: flex;
  gap: 4px;
  margin-top: var(--sp-sm);
}
.scale-picker__item {
  flex: 1;
  min-width: 0;
  padding: 8px 2px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-card);
  color: var(--c-text-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: border-color .12s, background .12s;
}
.scale-picker__item:hover { background: var(--c-hover); }
.scale-picker__num {
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.scale-picker__pct {
  font-size: 10px;
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}
/* 5 级是标准档，加一条下划提示 */
.scale-picker__item.is-mid .scale-picker__num::after {
  content: '';
  display: block;
  height: 2px;
  margin-top: 2px;
  border-radius: 2px;
  background: var(--c-border-strong);
}
.scale-picker__item.is-active {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  color: var(--c-primary);
}
.scale-picker__item.is-active .scale-picker__num { color: var(--c-primary); }
.scale-picker__item.is-active .scale-picker__pct { color: var(--c-primary); }

.scale-picker__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
}

/* 次要设备那一排：只有数字，矮一点 */
.scale-picker--sm .scale-picker__item { padding: 6px 2px; }

/* 实时预览：调的时候眼睛看着这里 */
.scale-preview {
  margin-top: var(--sp-md);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
}
.scale-preview__head {
  padding: 4px 10px;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  background: var(--c-hover);
  border-bottom: 1px solid var(--c-border);
}
.scale-preview__body { padding: var(--sp-md); }
.scale-preview__title {
  font-size: var(--fs-base);
  color: var(--c-text);
  line-height: 1.3;
}
.scale-preview__meta {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  margin-top: 2px;
}
.scale-preview__amount {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 639px) {
  .scale-picker__pct { display: none; }   /* 手机上十格放不下百分比 */
  .scale-picker__item { padding: 7px 1px; }
  .scale-picker__num { font-size: var(--fs-sm); }
}

/* ---------------- 数量：行内只留数字，点开底部大按键 ----------------
   原来两个加减按钮 + 中间数字 + 两条竖线要 46px，
   在 390px 的手机上几乎占掉品名的四分之一宽度。
   现在行里只有一个数字，宽度全还给品名。 */
.qty-hit {
  width: 100%;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px dashed var(--c-border-strong);
  background: transparent;
  color: var(--c-text);
  font-family: inherit;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qty-hit:active { background: var(--c-hover); }

/* 底部弹出面板 */
.qty-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(10, 14, 24, .45);
  display: flex;
  align-items: flex-end;
}
.qty-sheet {
  width: 100%;
  background: var(--c-card);
  border-radius: 16px 16px 0 0;
  padding: var(--sp-md) var(--sp-md) calc(var(--sp-md) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
}
.qty-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  font-size: var(--fs-base);
  color: var(--c-text);
  margin-bottom: var(--sp-md);
}
.qty-sheet__close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
}
.qty-sheet__body {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.qty-sheet__btn {
  flex: 0 0 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-bg);
  color: var(--c-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qty-sheet__btn:active { background: var(--c-border); }
.qty-sheet__val {
  flex: 1;
  min-width: 0;
  height: 64px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-card);
  color: var(--c-text);
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.qty-sheet__val:focus { border-color: var(--c-primary); }
.qty-sheet__hint {
  margin-top: var(--sp-sm);
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  text-align: center;
}
.qty-sheet__ok {
  width: 100%;
  margin-top: var(--sp-md);
}

/* 桌面上鼠标好点，行内数字右边给个「+」快捷提示 */
@media (pointer: fine) {
  .qty-hit { text-align: right; padding-right: 6px; }
}

/* 新客户加号：只在「打的名字搜不到」时出现 */
.combo__btn--new {
  width: 34px;
  color: var(--c-primary);
  border-color: var(--c-primary);
  border-style: dashed;
  background: var(--c-primary-light);
}

/* 检索行右侧的扫码按钮：贴在输入框内部右端，
   视觉上属于「同一个输入框」，但点它走扫码而不是打字 */
.scan-bar__cam {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: calc(100% - 4px);
  max-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--c-border);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: transparent;
  color: var(--c-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scan-bar__cam:active { background: var(--c-primary-light); }
/* 给右侧图标留出位置，字不会被压到图标底下 */
.scan-bar .search-box .input { padding-right: 40px; }

/* ---------------- 客户行：无边框平铺 ----------------
   客户就一行输入框，再套个带边框圆角的卡片盒子，
   屏幕上多出一个"框中框"。平铺，底下用细线跟清单分开。 */
.buyer-plate {
  padding: var(--sp-sm) var(--sp-md);
  margin-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--c-border);
}
.buyer-plate .field { margin-bottom: 0; }
@media (max-width: 639px) {
  .buyer-plate { padding: 8px 10px; }
}

/* ---------------- 清单：三列表头与内容居中对齐 ----------------
   表头「数量/单价/金额」原来右对齐、内容却居中/右对齐混杂，
   看起来是错位的。统一居中，跟竖线分列的格子感一致。 */
.receipt__head .receipt__qty,
.receipt__head .receipt__price,
.receipt__head .receipt__amt,
.receipt__qty, .receipt__price, .receipt__amt {
  text-align: center;
}
.receipt__price .input,
.receipt__head .receipt__qty,
.receipt__head .receipt__price,
.receipt__head .receipt__amt {
  text-align: center;
}
.receipt__qty .qty-hit { text-align: center; }
/* 桌面鼠标场景之前把数字拨到右边，现在统一回居中 */
@media (pointer: fine) {
  .qty-hit { text-align: center; padding-right: 2px; }
}
.receipt__amt { font-variant-numeric: tabular-nums; }

/* ---------------- 金额区：数字放大、控件缩小 ----------------
   老板反馈「金额数字要大、按钮选项要小，比例失调」。
   看的和点的是两回事：数字是给人看的，放大；
   「减」切换钮、账户下拉是操作件，收到跟正文一样的高度就够。
   再压行距：原来每行 6px 上下加 38px 控件，三行收款区
   快 150px，手机上把清单区挤没了。行距减半、控件降到 32px。 */
@media (max-width: 639px),
       (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .sum-row { padding: 3px 0; }
  .sum-row__val { font-size: 17px; font-weight: 700; }
  .sum-row__val--strong { font-size: 19px; }
  .sum-row__lb { font-size: var(--fs-sm); }
  .sum-row .input {
    height: 32px;
    min-height: 0;
    font-size: 16px;
    font-weight: 600;
  }
  .sum-row__mode {
    width: 20px;
    height: 20px;
    min-height: 0;
    font-size: 11px;
  }
  .sum-row--pay .select {
    height: 32px;
    min-height: 0;
    font-size: var(--fs-sm);
    padding: 0 4px;
    min-width: 0;
    width: auto;
    flex: 0 1 auto;
  }
  .sum-row--pay .input--plain {
    height: 32px;
    min-height: 0;
    font-size: var(--fs-sm);
    font-weight: 400;
  }
  /* 实收金额数字最大——这是老板最后确认的那个数 */
  .sum-row--pay .input--num {
    font-size: 18px;
    font-weight: 700;
    height: 34px;
    min-height: 0;
  }
  .card--tight .card__body { padding: 6px var(--sp-md); }
  /* 提交条：跟着收款区一起收，别再盖住半屏 */
  .submit-bar {
    padding: 6px var(--sp-md);
    margin-top: var(--sp-sm);
  }
  .submit-bar__money { font-size: 16px; }
  .submit-bar__actions .btn { height: 34px; padding: 0 12px; }
}
/* 竖屏手机：提交条垫在底部导航上方。
   底部导航是两行：二级 38 + 一级 46 = 85px（加分隔线），
   之前只留 56px，提交条下沿被导航盖住一截。 */
@media (max-width: 639px) {
  .submit-bar { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* ---- 底部导航自动隐藏 ----
   3 秒无操作滑出屏幕（body.nav-autohide 由 app.js 挂），
   提交条跟着贴底，底部不留一条空档。 */
@media (max-width: 639px) {
  .bottom-nav { transition: transform .25s ease; }
  body.nav-autohide .bottom-nav { transform: translateY(110%); }
  .submit-bar { transition: bottom .25s ease; }
  body.nav-autohide .submit-bar {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
}
/* 手机横屏：没有底部导航，提交条贴底就行 */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .submit-bar { bottom: 0; }
}
/* 手机横屏：高度只有 ~390，纵向再收紧一档 */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .app-main:has(> .mobile-top) { padding-top: 4px; }
  .buyer-plate { padding: 4px 10px; }
  .receipt__head { padding-top: 4px; padding-bottom: 4px; }
  .receipt__row { padding-top: 4px; padding-bottom: 4px; }
  .scan-bar { padding-bottom: var(--sp-sm); }
}

/* 数量列只有 34px：表头字号再收一号，保证「数量」两字单行放下 */
.receipt--narrow .receipt__head { font-size: 10px; }

/* 顶部快捷区：永远一行。窄屏放不下就横向滑，
   绝不折行——折成两行顶部就吃掉 1/4 屏 */
.chips.order-types,
.chips--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips.order-types::-webkit-scrollbar,
.chips--scroll::-webkit-scrollbar { display: none; }
.chips.order-types .chip,
.chips--scroll .chip { flex: 0 0 auto; }

/* ---------------- 历史销售单：筛选条 ----------------
   老板要的排法：左边客户，右边时间；时间那几个按钮
   固定几个短词，给多宽都是空的，所以收到最窄，
   省下来的全给客户名（手机上尤其重要，客户名一长就看不全）。 */
.ord-filter {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}
.ord-filter__who { flex: 1; min-width: 0; max-width: 320px; }

/* 客户自动搜索框：长得像输入框，候选列表往下弹 */
.ord-who {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ord-who__input {
  width: 100%;
  padding-left: 32px;
  padding-right: 30px;
}
.ord-who .search-box__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-3);
  display: inline-flex;
  z-index: 1;
}
.ord-who__x {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
}
.ord-who__pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
}
.ord-who__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  min-height: 40px;
}
.ord-who__row:last-child { border-bottom: none; }
.ord-who__row:active { background: var(--c-primary-light); }
.ord-who__row.is-empty { cursor: default; justify-content: center; }
.ord-filter__time {
  display: flex;
  gap: 0;
  flex: 0 0 auto;
  margin-bottom: 0;
  flex-wrap: nowrap;
}
.ord-filter__time::-webkit-scrollbar { display: none; }
.ord-filter__time .chip {
  flex: 0 0 auto;
  padding: 0 8px;
  height: 34px;
  min-height: 0;
  font-size: var(--fs-sm);
  border-radius: 0;
  border-left: 0;
}
.ord-filter__time .chip:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.ord-filter__time .chip:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.ord-filter__time .chip + .chip { border-left: 1px solid var(--c-border); }
.ord-adv {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}
.ord-adv .input { flex: 1; min-width: 0; height: 34px; min-height: 0; }
@media (max-width: 639px) {
  .ord-filter { gap: 6px; }
  /* 手机上客户框占满剩余宽度，时间按钮收到最窄 */
  .ord-filter__who { max-width: none; }
  .ord-who__input { height: 34px; min-height: 0; font-size: var(--fs-sm); padding-left: 30px; padding-right: 28px; }
  .ord-filter__time .chip { padding: 0 7px; height: 34px; font-size: var(--fs-sm); }
  .ord-adv .input { height: 34px; }
}
.receipt--narrow .receipt__head .receipt__qty,
.receipt--narrow .receipt__head .receipt__price,
.receipt--narrow .receipt__head .receipt__amt { padding: 0 3px; }

/* 单价列 44px：正文 15px 时三位数放不下会裁字，收表值字号 */
.receipt--narrow .receipt__price .input { font-size: var(--fs-sm); }
.receipt--narrow .receipt__amt { font-size: var(--fs-sm); }

/* ============ 单据详情页（重排） ============ */
/* 客户主角卡 */
.od-partner { padding: 14px 16px; margin-bottom: 12px; }
.od-partner__name { font-size: 19px; font-weight: 700; line-height: 1.3; }
.od-partner__sub { margin-top: 2px; color: var(--c-text-3, #999); font-size: 13px; }

/* 换货单明细分组小标题 */
.od-group-title {
  font-size: 12px; font-weight: 600; color: var(--c-text-2, #666);
  text-transform: none; letter-spacing: .04em;
  padding: 8px 4px 6px; border-bottom: 1px dashed var(--c-border, #ddd);
  margin-bottom: 6px;
}
.card--flush .od-group-title { padding-left: var(--sp-md); padding-right: var(--sp-md); }
.show-desktop .od-group-title:first-child { margin-top: 4px; }

/* 危险按钮的次级样式：和普通按钮拉开距离但不抢主按钮 */
.btn--danger-ghost {
  color: var(--c-danger, #e5484d);
  border-color: color-mix(in srgb, var(--c-danger, #e5484d) 45%, transparent);
  background: color-mix(in srgb, var(--c-danger, #e5484d) 6%, transparent);
}

/* 退货 / 换货弹窗里的行选择 */
.od-pick {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px dashed var(--c-border, #e5e5e5);
}
.od-pick__main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.od-pick__name { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.od-pick__qty { width: 84px; min-height: 0; height: 36px; text-align: center; flex: none; }

/* 换出商品搜索结果 */
.od-sr {
  border: 1px solid var(--c-border, #ddd); border-radius: 8px;
  margin-top: 6px; max-height: 220px; overflow-y: auto;
}
.od-sr__row {
  display: flex; justify-content: space-between; gap: 10px; width: 100%;
  padding: 10px 12px; background: none; border: 0; border-bottom: 1px dashed var(--c-border, #eee);
  font-size: 14px; text-align: left; cursor: pointer; color: inherit;
}
.od-sr__row:last-child { border-bottom: 0; }
.od-sr__row:active { background: var(--c-bg-soft, #f5f5f5); }

/* 手机上弹窗要够高，能装下换货的两组行 */
@media (max-width: 639px) {
  .modal--tall {
    position: fixed; inset: auto 0 0 0; max-height: 88vh; height: auto;
    border-radius: 16px 16px 0 0; margin: 0;
  }
}

/* 销/退/换 单性小标：清单里一眼认出这张单是什么性质 */
.od-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 4px; margin-right: 5px;
  font-size: 11px; font-weight: 700; line-height: 1; color: #fff;
  vertical-align: 1px; flex: none;
}
.od-tag--sale { background: var(--c-primary, #316dca); }
.od-tag--ret  { background: #e5484d; }
.od-tag--ex   { background: #8e4ec6; }

/* 单据详情底部：五键等分（打印/退货/换货/红冲/作废），窄屏也不能挤成两行 */
.action-bar--multi { gap: 6px; padding-left: 10px; padding-right: 10px; }
.action-bar--multi .btn {
  flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 4px;
  font-size: 13px; white-space: nowrap; min-height: 42px;
}
.action-bar--multi .btn svg { flex: none; }

/* 规则说明：一行小字，不再单独占一张卡 */
.od-hint {
  margin: 0 0 10px; font-size: 12px; line-height: 1.6;
  color: var(--c-text-3, #8a8a8a);
}

/* 详情页只有 3 格（金额/数量/收款），手机上强制一行三列：
   2 列会把「已收款」甩到第二行，留一个空洞。 */
@media (max-width: 639px) {
  .stat-grid.od-stats { grid-template-columns: repeat(3, 1fr); }
  .stat-grid.od-stats .stat { padding: 10px 10px; }
  .stat-grid.od-stats .stat__value { font-size: 18px; }
  .stat-grid.od-stats .stat__hint { font-size: 11px; }
}

/* ============ 报价单（三态 + 跟进备注） ============ */
/* 已成交的小绿勾：扫一眼列表就知道这单成了 */
.od-tag--done { background: #2f9e44; }

/* 列表里的「跟进：客户嫌贵…」一行，不能抢金额的视线 */
.od-quote-note {
  margin-top: 3px; font-size: 12px; line-height: 1.4;
  color: var(--c-text-3, #8a8a8a);
  max-width: 100%;
}

/* 报价统计也是三格，手机上别折成 2+1 */
@media (max-width: 639px) {
  .stat-grid.od-quote-stats { grid-template-columns: repeat(3, 1fr); }
  .stat-grid.od-quote-stats .stat { padding: 10px; }
  .stat-grid.od-quote-stats .stat__value { font-size: 18px; }
  .stat-grid.od-quote-stats .stat__hint { font-size: 11px; }
  /* 2390 行那条「奇数个最后一格跨两列」的规则要在这里让位，
     否则三格里的第三格会独占一行，看着像 2+1 布局 */
  .stat-grid--3.od-quote-stats > .stat:last-child:nth-child(odd) { grid-column: auto; }
}

/* 提交条上三个按钮（删掉 / 保存 / 报出）要挤得下 */
.submit-bar__actions .btn { white-space: nowrap; }

/* 报价单详情（手机，只读）的明细行：名称/数量单价/小计三块 */
.od-qline {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--c-border, #eee);
}
.od-qline:last-child { border-bottom: 0; }
.od-qline__main { flex: 1; min-width: 0; }
.od-qline__name { font-size: 14px; font-weight: 500; line-height: 1.35; }
.od-qline__meta { margin-top: 2px; font-size: 12px; color: var(--c-text-3, #8a8a8a); }
.od-qline__amt { flex: none; font-size: 14px; font-weight: 600; }

/* 报价明细行（手机）：原来 2 列会把「数量/单位/单价/删」排得东一个西一个。
   改成「名称占满整行，下面一行放数量·单位·单价·删除」，跟开单页一个手感。 */
@media (max-width: 860px) {
  .quote-line { grid-template-columns: 1fr 68px 1fr 34px; }
  .quote-line > div:first-child { grid-column: 1 / -1; }
}

/* ---------------- 库存页：按商品看 ----------------
   手机上一行一件货：品名 → 编码·规格 → 结存 / 售价 / 几个货位。
   点一下展开「在哪几个架子上、各多少」，现场就照着这个走；
   要找货再切「按货位」，那边保持按货架顺序排的老样子。 */
.stock-views { margin-bottom: var(--sp-sm); }
.stock-item { cursor: pointer; }
.stock-item .list-item__body { align-items: baseline; gap: var(--sp-sm); }
.stock-qty { font-size: 18px; font-weight: 700; }
.stock-price { color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-locs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.stock-locs-toggle__arrow {
  display: inline-flex;
  transition: transform .15s var(--ease);
}
.stock-locs-toggle__arrow.is-open { transform: rotate(180deg); }
.stock-locs {
  margin-top: var(--sp-sm);
  padding-top: 8px;
  border-top: 1px dashed var(--c-border);
}
.stock-locs__empty { font-size: var(--fs-xs); color: var(--c-text-3); padding: 4px 0; }
.stock-loc {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 5px 0;
  font-size: var(--fs-sm);
}
.stock-loc__code { color: var(--c-text-2); }
.stock-loc__qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-locs__more { margin-top: 6px; padding-left: 0; }

/* 库存卡片的品名允许折两行：硬件名字本来就长
   （「海康皓视通200万网络监控头(半球) Ipc32v2 4mm/PoE」），
   一行截断看不出型号，找货会拿错。 */
.stock-item .list-item__title .ellipsis {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.stock-item .list-item__title { align-items: flex-start; }
.stock-item .list-item__title .badge { flex: none; margin-top: 2px; }

/* ---------------- 报价单：进度 + 小票清单 + 行内改称呼 ----------------
   报价单和销售开单共用一套骨架，只多这三块样式。
   目的很直白：店员从「报价」走到「开单」，手不用重新学一遍。 */

/* 进度条：三段。草稿 → 已报价 → 结果（成交/未成交）。
   结果那一步在没出结果前只写「结果」，不预设输赢。 */
.qprog {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: var(--sp-md);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.qprog__step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  white-space: nowrap;
}
.qprog__dot {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--c-hover);
  color: var(--c-text-3);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.qprog__line {
  flex: 1 1 auto;
  min-width: 10px;
  height: 2px;
  background: var(--c-border-strong);
}
.qprog__step.is-done { color: var(--c-text-2); }
.qprog__step.is-done .qprog__dot { background: var(--c-primary-light, var(--c-hover)); color: var(--c-primary); }
.qprog__line.is-done { background: var(--c-primary); }
.qprog__step.is-cur { color: var(--c-text); font-weight: 600; }
.qprog__step.is-cur .qprog__dot { background: var(--c-primary); color: #fff; }
.qprog__step.is-won { color: var(--c-success); }
.qprog__step.is-won .qprog__dot { background: var(--c-success); color: #fff; }
.qprog__step.is-lost { color: var(--c-text-2); }
.qprog__step.is-lost .qprog__dot { background: var(--c-text-3); color: #fff; }

/* 报价清单：五列（没有库位）。数字列比开单页宽一点，
   因为这里单价要能直接打字改，太窄会看不见自己敲的数。 */
.receipt--quote .receipt__head,
.receipt--quote .receipt__row {
  grid-template-columns: 34px minmax(0, 1fr) 64px 96px 104px;
  padding: 8px 10px;
}
/* 品名允许折两行，序号/数量跟着走顶部——居中的话序号会掉到第二行旁边，
   看着像「这一行没有序号」。 */
.receipt--quote .receipt__row { align-items: start; }
.receipt--quote .receipt__no { padding-top: 2px; }
.receipt--quote .receipt__qty { text-align: right; }
.receipt--quote .receipt__qty .qty-inp { width: 100%; text-align: right; }
.receipt--quote .receipt__title { font-weight: 500; }

@media (max-width: 640px) {
  .receipt--quote .receipt__head,
  .receipt--quote .receipt__row {
    grid-template-columns: 14px minmax(0, 1fr) 38px 62px 70px;
    padding: 7px 4px 7px 8px;
  }
  .qprog { padding: 9px 8px; gap: 4px; }
  .qprog__step { font-size: 11px; gap: 4px; }
  .qprog__dot { width: 18px; height: 18px; font-size: 10px; }
}

/* 点开一行才出现的编辑区：客户看到的名称 / 单位 / 成本。
   平时不占地方——报价时九成的行不需要改这三项。 */
.qedit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 92px;
  gap: 8px;
  padding: 10px 12px 12px;
  background: var(--c-hover);
  border-top: 1px dashed var(--c-border);
}
.qedit .field { margin-bottom: 0; }
.qedit__hint { font-size: 11px; color: var(--c-text-3); margin-top: 4px; }
.qedit__ops {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

/* 客户行下面那排：类型 / 追加 / 标题。一行放完，不另起卡片。 */
.qmeta-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
  margin-top: 10px;
}
.qmeta-row__title { flex: 1 1 220px; min-width: 0; }

/* 手机上「客户看到的名字」独占一行：三列挤在一起会把 20 个字的商品名
   截成「不填就用：六类网…」，等于没写。 */
@media (max-width: 640px) {
  .qedit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qedit__name { grid-column: 1 / -1; }
  .qedit__ops { justify-content: space-between; }
}

/* 只读摘要：客户 + 类型标签 + 项目 */
.qro__who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qro__name { font-size: 17px; font-weight: 600; }
.qro__tag {
  font-size: 11px;
  color: var(--c-text-3);
  background: var(--c-hover);
  border-radius: 4px;
  padding: 1px 6px;
}
.qro__sub { font-size: var(--fs-sm); color: var(--c-text-2); margin-top: 6px; }

/* 报价页底部条：桌面上不悬浮，落在页面末尾。
   手机仍然贴底——拇指够得着比「在页面末尾」重要。 */
@media (min-width: 900px) {
  .submit-bar--quote { position: static; box-shadow: none; }
}

/* 手机上的报价底部条：合计独占一行，三个按钮平分下一行。
   挤成一行时 flex 会把「合计」压到只剩 30px，「1 行 / 合 计 / ¥60.00」竖着叠，
   像是排版坏了；按钮又不肯缩（nowrap），只能换行解决。 */
@media (max-width: 639px) {
  .submit-bar--quote {
    flex-wrap: wrap;
    row-gap: 8px;
    /* 底部导航是上下两排（38 + 46），60px 只够盖住一排，按钮会被切掉 */
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .submit-bar--quote .submit-bar__sum {
    flex: 1 0 100%;
    display: flex;
    align-items: baseline;
    gap: var(--sp-sm);
  }
  .submit-bar--quote .submit-bar__actions { width: 100%; }
  .submit-bar--quote .submit-bar__actions .btn { flex: 1; min-width: 0; }
}

/* 进度条在宽屏别拉成一根电话线，620px 刚好一眼看完 */
.qprog { max-width: 620px; }

/* 列宽再分配：报价单的单价要能直接打字，但商品名仍然是主角。
   平板 768 下品名 348px（原 288），手机 390 下 160px（原 148）。 */
.receipt--quote .receipt__head,
.receipt--quote .receipt__row {
  grid-template-columns: 30px minmax(0, 1fr) 52px 82px 94px;
}
@media (min-width: 1101px) {
  .receipt--quote .receipt__head,
  .receipt--quote .receipt__row {
    grid-template-columns: 34px minmax(0, 1fr) 56px 96px 108px;
  }
}
@media (max-width: 640px) {
  .receipt--quote .receipt__head,
  .receipt--quote .receipt__row {
    grid-template-columns: 14px minmax(0, 1fr) 34px 58px 66px;
  }
}

/* 「类型」两个字不许竖排：手机上被挤成两行像错位 */
.qmeta-row .text-3 { white-space: nowrap; }

/* 报价单的商品名在平板/手机上允许折两行：
   报价单是发给客户的，名字被截成「海康皓视通200万网络监控头(半…」，
   客户看不出是哪个型号，回头就要打电话问。 */
@media (max-width: 1100px) {
  .receipt--quote .receipt__title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
  }
}

/* ========== 装机报价：八个配件槽位 ==========
   装机单和普通报价单的区别就在这块：不是一张自由清单，而是八个固定格子。
   客户看装机单，先找「CPU 配的什么」，所以每个格子的名字要一直露在外面，
   不能像清单那样混在一起。 */

.bparts { padding: 2px var(--sp-md) var(--sp-md); }

.bpart {
  padding: 9px 0;
  border-bottom: 1px dashed var(--c-border);
}
.bpart:last-child { border-bottom: 0; }

.bpart__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

/* 标签固定宽度，八个格子的商品名才能左边对齐成一列——
   参差不齐的话，扫一眼找不到 CPU 那行。 */
.bpart__label {
  min-width: 64px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text-1);
}
.bpart__hint {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bpart__sum {
  margin-right: 2px;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-1);
}
.bpart.is-empty .bpart__label { color: var(--c-text-3); font-weight: 500; }
.bpart.is-open { background: var(--c-primary-weak); border-radius: var(--r-sm);
  box-shadow: 0 0 0 8px var(--c-primary-weak); }

.bpart__warn {
  margin: 4px 0 0 72px;
  font-size: var(--fs-sm);
  color: var(--c-warning);
}
.bpart__rows { margin-top: 4px; }

/* 一行配件：名字 / 数量 / 单价 / 金额，和开单页小票同一个顺序。
   数量单价直接可改，因为装机时客户现场改配置是常事。 */
.brow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 88px 86px;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.brow:hover { background: var(--c-hover); }
.brow.is-editing { background: var(--c-hover); }

.brow__name { min-width: 0; }
.brow__title {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brow__sub {
  display: block;
  font-size: 11px;
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brow__qty, .brow__price {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.brow__unit { font-size: 11px; color: var(--c-text-3); }
.brow__amt {
  text-align: right;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.brow__inp {
  width: 58px;
  height: 26px;
  padding: 2px 4px;
  text-align: right;
}

/* 搜索条缩进到商品名那一列，视觉上「属于这个格子」而不是整卡片 */
.bsearch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-left: 72px;
}

@media (max-width: 639px) {
  .bparts { padding: 2px 10px 10px; }
  .bpart { padding: 8px 0; }
  /* 手机上「处理器」「容量/频率」这类提示纯占地方，去掉；
     但空槽位的「未选」要留着——八个格子长得一样，没有这行字分不清哪些配过了 */
  .bpart__hint { display: none; }
  .bpart.is-empty .bpart__hint { display: inline; }
  .bpart__head > .btn { margin-left: auto; }
  .bpart__label { min-width: 0; }
  .bpart__warn { margin-left: 0; }
  .bpart.is-open { box-shadow: 0 0 0 6px var(--c-primary-weak); }

  /* 名称独占一行：390 宽挤成四列的话，商品名只剩「海康皓视…」 */
  .brow {
    grid-template-columns: auto auto minmax(0, 1fr);
    row-gap: 2px;
    padding: 7px 4px;
  }
  .brow__name { grid-column: 1 / -1; }
  .brow__title { white-space: normal; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
  .brow__qty { justify-content: flex-start; }
  .brow__price { justify-content: flex-start; }
  .brow__amt { grid-column: 3; }
  .brow__inp { width: 52px; }
  .bsearch { padding-left: 0; }
  .qedit { margin-left: 0; }
}

/* ==========================================================
   客户退换货办理（/aftersale/new）
   一张销售单上逐个商品选「保留 / 退货 / 换货」，
   每行都是一个独立的小块，不做成表格——表格里塞输入框，
   手机上一挤就全乱了。
   ========================================================== */
.as-origin {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  margin-bottom: var(--sp-md);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--r-md);
}
.as-origin__no { font-weight: 700; font-size: var(--fs-table); }
.as-origin__who { font-size: var(--fs-xs); color: var(--c-text-3); margin-top: 2px; }
.as-origin__amt { font-weight: 700; }

.as-rows { display: flex; flex-direction: column; gap: var(--sp-sm); }

.as-row { padding: 12px var(--sp-md); }
.as-row__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-sm);
}
.as-row__name { font-weight: 600; line-height: 1.35; }
.as-row__meta { text-align: right; flex-shrink: 0; }

/* 三选一：像药丸一样连成一条，选中的那个实心。
   比下拉好——三种状态一眼全在，不用点开才知道有"保留"这个选项。 */
.as-row__acts {
  display: flex; gap: 6px; margin-top: 10px; align-items: center;
}
.as-act {
  flex: 1;
  height: 34px;
  border: 1px solid var(--c-border-strong);
  background: var(--c-card);
  color: var(--c-text-2);
  border-radius: var(--r-md);
  font-size: var(--fs-table);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.as-act:hover:not(:disabled) { border-color: var(--c-primary); color: var(--c-primary); }
.as-act.is-on {
  background: var(--c-primary); border-color: var(--c-primary);
  color: #fff; font-weight: 600;
}
.as-act:disabled { opacity: .45; cursor: not-allowed; }

.as-row__body {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--c-border);
  display: flex; flex-direction: column; gap: 8px;
}
.as-qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-qty .input { width: 82px; }
.as-qty__amt { margin-left: auto; font-weight: 600; color: var(--c-text-2); }

.as-out {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 8px 10px;
  background: var(--c-bg);
  border-radius: var(--r-md);
}
.as-out__main { min-width: 0; flex: 1; }
.as-out__name { font-size: var(--fs-table); line-height: 1.3; }
.as-out__nums { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.as-out__nums .input { width: 60px; }
.as-out__x {
  width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--c-text-3); cursor: pointer; border-radius: 50%;
}
.as-out__x:hover { background: var(--c-border); color: var(--c-danger, #e5484d); }

.btn--dashed {
  border-style: dashed; color: var(--c-primary); background: transparent;
}

.as-sum { margin-top: var(--sp-md); }
.as-sum__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
}
.as-sum__row--net {
  border-top: 1px solid var(--c-border);
  margin-top: 4px; padding-top: 10px;
  font-size: var(--fs-table);
}
.as-sum__row--net b { font-size: 20px; }
.as-sum__pay { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.as-sum__pay .input { width: 120px; }

.as-picklist { margin-top: 10px; max-height: 52vh; overflow: auto; }
.as-pick {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 10px 4px; border-bottom: 1px solid var(--c-border);
  cursor: pointer;
}
.as-pick:last-child { border-bottom: 0; }
.as-pick:hover { background: var(--c-primary-light); }
.as-pick__main { min-width: 0; flex: 1; }
.as-pick__name { font-size: var(--fs-table); line-height: 1.3; }
.as-pick__side { text-align: right; flex-shrink: 0; }

@media (min-width: 640px) {
  /* 桌面上三选一拉满整行会很蠢（每个按钮 300px 宽），收到左半边 */
  .as-row__acts { max-width: 420px; }
}

@media (max-width: 639px) {
  .as-row { padding: 12px; }
  .as-act { height: 40px; }
  .as-out { flex-wrap: wrap; }
  .as-out__nums { width: 100%; justify-content: flex-end; }
  .as-out__nums .input { width: 72px; }
  .as-sum__row--net b { font-size: 18px; }
}

/* ==========================================================
   返修流程条
   「这单走到哪一步了」是客户最常问的一句，列表里直接给答案：
   四个节点，走过的实心打勾色、当前的蓝色带光圈、没到的灰色。
   旁边带日期，客户问"送去几天了"不用再点进去算。
   ========================================================== */
.rp-flow {
  display: flex; align-items: flex-start;
  max-width: 320px;
}
.rp-flow--m { margin: 6px 0 2px; max-width: none; }

.rp-step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: var(--c-text-3);
  white-space: nowrap;
}
/* 连接线：画在自己左半边，第一个不画 */
.rp-step::before {
  content: '';
  position: absolute;
  top: 4px; left: -50%;
  width: 100%; height: 2px;
  background: var(--c-border);
  border-radius: 1px;
}
.rp-step:first-child::before { display: none; }

.rp-step i {
  position: relative; z-index: 1;
  display: block;
  width: 10px; height: 10px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: var(--c-card);
  box-shadow: inset 0 0 0 2px var(--c-border-strong);
}
.rp-step em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: var(--c-text-3);
  opacity: .85;
}

.rp-step.is-done { color: var(--c-text-2); }
.rp-step.is-done i { background: var(--c-success, #30a46c); box-shadow: none; }
.rp-step.is-done::before { background: var(--c-success, #30a46c); }

.rp-step.is-now { color: var(--c-primary); font-weight: 600; }
.rp-step.is-now i {
  background: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}

.rp-flow.is-closed .rp-step { color: var(--c-text-3); }
.rp-flow.is-closed .rp-step i,
.rp-flow.is-closed .rp-step.is-done i { background: var(--c-border-strong); box-shadow: none; }
.rp-flow.is-closed .rp-step::before { background: var(--c-border); }

/* 详情里的时间线：比列表多一行日期，横向四段 */
.rp-line {
  display: flex;
  margin: var(--sp-md) 0;
  padding: 10px 0;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.rp-line__item {
  position: relative; flex: 1 1 0; text-align: center; min-width: 0;
}
.rp-line__item::before {
  content: ''; position: absolute; top: 5px; left: -50%;
  width: 100%; height: 2px; background: var(--c-border);
}
.rp-line__item:first-child::before { display: none; }
.rp-line__item i {
  position: relative; z-index: 1;
  display: block; width: 12px; height: 12px; margin: 0 auto 6px;
  border-radius: 50%; background: var(--c-card);
  box-shadow: inset 0 0 0 2px var(--c-border-strong);
}
.rp-line__lb { font-size: var(--fs-xs); color: var(--c-text-3); }
.rp-line__dt { font-size: 11px; color: var(--c-text-3); margin-top: 2px; }
.rp-line__item.is-done i { background: var(--c-success, #30a46c); box-shadow: none; }
.rp-line__item.is-done::before { background: var(--c-success, #30a46c); }
.rp-line__item.is-done .rp-line__lb { color: var(--c-text-2); }
.rp-line__item.is-now i { background: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-light); }
.rp-line__item.is-now .rp-line__lb { color: var(--c-primary); font-weight: 600; }

.rp-detail__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-sm); margin-bottom: var(--sp-sm);
}
.rp-detail__name { font-weight: 600; font-size: var(--fs-table); line-height: 1.35; }

.rp-kv {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--c-border);
  font-size: var(--fs-table);
}
.rp-kv:last-of-type { border-bottom: 0; }
/* 44px 只够两个字的标签，「维修方式」「购买日期」会折成两行，看着像字段名被劈开 */
.rp-kv > span {
  color: var(--c-text-3); flex-shrink: 0; width: 66px;
  font-size: var(--fs-xs); white-space: nowrap;
}
.rp-kv > b { font-weight: 500; word-break: break-all; }

@media (max-width: 639px) {
  .rp-step { font-size: 10px; }
  .rp-step em { font-size: 9px; }
}

/* 单号 SO20261104-007 是 13 个字符，带「销/退/换」小标后 150px 放不下，
   折成两行看着像两张单。单号永远不许折行。 */
.od-no { white-space: nowrap; }

/* 商品详情：最近出入库（一行一笔，窄屏自动换行） */
.stock-ledger__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--sp-md);
  border-top: 1px solid var(--c-line);
  flex-wrap: wrap;
}
.stock-ledger__row:first-child { border-top: none; }
.stock-ledger__row > :nth-child(2) { min-width: 60px; }
.stock-ledger__row > :nth-child(4) { margin-left: auto; }
/* 手机上「结存」不再抢右边，单号自己一行 */
@media (max-width: 640px) {
  .stock-ledger__row > :nth-child(4) { margin-left: 0; }
  .stock-ledger__row > :nth-child(5) { margin-left: auto; }
}

/* 勾选行（采购「直接入库」、退哪几台） */
.chk-line {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}
.chk-line input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.chk-list {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 6px 10px;
}
.chk-list .chk-line { border-bottom: 1px solid var(--c-line); }
.chk-list .chk-line:last-child { border-bottom: none; }

/* 采购到货入库 */
.rcv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-line);
}
.rcv-row:first-child { padding-top: 0; }
.rcv-row__name { flex: 1; min-width: 0; }
.rcv-row__qty { width: 110px; flex: none; text-align: right; }
.rcv-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* 退供应商：实退价输入（比数量框窄一点，别抢商品名的位置） */
.prc-input { width: 96px; text-align: right; }

/* 库存里的待检 / 二手：提醒有货但不在正常区，别照着总数答应客户 */
.stock-qc-note { color: var(--c-warning, #f5a623); }
.stock-2nd-note { color: var(--c-info, #3b82f6); }

/* 手机列表里的行内按钮：flex 会把「处置」压成竖排两个字 */
.as-fix-btn { flex: none; white-space: nowrap; min-width: 64px; }

/* ==========================================================================
   往来对账（/reconcile）
   --------------------------------------------------------------------------
   这张表的读法是「从上往下累」，所以期初行压在上面、期末行压在下面，
   中间每行都有余额。行高比普通表格松一点：对账是一行一行核，
   挤在一起眼睛会串行。
   ========================================================================== */
.ledger-table { min-width: 720px; }
.ledger-table td { padding-top: 7px; padding-bottom: 7px; }
.ledger-table .ellipsis { max-width: 320px; }
/* 日期、类型、单号不换行：一换行整行变两行高，几十行下去就找不到齐的那一列 */
.ledger-table th:nth-child(-n+3),
.ledger-table td:nth-child(-n+3) { white-space: nowrap; }
.ledger-table td:nth-child(4) { min-width: 190px; }

.ledger-opening td,
.ledger-total td {
  background: var(--c-hover);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}
.ledger-total td {
  border-top: 2px solid var(--c-border-strong);
  border-bottom: none;
  color: var(--c-text);
}

/* 作废单留着给人查，但不能抢眼：整行压灰，单号划掉 */
.ledger-void td { color: var(--c-text-3); }
.ledger-void .mono { text-decoration: line-through; text-decoration-thickness: 1px; }
.ledger-void .badge { text-decoration: none; }
.card-list .list-item.ledger-void { opacity: .62; }

@media print {
  .ledger-table { font-size: 9.5pt; }
  .ledger-table tr { break-inside: avoid; page-break-inside: avoid; }
  .ledger-table th { position: static; background: #f2f4f8; }
  .ledger-table td { height: auto; padding: 4px 6px; }
  .ledger-void td { color: #777; }
}

/* 台账在平板竖屏放不下 8 列：与其让人横着拖去找"余额"，
   不如换成卡片。1024 以上才用表格。 */
.ledger-narrow { display: none; }
@media (max-width: 1023px) {
  .ledger-wide { display: none !important; }
  .ledger-narrow { display: flex; }
}

/* 打印台账：卡片别带彩色边框和阴影，纸上只有黑白 */
@media print {
  .ledger-narrow { display: none !important; }
  .ledger-wide { display: block !important; }
  .stat { border-color: #ddd !important; box-shadow: none !important; }
  .stat--primary, .stat--danger, .stat--success { border-color: #ddd !important; }
  .notice { background: #fff !important; border: 1px solid #ddd !important; }
  .chips, .toolbar { display: none !important; }
}

/* 「返修流程已完成」的标签：badge--muted 的底色跟白卡片几乎一样，
   不加一圈细边，看着像一句灰色备注，而不像一个状态。 */
.rp-closed-tag { border: 1px solid var(--c-border); }

/* ==========================================================================
   返修登记：维修方式、拍照、缩略图
   --------------------------------------------------------------------------
   维修方式是这单的分岔口，做成两个并排的选项而不是下拉：
   下拉里「店面维修 / 返厂维修」看不出区别，还得先点开才知道有哪些。
   ========================================================================== */
.rp-route { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rp-route__opt {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-card); text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.rp-route__opt b { font-size: var(--fs-sm); font-weight: 600; }
.rp-route__opt span { font-size: var(--fs-xs); color: var(--c-text-3); }
.rp-route__opt.is-on { border-color: var(--c-primary); background: var(--c-primary-light); }
.rp-route__opt.is-on b { color: var(--c-primary); }

/* 「客户记不清」：勾上就把日期框停掉，不让人以为还能填 */
.rp-check {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; font-size: var(--fs-sm); color: var(--c-text-2); cursor: pointer;
}

.rp-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-pick__img {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--c-border);
}

/* 列表里的缩略图：认机器靠它，不靠读型号 */
.rp-goods { display: flex; gap: 8px; align-items: flex-start; }
.rp-thumb {
  width: 34px; height: 34px; flex: none;
  border-radius: var(--r-sm); object-fit: cover; background: var(--c-bg);
}
/* 卡片标题里塞了缩略图之后，品名会被 space-between 推到中间；
   让它自己占满剩下的宽度、靠左排。 */
.rp-thumb + .ellipsis { min-width: 0; flex: 1; text-align: left; }

/* 详情里的照片：按容器宽铺开，别撑破弹窗 */
.rp-photo { display: block; margin-top: var(--sp-md); }
.rp-photo img {
  width: 100%; max-height: 240px; object-fit: contain;
  border-radius: var(--r-md); background: var(--c-bg);
}
.rp-photo .text-3 { display: block; margin-top: 4px; }

@media print {
  .rp-thumb { display: none; }
  .rp-route, .rp-pick, .rp-check { display: none !important; }
}

/* ---------------------------------------------------------------------------
   工程报价（项目报价 · LED / 监控）

   条件表单是「一组一格」：同类的条件排在同一行，一行放不下自动折行。
   和普通开单页的表格不同，这里没有固定的列——净空尺寸是两个数字并排，
   安装方式是一排胶囊，桥架要不要是一个勾选框带两个数量。
   所以用 grid + 每个控件自己声明占几格（wide / span），不做成表格。
   --------------------------------------------------------------------------- */
.tp-sec { margin-bottom: var(--sp-md); }
.tp-sec__head {
  display: flex; align-items: baseline; gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-md) 0;
}
.tp-sec__title { font-weight: 600; }
.tp-sec__hint { color: var(--c-text-3); font-size: 13px; }
.tp-group {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-md) var(--sp-lg);
  padding: var(--sp-sm) var(--sp-md) var(--sp-md);
}
.tp-group__name {
  grid-column: 1 / -1;
  font-size: 13px; color: var(--c-text-3);
  margin: var(--sp-sm) 0 0;
  padding-bottom: 4px; border-bottom: 1px dashed var(--c-border);
}
.tp-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-md) var(--sp-lg);
}
.tp-field { min-width: 0; }
.tp-field--wide { grid-column: 1 / -1; }
.tp-field__label {
  display: block; font-size: 13px; color: var(--c-text-2);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tp-field__row { display: flex; align-items: center; gap: 6px; }
.tp-field__unit { color: var(--c-text-3); font-size: 13px; flex: none; }
.tp-field__hint { color: var(--c-text-3); font-size: 12px; margin-top: 2px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-chips .chip { margin: 0; }
.tp-child {
  padding-left: var(--sp-md); border-left: 2px solid var(--c-border);
  margin-top: var(--sp-sm);
}
.tp-rows { display: flex; flex-direction: column; gap: var(--sp-sm); }
.tp-row { display: flex; gap: var(--sp-sm); align-items: center; }
.tp-row .input { min-width: 0; }
.tp-row__spec { flex: 1 1 40%; }
.tp-row__qty { flex: 0 0 96px; }
.tp-row__note { flex: 1 1 30%; }
.tp-lens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tp-lens .input { width: 88px; }

@media (max-width: 1023px) {
  .tp-grid, .tp-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tp-grid, .tp-group { grid-template-columns: 1fr; gap: var(--sp-md); }
  .tp-field__label { white-space: normal; }
  .tp-row { flex-wrap: wrap; }
  .tp-row__qty { flex: 1 1 80px; }
}

/* 报价清单：按工程分段（一、屏体与配件 / 二、控制系统…）
   客户看工程报价是分段砍价的，所以段小计必须单独一行且够醒目。 */
.tq-seg td {
  background: var(--c-bg); font-weight: 600; color: var(--c-text-2);
  padding-top: 10px; padding-bottom: 8px;
}
.tq-seg__sum { float: right; font-weight: 600; color: var(--c-text); }
.tq-name { line-height: 1.35; }
.tq-name__spec { display: block; color: var(--c-text-3); font-size: 12px; }
.tq-inp { width: 96px; text-align: right; }
/* 人工改过的行：标一下「这行是你自己定的」，旁边给个改回的出口。
   不标的话，过两天没人记得哪个数是谈出来的、哪个是系统算的。 */
.tq-lock {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-bg); color: var(--c-text-3);
  font-size: 12px; line-height: 18px; cursor: pointer;
}
.tq-lock:hover { color: var(--c-primary); border-color: var(--c-primary); }
.tq-total {
  display: flex; justify-content: flex-end; align-items: baseline;
  gap: var(--sp-md); padding: var(--sp-md);
  border-top: 1px solid var(--c-border);
}
.tq-total__num { font-size: 22px; font-weight: 700; }

/* 打印：分段标题行不能被折页切开 */
@media print {
  .tq-seg { break-inside: avoid; }
}

/* 手机上的报价清单：六列排不进 390 宽。
   序号压成一格、单位藏起来（数量后面就是单位，客户看得懂）、
   数量/单价输入框收窄但还能点，金额保留两位小数。规格说明太长时掐两行。 */
@media (max-width: 640px) {
  .tq-no { width: 30px !important; }
  .tq-unit { display: none !important; }
  .tq-qty { width: 74px !important; }
  .tq-price { width: 76px !important; }
  .tq-amt { width: 84px !important; font-size: 13px; }
  .tq-inp {
    width: 100% !important; padding-left: 3px; padding-right: 3px;
    font-size: 15px;
  }
  .tq-name__spec {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .tq-seg td { font-size: 13px; }
  .tq-total { padding: var(--sp-md) var(--sp-sm); }
  .tq-total__num { font-size: 19px; }
}
.tq-mprice { display: none; }
@media (max-width: 640px) {
  /* 单价列在手机上藏起来，改在品名下面显示一行「¥128 / 块」；
     金额列保留（客户第一眼看的是这一行多少钱）。 */
  .tq-price { display: none !important; }
  .tq-mprice { display: block; color: var(--c-text-2); font-size: 13px; margin-top: 2px; }
  .tq-name__spec { -webkit-line-clamp: 3; }
}
