/* ==========================================================================
   BoltCart 全局样式 - 金诺五金
   手机优先 (Mobile-first) 设计
   ========================================================================== */

/* ----- CSS Reset ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f0f0;
  color: var(--color-text);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
}
button { cursor: pointer; background: none; }
ul, ol { list-style: none; }

/* ----- CSS Variables (Design Tokens) ----- */
:root {
  /* Brand */
  --color-primary: #D4380D;
  --color-primary-light: #FF7A45;
  --color-primary-bg: #FFF2E8;
  --color-primary-dark: #B2300A;

  /* Text */
  --color-text: #262626;
  --color-text-secondary: #8C8C8C;
  --color-text-light: #BFBFBF;

  /* Surfaces */
  --color-bg: #F5F5F5;
  --color-card: #FFFFFF;
  --color-border: #F0F0F0;

  /* Semantic */
  --color-success: #52C41A;
  --color-warning: #FAAD14;
  --color-danger: #FF4D4F;
  --color-price: #D4380D;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;

  /* Typography */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-xxl: 22px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-round: 999px;

  /* Layout */
  --header-h: 48px;
  --tab-h: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --content-max-w: 480px;
}

/* ----- App Shell ----- */
.app-container {
  max-width: var(--content-max-w);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom));
  padding-top: var(--header-h);
}
@media (min-width: 520px) {
  .app-container {
    box-shadow: 0 0 30px rgba(0,0,0,0.08);
  }
}
.app-container.no-tab {
  padding-bottom: var(--safe-bottom);
}

/* ----- Header ----- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-w);
  height: var(--header-h);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 100;
  gap: var(--space-md);
}
.app-header .back-btn {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
}
.app-header .back-btn:active {
  background: rgba(255,255,255,0.15);
}
.app-header .header-title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .header-right {
  flex-shrink: 0;
  font-size: var(--text-sm);
  cursor: pointer;
}

/* ----- Tab Bar ----- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-w);
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tab-item:active {
  opacity: 0.7;
}
.tab-item .tab-icon {
  font-size: 22px;
  line-height: 1;
}
.tab-item.active {
  color: var(--color-primary);
  font-weight: 600;
}
.tab-item .badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(calc(50% + 10px));
  min-width: 16px;
  height: 16px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid #fff;
}

/* ----- Page Content ----- */
.page {
  padding: var(--space-md);
  max-width: var(--content-max-w);
  margin: 0 auto;
}
.page-full {
  padding: 0;
}

/* ----- Cards ----- */
.card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-padding {
  padding: var(--space-lg);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 var(--space-xl);
  border-radius: var(--radius-round);
  font-size: var(--text-base);
  font-weight: 500;
  transition: opacity 0.15s;
  white-space: nowrap;
  gap: var(--space-sm);
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary-light {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.btn-outline {
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-card);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-block {
  width: 100%;
}
.btn-sm {
  height: 32px;
  padding: 0 var(--space-lg);
  font-size: var(--text-sm);
}
.btn-lg {
  height: 48px;
  font-size: var(--text-lg);
}

/* ----- Forms ----- */
.form-group {
  margin-bottom: var(--space-lg);
}
.form-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color 0.2s;
}
.form-input:focus {
  border-color: var(--color-primary);
}
.form-textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  font-size: var(--text-base);
  resize: vertical;
}
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  font-size: var(--text-base);
  appearance: auto;
}

/* ----- Price ----- */
.price {
  color: var(--color-price);
  font-weight: 700;
}
.price-symbol {
  font-size: var(--text-sm);
}
.price-value {
  font-size: var(--text-xl);
}
.price-decimal {
  font-size: var(--text-sm);
}

/* ----- Goods Grid (2 cols) ----- */
.goods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  padding: var(--space-md);
}
@media (min-width: 600px) {
  .goods-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Goods Card */
.goods-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s;
}
.goods-card:active {
  transform: scale(0.97);
}
.goods-card .goods-img {
  width: 100%;
  height: 200px; /* 兼容不支持 aspect-ratio 的浏览器 */
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  font-size: 36px;
  object-fit: cover;
}
.goods-card .goods-info {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.goods-card .goods-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.goods-card .goods-specs {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}
.goods-card .goods-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.goods-card .add-cart-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.goods-card .add-cart-btn:active { opacity: 0.8; }
.goods-card .add-cart-btn.disabled {
  background: #d9d9d9;
  pointer-events: none;
}

/* ----- Search Bar ----- */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-card);
  position: sticky;
  top: var(--header-h);
  z-index: 50;
}
.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--color-bg);
  border-radius: var(--radius-round);
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}
.search-input-wrap .search-icon {
  font-size: 16px;
  color: var(--color-text-light);
  flex-shrink: 0;
}
.search-input-wrap input {
  flex: 1;
  height: 100%;
  background: transparent;
  font-size: var(--text-base);
  color: var(--color-text);
}
.search-input-wrap .search-clear {
  font-size: 14px;
  color: var(--color-text-light);
  cursor: pointer;
  flex-shrink: 0;
}
.search-bar .search-submit {
  flex-shrink: 0;
  height: 36px;
  padding: 0 var(--space-lg);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-round);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ----- Group Tip ----- */
.group-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-primary-bg);
  font-size: var(--text-sm);
}
.group-tip .group-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* ----- Quantity Stepper ----- */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-stepper .qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  background: var(--color-bg);
  user-select: none;
}
.qty-stepper .qty-btn:active { background: #e8e8e8; }
.qty-stepper .qty-btn.disabled { color: var(--color-text-light); }
.qty-stepper .qty-value {
  width: 40px;
  text-align: center;
  font-size: var(--text-base);
  font-weight: 500;
  height: 32px;
  line-height: 32px;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

/* ----- Checkbox ----- */
.checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #d9d9d9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.checkbox.checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.checkbox.checked::after {
  content: '✓';
  font-size: 13px;
  font-weight: 700;
}

/* ----- Cart Item ----- */
.cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
}
.cart-item .item-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: #f5f5f5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--color-text-light);
  object-fit: cover;
}
.cart-item .item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cart-item .item-name {
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item .item-specs {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}
.cart-item .item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* ----- Cart Footer ----- */
.cart-footer {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-w);
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: var(--space-md);
  z-index: 50;
}
.cart-footer .total-section {
  flex: 1;
  text-align: right;
}
.cart-footer .total-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.cart-footer .total-amount {
  color: var(--color-price);
  font-size: var(--text-xl);
  font-weight: 700;
}
.cart-footer .btn-order {
  height: 40px;
  padding: 0 var(--space-xl);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-round);
  font-size: var(--text-base);
  font-weight: 600;
  flex-shrink: 0;
}

/* ----- Toast ----- */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  text-align: center;
  max-width: 280px;
  animation: toastIn 0.25s ease;
}
.toast.success { background: rgba(82,196,26,0.9); }
.toast.error { background: rgba(255,77,79,0.9); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.modal-content {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  width: 85%;
  max-width: 360px;
  overflow: hidden;
  animation: modalIn 0.25s ease;
}
.modal-header {
  padding: var(--space-xl) var(--space-xl) var(--space-sm);
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: center;
}
.modal-body {
  padding: var(--space-sm) var(--space-xl) var(--space-xl);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.6;
}
.modal-footer {
  display: flex;
  border-top: 1px solid var(--color-border);
}
.modal-footer .modal-btn {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  cursor: pointer;
}
.modal-footer .modal-btn:active { background: var(--color-bg); }
.modal-footer .modal-btn.primary { color: var(--color-primary); font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ----- Action Sheet (Bottom) ----- */
.action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  animation: fadeIn 0.2s;
}
.action-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-w);
  background: var(--color-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1001;
  animation: sheetUp 0.25s ease;
  padding-bottom: var(--safe-bottom);
}
.action-sheet-header {
  padding: var(--space-lg);
  text-align: center;
  font-size: var(--text-base);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}
.action-sheet-option {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  font-size: var(--text-base);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.action-sheet-option:active { background: var(--color-bg); }
.action-sheet-option .check {
  margin-left: var(--space-sm);
  color: var(--color-primary);
}
.action-sheet-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-top: var(--space-sm);
  background: var(--color-bg);
}
.action-sheet-cancel:active { opacity: 0.7; }

/* ----- Category Sidebar (slide from left) ----- */
.cat-toggle {
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-bg);
}
.cat-toggle:active { background: #e8e8e8; }

.cat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  animation: fadeIn 0.2s;
}

.cat-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  max-width: 70vw;
  height: 100vh;
  background: var(--color-card);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.1);
}
.cat-sidebar.open { transform: translateX(0); }

.cat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.cat-sidebar-title { font-size: 16px; font-weight: 600; }
.cat-sidebar-close {
  font-size: 18px; cursor: pointer; color: var(--color-text-secondary);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}

.cat-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cat-sidebar-body .cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.cat-sidebar-body .cat-item:active { background: var(--color-primary-bg); }
.cat-sidebar-body .cat-item.active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-weight: 600;
  border-left-color: var(--color-primary);
}
.cat-sidebar-body .cat-item .cat-count {
  font-size: 11px; color: var(--color-text-light);
  background: var(--color-bg); padding: 1px 8px; border-radius: 10px;
}

.active-cat-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  margin: 0 12px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 12px;
  border-radius: var(--radius-round);
  width: fit-content;
}
.active-cat-tag .cat-tag-clear { cursor: pointer; font-size: 13px; font-weight: 700; margin-left: 2px; }
@keyframes sheetUp { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }

/* ----- Loading Spinner ----- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Empty State ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl) var(--space-lg);
  gap: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}
.empty-state .empty-icon {
  font-size: 56px;
  opacity: 0.4;
}

/* ----- Misc ----- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-danger { color: var(--color-danger); }
.text-secondary { color: var(--color-text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-bold { font-weight: 700; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ----- Login Form ----- */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: var(--space-xl);
}
.login-page .login-logo {
  font-size: 48px;
  margin-bottom: var(--space-lg);
}
.login-page .login-title {
  font-size: var(--text-xxl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-xxl);
}
.login-page .login-form {
  width: 100%;
  max-width: 320px;
}
.login-page .login-form .form-group {
  margin-bottom: var(--space-lg);
}

/* ----- Order Card ----- */
.order-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  overflow: hidden;
}
.order-card .order-header {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}
.order-card .order-no {
  font-weight: 600;
  font-size: var(--text-base);
}
.order-card .order-status {
  font-size: var(--text-xs);
  padding: 2px 10px;
  border-radius: var(--radius-round);
}
.order-status.draft { background: #FFF7E6; color: #D48806; }
.order-status.confirmed { background: #E6F7FF; color: #1890FF; }
.order-status.completed { background: #F6FFED; color: #52C41A; }
.order-card .order-body {
  padding: var(--space-md) var(--space-lg);
}
.order-card .order-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}
.order-card .order-total {
  text-align: right;
  font-size: var(--text-base);
  font-weight: 600;
  margin-top: var(--space-sm);
}
.order-card .order-items {
  margin-top: var(--space-md);
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-md);
}
.order-card .order-item-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  padding: 4px 0;
}

/* ----- Admin ----- */
.admin-page {
  padding-bottom: var(--space-xxl);
}
.admin-page .admin-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  padding: var(--space-md);
}
.admin-page .admin-nav-item {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.admin-page .admin-nav-item:active { transform: scale(0.97); }
.admin-page .admin-nav-item .nav-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}
.admin-page .admin-nav-item .nav-label {
  font-size: var(--text-base);
  font-weight: 500;
}

/* ----- Data Table (Admin) ----- */
.data-table { width: 100%; }
.data-table th {
  text-align: left;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table td {
  padding: var(--space-md);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tr:active { background: var(--color-bg); }

/* ----- Goods Detail ----- */
.detail-image {
  width: 100%;
  height: 320px; /* 兼容不支持 aspect-ratio 的浏览器 */
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: var(--color-text-light);
}
.detail-info {
  padding: var(--space-lg);
  background: var(--color-card);
}
.detail-info .detail-name {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}
.detail-info .detail-price {
  font-size: var(--text-xxl);
  color: var(--color-price);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.detail-info .detail-specs {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}
.detail-info .detail-stock {
  font-size: var(--text-sm);
}
.detail-info .detail-stock.low { color: var(--color-warning); }
.detail-info .detail-stock.out { color: var(--color-danger); }

/* Price Table */
.price-table {
  margin: var(--space-md);
  background: var(--color-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.price-table .price-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.price-table .price-row.current {
  background: var(--color-primary-bg);
  font-weight: 600;
  color: var(--color-primary);
}
.price-table .price-row .price-tag {
  font-size: var(--text-xs);
  background: var(--color-primary);
  color: #fff;
  padding: 1px 8px;
  border-radius: var(--radius-round);
  margin-left: var(--space-sm);
}

/* ----- Detail Bottom Bar ----- */
.detail-bottom {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-w);
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: var(--space-md);
  z-index: 50;
}
.detail-bottom .qty-section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.detail-bottom .qty-section label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.detail-bottom .action-btns {
  flex: 1;
  display: flex;
  gap: var(--space-sm);
}
.detail-bottom .action-btns .btn {
  flex: 1;
}

/* ----- Order Create ----- */
.order-create-page .section-title {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}
.order-create-page .order-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
}
.order-create-page .order-item-row .item-detail {
  flex: 1;
  min-width: 0;
}
.order-create-page .order-item-row .item-name {
  font-size: var(--text-base);
  font-weight: 500;
}
.order-create-page .order-total-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: var(--space-md);
  text-align: right;
  font-size: var(--text-lg);
  font-weight: 700;
}
.order-create-page .order-total-bar .amount {
  color: var(--color-price);
}

/* ----- Customer Phone Modal ----- */
.phone-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-primary-bg);
}
.phone-input-bar input {
  flex: 1;
  height: 36px;
  padding: 0 var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-round);
  font-size: var(--text-base);
  background: var(--color-card);
}
.phone-input-bar .btn-lookup {
  height: 36px;
  padding: 0 var(--space-lg);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-round);
  font-size: var(--text-sm);
  font-weight: 500;
  flex-shrink: 0;
}
.phone-input-bar .customer-info {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
}

/* ----- SKU Selector (1688 style) ----- */
.sku-selector {
  margin: var(--space-md);
  padding: var(--space-lg);
  background: var(--color-card);
  border-radius: var(--radius-md);
}
.sku-selector-title {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}
.sku-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.sku-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 70px;
  background: var(--color-card);
}
.sku-item:active { transform: scale(0.96); }
.sku-item.active {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.sku-item.out {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}
.sku-item .sku-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 2px;
}
.sku-item .sku-item-price {
  font-size: var(--text-xs);
  color: var(--color-price);
}
.sku-item.out .sku-item-price { color: var(--color-text-light); }
.sku-item .sku-item-stock {
  font-size: 10px;
  color: var(--color-danger);
  margin-top: 2px;
}
.sku-selected {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
}
.sku-tag {
  display: inline-block;
  font-size: 10px;
  color: #fff;
  background: var(--color-primary);
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 500;
}

/* ----- 兼容旧浏览器：支持 aspect-ratio 时用正方形比例 ----- */
@supports (aspect-ratio: 1) {
  .goods-card .goods-img {
    aspect-ratio: 1;
    height: auto;
  }
  .detail-image {
    aspect-ratio: 1;
    height: auto;
  }
}

/* ========================================================================== 
   金诺五金 2026 简约主题
   暗红品牌色、米白背景、宽屏商品陈列；保留原业务组件和移动端交互。
   ========================================================================== */
:root {
  --color-primary: #8B1E18;
  --color-primary-light: #B64739;
  --color-primary-bg: #F8ECE9;
  --color-primary-dark: #69130F;
  --color-text: #211A17;
  --color-text-secondary: #746B66;
  --color-text-light: #AAA09A;
  --color-bg: #F6F3EF;
  --color-card: #FFFDFB;
  --color-border: #E9E2DD;
  --color-price: #8B1E18;
  --radius-md: 10px;
  --radius-lg: 18px;
  --header-h: 62px;
  --tab-h: 58px;
  --content-max-w: 1240px;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
}

.app-container {
  box-shadow: none;
  background: var(--color-bg);
}

.app-header {
  color: var(--color-text);
  background: rgba(255, 253, 251, .96);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-header .header-title {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 19px;
  letter-spacing: .08em;
}

.app-header .back-btn {
  color: var(--color-primary);
  font-size: 28px;
}

.tab-bar {
  width: min(100%, 720px);
  bottom: 10px;
  height: calc(var(--tab-h) + var(--safe-bottom));
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(61, 42, 31, .13);
  overflow: hidden;
}

.tab-item .tab-icon { font-size: 20px; }

.catalog-hero {
  margin: 18px 16px 0;
  padding: clamp(26px, 5vw, 54px);
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(255,255,255,.17), transparent 28%),
    linear-gradient(135deg, #741510, #A73528);
  box-shadow: 0 14px 36px rgba(61, 42, 31, .12);
}

.catalog-eyebrow {
  margin-bottom: 9px;
  color: #F5C8BF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
}

.catalog-hero h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.12;
}

.catalog-hero p {
  margin-top: 12px;
  color: #F9EAE6;
  line-height: 1.7;
}

.search-bar {
  margin: 12px 16px 0;
  padding: 7px;
  border: 1px solid var(--color-border);
  border-radius: 15px;
  background: var(--color-card);
  box-shadow: 0 7px 22px rgba(61, 42, 31, .06);
  top: calc(var(--header-h) + 8px);
}

.search-input-wrap {
  height: 42px;
  border-radius: 11px;
  background: #F8F5F2;
}

.search-submit {
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  color: white;
  background: var(--color-text);
}

.cat-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--color-primary);
}

.phone-input-bar,
.group-tip {
  margin-left: 16px;
  margin-right: 16px;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.goods-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 18px 16px;
}

.goods-card {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: 0 7px 24px rgba(61, 42, 31, .05);
  transition: transform .18s ease, box-shadow .18s ease;
}

.goods-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(61, 42, 31, .1);
}

.goods-card .goods-img,
.detail-image,
.detail-image-inner {
  background: #fff;
}

.goods-card .goods-img img,
.detail-image-inner img,
.cart-item .item-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.product-image-placeholder {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-primary) !important;
  background: linear-gradient(145deg, #fff, var(--color-primary-bg)) !important;
  text-align: center;
}

.product-image-placeholder span {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 22px;
  font-weight: 700;
}

.product-image-placeholder small {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.goods-card .goods-info { padding: 13px 14px 16px; }
.goods-card .goods-name { min-height: 2.8em; }
.goods-card .add-cart-btn {
  right: 12px;
  bottom: 12px;
  box-shadow: 0 5px 15px rgba(139, 30, 24, .25);
}

.detail-image {
  margin: 18px auto 0;
  width: min(calc(100% - 32px), 620px);
  border: 1px solid var(--color-border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(61, 42, 31, .09);
}

.detail-image-inner { width: 100%; height: 100%; }
.detail-info,
.sku-selector,
.price-table,
#page-goods-detail > .card {
  width: min(calc(100% - 32px), 760px);
  margin-left: auto !important;
  margin-right: auto !important;
}

.detail-info { margin-top: 16px; border-radius: 18px; }
.detail-info .detail-name {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: clamp(24px, 4vw, 36px);
}

.sku-item { border-radius: 10px; }
.sku-item.active {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.card { border: 1px solid var(--color-border); box-shadow: 0 7px 22px rgba(61, 42, 31, .05); }
.btn { border-radius: 12px; }
.form-input, .form-textarea, .form-select { border-radius: 10px; }

.cat-sidebar { background: var(--color-card); }
.cat-item { border-radius: 10px; }
.cat-item.active { color: var(--color-primary); background: var(--color-primary-bg); }

@media (max-width: 920px) {
  .goods-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .catalog-hero { margin: 12px 12px 0; padding: 26px 19px; border-radius: 20px; }
  .catalog-hero h1 { font-size: 31px; }
  .search-bar { margin: 10px 12px 0; }
  .phone-input-bar, .group-tip { margin-left: 12px; margin-right: 12px; }
  .goods-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 13px 12px; }
  .goods-card .goods-img { height: auto; }
  .goods-card .goods-info { padding: 10px 11px 13px; }
  .goods-card .goods-name { font-size: 13px; }
  .tab-bar { bottom: 0; border-width: 1px 0 0; border-radius: 0; box-shadow: 0 -5px 18px rgba(61,42,31,.07); }
}
