:root {
  /* STZ 后台 Demo 统一视觉令牌（橙主题） */
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel2: #fafbfc;
  --surface: #ffffff;
  --primary: #ff7a59;
  --primary-d: #e85d3a;
  --primary-soft: #faece7;
  --accent: #ff7a18;
  --teal: #0f6e56;
  --teal-bg: #e1f5ee;
  --coral-bg: #faece7;
  --blue: #185fa5;
  --blue-bg: #e6f1fb;
  --amber: #ba7517;
  --amber-bg: #faeeda;
  --text: #1f2329;
  --muted: #6b7280;
  --hint: #9aa1ac;
  --line: #e6e8ec;
  --line2: #d7dae0;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --ok: #3b6d11;
  --ok-bg: #eaf3de;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --shadow-lift: 0 8px 30px rgba(20, 40, 80, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}
.hidden { display: none !important; }

.screen { min-height: 100vh; min-height: 100dvh; }
.flex-col { display: flex; flex-direction: column; }
/* 关键：给“顶栏 + 内部滚动区”的屏幕一个确定高度，
   让 #view-container 等 overflow-y:auto 容器真正成为受约束的内部滚动区，
   其内部 position:sticky 的元素（吸顶条/工具栏）才能正常吸顶 */
#app-screen, #accounts-screen, #plans-screen { height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: var(--radius-sm); padding: 13px 16px; font-size: 16px;
  font-weight: 700; cursor: pointer; transition: .15s; width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-d); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: #fdeaea; color: var(--danger); }
.btn-warn { background: #fff4ec; color: var(--accent); }
.btn-sm { padding: 9px 14px; font-size: 14px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- 顶栏（对齐 Demo：白底横条 + 模块双层标题） ---------- */
#app-screen { background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: flex-start; gap: 12px; min-height: 56px;
  padding: 8px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); padding-top: max(8px, env(safe-area-inset-top));
}
.top-mod { display: flex; flex-direction: column; min-width: 0; }
.top-mod .mod-title { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--text); }
.top-mod .mod-sub { font-size: 12px; color: var(--muted); line-height: 1.3; }
/* 兼容：其余独立屏顶栏仍用 .brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.brand-icon { font-size: 22px; }
.brand-title { font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lang-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 14px; font-weight: 800; font-size: 13px; cursor: pointer; color: var(--text);
}

/* ---------- 视图容器 ---------- */
#view-container { flex: 1; padding: 14px 14px calc(var(--tabbar-h) + 16px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view { display: flex; flex-direction: column; gap: 14px; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 10px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.section-title { font-size: 13px; color: var(--muted); font-weight: 800; margin: 2px 2px; letter-spacing: .3px; }

/* ---------- 盘点主视图 ---------- */
.start-hero {
  background: linear-gradient(135deg, #ff7a59, #ff9e6b);
  border-radius: 20px; padding: 26px 20px; color: #fff; text-align: center;
  box-shadow: 0 10px 26px rgba(255, 122, 89, .32);
}
.start-hero .hero-ico { font-size: 46px; }
.start-hero h2 { color: #fff; margin: 10px 0 4px; font-size: 20px; }
.start-hero p { color: rgba(255,255,255,.85); margin: 0 0 18px; font-size: 13px; }
.start-hero .btn-light { background: #fff; color: var(--primary); }

.start-fields { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; text-align: left; }
.start-fields .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.start-fields .field input {
  padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; color: var(--text); background: #fbfcfe;
}
.start-fields .field input:focus { outline: none; border-color: var(--primary); background: #fff; }

/* 进行中：概览卡 */
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.count-topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 8px 0 10px; display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.session-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.session-summary .stat { flex: 1; min-width: 90px; background: var(--primary-soft); border-radius: 12px; padding: 12px 10px; text-align: center; }
.session-summary .stat b { display: block; font-size: 22px; color: var(--primary); }
.session-summary .stat span { font-size: 12px; color: var(--muted); }
.session-name-line { margin-top: 10px; font-weight: 700; font-size: 14px; }

.scan-row { display: flex; gap: 8px; }
.scan-row .btn-scan { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; padding: 16px; }
.manual-row { display: flex; gap: 8px; margin-top: 10px; }
.manual-row input { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }

/* 商品结果卡（点击打开抽屉） */
.product-card { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.product-card:active { background: #f5f8ff; }
.product-card .thumb {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover;
  background: #eef1f6; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #c2cbd6; overflow: hidden;
}
.product-card .info { flex: 1; min-width: 0; }
.product-card .p-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card .p-sku { color: var(--muted); font-size: 12px; }
.product-card .p-price { color: var(--accent); font-weight: 800; margin-top: 2px; }
.product-card .p-cat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.product-card .p-add { flex-shrink: 0; }

/* 盘点明细列表 */
.count-list { display: flex; flex-direction: column; gap: 10px; }
.count-item { display: flex; align-items: center; gap: 10px; }
.count-item .thumb {
  width: 56px; height: 56px; border-radius: 12px; object-fit: cover;
  background: #eef1f6; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #c2cbd6; overflow: hidden; cursor: pointer;
}
.count-item .ci-info { flex: 1; min-width: 0; }
.count-item .ci-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count-item .ci-sku { font-size: 11px; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-ctrl button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; color: var(--text); }
.qty-ctrl button:active { background: var(--primary-soft); }
.qty-ctrl .q { min-width: 28px; text-align: center; font-weight: 800; font-size: 16px; }
/* 计划外补录行：仅一个编辑按钮，避免控件拥挤遮挡商品编码 */
.qty-ctrl-extra { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ci-del-sm { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 15px; cursor: pointer; color: var(--danger); line-height: 1; }
.ci-del-sm:active { background: #fdeaea; }

/* ---------- 搜索 ---------- */
.search-bar { display: flex; gap: 8px; }
.search-bar input {
  flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; background: #fff;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }
.result-grid { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 记录 ---------- */
.session-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.session-row .sr-main { flex: 1; min-width: 0; }
.session-row .sr-name { font-weight: 800; font-size: 15px; }
.session-row .sr-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge { font-size: 11px; padding: 4px 10px; border-radius: 999px; font-weight: 800; flex-shrink: 0; }
.badge.active { background: #e6f6ee; color: var(--ok); }
.badge.done { background: var(--primary-soft); color: var(--primary); }
.sr-arrow { color: var(--muted); font-size: 20px; flex-shrink: 0; margin-left: 8px; }
.items-detail { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- 商品库 ---------- */
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.progress { font-size: 13px; color: var(--muted); }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tabbar .tab {
  flex: 1; border: none; background: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 8px 0; cursor: pointer; color: var(--muted);
  font-size: 11px; font-weight: 700;
}
.tabbar .tab .tab-ico { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .6; }
.tabbar .tab.active { color: var(--primary); }
.tabbar .tab.active .tab-ico { filter: none; opacity: 1; }

/* ---------- 扫码遮罩 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 24, .82);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.scanner-box { width: 100%; max-width: 460px; }
.scanner-head { display: flex; justify-content: space-between; align-items: center; color: #fff; margin-bottom: 10px; font-size: 14px; }
.icon-btn {
  border: none; background: rgba(255,255,255,.16); color: #fff; border-radius: 10px;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer;
}
.scanner-frame { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
#scanner-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-reticle {
  position: absolute; inset: 12%; border: 2px solid var(--accent);
  border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none;
}
.scanner-msg { color: #fff; text-align: center; font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- 弹窗 ---------- */
.modal-card { background: #fff; border-radius: 18px; padding: 24px 20px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow-lift); }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
#modal-body { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: #1d2733; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 86vw; text-align: center;
}

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; }
.empty .e-ico { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- 商品详情底部抽屉 ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8,14,24,.5); opacity: 0; pointer-events: none; transition: opacity .28s; z-index: 90; }
.backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 520px; bottom: 0; max-height: 94vh; max-height: 94dvh;
  background: var(--surface); border-radius: 22px 22px 0 0; z-index: 100;
  display: flex; flex-direction: column; transition: transform .34s cubic-bezier(.22,.61,.36,1);
  box-shadow: 0 -8px 34px rgba(0,0,0,.2);
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-grabber { width: 42px; height: 5px; border-radius: 999px; background: #d3dae3; margin: 10px auto 4px; cursor: grab; flex-shrink: 0; }
.sheet-close {
  position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--text); font-size: 16px; cursor: pointer; z-index: 5;
}
.sheet-scroll { flex: 1; overflow-y: auto; padding: 6px 16px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

/* 顶部商品信息 */
.p-head { padding: 6px 2px 12px; }
.p-sku-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.p-sku-row .sku-tag { background: var(--primary-soft); color: var(--primary); font-weight: 800; padding: 3px 10px; border-radius: 8px; letter-spacing: .4px; font-size: 13px; }
.p-name { margin: 8px 0 2px; font-size: 22px; font-weight: 800; line-height: 1.25; }
.p-en { font-size: 13px; color: var(--muted); }
.p-price { margin-top: 8px; color: var(--accent); font-weight: 800; font-size: 19px; }

/* 大图轮播 hero */
.hero { position: relative; border-radius: 18px; overflow: hidden; background: #11161e; aspect-ratio: 1/1; margin: 6px 0 16px; touch-action: pan-y; }
.hero-track { display: flex; height: 100%; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; cursor: grab; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-track.dragging { cursor: grabbing; scroll-snap-type: none; }
.hero-slide { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; padding: 12px; }
.hero-slide img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.85); color: #1d2733; font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.hero-arrow.left { left: 10px; } .hero-arrow.right { right: 10px; }
.hero-counter { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.hero-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; gap: 6px; justify-content: center; pointer-events: none; }
.hero-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.45); transition: .2s; }
.hero-dots .dot.on { background: #fff; width: 18px; border-radius: 999px; }

/* 详情补充信息 */
.p-meta { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.meta-row { display: flex; justify-content: space-between; font-size: 13px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.meta-row .k { color: var(--muted); } .meta-row .v { font-weight: 700; }
.sheet-action { width: 100%; border: none; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 800; background: var(--primary); color: #fff; cursor: pointer; }
.sheet-action:active { background: var(--primary-d); }
.sheet-action.disabled { background: var(--line); color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ---------- 登录 / Login ---------- */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #faece7 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow-lift); text-align: center;
}
.login-logo { font-size: 46px; }
.login-title { font-size: 22px; font-weight: 800; margin: 8px 0 4px; }
.login-sub { font-size: 12px; color: var(--muted); margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.auth-form .field input {
  padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; color: var(--text); background: #fbfcfe; font-weight: 500;
}
.auth-form .field input:focus { outline: none; border-color: var(--primary); background: #fff; }
.auth-error { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; font-weight: 600; }

/* 顶栏管理员按钮 */
.admin-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  width: 38px; height: 38px; font-size: 17px; cursor: pointer; line-height: 1; padding: 0;
}
.admin-btn:active { background: var(--primary-soft); }

/* ---------- 账号管理 / Accounts ---------- */
#accounts-screen { background: var(--bg); }
#accounts-container { flex: 1; padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; gap: 14px; }
.acct-panel { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.acct-panel h2 { margin: 0 0 12px; font-size: 16px; }
.acct-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.acct-row:last-child { border-bottom: none; }
.acct-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; flex-shrink: 0;
}
.acct-info { flex: 1; min-width: 0; }
.acct-name { font-weight: 800; font-size: 15px; }
.acct-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.role-badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 800; flex-shrink: 0; }
.role-badge.admin { background: #fdeee0; color: var(--accent); }
.role-badge.staff { background: var(--primary-soft); color: var(--primary); }
.acct-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mini-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 11px;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text);
}
.mini-btn:active { background: var(--primary-soft); }
.mini-btn.danger { color: var(--danger); border-color: #f3c9c9; }
.mini-btn.off { color: var(--muted); }
.acct-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.acct-form .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 700; }
.acct-form .field input, .acct-form .field select {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px; color: var(--text); background: #fbfcfe; font-weight: 500;
}
.acct-form .field input:focus, .acct-form .field select:focus { outline: none; border-color: var(--primary); background: #fff; }
.acct-form .row2 { display: flex; gap: 10px; }
.acct-form .row2 .field { flex: 1; }
.acct-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; margin: 4px 0; }
.acct-sep::before, .acct-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- 盘点操作区按钮组 ---------- */
.count-actions { display: flex; gap: 10px; margin-top: 14px; }
.count-actions .btn { flex: 1; }

/* ---------- 记录行邮件按钮 ---------- */
.email-btn { flex-shrink: 0; margin-right: 8px; }
.session-row .email-btn { margin-right: 6px; }

/* ---------- 发送邮件弹窗 ---------- */
.email-card { max-width: 420px; text-align: left; }
.email-card .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 700; }
.email-card .field input {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px;
  color: var(--text); background: #fbfcfe; font-weight: 500;
}
.email-card .field input:focus { outline: none; border-color: var(--primary); background: #fff; }
.email-preview {
  margin: 8px 0 4px; padding: 10px 12px; max-height: 200px; overflow: auto;
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word;
}

/* ---------- 盘点计划 ---------- */
#plans-screen { background: var(--bg); }
#plans-container { flex: 1; padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; gap: 14px; }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: none; }
.plan-info { flex: 1; min-width: 0; }
.plan-name { font-weight: 800; font-size: 15px; }
.plan-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.plan-tag { font-size: 11px; color: var(--primary); background: var(--primary-soft); padding: 1px 7px; border-radius: 999px; margin-left: 6px; font-weight: 700; }
.plan-emps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.emp-stat { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef1f6; color: #5b6472; border: 1px solid #e1e6ee; }
.emp-stat.pending { background: #fff4e5; color: #b76e00; border-color: #ffe0b0; }
.emp-stat.counting { background: #e8f1ff; color: #1d6fe0; border-color: #c4ddff; }
.emp-stat.done { background: #e7f7ec; color: #1a9c54; border-color: #bfe9cf; }
.emp-stat.pending_review { background: #f3ecff; color: #6b3fd6; border-color: #d9c9f7; }
.emp-stat.rejected { background: #fdeaea; color: #d23b3b; border-color: #f3c9c9; }
.task-card .emp-stat { margin-top: 6px; display: inline-block; }

.emp-list { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0; }
.emp-chk { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.emp-chk input { width: 17px; height: 17px; accent-color: var(--primary); }

.pe-table { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pe-head { display: flex; gap: 8px; font-size: 11px; color: var(--muted); font-weight: 800; padding: 0 2px; }
.pe-head span:nth-child(1) { flex: 0 0 84px; }
.pe-head span:nth-child(2) { flex: 1; min-width: 0; }
.pe-head span:nth-child(3) { flex: 0 0 150px; }
.pe-row { display: flex; gap: 8px; align-items: center; padding: 8px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; }
.pe-sku { flex: 0 0 84px; font-size: 12px; font-weight: 700; color: var(--primary); word-break: break-all; }
.pe-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-unit { color: var(--muted); font-weight: 400; font-size: 12px; }
.pe-inputs { flex: 0 0 150px; display: flex; flex-direction: column; gap: 4px; }
.pe-inputs input, .pe-inputs select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; width: 100%; }
.pe-del { flex-shrink: 0; border: none; background: #fdeaea; color: var(--danger); border-radius: 8px; width: 28px; height: 28px; font-size: 14px; cursor: pointer; }
.plan-editor-card { max-width: 520px; text-align: left; max-height: 92vh; overflow-y: auto; }

/* ---------- 收货快递单号核对 ---------- */
.tabbar .tab span[data-i18n] { white-space: nowrap; }
.ship-card, .ship-editor-card { max-width: 480px; text-align: left; max-height: 92vh; overflow-y: auto; }
.ship-photo-preview { min-height: 8px; text-align: center; }
.ship-task-card { flex-wrap: wrap; align-items: flex-start; }
.ship-task-card .task-main { flex: 1 1 60%; min-width: 0; }
.ship-task-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.ship-task-actions .btn { min-width: 92px; }
.ship-rec { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ship-rec:last-child { border-bottom: none; }
.ship-rec .ci-name { white-space: normal; word-break: break-all; }
.ship-badge { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; vertical-align: middle; border: 1px solid transparent; }
.ship-badge.ok { color: #1a9c54; background: #e7f7ec; border-color: #bfe9cf; }
.ship-badge.dup { color: #b76e00; background: #fff4e5; border-color: #ffd9a0; }
.ship-badge.outside { color: #d23b3b; background: #fdeaea; border-color: #f3c9c9; }
.ship-no-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ship-no-chip { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; background: var(--primary-soft); border: 1px solid var(--line); word-break: break-all; }
.ship-no-list.ok .ship-no-chip { color: #1a7c48; background: #e9f8ef; border-color: #c7ebd5; }
.ship-no-list.missing .ship-no-chip { color: #8a6200; background: #fff8e8; border-color: #ffe3ad; }
.ship-no-list.dup .ship-no-chip { color: #b76e00; background: #fff4e5; border-color: #ffd9a0; }
.ship-no-list.outside .ship-no-chip { color: #c22c2c; background: #fdeaea; border-color: #f3c9c9; }
.ship-sub-row { font-size: 13px; color: var(--text); padding: 7px 0; border-bottom: 1px solid var(--line); }
.ship-sub-row:last-child { border-bottom: none; }

/* 我的任务卡 */
.task-card { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--primary-soft); border-radius: 12px; }
.task-main { flex: 1; min-width: 0; }
.task-name { font-weight: 800; font-size: 15px; }
.task-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 计划清单项（盘点中） */
.plan-item.done .ci-name::after { content: ' ✓'; color: var(--ok); }
.ci-extra { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 3px; }
.ci-extra .pos { color: var(--ok); font-weight: 700; }
.ci-extra .neg { color: var(--danger); font-weight: 700; }
.times { color: var(--muted); font-weight: 700; font-size: 11px; }
.note-badge { display: inline-flex; align-items: center; gap: 2px; color: #8a5a00; background: #fff4d6; border: 1px solid #f0d28a; border-radius: 999px; padding: 0 6px; font-weight: 700; font-size: 11px; }
.badge-extra { display: inline-flex; align-items: center; margin-left: 6px; color: #b76e00; background: #fff4e5; border: 1px solid #ffd9a0; border-radius: 999px; padding: 1px 8px; font-weight: 800; font-size: 11px; vertical-align: middle; }
.list-sep { font-size: 12px; font-weight: 800; color: #b76e00; background: #fff7ea; border: 1px solid #ffd9a0; border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; }
.review-approve { margin-left: 6px; }
.review-reject { margin-left: 4px; }
.ci-expand { width: 30px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; color: var(--text); }
.count-item.merged .ci-sku { display: flex; gap: 4px; align-items: center; }

/* 合并明细的逐条记录 */
.rec-list { flex-basis: 100%; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.rec-sub { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); padding-left: 66px; }
.rec-sub .rec-q { font-weight: 800; color: var(--text); }
.rec-sub .rec-note { flex-basis: 100%; color: #8a5a00; background: #fff9ea; border: 1px solid #f0e0b8; border-radius: 8px; padding: 4px 8px; font-size: 12px; line-height: 1.4; word-break: break-word; }
.plan-note { margin-top: 4px; color: #8a5a00; background: #fff9ea; border: 1px solid #f0e0b8; border-radius: 8px; padding: 4px 8px; font-size: 12px; line-height: 1.4; word-break: break-word; }
.rec-del { margin-left: auto; border: none; background: #fdeaea; color: var(--danger); border-radius: 8px; width: 26px; height: 26px; font-size: 13px; cursor: pointer; }

/* 录入实点数弹窗 */
.qty-card { max-width: 360px; text-align: center; }
.qty-card #qty-input { text-align: center; }

/* 货架陈列 / Shelf Display */
.shelf-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); }
.shelf-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.shelf-field select, .shelf-field input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.shelf-field input { width: 64px; }
.shelf-grid { padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.shelf-group { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.shelf-group-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--primary-soft); border-bottom: 1px solid var(--line); font-weight: 800; }
.shelf-name { font-size: 15px; }
.shelf-name-input { font-size: 15px; font-weight: 800; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; flex: 1; min-width: 0; }
.shelf-count { margin-left: auto; font-size: 12px; color: var(--muted); background: #fff; border-radius: 999px; padding: 2px 10px; }
.shelf-layer { display: flex; align-items: stretch; border-bottom: 1px dashed var(--line); }
.shelf-layer:last-child { border-bottom: none; }
.layer-label { flex: 0 0 56px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); background: #fafafa; writing-mode: vertical-rl; text-orientation: mixed; }
.layer-slots { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
.shelf-slot { position: relative; width: 84px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; cursor: pointer; }
.shelf-slot .thumb { width: 100%; height: 72px; background: #f4f4f6; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.shelf-slot .slot-info { padding: 4px 6px; }
.slot-name { font-size: 11px; line-height: 1.25; max-height: 28px; overflow: hidden; }
.slot-sku { font-size: 10px; color: var(--muted); }
.slot-move { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.slot.empty { width: 100%; border-style: dashed; color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 16px; }
.shelf-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.shelf-empty p { margin-bottom: 14px; }

/* ============================================================
   统一后台 v2 · 三模块侧边栏 + 响应式抽屉
   ============================================================ */
#app-screen.app-shell { display: flex; flex-direction: row; }
.app-shell #view-container { padding: 14px; }

/* 侧边栏（桌面：常驻；移动：抽屉）—— 对齐 STZ 后台 Demo 深色导航 */
.sidebar {
  width: 236px; flex: none; height: 100%;
  background: #22262e; color: #cfd3da;
  display: flex; flex-direction: column; overflow-y: auto;
  border-right: 1px solid #2e333c;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
  border-bottom: 1px solid #2e333c; flex: none;
}
.sidebar-brand .brand-icon { font-size: 18px; }
.sidebar-brand .brand-title { color: #fff; font-size: 18px; font-weight: 600; line-height: 1.1; }
.sidebar-brand .brand-sub { font-size: 11px; color: #8b9099; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 10px 8px; }
.sb-group { margin-bottom: 6px; }
.sb-group-title {
  font-size: 11px; font-weight: 600; letter-spacing: .5px; color: #79808a;
  padding: 14px 12px 6px; text-transform: none;
}
.sb-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: #cfd3da; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: left; transition: .12s;
}
.sb-item:hover { background: #2c313b; color: #fff; }
.sb-item.active { background: #343b46; color: #fff; border-color: #444c59; box-shadow: none; }
.sb-ico { font-size: 16px; width: 18px; text-align: center; flex: none; opacity: .9; }
.sb-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot {
  flex: none; padding: 12px 16px; border-top: 1px solid #2e333c;
}
.sb-user { color: #fff; font-size: 14px; font-weight: 600; }
.sb-role { color: #8b9099; font-size: 12px; margin-top: 2px; }

/* 抽屉遮罩（仅移动端出现） */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }

/* 移动端汉堡按钮：桌面隐藏 */
.stz-menu-btn { display: none; }

/* 主内容区 */
.app-main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }

/* 类目（只读）与权限矩阵 */
.cats-list { max-height: 56vh; overflow-y: auto; margin-top: 8px; }
.cat-group { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-big { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.cat-subs { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-sub { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }

.perm-card { max-width: 820px; }
.perm-matrix { max-height: 60vh; overflow-y: auto; margin: 10px 0; }
.pm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pm-table th, .pm-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.pm-table thead th { color: var(--muted); font-weight: 800; }
.pm-table .pm-label { text-align: left; font-weight: 700; }
.pm-table td input { width: 18px; height: 18px; }

/* 响应式：≤860px 手机端 —— 侧边栏变抽屉 */
@media (max-width: 860px) {
  .stz-menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 8px 30px rgba(0,0,0,.35); width: 82%; max-width: 300px;
  }
  .sidebar.open { transform: translateX(0); }
  /* 表格横滚 */
  .count-table, .ship-table, table.wide { display: block; width: 100%; overflow-x: auto; white-space: nowrap; }
}

/* 响应式：手机端隐藏侧边栏常驻，确保 app-main 占满宽度（桌面 hover 不受影响） */
@media (min-width: 861px) {
  .drawer-mask { display: none !important; }
}

/* ==================== V1.0 数据导入工具 ==================== */
.di-wrap { display: flex; flex-direction: column; gap: 14px; max-width: 1180px; }
.di-intro h2 { font-size: 18px; margin: 0 0 6px; }
.di-intro p { margin: 0 0 12px; line-height: 1.6; }
.di-formula {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13.5px; font-weight: 700; color: var(--text);
}
.di-formula .di-k { color: var(--primary-d); }
.di-formula .di-note { grid-column: 1 / -1; font-weight: 500; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line2); padding-top: 8px; }
.di-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.di-upload { display: flex; flex-direction: column; gap: 10px; }
.dm-card-h { font-size: 14px; font-weight: 800; color: var(--text); }
.di-upload .dm-btn { display: inline-flex; align-items: center; justify-content: center; }
.dm-btn.dm-outline { background: #fff; color: var(--primary-d); border: 1.5px solid var(--primary); }
.dm-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--panel2); }
.di-meta { font-size: 13px; line-height: 1.7; margin-top: 2px; }
.di-meta b { color: var(--primary-d); font-size: 15px; }
.di-err, .di-errlist { color: var(--danger); font-size: 12.5px; }
.di-err { margin-top: 6px; }
.di-action { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.di-counts { flex: 1; font-size: 14px; }
.di-counts b { color: var(--primary-d); font-size: 17px; }
.di-report { font-size: 13.5px; line-height: 1.6; }
.di-report.di-ok { border-left: 4px solid var(--ok); }
.di-report.di-err { border-left: 4px solid var(--danger); }
.di-report.di-running { border-left: 4px solid var(--primary); }
.di-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.di-stats span { color: var(--muted); }
.di-stats b { color: var(--text); }
.di-errlist { margin: 8px 0 0; padding-left: 18px; }
@media (max-width: 980px) { .di-grid { grid-template-columns: 1fr; } .di-formula { grid-template-columns: 1fr; } }
