/* ============================================================================
 * 首页（工作台）—— 1:1 复刻安卓 activity_home.xml
 *
 * 所有数值都能在安卓源码里找到出处（dp/sp 直接当 px 用：两端都是
 * density-independent 单位，1080×2280@3x = 360×760dp，和 iPhone 的 390×844 CSS px
 * 基本同尺度，量出来站在一起看不出差别）：
 *   hero         padding 0 16 60；渐变 160deg #1F6FEB → #1552B8 → #103F8E（hero_gradient.xml，270°）
 *   用户行       gap 10；头像 38 圆、白色 22% 底；姓名 15sp 600；单位 11.5sp
 *   搜索行       h44、radius 12、白色 16% 底；左放大镜 18、右竖线 1×20 + 扫码 32
 *   统计卡       白底 radius 12、4 格、数字 17sp 700 彩色（蓝/橙/绿/红）、标签 11sp、
 *                marginTop -44 从蓝区下沿跨出来（hero 底部留 60 才不压住搜索框）
 *   分组标题     左 15sp 600 ／ 右 13sp 灰（左右两端）；容器左右 12
 *   格子         46dp 圆角 14dp 渐变块 + 24dp 白色线条图标 + 下方 6dp/11.5sp 文字
 *                右上角 18dp 红色数字角标（0 不显示、>99 显示 99+）
 *   底栏         h60、图标 22 + 文字 10.5sp；「任务」带红角标（见 .tabbar）
 *   FAB          右下胶囊 h52 radius26、「扫码作业」，距右 16、距底 76
 * ========================================================================== */

/* 只给读屏看的标题（首页没有标题栏，但页面得有名字；内容 1px 可见性裁剪，
   不用 display:none —— 那样读屏也读不到） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.hm {
  background: var(--wms-bg);
}

.hm-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

/* ---------- 蓝区头部 ---------- */
.hm-hero {
  padding: calc(env(safe-area-inset-top) + 6px) 16px 60px;
  background: linear-gradient(160deg, #1F6FEB 0%, #1552B8 55%, #103F8E 100%);
  color: #fff;
}

.hm-u {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
}

.hm-user {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.hm-av {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--wms-hero-glass);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.hm-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hm-nmrow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hm-nm {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-ow {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--wms-hero-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 当前作业仓（头部可点小块）：现场换仓高频，别藏进设置页 */
.hm-wh {
  flex: 0 0 auto;
  max-width: 108px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .18);
  font-size: 11px;
  color: #fff;
  cursor: pointer;
}

.hm-wh-t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-wh-a { font-size: 9px; opacity: .9; }

.hm-wh:active { background: rgba(255, 255, 255, .3); }

.hm-bell {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  display: grid;
  place-items: center;
  color: #fff;
}

.hm-bell svg { width: 24px; height: 24px; }

.hm-bell:active { opacity: .7; }

/* ---------- 搜索行 ---------- */
.hm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  /* 安卓 activity_home.xml:138 搜索行 layout_marginBottom=10dp —— 少了这 10dp，
     hero 就是 164 而不是 174（P1 复核量的就是这 10.5dp，连带整页往下错位） */
  margin-bottom: 10px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--wms-hero-search);
}

.hm-s-ico {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--wms-hero-text-dim);
}

.hm-s-ico svg { width: 18px; height: 18px; }

.hm-s-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  /* 16px 是 iOS 硬要求（小于 16 聚焦时会放大整页）；安卓是 14sp，这里必须让步 */
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.hm-s-input::placeholder { color: var(--wms-hero-text-dim); }
.hm-s-input::-webkit-search-cancel-button { display: none; }

.hm-s-line {
  flex: 0 0 auto;
  width: 1px;
  height: 20px;
  background: var(--wms-hero-line);
}

.hm-s-scan {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff;
}

.hm-s-scan svg { width: 24px; height: 24px; }

/* ---------- 统计卡（跨出蓝区） ---------- */
.hm-stats {
  position: relative;
  z-index: 2;
  display: flex;
  margin: -44px 16px 0;
  background: var(--wms-surface);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .08);
}

.hm-tile {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  color: var(--wms-text-2);
}

.hm-tile + .hm-tile { border-left: 1px solid var(--wms-line); }
.hm-tile:active { background: #F9FAFB; }

.hm-tile-n {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.hm-tile-l {
  font-size: 11px;
  color: var(--wms-sub);
  white-space: nowrap;
}

/* 统计口径说明（Ben 决策豁免项，安卓没有这一行）。
 * 原来是**常驻 40.5dp 高的文本**，把统计卡以下的所有内容整体推下去 40.5dp ——
 * 这就是 P1 复核里「宫格上半 24.5%」压不下去的主因：几何再怎么调，整块都在错位上。
 * 现在改成「统计卡右上角一个小『口径』按钮 + 点开浮层」：文案一字未删（浮层里逐字相同），
 * 但**不占版面高度**，统计卡以下与安卓逐 dp 对齐。 */
.hm-scope-btn {
  position: absolute;
  top: 2px;
  right: 4px;
  padding: 0 4px;
  border-radius: 6px;
  background: #EAF2FE;
  color: var(--wms-primary);
  font-size: 9px;
  line-height: 14px;
  font-weight: 600;
}

.hm-scope {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--wms-surface);
  box-shadow: 0 2px 6px rgba(16, 24, 40, .10), 0 8px 24px rgba(16, 24, 40, .12);
  font-size: 11.5px;
  line-height: 17.25px;
  color: var(--wms-sub);
  z-index: 5;
  text-align: left;
}

.hm-scope.on { display: block; }

/* 数字右上角的口径小标：「仓」= 当前仓口径 / 「全」= 全公司（按单位）口径。
   为什么要标：同一屏里两种口径并存是正常的（出库单 GDN 没有发货仓列），
   不标出来现场就会把「全公司 16」当成「我这个仓有 16 张」。 */
.hm-scope-tag {
  display: inline-block;
  margin-left: 2px;
  padding: 0 3px;
  border-radius: 4px;
  background: #EAF2FE;
  color: var(--wms-primary);
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  vertical-align: super;
  line-height: 1.4;
}

.hm-scope-tag.unit {
  background: #FEF4E6;
  color: #B54708;
}

/* ---------- 分组宫格 ---------- */
.hm-groups { padding: 0 12px; }

.hm-gtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  /* 安卓容器 paddingTop 6dp / paddingBottom 8dp（activity_home.xml:385-390），
     标题 15sp 行高实测 20.4dp → 整块 34.4dp。原来写的 10px 顶距让每组都高 4.5dp，
     8 组叠下来宫格越往下错得越多（P1 复核的「宫格上半 24.5%」主因之一）。 */
  padding: 6px 4px 8px;
}

.hm-gtitle b {
  font-size: 15px;
  line-height: 20.4px;
  font-weight: 700;
  color: var(--wms-text);
  flex: 0 0 auto;
}

.hm-gtitle span {
  font-size: 13px;
  line-height: 17.8px;
  color: var(--wms-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--wms-surface);
  border-radius: 12px;
  padding: 8px 0;
  /* 安卓 GridLayout 与下一组标题之间没有外边距（下一组标题自带 paddingTop 6） */
  margin-bottom: 0;
}

.hm-g {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 11px 2px;
  color: var(--wms-text-2);
  font-size: 11.5px;
}

.hm-g:active { opacity: .75; }

.hm-icwrap {
  position: relative;
  width: 46px;
  height: 46px;
}

.hm-ic {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--wms-sub);      /* 兜底：配置里没有渐变色也不要变透明 */
}

.hm-ic svg { width: 24px; height: 24px; }

.hm-badge {
  position: absolute;
  top: -1px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--wms-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 18px;
  text-align: center;
  box-sizing: border-box;
}

.hm-lb {
  margin-top: 6px;
  font-size: 11.5px;
  /* 安卓标签实测 15.6dp 高（11.5sp + includeFontPadding）→ 格子 11+46+6+15.6+11=89.6dp */
  line-height: 15.6px;
  color: var(--wms-text-2);
  text-align: center;
  white-space: nowrap;
}

/* ---------- 扫码作业 FAB ---------- */
.hm-fab {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 30;
  height: 52px;
  padding: 0 18px;
  border-radius: 26px;
  background: var(--wms-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 6px 16px rgba(255, 138, 0, .36);
}

.hm-fab:active { background: #F07C00; }
.hm-fab-ico { display: grid; place-items: center; }
.hm-fab-ico svg { width: 22px; height: 22px; }
.hm-fab-t { font-size: 15px; font-weight: 700; }

/* 标签预览：等宽 + 保留换行（40×30 标签一行能放多少半角位是固定的，不要折行） */
.lb-preview {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--wms-text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- 底部弹层（选仓库） ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: flex-end;
  background: rgba(16, 24, 40, .45);
}

.sheet {
  width: 100%;
  max-height: 78dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
  font-size: 15px;
  color: var(--wms-text);
}

.sheet-search { padding: 0 14px 8px; }

.sheet-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--wms-line);
}

.sheet-list .row {
  width: 100%;
  text-align: left;
}

/* ---------- 明细行公共件（app/linerow.js = 安卓 item_accept_line + LineStyle） ----------
 * 颜色小标：按颜色名取色 + 同色淡底（行内 style 由 JS 给，见 colorChipStyle）
 * 尺码小标：固定紫 #7A5AF8 / 底 #F1EEFE（不跟颜色混，现场要求两种小标不同色）
 * 货位：搬移单「移出」墨色 / 「移入」主色，上下两行
 * 行高与行内间距照安卓 item_accept_line.xml（行1 代码+数量 / 行2 小标+品名 / 行3 数量摘要）
 */
.lr-chips { display: inline-flex; align-items: center; gap: 4px; }
.lr-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
}
.lr-chips.dim .lr-chip { opacity: .45; }
.lr-row .lr-top { display: flex; align-items: baseline; gap: 8px; }
.lr-row .lr-code { font-weight: 600; letter-spacing: .2px; }
.lr-row.hit .lr-code { color: var(--wms-primary, #1F6FEB); font-weight: 700; }
.lr-row .lr-qtysub { font-size: 11.5px; color: var(--text-3); }
.lr-row .lr-mid { display: flex; align-items: center; flex-wrap: wrap; min-height: 18px; }
.lr-row .lr-mid .lr-chip:first-child { margin-left: 0; }
.lr-row .lr-name { font-size: 12.5px; color: var(--text-2); margin-left: 6px; }
.lr-row .lr-meta { font-size: 12px; color: var(--text-3); }
/* 作业明细行高对齐安卓 WorkLineAdapter 的 73.8dp（三行：代码 / 小标+品名 / 摘要）。
   默认 .row 的 10px 上下内边距 + row-sub 的 3px 外边距会堆到 97dp，正片列表比安卓低 23dp。 */
.lr-row { padding: 7px 14px; }
.lr-row .lr-meta { margin-top: 1px; line-height: 1.25; }
/* 品名行必须单行省略（安卓 tvLineName 是 singleLine+ellipsis）：不省略时长品名折成两行，
   行高从 73.8dp 涨到 91dp，整片列表比安卓短一截（2026-11-07 实测 move_work）。 */
.lr-row .lr-mid { flex-wrap: nowrap; overflow: hidden; }
.lr-row .lr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 搬移单的移出/移入货位：移出红 #F04438、移入绿 #12B76A（安卓 MoveWorkActivity.locNameOf
   里那两段 Spannable 就是这两个颜色，粗体；箭头用次要色 wms_sub）。 */
.lr-row .lr-from { color: #F04438; font-weight: 700; }
.lr-row .lr-to { color: #12B76A; font-weight: 700; }
.lr-row .lr-arrow { color: var(--wms-sub, #98A2B3); font-weight: 700; }
.lr-loc { display: inline-flex; flex-direction: column; margin-left: 6px; vertical-align: middle; }
.lr-loc-line { font-size: 9.5px; line-height: 13px; color: #1D2939; white-space: nowrap; }
.lr-loc-line.is-in { color: var(--wms-primary, #1F6FEB); }
.lr-sub { display: flex; align-items: center; flex-wrap: wrap; }
.lr-sub .lr-code { margin-right: 2px; }

/* ---------- 功能面板（ui.js WFuncSheet = 安卓 core/FunctionSheet） ----------
 * 1) 高度 = min(内容高, 屏高 72%)：面板本身给 72dvh 上限，内容少时 flex 自然收缩到内容高；
 * 2) 超了在 .sheet-list 里滚（安卓套的是 ScrollView）；
 * 3) 一项的内边距 9dp（安卓 tile: setPadding(dp(10), dp(9), dp(10), dp(9))）。
 * 只出 enabled 项由组件过滤，CSS 里不再需要 .off 灰态。
 */
.func-sheet { max-height: 72dvh; }
.func-list .func-tile {
  padding-top: 9px;
  padding-bottom: 9px;
}
.func-list .func-tile .row-title { font-weight: 600; }

