:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #c45c3e;
  --accent-hover: #a84d33;
  --border: #e8e4de;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(26, 26, 26, 0.06);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

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

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem;
}

.nav a:hover {
  color: var(--accent);
}

.nav-muted {
  opacity: 0.75;
}

.nav-user {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nav-points {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(196, 92, 62, 0.1);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.nav-review-link {
  position: relative;
  padding-right: 0.35rem;
}

.nav-review-dot {
  position: absolute;
  top: 0.05rem;
  right: -0.2rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 1.5px var(--surface);
  pointer-events: none;
}

.main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.site-footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0;
}

.site-footer-icp {
  margin-top: 0.35rem;
}

.site-footer-icp a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer-icp a:hover {
  color: var(--text);
  text-decoration: underline;
}

.trading-hours-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  color: #8a4b12;
  background: #fff8ed;
  border: 1px solid #f0d9b8;
  border-radius: var(--radius);
}

.trading-hours-banner--open {
  color: #2d5a3d;
  background: #f0f7f2;
  border-color: #c5e0cc;
}

.order-trading-hours {
  margin-bottom: 0;
}

.flash-wrap {
  margin-bottom: 1.25rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.flash-success {
  background: #e8f5e9;
  color: #1b5e20;
}

.flash-danger {
  background: #ffebee;
  color: #b71c1c;
}

.flash-warning {
  background: #fff8e1;
  color: #e65100;
}

.flash-info {
  background: #e3f2fd;
  color: #0d47a1;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

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

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover {
  background: #b71c1c;
  color: #fff;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 420px;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-check input {
  width: auto;
}

.form-check label {
  margin: 0;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-muted);
  cursor: pointer;
}

.sales-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sales-filter .form-group {
  margin-bottom: 0;
}

.sales-filter .form-group input[type="text"],
.sales-filter .form-group select {
  min-width: 200px;
  max-width: 280px;
}

.sales-filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sales-export-bar {
  margin: 0 0 0.75rem;
}

.admin-user-edit-form {
  max-width: 480px;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  white-space: normal;
}

.admin-user-delete-form {
  margin: 0;
  display: inline;
}

.admin-users-filter {
  margin-bottom: 1.25rem;
}

.admin-users-table .th-sortable {
  white-space: nowrap;
}

.th-sort-label {
  vertical-align: middle;
}

.table-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.15rem;
  padding: 0;
  border-radius: 3px;
  color: var(--text-muted);
  text-decoration: none;
  vertical-align: middle;
  line-height: 1;
}

.table-sort-btn:hover {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.05);
}

.table-sort-icon {
  font-size: 0.58rem;
  line-height: 1;
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-card h1 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
}

.auth-links {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.category-bar a {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
}

.category-bar a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-bar a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(26, 26, 26, 0.08);
}

.product-card a.card-link {
  color: inherit;
  text-decoration: none;
}

.product-card .thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(145deg, #ebe8e4, #ddd9d3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .thumb .no-img {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.product-card .body {
  padding: 1rem 1.1rem 1.15rem;
}

.product-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.product-card .meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.product-card .price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
}

/* 商品详情图 1：固定 400×400 区域，contain 完整显示 */
.product-detail-img-fig {
  position: relative;
  box-sizing: border-box;
  width: 400px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 400px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #ebe8e4, #ddd9d3);
}

.product-detail-img-fig--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.product-detail .gallery {
  background: linear-gradient(145deg, #ebe8e4, #ddd9d3);
  border-radius: 10px;
  overflow: hidden;
}

.product-detail .gallery:not(.product-gallery) {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail .gallery.product-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.5rem;
  aspect-ratio: auto;
  min-height: 260px;
}

@media (max-width: 520px) {
  .product-detail .gallery.product-gallery {
    grid-template-columns: 1fr;
  }
}

.product-detail .gallery img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 双图时：首张维持原展示；第二张在正方形容器内 cover 裁剪 */
.product-detail .gallery.product-gallery > img {
  width: 100%;
  min-height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.product-detail .gallery.product-gallery .gallery-img-square {
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  align-self: center;
}

.product-detail .gallery.product-gallery .gallery-img-square img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.product-detail h1 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.product-detail .desc {
  color: var(--text-muted);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.product-detail .buy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.product-detail input[type="number"] {
  width: 80px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

table.data-table th,
table.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  font-weight: 600;
  background: #faf9f7;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

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

/* 订单明细 / 列表：缩略图 + 点击放大（见 image-lightbox.js） */
.order-line-product {
  vertical-align: top;
}

.order-proof-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin: -0.25rem 0 1rem;
}

.order-proof-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.order-proof-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.order-proof-thumbs .order-thumb-trigger {
  margin-bottom: 0;
}

.order-proof-thumbs--compact {
  gap: 0.35rem;
}

.order-thumb-trigger {
  display: inline-block;
  padding: 0;
  margin: 0 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: #f5f4f2;
  cursor: zoom-in;
  overflow: hidden;
  line-height: 0;
  max-width: 100%;
  vertical-align: top;
}

.order-thumb-trigger:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.order-thumb-img {
  width: 120px;
  height: 120px;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #f5f4f2;
}

.order-card-proof .order-thumb-img,
.seller-proof-cell .order-thumb-img {
  width: 96px;
  height: 96px;
}

.order-card-proof {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.order-card-proof-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.order-card-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.order-detail-no-img {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* 全站图片 lightbox */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 12, 9, 0.82);
  cursor: pointer;
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1100px);
  max-height: min(92vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.image-lightbox-img {
  max-width: 100%;
  max-height: min(88vh, 860px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.image-lightbox-close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  pointer-events: auto;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.image-lightbox-close:hover {
  background: #fff;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-card-col .order-no {
  font-size: 0.8125rem;
  font-weight: 600;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow);
}

.order-card > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.order-cancel-form {
  margin: 0;
  display: inline;
}

.order-card .status {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.status-pending {
  background: #fff8e1;
  color: #e65100;
}

.status-paid {
  background: #e8f5e9;
  color: #1b5e20;
}

.status-review {
  background: #e3f2fd;
  color: #1565c0;
}

.status-done {
  background: #e8f5e9;
  color: #1b5e20;
}

.status-expired {
  background: #fef3c7;
  color: #92400e;
}

.status-inactive {
  background: #eceff1;
  color: #455a64;
}

.status-rejected {
  background: #ffebee;
  color: #c62828;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.cart-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.cart-total {
  font-size: 1.25rem;
  font-weight: 700;
  margin-left: auto;
}

.payment-box {
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}

.payment-box .amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0;
}

/* 我的钱包 */
.wallet-page {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.wallet-page-title {
  font-size: clamp(1.15rem, 0.85rem + 1.6vw, 1.75rem);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.wallet-page-sub {
  font-size: clamp(0.78rem, 0.68rem + 0.55vw, 0.9375rem);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.wallet-filter {
  margin-bottom: 1.5rem;
  max-width: 100%;
}

.wallet-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.wallet-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.wallet-filter-field select,
.wallet-date-input {
  max-width: 100%;
  min-width: 4.5rem;
  padding: 0.38rem 0.5rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: clamp(0.75rem, 0.65rem + 0.35vw, 0.8125rem);
  box-sizing: border-box;
}

.wallet-filter-field--date {
  min-width: 9rem;
}

.wallet-filter-sep {
  align-self: flex-end;
  padding-bottom: 0.45rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.wallet-filter-submit {
  margin-top: 1.15rem;
}

.wallet-filter .btn {
  margin-top: 1.15rem;
}

.wallet-period-hint {
  font-size: clamp(0.72rem, 0.62rem + 0.35vw, 0.8125rem);
  color: var(--text-muted);
  margin: 0.65rem 0 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.wallet-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.35rem, 0.15rem + 1vw, 0.65rem);
  margin-top: 0.5rem;
  width: 100%;
  min-width: 0;
}

.wallet-stat-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wallet-stat-grid > * {
  min-width: 0;
}

.wallet-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(0.4rem, 0.25rem + 0.6vw, 0.65rem) clamp(0.3rem, 0.15rem + 0.5vw, 0.5rem);
  box-shadow: var(--shadow);
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.wallet-stat-highlight {
  border-color: var(--accent);
  background: linear-gradient(145deg, #faf8f5, #fff);
}

.wallet-stat-value {
  display: block;
  font-size: clamp(0.65rem, 0.28rem + 2.1vw, 1.22rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.wallet-stat-label {
  display: block;
  font-size: clamp(0.52rem, 0.22rem + 1.15vw, 0.6875rem);
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
}

.wallet-footnote {
  font-size: clamp(0.6rem, 0.5rem + 0.35vw, 0.6875rem);
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 1.25rem;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 卖家审核：支付凭证缩略图 */
.seller-proof-cell {
  vertical-align: top;
  min-width: 120px;
  max-width: 140px;
}

.seller-proof-thumb {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f0eeeb;
}

.seller-proof-missing {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* 销售明细表 */
.sales-table-wrap {
  -webkit-overflow-scrolling: touch;
}

table.sales-table {
  table-layout: fixed;
  width: 100%;
  min-width: 56rem;
}

table.sales-table th {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.order-no {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.page-title .order-no {
  font-size: 0.72em;
  font-weight: 600;
}

.sales-col-order {
  width: 5.75rem;
  min-width: 5.75rem;
  max-width: 5.75rem;
  font-size: 0.75rem;
  line-height: 1.35;
  vertical-align: top;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.sales-col-time {
  width: 7.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sales-col-buyer {
  width: 9.5rem;
  min-width: 9.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  vertical-align: top;
}

.sales-col-seller {
  width: 8.5rem;
  min-width: 8.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  vertical-align: top;
}

.sales-party-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-party-name--buyer {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
}

.sales-party-login--buyer {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
}

.sales-party-name--seller {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
}

.sales-party-login {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-party-login--seller {
  font-size: 0.6875rem;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
}

.sales-col-product {
  width: 8em;
  max-width: 8em;
  min-width: 8em;
  font-size: 0.8125rem;
  line-height: 1.4;
  vertical-align: top;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.sales-col-qty {
  width: 2.5rem;
  text-align: center;
}

.sales-col-unit {
  width: 4.75rem;
  white-space: nowrap;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.sales-col-sub {
  width: 5rem;
  white-space: nowrap;
  font-weight: 600;
}

.sales-col-proof {
  width: 5.5rem;
}

.sales-col-status {
  width: 6.5rem;
  vertical-align: top;
}

.sales-col-status .status {
  font-size: 0.6875rem;
  padding: 0.2rem 0.45rem;
  white-space: nowrap;
}

/* 销售订单（管理员）：交易凭证缩略图，点击见 image-lightbox */
.sales-proof-cell {
  vertical-align: top;
  max-width: 320px;
}

.sales-proof-cell .order-thumb-img {
  width: 64px;
  height: 64px;
}

table.sales-table--admin {
  min-width: 62rem;
}

table.sales-table--admin .sales-proof-cell .order-thumb-img {
  width: 52px;
  height: 52px;
}

/* 卖家审核表：数据一行，操作下一行通栏居中 */
.seller-reviews-table tr.seller-review-main td {
  border-bottom: none;
  padding-bottom: 0.35rem;
  vertical-align: top;
}

.seller-reviews-table tr.seller-review-main td:first-child {
  font-size: 0.75rem;
  line-height: 1.35;
  max-width: 5.5rem;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.seller-reviews-table tr.seller-review-actions-row td.seller-review-actions-full {
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
  padding-bottom: 0.85rem;
  text-align: center;
}

.seller-reviews-table td.seller-review-op-head {
  border-bottom: none;
  padding-bottom: 0.35rem;
}

.seller-reviews-table .seller-review-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
}

.seller-reviews-table .seller-review-action-form {
  margin: 0;
  display: inline-block;
}

.seller-reviews-table .seller-review-action-form .btn {
  min-width: 5rem;
}

/* —— 管理员交易审核 —— */
.admin-audit {
  max-width: 960px;
  margin: 0 auto;
}

.admin-audit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.admin-audit-title {
  margin-bottom: 0.35rem;
}

.admin-audit-desc {
  max-width: 36rem;
  margin-bottom: 0;
}

.admin-stat-card {
  flex-shrink: 0;
  min-width: 120px;
  padding: 1rem 1.35rem;
  background: linear-gradient(145deg, #1e3a5f, #2c5282);
  color: #fff;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}

.admin-stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.admin-stat-label {
  font-size: 0.8125rem;
  opacity: 0.9;
  margin-top: 0.25rem;
  display: block;
}

.admin-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.admin-trading-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.admin-trading-status--open {
  color: #1a6b3a;
  font-weight: 600;
}

.admin-trading-status--closed {
  color: var(--accent);
  font-weight: 600;
}

.admin-trading-form {
  max-width: 28rem;
}

.admin-trading-toggle-wrap {
  margin-bottom: 1.25rem;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

.admin-toggle {
  --admin-toggle-font: 0.9375rem;
  --admin-toggle-lh: 1.4;
  --admin-toggle-track-h: 1.35em;
  --admin-toggle-track-w: 2.35em;
  --admin-toggle-pad: 0.12em;
  --admin-toggle-knob: calc(var(--admin-toggle-track-h) - var(--admin-toggle-pad) * 2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 0.65em;
  font-size: var(--admin-toggle-font);
  line-height: var(--admin-toggle-lh);
  cursor: pointer;
  user-select: none;
}

.admin-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-toggle-box {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--admin-toggle-track-w) + 0.7em);
  height: calc(var(--admin-toggle-track-h) + 0.45em);
  padding: 0.225em 0.35em;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e2dc);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.08),
    0 4px 14px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.admin-toggle-input:checked ~ .admin-toggle-box {
  border-color: rgba(29, 154, 85, 0.35);
  box-shadow:
    0 2px 8px rgba(29, 154, 85, 0.2),
    0 4px 16px rgba(29, 154, 85, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.admin-toggle-input:not(:checked) ~ .admin-toggle-box {
  border-color: rgba(197, 48, 48, 0.28);
  box-shadow:
    0 2px 8px rgba(197, 48, 48, 0.14),
    0 4px 14px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.admin-toggle-track {
  position: relative;
  display: block;
  width: var(--admin-toggle-track-w);
  height: var(--admin-toggle-track-h);
  border-radius: 999px;
  background: #c53030;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background 0.2s ease;
}

.admin-toggle-track::after {
  content: "";
  position: absolute;
  top: var(--admin-toggle-pad);
  left: var(--admin-toggle-pad);
  width: var(--admin-toggle-knob);
  height: var(--admin-toggle-knob);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.admin-toggle-input:checked ~ .admin-toggle-box .admin-toggle-track {
  background: #1d9a55;
}

.admin-toggle-input:checked ~ .admin-toggle-box .admin-toggle-track::after {
  transform: translateX(
    calc(var(--admin-toggle-track-w) - var(--admin-toggle-knob) - var(--admin-toggle-pad) * 2)
  );
}

.admin-toggle-input:focus-visible ~ .admin-toggle-box .admin-toggle-track {
  outline: 2px solid #c53030;
  outline-offset: 1px;
}

.admin-toggle-input:checked:focus-visible ~ .admin-toggle-box .admin-toggle-track {
  outline-color: #1d9a55;
}

.admin-toggle-label,
.admin-toggle-state {
  font-size: 1em;
  font-weight: 600;
  line-height: var(--admin-toggle-lh);
}

.admin-toggle-state {
  flex-shrink: 0;
  min-width: 2.5em;
  text-align: center;
}

.admin-toggle-state::before {
  content: "关闭";
  font-size: 1em;
  color: #c53030;
}

.admin-toggle-input:checked ~ .admin-toggle-state::before {
  content: "开启";
  color: #1d9a55;
}

.admin-preset-preview-cell {
  white-space: normal;
  max-width: 120px;
}

.admin-preset-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin: 0 0.2rem 0.2rem 0;
  background: #f5f4f2;
}

.admin-preset-current-preview .form-label-like {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.admin-preset-current-imgs {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.one-click-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.one-click-preset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.one-click-preset-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
}

.one-click-preset-cat {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.one-click-preset-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

.one-click-preset-price {
  font-size: 0.8125rem;
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.one-click-preset-imgs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.one-click-preset-imgs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.one-click-qty-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.one-click-qty-input {
  width: 5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.admin-preset-current-imgs figure {
  margin: 0;
  text-align: center;
}

.admin-preset-current-imgs img {
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: #f5f4f2;
}

.admin-preset-current-imgs figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.admin-audit-section {
  margin-bottom: 2.5rem;
}

.admin-recent-section {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.admin-audit-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.audit-card-head {
  padding: 1rem 1.25rem;
  background: #faf9f7;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.audit-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.audit-order-id {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.audit-time {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.audit-card-buyer {
  font-size: 0.9375rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.audit-total {
  color: var(--text);
}

.audit-card-body {
  padding: 1rem 1.25rem 1.25rem;
}

.audit-table-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.audit-table-wrap {
  margin-bottom: 1rem;
}

.audit-lines th,
.audit-lines td {
  font-size: 0.875rem;
  vertical-align: middle;
}

.audit-points-cell {
  font-weight: 600;
  color: #1565c0;
}

.audit-seller-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.75rem 1rem;
  background: #f0f7ff;
  border-radius: 10px;
  border: 1px solid #bbdefb;
}

.audit-summary-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.audit-pill {
  font-size: 0.8125rem;
  padding: 0.3rem 0.65rem;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.audit-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.audit-actions-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.audit-form {
  display: inline;
  margin: 0;
}

.admin-empty {
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .audit-lines .data-table th:nth-child(6),
  .audit-lines .data-table td:nth-child(6) {
    white-space: nowrap;
  }

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

  .audit-actions-primary {
    width: 100%;
    flex-direction: column-reverse;
  }

  .audit-actions-primary .btn {
    width: 100%;
  }
}

/* ========== 移动端全站自适应（手机竖屏 / 小屏） ========== */

@media (max-width: 768px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .main {
    padding: 1.25rem 0 2.5rem;
  }

  .page-title {
    font-size: 1.45rem;
  }

  .page-sub {
    font-size: 0.9rem;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .product-detail {
    padding: 1rem;
    gap: 1.25rem;
  }

  .auth-card {
    padding: 1.5rem 1.15rem;
    max-width: 100%;
  }

  .payment-box {
    padding: 1.5rem 1.15rem;
    max-width: 100%;
  }

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

  .cart-total {
    margin-left: 0;
    width: 100%;
    text-align: left;
  }

  table.data-table th,
  table.data-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
  }

  .admin-audit {
    max-width: 100%;
  }

  .admin-audit-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    min-height: auto;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .logo {
    font-size: 1.1rem;
  }

  .nav {
    justify-content: flex-start;
    gap: 0.4rem 0.6rem;
    row-gap: 0.5rem;
  }

  .nav a {
    font-size: 0.8125rem;
  }

  .nav-points {
    font-size: 0.75rem;
    padding: 0.22rem 0.5rem;
  }

  .nav-user {
    font-size: 0.8rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .category-bar {
    margin-bottom: 1.2rem;
    gap: 0.4rem;
  }

  .category-bar a {
    padding: 0.38rem 0.85rem;
    font-size: 0.8125rem;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .product-card h2 {
    font-size: 0.9375rem;
  }

  .product-detail .buy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .product-detail .buy-row form {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }

  .product-detail .buy-row input[type="number"] {
    width: 100%;
    max-width: 12rem;
  }

  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="password"],
  .form-group input[type="number"],
  .form-group select,
  .form-group textarea {
    max-width: 100%;
  }

  .admin-user-edit-form {
    max-width: 100%;
  }

  .sales-filter {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .sales-filter .form-group input[type="text"],
  .sales-filter .form-group select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .sales-filter-actions {
    width: 100%;
  }

  .sales-filter-actions .btn {
    flex: 1;
    min-width: 0;
  }

  table.sales-table {
    min-width: 34rem;
    font-size: 0.8125rem;
  }

  table.sales-table th,
  table.sales-table td {
    padding: 0.5rem 0.4rem;
  }

  table.sales-table th {
    font-size: 0.6875rem;
  }

  .sales-col-order {
    width: 4.25rem;
    min-width: 4.25rem;
    max-width: 4.25rem;
    font-size: 0.6875rem;
    line-height: 1.3;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .sales-col-time {
    width: 4.75rem;
    font-size: 0.6875rem;
    line-height: 1.3;
    white-space: normal;
  }

  .sales-col-buyer {
    width: 7rem;
    min-width: 7rem;
    font-size: 0.75rem;
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }

  .sales-party-name--buyer {
    font-size: 0.75rem;
    font-weight: 500;
  }

  .sales-col-buyer .sales-party-login--buyer {
    display: block;
    font-size: 0.6875rem;
  }

  .sales-col-seller .sales-party-login:not(.sales-party-login--buyer) {
    display: block;
  }

  .sales-col-seller {
    width: 5.25rem;
    min-width: 5.25rem;
    max-width: 5.25rem;
    font-size: 0.75rem;
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
  }

  .sales-party-name--seller {
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 5.25rem;
    white-space: normal;
    word-break: break-word;
  }

  .sales-party-login--seller {
    display: block;
    font-size: 0.6875rem;
    margin-top: 0.1rem;
    white-space: normal;
    word-break: break-word;
  }

  .sales-col-product {
    width: 8em;
    max-width: 8em;
    min-width: 8em;
    font-size: 0.75rem;
  }

  .sales-col-qty {
    width: 2rem;
    font-size: 0.75rem;
  }

  .sales-col-unit {
    display: none;
  }

  .sales-col-sub {
    width: 4.25rem;
    font-size: 0.8125rem;
  }

  .sales-col-proof {
    width: 3.5rem;
  }

  table.sales-table--admin .sales-proof-cell .order-thumb-img {
    width: 40px;
    height: 40px;
  }

  .sales-col-status {
    width: 4.5rem;
  }

  .sales-col-status .status {
    font-size: 0.625rem;
    padding: 0.15rem 0.35rem;
    line-height: 1.25;
    white-space: normal;
    display: inline-block;
    max-width: 4.25rem;
    text-align: center;
  }

  table.sales-table--admin {
    min-width: 42rem;
  }

  .wallet-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .wallet-filter-field select,
  .wallet-date-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .wallet-filter-sep {
    align-self: center;
    padding-bottom: 0;
    text-align: center;
  }

  .wallet-filter .btn,
  .wallet-filter-submit {
    margin-top: 0;
    width: 100%;
  }

  .order-card {
    flex-direction: column;
    align-items: stretch;
  }

  .order-card > div:last-child {
    justify-content: flex-start;
  }

  .flash {
    font-size: 0.875rem;
    padding: 0.65rem 0.85rem;
  }

  .btn {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 38px;
  }
}

@media (max-width: 380px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .payment-box .amount {
    font-size: 1.65rem;
  }
}
