/* ============== Base ============== */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --primary-bg: #EFF6FF;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --green: #10B981;
  --green-bg: #D1FAE5;
  --orange: #F59E0B;
  --orange-bg: #FEF3C7;
  --red: #EF4444;
  --red-bg: #FEE2E2;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============== Layout ============== */
#app {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  padding-bottom: 100px;
}

/* ============== Header (蓝色) ============== */
.app-header {
  background: linear-gradient(135deg, #4A8FFF 0%, #3B82F6 50%, #2D6FE0 100%);
  color: #fff;
  padding: 20px 18px 22px;
  position: relative;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon { font-size: 22px; }

.header-title h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-tag {
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.22);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.header-tags {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* ============== Stats ============== */
.stats-section { padding: 16px; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 84px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-2);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-value.profit { color: var(--green); }

/* 客户欠款独立卡片 */
.debt-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.debt-label {
  font-size: 14px;
  color: var(--text-2);
}

.debt-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--red);
}

/* ============== Tab Nav ============== */
.tab-nav {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

/* ============== Tab Panels ============== */
.tab-content { padding: 0 16px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============== Action Card ============== */
.action-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 140px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--primary); }

.status-select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  outline: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
}

.btn-batch-entry {
  height: 38px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-batch-entry:active { background: var(--primary-dark); }

.btn-batch-sell {
  height: 38px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-batch-sell:active { background: #0E9F6E; }

.link-row {
  display: flex;
  gap: 16px;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}

.text-link {
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.text-link:hover { text-decoration: underline; }

/* ============== Table ============== */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table thead {
  background: #F9FAFB;
}

.data-table th {
  padding: 12px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.th-check { width: 36px; text-align: center; padding-left: 14px; padding-right: 0; }
.th-action { width: 60px; text-align: center; }

.data-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 14px;
  vertical-align: middle;
}

.data-table tbody tr:active { background: #F9FAFB; }
.data-table tbody tr:last-child td { border-bottom: none; }

.empty-row td {
  text-align: center;
  color: var(--text-3);
  padding: 40px 20px;
}

/* 库存行样式 */
.inv-model-cell { font-weight: 600; }
.inv-imei-cell {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-2);
}
.inv-serial-cell {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-3);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-green { background: var(--green-bg); color: var(--green); }
.tag-orange { background: var(--orange-bg); color: var(--orange); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-gray { background: #E5E7EB; color: #4B5563; }

.tag-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.row-action {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.row-action button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-action button:active { transform: scale(0.92); }
.row-action button.sell { background: var(--primary); color: #fff; }

/* ============== Empty State ============== */
.empty-state {
  text-align: center;
  color: var(--text-3);
  padding: 50px 20px;
  font-size: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============== Customer List ============== */
.customer-list, .order-list, .outbound-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  position: relative;
}

.list-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.list-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.list-meta strong {
  color: var(--text);
  font-weight: 600;
}

.list-amount {
  font-size: 18px;
  font-weight: 700;
}

.list-amount.green { color: var(--green); }
.list-amount.red { color: var(--red); }

.list-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-outline {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  background: #fff;
}

.btn-primary {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-success {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--green);
  color: #fff;
}

/* 出库记录 summary */
.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.summary-item {
  background: var(--card);
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
  box-shadow: var(--shadow);
}

.summary-label {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
}

.summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.summary-value.profit { color: var(--green); }

/* ============== FAB 浮动按钮 ============== */
.fab-share {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.15s;
}

.fab-share:active { transform: scale(0.92); }

/* ============== Modal ============== */
.modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal-sheet {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-center-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}

.modal-center {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: #D1D5DB;
  border-radius: 2px;
  margin: 10px auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F3F4F6;
  color: var(--text-2);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body { padding: 16px 18px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--border);
}

.modal-footer button {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
}

.modal-footer .btn-cancel {
  background: #F3F4F6;
  color: var(--text-2);
}
.modal-footer .btn-confirm {
  background: var(--primary);
  color: #fff;
}
.modal-footer .btn-success {
  background: var(--green);
  color: #fff;
}

/* ============== Forms ============== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}

.form-textarea {
  height: auto;
  min-height: 70px;
  padding: 10px 12px;
  resize: vertical;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row > * { flex: 1; }

/* 切换按钮组 */
.toggle-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.toggle-group.two { grid-template-columns: 1fr 1fr; }

.toggle-btn {
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: #fff;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.toggle-btn.active.green {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

.toggle-btn.active.orange {
  background: var(--orange-bg);
  border-color: var(--orange);
  color: var(--orange);
}

.toggle-btn.active.red {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

/* ============== Toast ============== */
.toast-root {
  position: fixed;
  top: 30px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
}

.toast {
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 90%;
  animation: toastIn 0.2s ease;
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.toast-success { background: var(--green); }
.toast.toast-error { background: var(--red); }

/* ============== Order detail ============== */
.settle-meta {
  background: var(--primary-bg);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.settle-meta-item .label {
  font-size: 12px;
  color: var(--text-2);
}

.settle-meta-item .val {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.settle-meta-item .val.green { color: var(--green); }
.settle-meta-item .val.red { color: var(--red); }

.settle-phones {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.settle-phone {
  background: #F9FAFB;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.settle-phone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 6px;
}

.settle-phone-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  color: var(--text-2);
  font-size: 12px;
}

.settle-phone-meta span strong { color: var(--text); }

.settle-phone-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.settle-phone-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.settle-phone-actions button {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-2);
}

.settle-phone-actions button.del { color: var(--red); border-color: var(--red); }

/* 结算单生成器（截图用） */
.receipt-preview {
  width: 720px;
  background: #fff;
  padding: 30px 36px;
  font-family: -apple-system, 'PingFang SC', sans-serif;
  color: #111827;
}

.receipt-preview h2 {
  margin: 0 0 4px;
  font-size: 22px;
  text-align: center;
}

.receipt-preview .receipt-sub {
  text-align: center;
  color: #6B7280;
  margin-bottom: 18px;
  font-size: 13px;
}

.receipt-preview .receipt-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
}

.receipt-preview .receipt-info > div { flex: 1; }
.receipt-preview .receipt-info .right { text-align: right; }

.receipt-preview table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 13px;
}

.receipt-preview th, .receipt-preview td {
  border: 1px solid #E5E7EB;
  padding: 8px;
  text-align: left;
}

.receipt-preview th {
  background: #F9FAFB;
  font-weight: 600;
}

.receipt-preview .receipt-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: #F9FAFB;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.receipt-preview .receipt-stats div { text-align: center; }
.receipt-preview .receipt-stats strong { display: block; font-size: 18px; }
.receipt-preview .receipt-total {
  text-align: right;
  font-size: 18px;
  margin-bottom: 20px;
}
.receipt-preview .receipt-total .amt { color: #3B82F6; font-size: 24px; font-weight: 700; }

.receipt-preview .receipt-sign {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #6B7280;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px dashed #E5E7EB;
}

/* ============== 扫码对话框 ============== */
.scan-modal-content {
  padding: 20px;
  text-align: center;
}

.scan-frame {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame .scan-line {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(59,130,246,0.5);
  border-radius: 12px;
  pointer-events: none;
}

.scan-frame .scan-line::before,
.scan-frame .scan-line::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid #3B82F6;
}
.scan-frame .scan-line::before { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.scan-frame .scan-line::after { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 8px 0; }

.scan-hint {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 13px;
}

/* ============== Responsive ============== */
@media (max-width: 480px) {
  .stat-value { font-size: 24px; }
  .data-table th, .data-table td { padding: 10px 6px; font-size: 12px; }
  .summary-item .summary-value { font-size: 14px; }
}

@media (min-width: 720px) {
  #app { box-shadow: 0 0 24px rgba(0,0,0,0.08); }
}

/* 隐藏滚动条但保留滚动 */
.scroll-hide::-webkit-scrollbar { display: none; }
.scroll-hide { scrollbar-width: none; }

/* 文本省略 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  display: inline-block;
  vertical-align: middle;
}

/* ============== 结算表格 ============== */
.settle-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.settle-input {
  flex: 1;
  min-width: 100px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  outline: none;
  font-size: 14px;
  transition: border-color 0.15s;
}

.settle-input:focus { border-color: var(--primary); }

.settle-input.settle-date { max-width: 140px; flex: 0 0 140px; }

.settle-table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settle-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  min-width: 600px;
}

.settle-table thead {
  background: #F9FAFB;
}

.settle-table th {
  padding: 10px 6px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.st-th-idx { width: 32px; text-align: center; }
.st-th-price { width: 70px; }

.settle-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}

.settle-table .st-idx {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

.settle-table .empty-row td {
  text-align: center;
  color: var(--text-3);
  padding: 30px 20px;
}

.st-cell {
  width: 100%;
  height: 34px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.st-cell:focus {
  border-color: var(--primary);
  background: #fff;
}

.st-cell.st-model { min-width: 90px; font-weight: 500; }
.st-cell.st-imei { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }
.st-cell.st-price { text-align: right; font-weight: 600; color: var(--primary); }

.st-del-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.st-del-btn:active { transform: scale(0.9); }

.st-copy-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.st-copy-btn:active { transform: scale(0.9); }

/* 结算统计栏 */
.settle-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.st-total-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.st-total-label {
  font-size: 12px;
  color: var(--text-2);
}

.st-total-item strong {
  font-size: 20px;
  font-weight: 700;
}

.st-total-item strong.green { color: var(--green); }
.st-total-item strong.red { color: var(--red); }
.st-total-item strong.blue { color: var(--primary); }

/* 结算操作按钮 */
.settle-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.st-action-btn {
  flex: 1;
  height: 44px !important;
  font-size: 14px;
  border-radius: 10px;
}

/* 扫码查串号结果 */
.scan-result-card {
  background: #F9FAFB;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.scan-result-card .scan-result-model {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.scan-result-card .scan-result-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.scan-result-card .scan-result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.scan-result-card .scan-result-meta strong { color: var(--text); }

.scan-not-found {
  text-align: center;
  padding: 24px;
  color: var(--red);
  font-size: 15px;
}

/* 响应式：结算表格在小屏幕下 */
@media (max-width: 480px) {
  .settle-totals { grid-template-columns: repeat(2, 1fr); }
  .st-cell { font-size: 12px; }
  .settle-actions { flex-wrap: wrap; }
  .st-action-btn { flex: 1 1 45%; }
}

/* ===== 入库 IMEI 扫码 ===== */
.imei-input-wrap { display: flex; gap: 8px; }
.imei-input-wrap .form-input { flex: 1; }
.imei-scan-btn {
  flex-shrink: 0;
  width: 88px;
  height: 42px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.imei-scan-btn:active { background: var(--primary-dark); }

.barcode-scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  flex-direction: column;
}
.bs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  color: #fff;
}
.bs-close {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff; font-size: 18px; cursor: pointer;
}
.bs-title { font-size: 16px; font-weight: 600; }
.bs-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  overflow: hidden;
}
.bs-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}
.bs-frame video { width: 100%; height: 100%; object-fit: cover; }
.bs-laser {
  position: absolute;
  left: 8%; right: 8%; top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #22C55E 15%, #22C55E 85%, transparent);
  box-shadow: 0 0 10px 2px rgba(34,197,94,0.55);
  animation: bs-scan 2s ease-in-out infinite;
}
@keyframes bs-scan {
  0%, 100% { top: 18%; }
  50% { top: 82%; }
}
.bs-hint {
  margin-top: 18px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* ===== 库存聚合视图（按型号分组） ===== */
.inv-group-row { cursor: pointer; transition: background .15s; }
.inv-group-row:hover { background: #F3F4F6; }
.inv-group-row .inv-model-cell strong { font-size: 15px; }
.inv-group-row .tag { margin-left: 6px; font-size: 11px; }
.inv-arrow {
  display: inline-block;
  margin-right: 8px;
  color: #9CA3AF;
  transition: transform .2s;
  font-size: 13px;
  width: 14px;
}
.inv-arrow.open { transform: rotate(90deg); }
.inv-detail td { padding: 0 !important; background: #F9FAFB; }
.inv-detail-wrap { padding: 6px 10px; border-top: 1px dashed #E5E7EB; border-bottom: 1px dashed #E5E7EB; }
.inv-bio-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: #F0FDF4;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}
.inv-bio-ok { color: #059669; font-weight: 700; }
.inv-bio-no { color: #DC2626; font-weight: 700; }
/* 容量子分组 */
.inv-subgroup { margin-bottom: 2px; }
.inv-subgroup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  background: #F9FAFB;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.inv-subgroup-row:active { background: #F3F4F6; }
.inv-sub-cap { font-size: 14px; }
.inv-sub-count { color: var(--text-2); }
.inv-sub-cost { color: var(--primary); font-weight: 600; margin-left: auto; }
.inv-subgroup-items { padding: 0 4px; }
.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
  flex-wrap: wrap;
}
.inv-item:last-child { border-bottom: none; }
.inv-item-imei {
  font-family: monospace;
  font-size: 12.5px;
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-item-days { font-size: 12px; min-width: 44px; }
.inv-item-price { font-weight: 600; color: var(--primary); margin-left: auto; }
.inv-item-bio { white-space: nowrap; }
.inv-item-clickable { cursor: pointer; }
.inv-item-clickable:active { opacity: .6; }
.days-ok { color: #6B7280; }
.days-warn { color: #F59E0B; font-weight: 600; }
.days-danger { color: #EF4444; font-weight: 600; }

/* ===== 表单提示 & 禁用按钮 ===== */
.form-hint { font-size: 11px; color: #9CA3AF; font-weight: 400; margin-left: 4px; }
.toggle-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ===== 出库类型选择 ===== */
.ob-type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ob-type-btn {
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  background: #F9FAFB;
  padding: 12px 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: all .15s;
}
.ob-type-btn.active {
  border-color: var(--primary);
  background: #EFF6FF;
  color: var(--primary);
  font-weight: 600;
}
.ob-type-btn:active { transform: scale(.96); }
.ob-type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}
.ob-type-sale { background: #DBEAFE; color: #1E40AF; }
.ob-type-transfer { background: #E0E7FF; color: #4338CA; }
.ob-type-repair { background: #FEF3C7; color: #92400E; }
.ob-type-scrap { background: #FEE2E2; color: #991B1B; }

/* ===== 出库购物车列表项 ===== */
.ob-cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  margin-bottom: 6px;
}
.ob-cart-info { flex: 1; min-width: 0; }
.ob-cart-model { font-size: 14px; font-weight: 600; color: #111827; }
.ob-cart-imei { font-size: 12px; color: #6B7280; margin-top: 2px; }
.ob-cart-del {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: #FEE2E2; color: #991B1B;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ob-cart-del:active { background: #FECACA; }

/* ===== 弹窗吸底操作栏：内容再长按钮也固定在弹窗底部 ===== */
.modal-footer.sticky-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: #fff;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

/* ===== 客户结算单 ===== */
.settle-summary {
  background: #F0F9FF;
  border-radius: 10px;
  padding: 12px 14px;
}
.settle-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #6B7280;
  padding: 3px 0;
}
.settle-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #CBD5E1;
  margin-top: 6px;
  padding-top: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.settle-summary-total span:last-child { color: #059669; font-size: 22px; font-weight: 700; }

.settle-item {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.settle-item-issue { background: #FFFBEB; border-color: #FDE68A; }
.settle-item-edit { background: #EFF6FF; border-color: #93C5FD; }
.settle-item-edit .form-row { margin-top: 8px; }
.settle-item-warn { font-size: 12px; color: #B45309; margin-top: 5px; }
.ob-cart-edit {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: #DBEAFE; color: #1E40AF;
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ob-cart-edit:active { background: #BFDBFE; }
.settle-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.settle-item-model { font-weight: 600; font-size: 14px; color: #111827; }
.settle-item-note { font-size: 12px; color: #B45309; margin-top: 4px; }
.settle-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.settle-item-base { font-size: 12px; color: #6B7280; }
.settle-item-deduct { font-size: 12px; color: #374151; display: inline-flex; align-items: center; gap: 4px; }
.settle-item-final { font-size: 13px; color: #374151; }
.settle-item-final strong { color: #059669; font-size: 16px; }

/* ===== 客户视图：全屏结算单 ===== */
.receipt-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #1E293B;
  overflow-y: auto;
}
.receipt-overlay-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(30, 41, 59, 0.97);
  color: #fff;
  z-index: 1;
}
.receipt-overlay-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 12px 40px;
}
.receipt-overlay .receipt-preview {
  width: min(420px, 100%);
  padding: 22px 18px;
  border-radius: 10px;
}
.receipt-overlay .receipt-phones { margin-bottom: 12px; }
.receipt-phone {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
.receipt-phone-issue { border-color: #FCA5A5; background: #FEF2F2; }
.receipt-phone-line1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.receipt-phone-price { color: #059669; white-space: nowrap; }
.receipt-phone-line2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: #6B7280;
}
.receipt-phone-issue-note { margin-top: 4px; font-size: 12px; color: #DC2626; font-weight: 600; }
.receipt-phone-deduct { margin-top: 4px; font-size: 12px; color: #B45309; }
