/* ========== CSS Variables ========== */
:root {
  --color-primary: #3b4cca;
  --color-primary-dark: #2a3ba8;
  --color-primary-light: #e8eaff;
  --color-accent: #ee1515;
  --color-accent-light: #fde8e8;
  --color-yellow: #ffcb05;
  --color-success: #4caf50;
  --color-success-light: #e8f5e9;
  --color-warning: #ff9800;
  --color-warning-light: #fff3e0;
  --color-danger: #f44336;
  --color-danger-light: #fde8e8;

  --bg-page: #f5f6fa;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1d3a;
  --bg-sidebar-hover: rgba(255,255,255,0.08);

  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-light: #ffffff;

  --border-color: #e5e7eb;
  --border-radius: 12px;
  --border-radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);

  --sidebar-width: 240px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* ========== Layout ========== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.sidebar-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.sidebar-version { margin-top: 4px; }

/* Pokeball Icon (SVG) */
.pokeball-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(238,21,21,0.35));
}

/* Navigation */
.nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--border-radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,76,202,0.3);
}

.nav-item svg { flex-shrink: 0; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 99;
  background: var(--bg-sidebar);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  align-items: center;
  justify-content: center;
}

/* ========== Page ========== */
.page { max-width: 1280px; margin: 0 auto; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,76,202,0.25); }

.btn-secondary {
  background: #f0f1f5;
  color: var(--text-primary);
}
.btn-secondary:hover { background: #e4e6ec; }

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

.btn-danger-outline {
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  background: transparent;
}
.btn-danger-outline:hover { background: var(--color-accent-light); }

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.card-danger { border: 1px solid var(--color-danger-light); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== Metrics Grid ========== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

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

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-all;
}

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

.profit-positive { color: var(--color-success); }
.profit-negative { color: var(--color-accent); }

/* ========== Dashboard Grid ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container {
  height: 260px;
  position: relative;
}

/* ========== Low Stock List ========== */
.low-stock-list { display: flex; flex-direction: column; gap: 8px; }

.low-stock-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--color-danger-light);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
}

.low-stock-name { font-weight: 600; color: var(--text-primary); flex: 1; }
.low-stock-info { color: var(--text-secondary); font-size: 12px; }
.low-stock-qty { color: var(--color-accent); font-weight: 600; font-size: 12px; white-space: nowrap; }

/* ========== Top Products ========== */
.top-products { display: flex; flex-direction: column; gap: 10px; }

.top-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.top-product-item:last-child { border-bottom: none; }

.top-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: #e5e7eb;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.rank-1 { background: #ffd700; color: #8a6d00; }
.rank-2 { background: #c0c0c0; color: #555; }
.rank-3 { background: #cd7f32; color: #fff; }

.top-product-info { flex: 1; display: flex; flex-direction: column; }
.top-product-name { font-size: 13px; font-weight: 500; }
.top-product-sales { font-size: 12px; color: var(--text-muted); }
.top-product-revenue { font-size: 14px; font-weight: 600; color: var(--color-primary); }

/* ========== Table ========== */
.table-wrap { overflow-x: auto; }

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

.table thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  background: #fafbfc;
}
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.th-sortable:hover { background: #f0f0f0; color: var(--color-primary); }
.th-sortable .sort-hint { color: #ccc; font-size: 12px; margin-left: 2px; }
.th-sortable .sort-active { color: var(--color-primary); font-weight: 700; margin-left: 2px; }

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

.table tbody tr:hover { background: #f9faff; }
.table tbody tr:last-child td { border-bottom: none; }

.product-name-cell { display: flex; flex-direction: column; gap: 2px; }
.product-name { font-weight: 500; }
.product-note { font-size: 11px; color: var(--text-muted); }

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-accent); }
.text-bold { font-weight: 600; }
.text-sm { font-size: 12px; }

/* ========== Tags ========== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-blue { background: var(--color-primary-light); color: var(--color-primary); }
.tag-red { background: var(--color-accent-light); color: var(--color-accent); }
.tag-green { background: var(--color-success-light); color: var(--color-success); }
.tag-gray { background: #f0f1f5; color: var(--text-secondary); }

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-danger { background: var(--color-accent-light); color: var(--color-accent); }
.badge-success { background: var(--color-success-light); color: var(--color-success); }

/* ========== Action Buttons ========== */
.action-btns { display: flex; gap: 4px; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }
.icon-btn-danger:hover { background: var(--color-accent-light); color: var(--color-accent); }

/* ========== Filter Bar ========== */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar .input { flex: 1; min-width: 180px; }
.filter-bar select { max-width: 200px; }

/* ========== Inputs ========== */
.input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59,76,202,0.1);
}
textarea.input { resize: vertical; min-height: 36px; }

select.input { cursor: pointer; }

/* ========== Links ========== */
.link { color: var(--color-primary); font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ========== Empty States ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state p { color: var(--text-muted); font-size: 15px; }
.empty-text { text-align: center; padding: 32px 20px; color: var(--text-muted); font-size: 14px; }

/* ========== Progress Bar ========== */
.progress-bar {
  position: relative;
  width: 100px;
  height: 20px;
  background: #f0f1f5;
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
  border-radius: 10px;
  transition: width 0.5s;
}
.progress-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s; }

.modal {
  background: #fff;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
  font-size: 28px;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
}
.modal-close:hover { background: #f0f1f5; color: var(--text-primary); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

/* ========== Form ========== */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

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

/* ========== Transaction Preview ========== */
.transaction-preview {
  background: #f8f9ff;
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preview-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.preview-row span:first-child { color: var(--text-secondary); }
.preview-row span:last-child { font-weight: 500; }

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--border-radius-sm);
  background: #333;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.3s;
  min-width: 200px;
}
.toast.show { transform: translateX(0); }

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-accent); }
.toast-info { background: var(--color-primary); }

.toast-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========== Settings ========== */
.settings-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.settings-stat { display: flex; flex-direction: column; gap: 2px; }
.settings-stat-value { font-size: 24px; font-weight: 700; color: var(--color-primary); }
.settings-stat-label { font-size: 13px; color: var(--text-secondary); }

.settings-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.category-manager { display: flex; flex-wrap: wrap; gap: 8px; }
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 14px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.category-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
  font-size: 11px;
  text-align: center;
  line-height: 18px;
}
.category-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(0,0,0,0.1);
  color: var(--color-primary);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}
.category-delete:hover {
  background: var(--color-danger, #ee1515);
  color: #fff;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .dashboard-grid,
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .mobile-menu-btn { display: flex; }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    padding-top: 64px;
  }

  .page-title { font-size: 20px; }
  .metric-value { font-size: 20px; }
  .form-row { flex-direction: column; gap: 0; }

  .modal { max-width: 100%; }
  .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }

  .page-header { flex-direction: column; align-items: stretch; }
  .header-actions { flex-direction: row; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .table { font-size: 12px; }
  .table thead th, .table tbody td { padding: 8px 6px; }
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ee1515 0%, #c00d0d 50%, #3b4cca 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-icon { margin: 0 auto 16px; display: block; }
.login-title { font-size: 26px; font-weight: 800; color: #2b2b2b; margin: 0 0 4px; }
.login-subtitle { font-size: 14px; color: #888; margin: 0 0 24px; }
.login-error {
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}
.login-btn { width: 100%; margin-top: 8px; padding: 12px; font-size: 16px; }
.login-hint { font-size: 12px; color: #aaa; margin: 20px 0 0; line-height: 1.6; }
.login-card .form-group { text-align: left; margin-bottom: 16px; }
.login-card .form-label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }

/* ========== 连接状态 & 退出 ========== */
.conn-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.conn-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.conn-status.online { background: rgba(76,175,80,0.15); color: #4caf50; }
.conn-status.online::before { background: #4caf50; }
.conn-status.offline { background: rgba(238,21,21,0.15); color: #ee1515; }
.conn-status.offline::before { background: #ee1515; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.btn-logout {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ========== 系列标签 ========== */
.tag-purple { background: #f3e8ff; color: #7c3aed; }
.product-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

/* ========== 批量录入 ========== */
.batch-info-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.batch-table-wrap {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.batch-table {
  margin: 0;
  font-size: 13px;
}

.batch-table thead th {
  position: sticky;
  top: 0;
  background: #f8f9fb;
  z-index: 1;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

.batch-table tbody td {
  padding: 6px 10px;
  border-top: 1px solid var(--border-color);
}

.batch-table .input {
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
}

.batch-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.2s;
}
.batch-del-btn:hover { background: #fee; color: #ee1515; }

.btn-sm { padding: 6px 12px; font-size: 13px; gap: 4px; }

.input-sm { padding: 6px 10px; font-size: 13px; }

.modal-large { max-width: 720px; }

/* ========== 订单管理 ========== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #eee);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted, #888); }
.stat-value { font-size: 18px; font-weight: 600; color: var(--text-primary, #222); }

.order-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.order-item-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.order-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.order-item-row .input { flex: 1; min-width: 160px; }
.order-item-row .tag { flex-shrink: 0; }

.txn-product-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.txn-product-filter .input { flex: 1; }

/* ========== 组合商品 ========== */
.combo-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.combo-item-row .combo-item-product { flex: 1; }
.combo-item-row .combo-item-qty { width: 70px; }

/* ========== 视图切换按钮 ========== */
.view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}
.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.view-toggle-btn:hover { background: #f0f2f5; color: var(--text-primary); }
.view-toggle-btn.active { background: var(--color-primary); color: #fff; }

/* ========== 产品卡片视图 ========== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.product-card-low { border-color: #fcc;
}
.product-card-img {
  width: 100%;
  height: 180px;
  background-color: #f8f9fb;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--border-color);
}
.product-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ee1515;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.product-card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.product-card-name { font-weight: 600; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.product-card-prices { display: flex; align-items: baseline; gap: 8px; }
.product-card-sell { font-size: 18px; font-weight: 700; color: var(--color-primary); }
.product-card-cost { font-size: 12px; color: var(--text-muted); }
.product-card-profit { font-size: 12px; color: var(--text-secondary); }
.product-card-stock { font-size: 13px; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; }
.product-card-actions { display: flex; gap: 4px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border-color); }

/* ========== 图片上传区域 ========== */
.image-upload-area { width: 100%; }
.image-upload-placeholder {
  width: 100%;
  height: 140px;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-muted);
  font-size: 13px;
}
.image-upload-placeholder:hover { border-color: var(--color-primary); background: #f8faff; }
.image-preview {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.image-preview img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}
.image-preview-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }

/* ========== 批量入库汇总 ========== */
.batch-in-summary { margin-top: 12px; }
.batch-summary-bar {
  padding: 10px 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: var(--border-radius);
  font-size: 14px;
  color: var(--text-primary);
}
.batch-summary-bar strong { color: var(--color-primary); }

