:root {
  --ink: #18212f;
  --muted: #68758a;
  --line: #d9e1e8;
  --soft: #f4f7f8;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warn: #b45309;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f8faf9;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}
button, .primary-link {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
}
button:hover, .primary-link:hover { background: var(--accent-dark); }
button:disabled { background: #9aa6b2; border-color: #9aa6b2; cursor: not-allowed; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 220px minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  width: 220px;
  min-width: 0;
}
.brand-logo {
  width: 100%;
  height: 46px;
  object-fit: contain;
  object-position: left center;
}
.top-search { display: flex; gap: 8px; }
.top-search button { width: 92px; }
.top-nav { display: flex; gap: 18px; color: var(--muted); font-weight: 700; }
.top-nav span { color: var(--ink); }
.logout-form { margin: 0; }
.logout-form button {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.logout-form button:hover { background: transparent; color: var(--accent-dark); }
.messages { max-width: 1180px; margin: 16px auto 0; padding: 0 20px; }
.message { padding: 12px 14px; border-radius: 6px; background: #e8f5f2; border: 1px solid #b7ded6; }
.message.error { background: #fff1f2; border-color: #fecdd3; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 48px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 36px;
  align-items: center;
  min-height: 380px;
  padding: 36px 0 44px;
}
.hero h1 { font-size: 44px; margin: 0 0 14px; letter-spacing: 0; }
.hero p { max-width: 620px; color: var(--muted); font-size: 18px; margin: 0 0 24px; }
.hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.content-band { margin-top: 28px; }
.section-title, .card-bottom, .cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.section-title h2, .page-head h1 { margin: 0; }
.section-title a { color: var(--accent-dark); font-weight: 700; }
.category-grid, .product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.category-tile, .product-card, .filters, .order-preview, .status-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.category-tile { padding: 16px; display: grid; gap: 4px; }
.category-tile span, .meta, .empty, .page-head p, .product-card p { color: var(--muted); }
.product-card { overflow: hidden; display: grid; grid-template-rows: 150px 1fr; }
.product-image img { width: 100%; height: 150px; object-fit: cover; background: var(--soft); }
.product-body { padding: 14px; display: grid; gap: 10px; }
.product-name { font-weight: 800; min-height: 48px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.card-bottom strong { color: var(--warn); }

.page-head { margin-bottom: 20px; }
.catalog-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { padding: 14px; position: sticky; top: 82px; }
.filters form, .checkout-form, .buy-box { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; }
.ghost-button { display: inline-flex; justify-content: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.result-count { margin-bottom: 12px; color: var(--muted); }
.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding: 14px 0;
}
.pagination-total {
  margin-right: auto;
  color: var(--ink);
  white-space: nowrap;
}
.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.page-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}
.page-button.active {
  border-color: #2f96ff;
  color: #1479e8;
  box-shadow: 0 0 0 1px rgba(47,150,255,.15);
}
.page-button.disabled {
  color: #b8c0ca;
  background: #f7f8fa;
}
.page-ellipsis {
  min-width: 34px;
  text-align: center;
  color: #9aa6b2;
  font-weight: 800;
}
.page-size-form,
.jump-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.page-size-form select {
  width: 122px;
  height: 38px;
  padding: 6px 10px;
  border-radius: 4px;
  background: white;
  font-weight: 700;
}
.page-size-form select:focus,
.jump-form input:focus {
  outline: 0;
  border-color: #2f96ff;
  box-shadow: 0 0 0 3px rgba(47,150,255,.16);
}
.jump-form span {
  white-space: nowrap;
}
.jump-form input {
  width: 72px;
  height: 38px;
  padding: 6px 8px;
  border-radius: 4px;
  text-align: center;
}
.jump-form button {
  width: auto;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 4px;
}

.detail-layout { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 28px; align-items: start; }
.detail-media img { aspect-ratio: 1 / 1; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; }
.breadcrumb, .lead { color: var(--muted); }
.detail-main h1 { font-size: 34px; margin: 8px 0; }
.spec-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.spec-list div, .sku-panel div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.spec-list dt, .sku-panel span { color: var(--muted); font-size: 13px; }
.spec-list dd { margin: 2px 0 0; font-weight: 800; word-break: break-word; }
.buy-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.sku-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 10px; }
.attachment-list a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: white; }

.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: var(--soft); }
.inline-form { display: flex; gap: 8px; min-width: 170px; }
.inline-form button { width: 76px; }
.danger { background: #be123c; border-color: #be123c; }
.cart-summary { margin-top: 16px; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 8px; }

.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.checkout-form, .order-preview { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.field-error { color: #be123c; font-size: 13px; }
.preview-line { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.preview-line em { color: var(--muted); font-style: normal; }
.preview-total { margin-top: 14px; font-weight: 800; color: var(--warn); }
.status-panel { display: grid; gap: 8px; padding: 16px; margin-bottom: 18px; }
.verify-form { max-width: 420px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.auth-panel {
  max-width: 460px;
  margin: 28px auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.auth-panel h1 { margin: 0 0 8px; }
.auth-panel p { color: var(--muted); }
.auth-form { display: grid; gap: 12px; margin-top: 18px; }
.auth-form small { color: var(--muted); font-size: 12px; }
.auth-switch a { color: var(--accent-dark); font-weight: 800; }
.site-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: white;
}

@media (max-width: 820px) {
  .site-header, .hero, .catalog-layout, .detail-layout, .checkout-layout { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .brand {
    width: min(240px, 100%);
  }
  .top-nav { justify-content: space-between; }
  .hero { min-height: unset; }
  .hero h1 { font-size: 34px; }
  .filters { position: static; }
  .spec-list, .sku-panel, .info-grid { grid-template-columns: 1fr; }
  .pagination-bar { justify-content: flex-start; }
  .pagination-total { width: 100%; }
  .pagination-pages { overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
}
