/*!
 * 物资申领核销系统 · 员工 H5 页面样式（移动端优先）
 * 基元（按钮/表单/卡片/状态色/toast）来自 base.css，本文件只补页面布局与移动端形态。
 * 苹果风：顶栏与底部 TabBar 是悬浮磨砂层，页面内容浮在柔光底上。
 */

/* ---------- 全局壳 ---------- */

html, body { height: 100%; }
.h5-body {
  background: transparent;               /* 透出 html 的柔光渐变 */
  padding-top: calc(52px + env(safe-area-inset-top));
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

/* 顶部标题条 */
.h5-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: calc(52px + env(safe-area-inset-top));
  display: flex; align-items: center;
  padding: env(safe-area-inset-top) 12px 0;
  background: rgba(255, 255, 255, .6);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: 0 1px 0 rgba(60,60,67,.05), 0 8px 22px -18px rgba(16,24,40,.55);
  color: var(--c-text);
  font-size: 15px;
}
.h5-top-title { font-weight: 600; letter-spacing: -0.018em; white-space: nowrap; }
.h5-top-who { font-size: 13px; color: var(--c-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h5-top-out {
  margin-left: 8px;
  min-width: 44px; min-height: 44px;          /* 可点区域 ≥44px */
  padding: 0 6px; font: inherit; font-size: 13px;
  color: var(--c-text-2); background: none; border: 0; cursor: pointer; opacity: .9;
}
.h5-top-out:active { opacity: .55; }

/* 主内容区：桌面端居中限宽 640px */
.h5-main { max-width: 640px; margin: 0 auto; padding: 14px 12px 28px; }
.h5-view { min-height: 50vh; }

/* 底部 TabBar */
.h5-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex;
  background: rgba(255, 255, 255, .72);
  border-top: 1px solid var(--glass-edge);
  box-shadow: 0 -1px 0 rgba(60,60,67,.04), 0 -10px 30px -22px rgba(16,24,40,.7);
  padding-bottom: env(safe-area-inset-bottom);
}
.h5-tab {
  position: relative; flex: 1 1 0; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--c-muted); font-size: 11px; text-decoration: none;
  transition: color .16s, transform .16s;
}
.h5-tab-ico { font-size: 20px; line-height: 1; }
.h5-tab.on { color: var(--c-primary-ink); font-weight: 600; }
.h5-tab:active { transform: scale(.94); }
.h5-tab-badge {
  position: absolute; top: 7px; left: calc(50% + 8px);
  min-width: 16px; padding: 0 4px; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
  color: #fff; background: linear-gradient(180deg, #ff6257, var(--c-err)); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(255,69,58,.45);
}
.h5-tab-badge:empty { display: none; }

/* ---------- 通用小块 ---------- */

.h5-card { padding: 15px; margin-bottom: 13px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-2); }
.h5-sub { font-size: 12px; color: var(--c-text-2); }
.h5-sec-title { font-size: 15px; font-weight: 600; letter-spacing: -0.018em; margin: 4px 2px 10px; }
.h5-sk-line { display: block; height: 14px; margin: 10px 0; border-radius: 8px;
  background: linear-gradient(90deg, rgba(120,128,140,.1), rgba(120,128,140,.18), rgba(120,128,140,.1));
  background-size: 200% 100%; animation: supply-sk 1.3s ease-in-out infinite; }
.h5-back { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 2px -10px;
  padding: 0 12px 0 10px; border: 0; background: none; color: var(--c-primary-ink);
  font-size: 14px; cursor: pointer; }
.h5-back:active { opacity: .6; }

/* 一次性提示条（购物车不落盘说明等） */
.h5-tip { display: flex; align-items: center; gap: 6px; padding: 9px 4px 9px 12px; margin-bottom: 11px;
  font-size: 12px; color: var(--c-warn-ink);
  background: rgba(255, 159, 10, .13); border: 1px solid rgba(255, 159, 10, .26); border-radius: 13px; }
.h5-tip-x { margin-left: auto; min-width: 44px; min-height: 36px; border: 0; background: none;
  color: inherit; font-size: 16px; cursor: pointer; }

/* 失败态 */
.h5-fail { padding: 32px 16px; text-align: center; color: var(--c-text-2); font-size: 13px; }
.h5-fail .supply-btn { margin-top: 12px; min-height: 44px; }

/* 状态标签色扩展：契约 4 色之外补充 cancelled/expired */
.supply-tag-cancelled, .supply-tag-expired { background: rgba(120,128,140,.13); color: var(--c-muted); }

/* ---------- 申领大厅 ---------- */

.h5-search { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 40;
  background: rgba(242, 244, 249, .5); padding: 8px 0 2px; }
.h5-search input { min-height: 44px; font-size: 14px; border-radius: 22px; padding-left: 16px;
  background: rgba(255,255,255,.78); }

/* 分类横向滚动条 */
.h5-cats { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 12px 2px; margin: 0 -12px; scrollbar-width: none; }
.h5-cats::-webkit-scrollbar { display: none; }
.h5-cat { flex: 0 0 auto; min-height: 40px; padding: 0 15px; display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 500; color: var(--c-text-2);
  background: rgba(255,255,255,.66); border: 1px solid var(--glass-edge);
  border-radius: 20px; box-shadow: var(--shadow-1); cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s, transform .16s; }
.h5-cat:active { transform: scale(.96); }
.h5-cat.on { color: #fff; background: linear-gradient(180deg, #2f9bff, var(--c-primary));
  border-color: transparent; box-shadow: 0 4px 14px -6px rgba(10,132,255,.8); }

.h5-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 11px; margin-top: 11px; }
.h5-item { position: relative; background: var(--glass); border: 1px solid var(--glass-edge);
  border-radius: var(--radius); padding: 13px; min-height: 44px; cursor: pointer;
  box-shadow: var(--shadow-2); transition: transform .18s cubic-bezier(.32,.72,0,1), box-shadow .18s; }
.h5-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.h5-item:active { transform: scale(.975); box-shadow: var(--shadow-1); }
.h5-item-name { font-size: 14px; font-weight: 600; letter-spacing: -0.014em; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 40px; }
.h5-item-spec { font-size: 12px; color: var(--c-muted); margin-top: 2px; height: 18px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.h5-item-meta { display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 7px; gap: 4px; }
.h5-item-stock { font-size: 12px; color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.h5-item-stock.out { color: var(--c-err-ink); font-weight: 600; }
.h5-item-price { font-size: 13px; color: var(--c-warn-ink); font-weight: 600; white-space: nowrap; }
/* 库存 0 / 停用：置灰且不可点（pointer-events 关闭 = 不可加） */
.h5-item.off { opacity: .48; filter: grayscale(.9); pointer-events: none; box-shadow: none; }
.h5-item-off-tag { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--c-muted);
  background: rgba(120,128,140,.13); border-radius: 9px; padding: 0 8px; line-height: 18px; }

.h5-more { padding: 12px 0 4px; text-align: center; font-size: 12px; color: var(--c-muted); }
.h5-more .supply-btn { min-height: 44px; }

/* 数量步进器（详情弹层 / 购物车共用） */
.h5-step { display: inline-flex; align-items: stretch; border: 1px solid var(--c-line);
  border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.86); box-shadow: var(--shadow-1); }
.h5-step button { min-width: 44px; min-height: 44px; font: inherit; font-size: 18px; line-height: 1;
  border: 0; background: transparent; color: var(--c-primary-ink); cursor: pointer; transition: background .14s; }
.h5-step button:hover:not(:disabled) { background: var(--c-primary-soft); }
.h5-step button:disabled { color: #c3c9d2; cursor: not-allowed; }
.h5-step input { width: 54px; min-height: 44px; text-align: center; border: 0;
  border-left: 1px solid var(--c-line); border-right: 1px solid var(--c-line); border-radius: 0;
  box-shadow: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield; }
.h5-step input::-webkit-outer-spin-button, .h5-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 详情弹层字段行 */
.h5-dl { font-size: 13px; }
.h5-dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--c-line); }
.h5-dl div:last-child { border-bottom: 0; }
.h5-dl-k { color: var(--c-text-2); flex: 0 0 auto; }
.h5-dl-v { text-align: right; word-break: break-all; }
.h5-modal-op { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }

/* ---------- 申请单（购物车） ---------- */

.h5-cart-row { display: flex; align-items: center; gap: 8px; padding: 12px 0;
  border-bottom: 1px solid var(--c-line); }
.h5-cart-row:last-of-type { border-bottom: 0; }
.h5-cart-info { flex: 1 1 auto; min-width: 0; }
.h5-cart-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h5-cart-del { min-width: 44px; min-height: 44px; border: 0; background: none;
  color: var(--c-muted); font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.h5-cart-del:active { color: var(--c-err); }
.h5-cart-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 13px; margin-top: 4px; border-top: 1px solid var(--c-line); }
.h5-count { font-size: 13px; color: var(--c-text-2); }
.h5-count b { color: var(--c-primary-ink); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.h5-reason-cnt { text-align: right; font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.h5-reason-cnt.over { color: var(--c-err-ink); }

/* ---------- 我的申领 ---------- */

.h5-chips { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 0 10px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; scrollbar-width: none; }
.h5-chips::-webkit-scrollbar { display: none; }
.h5-chip { position: relative; flex: 0 0 auto; min-height: 40px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--c-text-2);
  background: rgba(255,255,255,.66); border: 1px solid var(--glass-edge); border-radius: 20px;
  box-shadow: var(--shadow-1); cursor: pointer; white-space: nowrap; transition: background .16s, color .16s; }
.h5-chip.on { color: var(--c-primary-ink); border-color: transparent;
  background: var(--c-primary-soft); box-shadow: none; font-weight: 600; }
.h5-chip em { font-style: normal; min-width: 16px; padding: 0 4px; font-size: 10px; font-weight: 600; line-height: 16px;
  text-align: center; color: #fff; background: linear-gradient(180deg, #ff6257, var(--c-err)); border-radius: 8px; }

.h5-order { cursor: pointer; }
.h5-order:active { transform: scale(.995); }
.h5-order-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h5-order-no { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; color: var(--c-text-2); }
.h5-order-brief { margin-top: 6px; font-size: 13px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.h5-order-meta { margin-top: 6px; font-size: 12px; color: var(--c-muted);
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* 详情 */
.h5-detail-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.h5-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.h5-lines th, .h5-lines td { padding: 8px 6px; border-bottom: 1px solid var(--c-line); text-align: left; }
.h5-lines th { color: var(--c-text-2); font-weight: 500; font-size: 12px; white-space: nowrap; }
.h5-lines td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.h5-acts { display: flex; gap: 10px; margin-top: 12px; }
.h5-acts .supply-btn { flex: 1 1 0; min-height: 44px; }
.h5-rej-reason { color: var(--c-err-ink); }
.h5-link-card { display: flex; align-items: center; justify-content: center; min-height: 48px;
  color: var(--c-primary-ink); font-weight: 500; background: var(--glass); border: 1px solid var(--glass-edge);
  border-radius: var(--radius); box-shadow: var(--shadow-2); margin-bottom: 12px; text-decoration: none; }
.h5-link-card:active { transform: scale(.99); }

/* 时间线（提交→审批→出库） */
.h5-tl { margin: 6px 0 2px; padding: 0 0 0 4px; }
.h5-tl li { list-style: none; position: relative; padding: 0 0 14px 18px; font-size: 13px; }
.h5-tl li::before { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px;
  border-radius: 50%; background: rgba(120,128,140,.28); box-shadow: 0 0 0 3px rgba(255,255,255,.7); }
.h5-tl li::after { content: ""; position: absolute; left: 4px; top: 18px; bottom: 2px; width: 1px; background: var(--c-line); }
.h5-tl li:last-child::after { display: none; }
.h5-tl li.hit::before { background: var(--c-primary); box-shadow: 0 0 0 3px rgba(255,255,255,.75), 0 0 10px rgba(10,132,255,.55); }
.h5-tl-t { color: var(--c-muted); font-size: 12px; }

/* 下拉刷新指示（scroll 触顶检测，不引库） */
.h5-refresh { height: 0; overflow: hidden; text-align: center; color: var(--c-muted);
  font-size: 12px; line-height: 36px; transition: height .15s; }
.h5-refresh.show { height: 36px; }

/* ---------- 核销码页 ---------- */

.h5-qr-page { text-align: center; }
.h5-qr-card { background: rgba(255,255,255,.82); border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg); padding: 22px 16px; margin-bottom: 13px; box-shadow: var(--shadow-3); }
.h5-qr-img { width: min(66vw, 320px); height: min(66vw, 320px); background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow-1); }
/* 已核销/已过期：打码遮挡（模糊 + 灰化），防截图冒领 */
.h5-qr-img.dead { filter: blur(9px) grayscale(1); opacity: .5; pointer-events: none; user-select: none; }
.h5-qr-code { margin: 15px auto 0; padding: 11px 13px; max-width: 420px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 20px; font-weight: 700;
  letter-spacing: 2px; word-break: break-all; color: var(--c-text);
  background: rgba(120,128,140,.1); border: 1px dashed var(--c-line-strong); border-radius: 13px; user-select: all; }
.h5-qr-code.blur { filter: blur(6px); user-select: none; }
.h5-qr-expire { margin-top: 10px; font-size: 13px; font-weight: 500; color: var(--c-warn-ink); }
.h5-qr-expire.gray { color: #5f5391; }
.h5-qr-notice { margin-top: 4px; font-size: 12px; color: var(--c-muted); }
.h5-qr-fallback { margin: 10px auto 0; max-width: 420px; padding: 11px 13px; font-size: 13px;
  color: var(--c-err-ink); background: rgba(255,69,58,.12); border-radius: 13px; }
.h5-qr-fallback .code-text { margin-top: 6px; font-size: 16px; }
.h5-qr-info { text-align: left; font-size: 13px; margin-top: 14px; }
.h5-qr-tip { margin-top: 12px; padding: 11px 13px; font-size: 12px; color: var(--c-text-2);
  background: var(--c-primary-soft); border-radius: 13px; text-align: left; line-height: 1.7; }
.h5-qr-list { margin: 6px 0 0; padding: 0; text-align: left; font-size: 13px; color: var(--c-text-2); }
.h5-qr-list li { list-style: none; padding: 6px 0; border-bottom: 1px solid var(--c-line);
  display: flex; justify-content: space-between; gap: 10px; }
.h5-qr-list li:last-child { border-bottom: 0; }

/* 桌面端：表单更宽松 */
@media (min-width: 641px) {
  .h5-main { padding: 16px 20px 28px; }
  .h5-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
}

/* 打印：body 加 .printing-qr 时只保留二维码区域 */
@media print {
  body.h5-body { background: #fff; padding: 0; }
  .h5-top, .h5-tabbar, .h5-search, .h5-cats, .h5-back, .h5-tip { display: none !important; }
  body.printing-qr .h5-main > *:not(.h5-print-area) { display: none !important; }
  .h5-print-area { max-width: 420px; margin: 0 auto; }
  .h5-qr-card { border: 0; padding: 0; box-shadow: none; background: #fff; }
  .h5-qr-img { width: 320px; height: 320px; }
  .h5-qr-noimg { display: none !important; }   /* 打印时不打印兜底框（图已可见） */
}
