/* ===== 销售端独立样式（Mobile First） =====
 * 适配规则：
 * 1. 内容区最大宽度600px居中，左右边距12px
 * 2. 字体：标题18px/正文14px/辅助12px，数字加粗突出
 * 3. 卡片：白底+圆角12px+轻阴影，内边距14px，间距10px
 * 4. 可点击区域最小44x44px
 * 5. 输入框高度44px、字体16px（防iOS放大）
 * 6. 底部Tab固定，适配安全区域
 */
.sales-mode {
  background: #f0f2f5;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.sales-mode .sidebar,
.sales-mode .topbar,
.sales-mode .tabbar,
.sales-mode .sidebar-mask { display: none !important; }
/* 销售端所有表单元素强制全屏宽，覆盖管理端全局样式 */
.sales-mode input,
.sales-mode select,
.sales-mode textarea {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
.sales-mode .mainwrap { margin-left: 0 !important; padding-bottom: 72px !important; }
.sales-mode .view {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  overflow-x: visible !important;
}

/* 顶部栏 */
.sales-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2f6cad 100%);
  color: #fff;
  padding: 14px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sales-header .title { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.sales-header .city-select {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}
.sales-header .city-select option { color: #333; }
.sales-header .user-btn {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sales-header .sales-back-btn {
  background: transparent;
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.sales-header .sales-back-btn:active { background: rgba(255,255,255,.15); }

/* 统计卡片 */
.sales-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}
.sales-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sales-stat-card .label { font-size: 12px; color: #8a8f99; margin-bottom: 6px; }
.sales-stat-card .value { font-size: 20px; font-weight: 700; color: #1e3a5f; line-height: 1.2; }
.sales-stat-card .unit { font-size: 11px; color: #aaa; font-weight: 400; margin-left: 2px; }

/* 图表区 */
.sales-chart-wrap {
  background: #fff;
  margin: 0 12px 12px;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sales-chart-wrap .chart-title { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }

/* 卡片列表 */
.sales-card-list { padding: 0 12px; }
.sales-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  transition: transform .1s;
}
.sales-card:active { transform: scale(.98); }
.sales-card .info { flex: 1; min-width: 0; }
.sales-card .info .name { font-size: 16px; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; }
.sales-card .info .sub { font-size: 12px; color: #8a8f99; margin-top: 2px; line-height: 1.5; }
.sales-card .amount { font-size: 22px; font-weight: 700; color: #2f6cad; text-align: right; flex-shrink: 0; }
.sales-card .amount .small { font-size: 11px; color: #999; font-weight: 400; display: block; margin-top: 2px; }
.sales-card .amount .remaining-line { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; }
.sales-card .amount .remaining-line small { font-size: 11px; color: #999; font-weight: 400; }

/* 货柜卡片进度条 */
.sales-card .progress-bar {
  width: 100%;
  height: 6px;
  background: #eef0f4;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}
.sales-card .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f6cad, #4a90d9);
  border-radius: 3px;
  transition: width .3s;
}

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-tag.transit { background: #e0f2fe; color: #0284c7; }
.status-tag.instock { background: #dcfce7; color: #16a34a; }

/* 底部Tab栏 */
.sales-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 200;
}
.sales-tabbar .tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  cursor: pointer;
  color: #999;
  text-decoration: none;
  font-size: 11px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}
.sales-tabbar .tab-item.active { color: #2f6cad; }
.sales-tabbar .tab-item svg { width: 22px; height: 22px; }

/* 表单 */
.sales-form { padding: 12px; }
.sales-form .form-group { margin-bottom: 16px; }
.sales-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.sales-form input, .sales-form select {
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  font-size: 16px !important;
  box-sizing: border-box !important;
  background: #fff !important;
  min-height: 44px !important;
  margin: 0 !important;
}
.sales-form input:focus, .sales-form select:focus {
  outline: none;
  border-color: #2f6cad !important;
  box-shadow: 0 0 0 3px rgba(47,108,173,.1);
}
.sales-form .suggested {
  font-size: 12px;
  color: #2f6cad;
  margin-top: 6px;
  font-weight: 500;
}

/* 底部固定按钮 */
.sales-fixed-btn {
  position: fixed;
  bottom: 72px;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 150;
  max-width: 600px;
  margin: 0 auto;
  box-sizing: border-box;
}
.sales-btn {
  width: 100%;
  padding: 14px;
  background: #2f6cad;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}
.sales-btn:active { background: #1e5a9a; transform: scale(.98); }
.sales-btn:disabled { background: #ccc; cursor: not-allowed; }
.sales-btn.secondary {
  background: #fff;
  color: #2f6cad;
  border: 1px solid #2f6cad;
}

/* 弹窗 */
.sales-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.sales-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.sales-modal .icon { font-size: 48px; margin-bottom: 12px; }
.sales-modal .title { font-size: 18px; font-weight: 700; color: #333; margin-bottom: 8px; }
.sales-modal .desc { font-size: 14px; color: #666; margin-bottom: 20px; line-height: 1.5; }

/* 扫码页 */
.scan-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 60px);
  background: #000;
  overflow: hidden;
}
.scan-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  border: 2px solid #2f6cad;
  border-radius: 12px;
}
.scan-line {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: #2f6cad;
  animation: scanMove 2s linear infinite;
}
@keyframes scanMove {
  0% { top: 10px; }
  50% { top: calc(100% - 12px); }
  100% { top: 10px; }
}
.scan-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
}

/* 滞销预警 */
.slow-list { padding: 0 12px 12px; }
.slow-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid #f59e0b;
}
.slow-item .name { font-size: 14px; color: #333; }
.slow-item .remaining { font-size: 14px; font-weight: 600; color: #f59e0b; }

/* section标题 */
.sales-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  padding: 8px 16px 4px;
}

/* 销售台账表格 */
.sales-table-wrap {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 10px;
}
.sales-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sales-table thead th {
  background: #f5f6fa;
  color: #555;
  font-weight: 600;
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 12px;
}
.sales-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}
.sales-table tbody tr:last-child td { border-bottom: none; }
.sales-table tbody tr:active { background: #f5f6fa; }
.sales-table td:nth-child(3),
.sales-table td:nth-child(4),
.sales-table th:nth-child(3),
.sales-table th:nth-child(4) { text-align: right; }
.sales-table .table-actions { white-space: nowrap; text-align: center; }
.sales-table .table-btn {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  margin: 0 2px;
  min-height: 28px;
}
.sales-table .edit-btn { background: #e8f0fe; color: #2f6cad; }
.sales-table .edit-btn:active { background: #d0e0f5; }
.sales-table .del-btn { background: #fde8e8; color: #d33; }
.sales-table .del-btn:active { background: #f8d0d0; }

/* 修改弹窗 */
.sales-modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 20px;
}
.sales-modal {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.sales-modal .title { font-size: 17px; font-weight: 700; color: #1e3a5f; }

/* 空状态 */
.sales-empty {
  text-align: center;
  padding: 48px 20px;
  color: #aaa;
  font-size: 14px;
}

/* loading */
.sales-loading {
  text-align: center;
  padding: 30px;
  color: #999;
}

/* 操作按钮组 */
.sales-actions { display: flex; gap: 8px; }
.sales-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.sales-icon-btn.danger { color: #dc2626; border-color: #fecaca; }

/* 用户下拉 */
.sales-user-dropdown {
  position: absolute;
  top: 56px;
  right: 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  overflow: hidden;
  z-index: 250;
  min-width: 140px;
}
.sales-user-dropdown a {
  display: block;
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
}
.sales-user-dropdown a:hover { background: #f5f6fa; }
.sales-user-dropdown a.danger { color: #dc2626; }
.sales-user-dropdown .portal-menu-title { padding: 8px 16px 5px; color: #888; font-size: 11px; border-bottom: 1px solid #eee; }
.sales-user-dropdown .portal-option { display: flex; justify-content: space-between; align-items: center; }
.sales-user-dropdown .portal-option.active { background: #eef5fb; color: #2f6cad; font-weight: 600; }
.sales-user-dropdown .portal-option b { font-size: 10px; font-weight: 500; }

/* ===== v20 销售端界面优化 ===== */
.sales-mode{background:#f3f6f9}
.sales-mode .view{background:linear-gradient(180deg,#edf4fa 0,#f3f6f9 160px)}
.sales-header{background:rgba(31,83,128,.96);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 4px 18px rgba(23,63,98,.18)}
.sales-header .user-btn,.sales-header .sales-back-btn{min-width:44px;min-height:44px;transition:background-color .16s,transform .12s}
.sales-header .user-btn:active,.sales-header .sales-back-btn:active{transform:scale(.94)}
.sales-card,.sales-summary-card,.sales-form-card,.sales-table-wrap{border:1px solid rgba(218,226,235,.92);box-shadow:0 2px 8px rgba(31,58,95,.07)}
.sales-card{border-radius:14px;transition:transform .15s,box-shadow .18s,border-color .18s}
.sales-btn,.sales-icon-btn,.sales-table .table-btn{transition:background-color .16s,transform .12s,box-shadow .16s}
.sales-btn:active:not(:disabled),.sales-icon-btn:active,.sales-table .table-btn:active{transform:scale(.97)}
.sales-btn:focus-visible,.sales-icon-btn:focus-visible,.sales-tabbar .tab-item:focus-visible{outline:3px solid rgba(47,108,173,.25);outline-offset:2px}
.sales-form-group label .required,.sales-required{color:#dc2626}
.sales-form-group input,.sales-form-group select,.sales-form-group textarea{min-height:46px;transition:border-color .16s,box-shadow .16s}
.sales-form-group input:focus,.sales-form-group select:focus,.sales-form-group textarea:focus{outline:none;border-color:#2f6cad;box-shadow:0 0 0 3px rgba(47,108,173,.14)}
.sales-form-group input:user-invalid,.sales-form-group select:user-invalid,.sales-form-group textarea:user-invalid{border-color:#dc6a64;background:#fffafa}
.sales-table-wrap{overflow:auto;scrollbar-width:thin;scrollbar-color:#bdcad7 transparent}
.sales-table thead th{position:sticky;top:0;z-index:2}
.sales-table tbody tr:nth-child(even) td{background:#fafbfd}
.sales-table tbody tr:hover td{background:#eef5fb}
.sales-loading{min-height:110px;display:flex;align-items:center;justify-content:center;gap:10px}
.sales-loading::before{content:"";width:22px;height:22px;border:3px solid #dce6ef;border-top-color:#2f6cad;border-radius:50%;animation:sales-spin .75s linear infinite}
@keyframes sales-spin{to{transform:rotate(360deg)}}
.sales-user-dropdown{border:1px solid #e1e7ee;box-shadow:0 12px 30px rgba(31,58,95,.17)}
.sales-tabbar{padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -5px 18px rgba(31,58,95,.08)}
.sales-tabbar .tab-item{min-height:52px;margin:4px 3px;border-radius:10px;transition:background-color .16s,color .16s}
.sales-tabbar .tab-item.active{background:#edf5fc;font-weight:600}
@media(hover:hover){.sales-card:hover{transform:translateY(-1px);border-color:#cbd9e7;box-shadow:0 9px 22px rgba(31,58,95,.11)}}
