/* =========================================================================
   库存进销存管理系统 —— 样式表
   零依赖、无外部字体/CDN。移动端优先，<768px 用底部标签栏 + 卡片式表格。
   ========================================================================= */

/* =========================================================================
   1. 设计变量
   ========================================================================= */

:root {
  /* 主色：深靛蓝 */
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;

  /* 状态色 */
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --info: #0369a1;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;

  /* 中性色 */
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-4: #9ca3af;

  /* 形状与动效 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 6px 16px rgba(17, 24, 39, 0.1);
  --shadow-lg: 0 18px 40px rgba(17, 24, 39, 0.18);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* 尺寸 */
  --topbar-h: 56px;
  --tabbar-h: 58px;
  --sidebar-w: 232px;
  --content-max: 1600px; /* 宽屏上限。原来写 1280px，在 1920/2560 显示器上两侧会空出大片空白 */

  /* 中文字体回退栈（系统字体，无外部请求） */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* =========================================================================
   2. 基础重置
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

p {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

dl,
dd,
dt {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.ta-right {
  text-align: right;
}

.ta-center {
  text-align: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.num {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.num-pos {
  color: var(--success);
}

.num-neg {
  color: var(--danger);
}

.num-zero {
  color: var(--text-3);
}

/* 启动占位 & noscript */
.boot-splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}

.boot-text {
  color: var(--text-3);
}

.noscript {
  max-width: 520px;
  margin: 15vh auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

/* =========================================================================
   3. 顶部栏 / 侧边栏 / 底部标签栏（外壳）
   ========================================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark.lg {
  width: 42px;
  height: 42px;
  font-size: 20px;
  border-radius: 12px;
}

.brand-text {
  font-size: 15px;
  white-space: nowrap;
}

.topbar-spacer {
  flex: 1;
  min-width: 8px;
}

.topbar-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

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

.user-name {
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}

.role-admin {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-200);
}

.role-staff {
  background: #f3f4f6;
  color: var(--text-2);
  border-color: var(--border);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.icon-btn:hover {
  background: #f3f4f6;
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn.danger {
  color: var(--danger);
}

.icon-btn.danger:hover {
  background: var(--danger-bg);
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 50;
}

.dropdown.is-open {
  display: block;
  animation: pop-in 160ms ease-out;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-item.is-danger {
  color: var(--danger);
}

.dropdown-item.is-danger:hover {
  background: var(--danger-bg);
}

/* 布局：手机单列，桌面侧边栏 + 内容 */
.layout {
  display: block;
  min-height: calc(100dvh - var(--topbar-h));
}

.sidebar {
  display: none;
}

.content {
  padding: 14px 14px calc(var(--tabbar-h) + 26px);
  max-width: var(--content-max);
  margin: 0 auto;
}

.nav-group {
  margin-bottom: 14px;
}

.nav-group-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: #f3f4f6;
  color: var(--text);
  text-decoration: none;
}

.nav-item.is-active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.tab-item {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.tab-item:hover {
  text-decoration: none;
  background: #f9fafb;
}

.tab-item.is-active {
  color: var(--primary);
  font-weight: 600;
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

/* 手机「更多」抽屉 */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: flex-end;
  animation: fade-in 160ms ease-out;
}

.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: 4px auto 12px;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  width: 100%;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.sheet-item:hover {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary-700);
  text-decoration: none;
}

.sheet-item.is-active {
  border-color: var(--primary);
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}

.sheet-item.is-danger {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-bg);
  margin-top: 8px;
}

.sheet-icon {
  font-size: 20px;
}

/* =========================================================================
   4. 页面标题、工具栏、卡片
   ========================================================================= */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.page-title {
  font-size: 19px;
}

.page-desc {
  color: var(--text-3);
  font-size: 12.5px;
  margin-top: 3px;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-title {
  font-size: 14.5px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-body {
  padding: 14px;
}

.card-table .card-body {
  padding: 0;
}

.section-title {
  font-size: 13.5px;
  color: var(--text-2);
  margin: 4px 0 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-group,
.date-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.range-sep,
.range-label {
  color: var(--text-3);
  font-size: 12.5px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-label {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* =========================================================================
   5. 按钮
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition),
    box-shadow var(--transition), transform var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-600);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: #f9fafb;
  color: var(--text);
  border-color: var(--text-4);
}

.btn-subtle {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-100);
}

.btn-subtle:hover:not(:disabled) {
  background: var(--primary-100);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* =========================================================================
   6. 表格（桌面表格 / 手机卡片）
   ========================================================================= */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.data-table tbody tr.row-low-stock {
  background: #fffdf5;
}

.data-table tbody tr.row-low-stock:hover {
  background: var(--warn-bg);
}

.data-table tbody tr.row-low-stock td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}

.data-table tbody tr.row-diff td {
  background: #fffdf5;
}

.data-table tbody tr.row-invalid td {
  background: var(--danger-bg);
}

.cell-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cell-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.cell-sub {
  font-size: 12px;
  color: var(--text-4);
  word-break: break-word;
}

.stock-cell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.stock-cell .unit {
  color: var(--text-4);
  font-size: 12px;
}

.stock-cell.is-low .num {
  color: var(--warn);
  font-weight: 700;
}

.col-actions {
  white-space: nowrap;
}

.col-rank {
  width: 54px;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: #f3f4f6;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.rank-1 {
  background: #fef3c7;
  color: #92400e;
}

.rank-2 {
  background: #e5e7eb;
  color: #374151;
}

.rank-3 {
  background: #ffedd5;
  color: #9a3412;
}

.stocktake-table .qty-input {
  width: 96px;
  text-align: right;
  margin-left: auto;
  display: block;
}

.stocktake-table .cell-error {
  font-size: 11.5px;
  color: var(--danger);
  margin-top: 4px;
}

.diff-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

/* =========================================================================
   7. 徽标 / 提示条 / 分段控件
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-default {
  background: #f3f4f6;
  color: var(--text-2);
  border-color: var(--border);
}

.badge-primary {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-200);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}

.badge-in {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge-out {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  margin-bottom: 10px;
}

.banner-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #991b1b;
}

.banner-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}

.banner-icon {
  flex: none;
}

.banner-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: #f3f4f6;
  border-radius: var(--radius-pill);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-2);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  position: relative;
  transition: background var(--transition);
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.tab:hover {
  color: var(--text);
  background: #f9fafb;
}

.tab.is-active {
  color: var(--primary-700);
  border-bottom-color: var(--primary);
}

.tab-ic {
  font-size: 15px;
}

/* =========================================================================
   8. 表单
   ========================================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.field-label .req {
  color: var(--danger);
  margin-left: 3px;
}

.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  min-width: 0;
}

.input:hover:not(:disabled) {
  border-color: var(--text-4);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.input:disabled,
.input[readonly] {
  background: #f9fafb;
  color: var(--text-3);
  cursor: not-allowed;
}

textarea.input {
  resize: vertical;
  min-height: 38px;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.input.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 0;
}

.field.has-error .field-error {
  min-height: 16px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-4);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.form-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
  font-size: 13px;
  margin-bottom: 12px;
  word-break: break-word;
}

.search-input {
  min-width: 190px;
}

.input-date {
  width: auto;
  min-width: 138px;
}

.date-range .input-date {
  width: auto;
}

/* =========================================================================
   9. 弹窗
   ========================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 180ms ease-out;
  overflow-y: auto;
}

.modal-backdrop.modal-out {
  animation: fade-out 180ms ease-out forwards;
}

.modal {
  width: 100%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-out .modal {
  animation: sheet-down 180ms ease-out forwards;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 2;
}

.modal-title {
  font-size: 15.5px;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  word-break: break-word;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky;
  bottom: 0;
}

.modal-foot-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.modal-note {
  font-size: 12px;
  color: var(--text-3);
}

.confirm-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-message {
  font-size: 13.5px;
  color: var(--text-2);
  word-break: break-word;
}

.confirm-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.confirm-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  color: var(--text-2);
}

.confirm-warn {
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}

.diff-preview {
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.diff-preview-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.dp-name {
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-more {
  font-size: 12px;
  color: var(--text-4);
}

/* =========================================================================
   10. 提示（toast）
   ========================================================================= */

.toast-wrap {
  position: fixed;
  z-index: 100;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 14px);
  width: min(94vw, 460px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  animation: toast-in 200ms ease-out;
}

.toast-out {
  animation: toast-out 200ms ease-out forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--text-3);
  flex: none;
}

.toast-success .toast-icon {
  background: var(--success);
}

.toast-error .toast-icon {
  background: var(--danger);
}

.toast-warning .toast-icon {
  background: var(--warn);
}

.toast-info .toast-icon {
  background: var(--info);
}

.toast-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  color: var(--text);
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--text-4);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.toast-close:hover {
  color: var(--text-2);
}

/* =========================================================================
   11. 加载态 / 空状态
   ========================================================================= */

.spinner {
  width: var(--sp, 18px);
  height: var(--sp, 18px);
  border-radius: 50%;
  border: 2px solid var(--primary-100);
  border-top-color: var(--primary);
  display: inline-block;
  animation: spin 700ms linear infinite;
  flex: none;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 10px;
  color: var(--text-3);
  font-size: 13px;
}

.sk-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.sk-line {
  display: flex;
  gap: 12px;
}

.sk {
  background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
}

.sk-bar {
  height: 12px;
  flex: 1;
}

.sk-title {
  height: 18px;
  max-width: 240px;
  margin-bottom: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 30px;
  line-height: 1;
}

.empty-title {
  font-weight: 600;
  color: var(--text-2);
}

.empty-desc {
  font-size: 12.5px;
  color: var(--text-4);
  max-width: 380px;
}

.empty-action {
  margin-top: 8px;
}

.empty-error .empty-title {
  color: var(--danger);
}

/* =========================================================================
   12. 分页
   ========================================================================= */

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.pager-info {
  font-size: 12.5px;
  color: var(--text-3);
}

.pager-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.pager-btn {
  min-width: 32px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.pager-btn:hover:not(:disabled) {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-700);
}

.pager-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-gap {
  color: var(--text-4);
  padding: 0 2px;
}

/* =========================================================================
   13. 概览卡片 / 图表
   ========================================================================= */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.metric:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.metric-label {
  font-size: 12.5px;
  color: var(--text-3);
}

.metric-icon {
  font-size: 15px;
  opacity: 0.85;
}

.metric-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  word-break: break-all;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--text-4);
  margin-top: 2px;
}

.metric-primary .metric-value {
  color: var(--primary-700);
}

.metric-pos .metric-value {
  color: var(--success);
}

.metric-neg .metric-value {
  color: var(--danger);
}

.metric-warn .metric-value {
  color: var(--warn);
}

.chart-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 250px;
}

.chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-2);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  flex: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 138px;
  padding: 8px 10px;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.chart-tooltip[hidden] {
  display: none;
}

.tt-date {
  font-weight: 700;
  margin-bottom: 4px;
}

.tt-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tt-label {
  flex: 1;
  color: #d1d5db;
}

.tt-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.chart-hint {
  font-size: 11.5px;
  color: var(--text-4);
}

/* 低库存列表 */
.low-stock-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.low-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.low-stock-row:last-child {
  border-bottom: 0;
}

.low-stock-row:hover {
  background: var(--warn-bg);
}

.ls-left {
  min-width: 0;
}

.ls-name {
  font-weight: 600;
  word-break: break-word;
}

.ls-sub {
  font-size: 12px;
  color: var(--text-4);
}

.ls-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}

.ls-warn,
.ls-suggest {
  font-size: 11.5px;
  color: var(--text-4);
}

/* =========================================================================
   14. 详情 / 明细 / 合计
   ========================================================================= */

.desc-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.desc-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.desc-row:last-child {
  border-bottom: 0;
}

.desc-row dt {
  width: 92px;
  flex: none;
  color: var(--text-3);
  font-size: 12.5px;
}

.desc-row dd {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.doc-detail-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.doc-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.doc-total-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}

.doc-total-item .dt-label {
  color: var(--text-3);
}

.doc-total-item .dt-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.doc-total-item.is-primary .dt-value {
  color: var(--primary-700);
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.mini-metric {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.mini-metric.is-low {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.mini-label {
  font-size: 11.5px;
  color: var(--text-3);
}

.mini-value {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  word-break: break-all;
}

/* =========================================================================
   15. 明细行编辑器
   ========================================================================= */

.items-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.items-head {
  display: none;
}

.items-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition), background var(--transition);
}

.item-row.has-error {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.item-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.item-main .cell-product {
  grid-column: 1 / -1;
}

.item-main .cell-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--primary-700);
}

.item-main .cell-remove {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.item-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  word-break: break-word;
}

.items-foot {
  display: flex;
  justify-content: flex-start;
}

.items-editor .field-hint {
  margin-top: 2px;
}

/* 商品选择器 */
.picker {
  position: relative;
  display: flex;
  align-items: center;
}

.picker-input {
  padding-right: 30px;
}

.picker-caret {
  position: absolute;
  right: 2px;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--text-4);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.picker-caret:hover {
  background: #f3f4f6;
  color: var(--text-2);
}

.picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.picker-panel[hidden] {
  display: none;
}

.picker-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.picker-opt:last-child {
  border-bottom: 0;
}

.picker-opt:hover,
.picker-opt.is-active {
  background: var(--primary-50);
}

.picker-opt-main {
  min-width: 0;
}

.picker-opt-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-opt-sub {
  font-size: 11.5px;
  color: var(--text-4);
}

.picker-opt-stock {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex: none;
}

.picker-opt-stock.is-low {
  color: var(--warn);
  font-weight: 700;
}

.picker-empty {
  padding: 12px;
  color: var(--text-4);
  font-size: 12.5px;
  text-align: center;
}

/* 底部固定操作条 */
.sticky-actions {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 8px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(6px);
}

.sticky-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--text-2);
  min-width: 0;
}

.sticky-total {
  font-weight: 600;
  color: var(--text);
}

.sticky-warn {
  color: var(--warn);
}

.sticky-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* =========================================================================
   16. 报表
   ========================================================================= */

.report-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
}

.summary-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.summary-card.is-primary {
  background: linear-gradient(135deg, var(--primary-50), #fff);
  border-color: var(--primary-200);
}

.summary-label {
  font-size: 12.5px;
  color: var(--text-3);
}

.summary-value {
  font-size: 23px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--primary-700);
  margin-top: 4px;
  word-break: break-all;
}

/* =========================================================================
   17. 登录 / 初始化
   ========================================================================= */

.auth-root {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 55%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 22px 20px 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-brand .brand-text {
  font-size: 16px;
  font-weight: 700;
}

.auth-title {
  font-size: 20px;
}

.auth-subtitle {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .field {
  gap: 6px;
}

.auth-notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  color: var(--info);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  background: var(--surface);
  padding: 16px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.center-page {
  min-height: 60dvh;
  display: grid;
  place-items: center;
}

/* =========================================================================
   18. 成员 / 个人中心 / 维护弹窗
   ========================================================================= */

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.profile-name-box {
  min-width: 0;
}

.profile-name {
  font-size: 17px;
  font-weight: 700;
}

.profile-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
}

.ref-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-tip {
  font-size: 12.5px;
  color: var(--text-3);
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46dvh;
  overflow-y: auto;
}

.ref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ref-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  word-break: break-word;
}

.ref-order {
  font-size: 11.5px;
  color: var(--text-4);
}

.ref-row-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.ref-actions {
  display: flex;
  justify-content: flex-start;
}

/* 导入 */
.import-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.import-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-body input[type="file"] {
  padding: 8px;
  background: var(--surface-2);
}

/* 盘点差异统计 */
.diff-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.diff-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
}

.ds-label {
  color: var(--text-3);
}

.ds-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

/* =========================================================================
   19. 动画
   ========================================================================= */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(14px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes sheet-down {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(16px);
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    transform: translateY(-4px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* =========================================================================
   20. 平板（≥600px）
   ========================================================================= */

@media (min-width: 600px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .desc-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
  }

  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .items-head,
  .item-main {
    display: grid;
    grid-template-columns: minmax(0, 3fr) 100px 120px 120px 40px;
    gap: 8px;
    align-items: center;
  }

  .items-head {
    display: grid;
    padding: 0 10px 2px;
    font-size: 12px;
    color: var(--text-3);
    font-weight: 600;
  }

  .item-row {
    padding: 8px 10px;
  }

  .item-main .cell-product {
    grid-column: auto;
  }

  .item-main .cell-total {
    justify-content: flex-end;
  }

  .item-main .cell-remove {
    justify-content: center;
  }

  .sticky-actions {
    bottom: 10px;
  }

  .toast-wrap {
    bottom: 18px;
  }
}

/* =========================================================================
   21. 桌面（≥768px）：左侧边栏 + 表格模式
   ========================================================================= */

@media (min-width: 768px) {
  .layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    align-items: start;
  }

  .sidebar {
    display: block;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100dvh - var(--topbar-h));
    overflow-y: auto;
    padding: 14px 10px;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }

  .content {
    padding: 18px 20px 40px;
  }

  .tabbar {
    display: none;
  }

  .modal-backdrop {
    align-items: center;
    padding: 26px 16px;
  }

  .modal {
    max-width: 560px;
    max-height: 88dvh;
    border-radius: var(--radius-lg);
    animation: pop-in 180ms ease-out;
  }

  .modal-lg {
    max-width: 820px;
  }

  .modal-sm {
    max-width: 440px;
  }

  .modal-head {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .toast-wrap {
    left: auto;
    right: 18px;
    transform: none;
    width: 360px;
  }

  .sticky-actions {
    bottom: 16px;
  }

  .page-title {
    font-size: 21px;
  }
}

/* 超宽屏（≥1700px）：干脆铺满整个可用宽度，不再居中留白 */
@media (min-width: 1700px) {
  .content {
    max-width: none;
  }
}

/* =========================================================================
   22. 手机（<768px）：卡片式表格、隐藏次要列
   ========================================================================= */

@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }

  .data-table {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody,
  .data-table tfoot {
    display: block;
  }

  .data-table tbody tr {
    display: block;
    padding: 8px 12px;
    border-bottom: 6px solid #f1f2f6;
    background: var(--surface);
  }

  .data-table tbody tr.row-low-stock {
    background: #fffdf5;
    box-shadow: inset 3px 0 0 var(--warn);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    flex: none;
    max-width: 44%;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-align: left;
    padding-top: 2px;
  }

  .data-table tbody td > * {
    min-width: 0;
  }

  /* 商品名 / 单据号这类主内容占整行，标签隐藏 */
  .data-table tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 8px;
  }

  .data-table tbody td:first-child::before {
    display: none;
  }

  .data-table tbody td.cell-main {
    display: block;
    text-align: left;
  }

  .data-table tbody td.cell-main::before {
    display: none;
  }

  .data-table tbody td.col-actions,
  .data-table tbody td[data-label="操作"] {
    justify-content: flex-end;
    padding-top: 9px;
    border-top: 1px dashed var(--border);
    margin-top: 4px;
  }

  .data-table tbody td.col-actions::before,
  .data-table tbody td[data-label="操作"]::before {
    display: none;
  }

  .row-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .stock-cell {
    justify-content: flex-end;
  }

  .stocktake-table {
    display: block;
  }

  .stocktake-table thead {
    display: none;
  }

  .stocktake-table tbody tr {
    display: block;
    padding: 10px 12px;
    border-bottom: 6px solid #f1f2f6;
  }

  .stocktake-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }

  .stocktake-table tbody td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
  }

  .stocktake-table tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 6px;
  }

  .stocktake-table tbody td:first-child::before {
    display: none;
  }

  .stocktake-table .qty-input {
    width: 120px;
  }

  .data-table tfoot tr {
    display: block;
  }

  .data-table tfoot td {
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }

  .data-table tfoot td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
  }

  .search-input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .toolbar-left,
  .toolbar-right,
  .filter-group,
  .date-range {
    width: 100%;
  }

  .filter-group .input,
  .date-range .input-date {
    flex: 1 1 140px;
  }

  .page-head-actions {
    width: 100%;
  }

  .btn {
    flex: 0 1 auto;
  }

  .sticky-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sticky-btns {
    margin-left: 0;
    width: 100%;
  }

  .sticky-btns .btn {
    flex: 1;
  }

  .modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-foot-btns {
    margin-left: 0;
    width: 100%;
  }

  .modal-foot-btns .btn {
    flex: 1;
  }

  .desc-row {
    flex-direction: column;
    gap: 2px;
  }

  .desc-row dt {
    width: auto;
  }
}

/* 很窄的手机（<380px） */
@media (max-width: 379px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .item-main {
    grid-template-columns: 1fr;
  }

  .brand-text {
    display: none;
  }

  .user-name {
    max-width: 80px;
  }
}

/* 打印（导出前预览） */
@media print {
  .topbar,
  .sidebar,
  .tabbar,
  .toolbar,
  .page-head-actions,
  .pager,
  .toast-wrap {
    display: none !important;
  }

  .content {
    padding: 0;
  }

  body {
    background: #fff;
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================================
   26. 视觉打磨层（美化覆盖）
   ---------------------------------------------------------------------------
   原则：只覆盖「视觉属性」——颜色、阴影、圆角、间距、字重、过渡、背景。
        不改 display / position / grid-template 等布局属性，
        也不新增或重命名任何类名，所以不会破坏现有功能与交互。

   手机端（<768px）的表格是「卡片模式」，行背景被用作卡片本身，
   因此所有斑马纹/悬停底色都只在 ≥768px 生效，避免把手机端搞花。
   ========================================================================= */

:root {
  /* 更柔和的层次阴影（原来的阴影太浅，卡片看起来是"贴"在背景上的） */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 2px 8px -2px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 26px -8px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 26px 52px -14px rgba(16, 24, 40, 0.24);

  /* 焦点环：键盘操作和无障碍都靠它 */
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.16);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --border: #e6e8ef;
  --border-strong: #cfd4e0;
  --surface-2: #f8f9fc;
}

/* ---------- 页面底色：极淡的双色光晕，避免整片死灰 ---------- */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 6% -10%, rgba(99, 102, 241, 0.1), transparent 62%),
    radial-gradient(900px 460px at 100% -6%, rgba(139, 92, 246, 0.08), transparent 58%);
  background-attachment: fixed;
}

/* ---------- 顶部栏：毛玻璃 + 极细阴影 ---------- */
.topbar {
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 20px -20px rgba(16, 24, 40, 0.35);
}

.brand-mark {
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.7);
}

.brand-text {
  letter-spacing: 0.01em;
  font-weight: 700;
}

/* ---------- 侧边栏与导航 ---------- */
.sidebar {
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--border);
}

.nav-group-title {
  color: var(--text-4);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.09em;
}

.nav-item {
  border-radius: 10px;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.nav-item:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}

.nav-item.is-active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(79, 70, 229, 0.95);
}

/* ---------- 卡片：把"贴"改成"浮" ---------- */
.card {
  border: 1px solid rgba(16, 24, 40, 0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.06);
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfe 100%);
}

.card-title {
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
}

.card-body {
  padding: 16px;
}

.card-table .card-body {
  padding: 0;
}

/* ---------- 指标卡（仪表盘）：顶部彩条 + 图标色块 ---------- */
.metric {
  position: relative;
  overflow: hidden;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(16, 24, 40, 0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metric::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #a5b4fc, #c4b5fd);
}

.metric:hover {
  transform: translateY(-2px);
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary-50);
  font-size: 15px;
  opacity: 1;
}

.metric-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}

.metric-value {
  margin-top: 7px;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -0.012em;
}

.metric-primary::after {
  background: linear-gradient(90deg, #818cf8, #6366f1);
}

.metric-pos::after {
  background: linear-gradient(90deg, #34d399, #059669);
}

.metric-neg::after {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.metric-warn::after {
  background: linear-gradient(90deg, #fbbf24, #d97706);
}

.metric-pos .metric-icon {
  background: var(--success-bg);
}

.metric-neg .metric-icon {
  background: var(--danger-bg);
}

.metric-warn .metric-icon {
  background: var(--warn-bg);
}

/* ---------- 按钮：渐变主色 + 轻微抬升 ---------- */
.btn {
  border-radius: 10px;
  padding: 9px 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(180deg, #5b52ea 0%, #4f46e5 100%);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 8px 18px -10px rgba(79, 70, 229, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(16, 24, 40, 0.14), 0 14px 26px -14px rgba(79, 70, 229, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-700);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.tab-item:focus-visible,
.pager-btn:focus-visible,
.seg-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* ---------- 输入框：悬停有反馈，聚焦有光环 ---------- */
.input {
  border-radius: 10px;
  border-color: var(--border-strong);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:hover:not(:disabled) {
  border-color: var(--text-4);
}

.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

/* ---------- 表格：只在桌面加斑马纹与悬停色 ----------
   手机上表格会变成"一行一张卡片"，行背景就是卡片底色，
   这时加斑马纹会让卡片深浅不一，所以下面全部限定在 ≥768px。 */
@media (min-width: 768px) {
  .data-table thead th {
    background: #f7f8fc;
    color: var(--text-2);
    font-weight: 650;
    letter-spacing: 0.035em;
    border-bottom: 1px solid var(--border);
  }

  .data-table tbody tr:nth-child(even) {
    background: #fcfcfe;
  }

  .data-table tbody tr:hover {
    background: var(--primary-50);
  }

  .data-table tbody td {
    border-bottom: 1px solid rgba(16, 24, 40, 0.055);
  }

  .data-table tbody tr:last-child td {
    border-bottom: 0;
  }
}

/* ---------- 徽标 ---------- */
.badge {
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

/* ---------- 空状态：图标加个柔和的圆底 ---------- */
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-50) 0%, #f5f3ff 100%);
  font-size: 24px;
}

.empty-title {
  font-size: 15px;
  font-weight: 650;
}

/* ---------- 骨架屏：流光 ---------- */
.sk-bar,
.sk-line,
.sk-title {
  background: linear-gradient(90deg, #eef0f6 25%, #f8f9fc 37%, #eef0f6 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------- 手机底部标签栏 ---------- */
.tabbar {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

.tab-item {
  transition: color var(--transition), transform var(--transition);
}

.tab-item.is-active {
  color: var(--primary);
  font-weight: 650;
}

.tab-item.is-active .tab-ic {
  transform: translateY(-1px) scale(1.08);
}

/* ---------- 分页 ---------- */
.pager-btn {
  border-radius: 9px;
}

.pager-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px -10px rgba(79, 70, 229, 0.95);
}

/* ---------- 弹窗 / 提示 / 底部操作条 ---------- */
.modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.toast {
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.sticky-actions {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

/* ---------- 标题排版 ---------- */
.page-title {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.page-desc {
  color: var(--text-3);
}

/* ---------- 滚动条 ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #c9cfdd transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #cfd4e0;
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #b6bdcd;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 文字选中色 ---------- */
::selection {
  background: rgba(99, 102, 241, 0.22);
}

/* ---------- 打印：去掉背景光晕 ---------- */
@media print {
  body {
    background-image: none;
  }
}

/* ---------- 减少动效偏好：关掉抬升与流光 ---------- */
@media (prefers-reduced-motion: reduce) {
  .metric:hover,
  .btn-primary:hover:not(:disabled) {
    transform: none;
  }
  .sk-bar,
  .sk-line,
  .sk-title {
    animation: none;
  }
}

/* =========================================================================
   27. 盘点「快速录入」条
   货号 → 回车 → 数量 → 回车，键盘连续录入 / 扫码枪扫描
   ========================================================================= */

.quick-entry {
  background: var(--surface);
  border: 1px solid rgba(16, 24, 40, 0.07);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.quick-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quick-line .quick-sku {
  flex: 1 1 260px;
  min-width: 180px;
  font-size: 15px;
}

.quick-line .quick-qty {
  flex: 0 0 92px;
  width: 92px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quick-line .btn {
  flex: 0 0 auto;
}

.quick-progress {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quick-hint {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
  min-height: 18px;
}

.quick-hint-error {
  color: var(--danger);
}

.quick-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 767px) {
  /* 窄屏：货号独占一行，数量与按钮一行，进度跟在后面 */
  .quick-line .quick-sku {
    flex: 1 1 100%;
    font-size: 16px; /* iOS 聚焦小于 16px 的输入框会自动放大页面 */
  }

  .quick-line .quick-qty {
    flex: 1 1 auto;
    width: auto;
    min-width: 88px;
    font-size: 16px;
  }

  .quick-progress {
    margin-left: auto;
  }
}

/* ---------- 摄像头扫码取景框 ---------- */
.scan-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan-video {
  width: 100%;
  max-height: 58vh;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
}

.scan-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  text-align: center;
}

/* ---------- 带行内按钮的字段（例如条码右侧的扫码按钮） ---------- */
.field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-row .input {
  flex: 1 1 auto;
  min-width: 0;
}

.field-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* =========================================================================
   28. 找货页（平台来单后按货号定位库位）
   ========================================================================= */

.pick-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pick-input {
  flex: 1 1 260px;
  min-width: 0;
  height: 48px;
  font-size: 18px;
}

.pick-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid rgba(16, 24, 40, 0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 库位是这一页唯一的主角，字号给到最大 */
.pick-loc-box {
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--primary-100);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary-50) 0%, #f5f3ff 100%);
}

.pick-loc-label {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.pick-loc {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--primary-700);
  word-break: break-all;
}

.pick-loc-empty {
  color: var(--text-4);
}

.pick-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pick-sku {
  font-size: 15px;
  color: var(--text-2);
}

.pick-name {
  font-size: 18px;
  font-weight: 650;
}

.pick-meta {
  font-size: 13px;
  color: var(--text-3);
}

.pick-actions {
  display: flex;
  gap: 8px;
}

.pick-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pick-loc-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  font-size: 18px;
  text-align: center;
}

.pick-hint {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.pick-hint-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
}

.pick-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pick-cand {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.pick-cand:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.pick-cand-sku {
  flex: 0 0 auto;
  font-size: 13.5px;
  color: var(--text-2);
}

.pick-cand-name {
  flex: 1 1 auto;
  font-size: 14px;
}

.pick-cand-loc {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-700);
}

@media (max-width: 767px) {
  .pick-input {
    font-size: 16px;
  }

  .pick-loc {
    font-size: 36px;
  }
}
/* 商品列表 / 详情里的库位 */
.loc-cell {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  color: var(--primary-700);
  white-space: nowrap;
}

.loc-empty {
  font-weight: 400;
  color: var(--text-4);
}
/* 找货页：按外部货号命中时的提示条 */
.pick-via {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 10px;
}
/* =========================================================================
   29. 库位三段落选择 + 拣货单
   ========================================================================= */

.pick-seg-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pick-seg {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 17px;
}

.pick-sep {
  color: var(--text-4);
  font-weight: 700;
}

.pick-sep.is-hidden,
.pick-seg-row.is-hidden,
.pick-manual.is-hidden {
  display: none;
}

.pick-manual {
  display: flex;
}

.pick-manual .input {
  flex: 1 1 auto;
}

.pick-loc-preview {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
}

.pick-preview-label {
  font-size: 12.5px;
  color: var(--text-3);
}

.pick-loc-preview .mono {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--primary-700);
}

.pick-toggle {
  align-self: flex-start;
  padding: 2px 0;
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- 拣货单 ---------- */

.picklist-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.picklist-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.picklist-stat {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.picklist-stat-label {
  font-size: 12.5px;
  color: var(--text-3);
}

.picklist-stat-value {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.picklist-stat-warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.picklist-stat-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.picklist-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picklist-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid rgba(16, 24, 40, 0.07);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.picklist-row.is-picked {
  opacity: 0.55;
}

.picklist-row.is-picked .picklist-name {
  text-decoration: line-through;
}

.picklist-row.is-missing {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.picklist-check {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  font-size: 17px;
  font-weight: 800;
  color: transparent;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
}

.picklist-check.is-on {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.picklist-loc {
  flex: 0 0 auto;
  min-width: 84px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--primary-700);
}

.picklist-loc-empty {
  font-size: 13px;
  font-weight: 500;
  color: var(--warn);
}

.picklist-loc-missing {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.picklist-info {
  flex: 1 1 auto;
  min-width: 0;
}

.picklist-sku {
  font-size: 13px;
  color: var(--text-2);
}

.picklist-name {
  font-size: 15px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picklist-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.picklist-qty {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

.picklist-del {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  font-size: 16px;
  color: var(--text-4);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.picklist-del:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

@media (max-width: 767px) {
  .picklist-row {
    flex-wrap: wrap;
  }

  .picklist-loc {
    min-width: 0;
    order: -1;
    font-size: 20px;
  }

  .picklist-info {
    flex: 1 1 100%;
    order: 1;
  }

  .picklist-qty,
  .picklist-check,
  .picklist-del {
    order: 0;
  }
}