:root {
  color-scheme: light;
  --ink: #202427;
  --muted: #687176;
  --line: #dfe5e6;
  --paper: #f3f5f6;
  --white: #ffffff;
  --teal: #0f8f83;
  --teal-dark: #08655e;
  --coral: #e95f47;
  --gold: #b8862f;
  --graphite: #22282c;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 58px;
  padding: 0 22px;
  background: #263034;
  color: white;
  border-bottom: 3px solid var(--teal);
}

.brand,
.topnav,
.ghost-button,
.primary-button,
.secondary-button,
.buy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand {
  justify-self: start;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: white;
  background: var(--teal);
  border-radius: 6px;
  overflow: hidden;
}

.brand-mark.has-image {
  width: min(220px, 36vw);
  height: 52px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topnav {
  gap: 28px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.topnav a:hover {
  color: white;
}

.ghost-button,
.primary-button,
.secondary-button,
.buy-button,
.icon-button,
.category-link {
  cursor: pointer;
  border: 0;
  border-radius: 6px;
}

.ghost-button {
  justify-self: end;
  min-height: 34px;
  padding: 0 14px;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-area {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.auth-user {
  max-width: 280px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.wholesale-shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 54px;
}

.shop-head {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 520px);
  gap: 24px;
  align-items: end;
  padding: 26px 28px;
  background: white;
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.shop-head h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: 0;
}

.shop-head p,
.side-card p,
.goods-name + p,
.pay-preview p,
.admin-hero p {
  color: var(--muted);
  line-height: 1.65;
}

.product-rich-text,
#modalDesc {
  color: var(--muted);
  line-height: 1.65;
}

.product-rich-text p,
.product-rich-text ul,
.product-rich-text ol,
#modalDesc p,
#modalDesc ul,
#modalDesc ol {
  margin: 4px 0;
}

.product-rich-text pre,
.product-rich-text code,
#modalDesc pre,
#modalDesc code {
  white-space: pre-wrap;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  background: #f2f6f4;
  border-radius: 6px;
}

.product-rich-text pre,
#modalDesc pre {
  padding: 8px;
  overflow: auto;
}

.search-box,
.query-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.12);
}

input,
select {
  min-height: 40px;
}

textarea {
  min-height: 140px;
  padding-top: 10px;
  line-height: 1.6;
  resize: vertical;
}

.primary-button,
.secondary-button,
.buy-button {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button,
.buy-button {
  color: white;
  background: var(--teal);
}

.secondary-button {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.secondary-button.active {
  color: var(--teal-dark);
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.1);
}

.buy-button {
  min-width: 88px;
}

.buy-button:disabled {
  cursor: not-allowed;
  color: #8a9698;
  background: #e8ecea;
}

.notice-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  margin: 12px 0;
  color: #745015;
  background: #fff7e7;
  border: 1px solid #f0dfb8;
  border-radius: 8px;
  font-size: 14px;
}

.shop-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 14px;
  align-items: start;
}

.category-panel,
.goods-panel,
.orders-panel,
.checkout-box,
.admin-stats div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-panel {
  position: sticky;
  top: 74px;
  padding: 12px;
}

.panel-title {
  padding: 10px 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.category-link {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  margin-bottom: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.category-link.active,
.category-link:hover {
  color: white;
  background: var(--teal);
}

.category-link b {
  font-weight: 800;
}

.side-card {
  padding: 14px;
  margin-top: 14px;
  background: #f7faf9;
  border: 1px dashed #cbdad7;
  border-radius: 8px;
}

.side-card p {
  margin: 8px 0 0;
  font-size: 13px;
}

.goods-panel {
  overflow: hidden;
}

.goods-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.goods-head h2,
.section-heading h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0;
}

.goods-tools {
  width: 170px;
}

.goods-table-wrap {
  overflow-x: auto;
}

.goods-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.goods-table th,
.goods-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.goods-table th {
  color: var(--muted);
  background: #f8faf9;
  font-size: 12px;
  font-weight: 900;
}

.goods-info {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 340px;
}

.goods-image {
  width: 76px;
  height: 58px;
  object-fit: cover;
  background: #eef4f1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.goods-name {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
}

.goods-name strong {
  font-size: 16px;
}

.goods-badge,
.stock {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
}

.goods-badge {
  color: var(--teal-dark);
  background: #e7f5f1;
}

.goods-table p,
.goods-table small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stock.ok {
  color: var(--teal-dark);
  background: #e7f5f1;
}

.stock.warn {
  color: #8b6119;
  background: #fff2d9;
}

.stock.out {
  color: #a44336;
  background: #ffebe6;
}

.price {
  color: var(--coral);
  font-size: 18px;
}

.orders-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  padding: 22px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.query-result {
  grid-column: 2;
  min-height: 32px;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.checkout {
  width: min(620px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

.checkout::backdrop {
  background: rgba(11, 23, 25, 0.64);
  backdrop-filter: blur(8px);
}

.checkout-box {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.auth-box {
  width: min(460px, calc(100vw - 24px));
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.modal-head h2 {
  margin: 0;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--muted);
  background: #eef4f1;
  font-size: 22px;
}

.checkout-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.checkout-product {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkout-product img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.checkout-product p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.checkout-summary > div,
.checkout-summary label {
  padding: 12px;
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkout-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.checkout-summary strong {
  display: block;
  margin-top: 8px;
}

.checkout-summary input {
  min-height: 34px;
  padding: 0 6px;
}

.price-hint {
  padding: 10px 12px;
  color: #745015;
  background: #fff7e7;
  border: 1px solid #f0dfb8;
  border-radius: 8px;
  font-size: 13px;
}

.pay-preview {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 68px;
  height: 68px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr span {
  background: var(--graphite);
  border-radius: 3px;
}

.qr span:nth-child(2) {
  background: var(--teal);
}

.qr span:nth-child(3) {
  background: var(--coral);
}

.modal-actions {
  padding: 0;
  margin: 4px 0 0;
}

.admin-body {
  min-height: 100vh;
  background: #f7faf8;
}

.admin-main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 52px 0 78px;
}

.admin-hero {
  max-width: 720px;
  margin-bottom: 24px;
}

.admin-hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 64px);
  letter-spacing: 0;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stats div {
  display: grid;
  gap: 8px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(19, 42, 42, 0.06);
}

.admin-stats strong {
  font-size: 30px;
  line-height: 1;
}

.admin-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-card {
  padding: 22px;
  margin-bottom: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.level-editor {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.level-row,
.category-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.category-row {
  grid-template-columns: 1fr 1.4fr minmax(240px, auto) auto auto;
}

.category-icon-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.category-icon-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  color: var(--muted);
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
}

.category-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-icon-input {
  min-width: 0;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.cards-upload-grid {
  grid-template-columns: minmax(220px, 0.45fr) 1fr;
}

.cards-text-field {
  grid-column: 1 / -1;
}

.cards-text-field textarea {
  min-height: 220px;
  font-family: Consolas, "Courier New", monospace;
}

.member-order-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.member-order-head p {
  margin: 0;
  color: var(--muted);
}

.order-filter-form {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(180px, 1.3fr) auto auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0 14px;
}

.balance-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.balance-card div {
  padding: 14px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.balance-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.recharge-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.recharge-result {
  grid-column: auto;
  margin-top: 12px;
}

.recharge-records {
  margin-top: 12px;
}

.admin-thumb {
  width: 72px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.code-editor {
  min-height: 180px;
  font-family: Consolas, "Courier New", monospace;
}

.product-image-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f7faf8;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.admin-table-wrap {
  display: block;
}

.admin-table {
  margin-top: 18px;
  overflow-x: auto;
}

.admin-table table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
}

.card-info {
  max-width: 260px;
  max-height: 120px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--ink);
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 12px/1.5 Consolas, "Courier New", monospace;
}

.order-detail {
  display: grid;
  gap: 6px;
}

.article-list {
  display: grid;
  gap: 12px;
}

.article-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article-card span,
.article-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.article-card h2,
.article-detail h1 {
  margin: 0;
}

.article-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.article-content {
  color: var(--ink);
  line-height: 1.8;
}

.article-content h2,
.article-content h3 {
  margin: 24px 0 8px;
}

.article-content pre,
.article-content code {
  white-space: pre-wrap;
  font: 13px/1.6 Consolas, "Courier New", monospace;
  background: #f2f6f4;
  border-radius: 6px;
}

.article-content pre {
  padding: 12px;
  overflow: auto;
}

.order-detail p {
  margin: 0;
}

#levelList {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

#levelList p {
  display: grid;
  gap: 2px;
  margin: 0;
}

#levelList span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .topnav {
    display: none;
  }

  .auth-area {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .auth-user {
    max-width: 180px;
  }

  .shop-head,
  .shop-layout,
  .orders-panel {
    grid-template-columns: 1fr;
  }

  .category-panel {
    position: static;
  }

  .query-result {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .wholesale-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 10px;
  }

  .shop-head {
    padding: 20px;
  }

  .search-box,
  .query-form,
  .order-filter-form,
  .recharge-form,
  .balance-card,
  .checkout-summary,
  .pay-preview,
  .checkout-product,
  .admin-form-grid,
  .level-row,
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .notice-bar,
  .member-order-head,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Alignment refinements */
.topnav {
  text-align: center;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.panel-title {
  text-align: center;
}

.category-link {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  text-align: center;
}

.category-icon {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
}

.category-icon-empty {
  visibility: hidden;
}

.category-link span {
  justify-self: center;
  min-width: 0;
  text-align: center;
}

.category-link b {
  justify-self: end;
  min-width: 24px;
  text-align: center;
}

/* Product list simplification and checkout refinement */
.goods-info-compact {
  grid-template-columns: 74px 1fr;
  min-width: 260px;
}

.goods-info-compact .goods-image {
  width: 74px;
  height: 74px;
}

.goods-delivery {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  margin-top: 6px;
  color: var(--teal-dark);
  background: #e8f6f3;
  border: 1px solid #cce8e2;
  border-radius: 6px;
  font-weight: 800;
}

.recharge-level-card {
  margin: 0 0 14px;
}

.checkout {
  width: min(860px, calc(100% - 28px));
}

.checkout-box {
  max-height: min(86vh, 760px);
  overflow-y: auto;
}

.checkout-product {
  grid-template-columns: 128px 1fr;
  align-items: start;
}

.checkout-product img {
  width: 128px;
  height: 96px;
}

#modalSku {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#modalDesc {
  max-height: 220px;
  margin-top: 8px;
  overflow: auto;
  padding-right: 4px;
}

.checkout-desc-block {
  color: var(--ink);
}

.checkout-merchant-message {
  padding: 10px 12px;
  margin: 10px 0 0;
  color: #745015;
  background: #fff7e7;
  border: 1px solid #f0dfb8;
  border-radius: 8px;
}

/* Admin left navigation */
.admin-body .topbar .topnav {
  display: none;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-content {
  min-width: 0;
}

.admin-side-nav {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-side-nav::before {
  content: "后台分类";
  padding: 8px 10px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-side-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: #f7faf9;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.admin-side-nav a:hover {
  color: var(--teal-dark);
  background: #eaf6f3;
  border-color: #c8e7e1;
}

.admin-content > .admin-card,
.admin-content > .orders-panel,
.admin-content > .admin-hero,
.admin-content > .admin-stats {
  scroll-margin-top: 82px;
}

@media (max-width: 920px) {
  .admin-body .topbar .topnav {
    display: none;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-side-nav {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .admin-side-nav::before {
    display: none;
  }

  .admin-side-nav a {
    flex: 0 0 auto;
    min-width: 96px;
  }
}

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

  .checkout-product img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  #modalDesc {
    max-height: 180px;
  }
}

/* Checkout detail redesign */
#checkoutDialog {
  width: min(1060px, calc(100% - 28px));
}

#checkoutForm {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  grid-template-areas:
    "head head"
    "product summary"
    "product delivery"
    "product email"
    "product password"
    "product paytype"
    "product pay"
    "product result"
    "product actions";
  gap: 14px 18px;
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 22px;
}

/* Admin page switching and card manager */
.admin-page-hidden {
  display: none !important;
}

.admin-side-nav a.active {
  color: var(--teal-dark);
  background: #dff2ee;
  border-color: #9bd6cc;
  box-shadow: inset 3px 0 0 var(--teal);
}

.card-manage-heading {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.card-filter-grid {
  align-items: end;
}

.card-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.danger-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #f2b8b5;
  border-radius: 7px;
  color: #9f1d1d;
  background: #fff1f0;
  font-weight: 800;
  cursor: pointer;
}

.danger-button:hover {
  background: #ffe2df;
  border-color: #e28b86;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-available {
  color: #0f6b4f;
  background: #dcf7eb;
}

.status-used {
  color: #7a3f00;
  background: #fff0cf;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #f8faf9;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.rule-block {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.rule-block + .rule-block {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rule-block > b {
  color: var(--ink);
  font-size: 13px;
}

.merged-rule-heading {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.inline-code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.inline-code-field .secondary-button {
  white-space: nowrap;
}

#checkoutForm > .modal-head {
  grid-area: head;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

#checkoutForm > .checkout-product {
  grid-area: product;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
  min-height: 0;
  padding: 18px;
  background: linear-gradient(180deg, #fbfdfc, #f6faf9);
}

#checkoutForm > .checkout-product img {
  width: 180px;
  height: 136px;
  object-fit: cover;
  border-radius: 8px;
}

#checkoutForm #modalSku {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

#checkoutForm #modalDesc {
  max-height: none;
  height: min(52vh, 430px);
  min-height: 340px;
  padding: 16px;
  overflow: auto;
  color: var(--ink);
  background: white;
  border: 1px solid #dfe8e8;
  border-radius: 8px;
  line-height: 1.8;
}

#checkoutForm #modalDesc::before {
  content: "商品说明";
  display: block;
  margin-bottom: 12px;
  color: var(--teal-dark);
  font-size: 16px;
  font-weight: 900;
}

#checkoutForm .checkout-desc-block {
  color: var(--ink);
  font-size: 14px;
}

#checkoutForm .checkout-desc-block p,
#checkoutForm .checkout-desc-block ul,
#checkoutForm .checkout-desc-block ol {
  margin: 8px 0;
}

#checkoutForm .checkout-merchant-message {
  margin-top: 14px;
}

#checkoutForm > .checkout-summary {
  grid-area: summary;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#checkoutForm > #priceHint {
  grid-area: delivery;
  margin: 0;
}

#checkoutForm > label:nth-of-type(1) {
  grid-area: email;
}

#checkoutForm > label:nth-of-type(2) {
  grid-area: password;
}

#checkoutForm > label:nth-of-type(3) {
  grid-area: paytype;
}

#checkoutForm > .pay-preview {
  grid-area: pay;
  grid-template-columns: 64px 1fr;
}

#checkoutForm > .pay-preview .qr {
  width: 56px;
  height: 56px;
}

#checkoutForm > .checkout-result {
  grid-area: result;
  grid-column: auto;
}

#checkoutForm > .modal-actions {
  grid-area: actions;
  position: sticky;
  bottom: -22px;
  padding: 12px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), white 45%);
}

@media (max-width: 920px) {
  #checkoutForm {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "product"
      "summary"
      "delivery"
      "email"
      "password"
      "paytype"
      "pay"
      "result"
      "actions";
  }

  #checkoutForm > .checkout-product {
    min-height: auto;
  }

  #checkoutForm #modalDesc {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  #checkoutForm > .checkout-product {
    grid-template-columns: 1fr;
  }

  #checkoutForm > .checkout-product img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  #checkoutForm #modalDesc {
    min-height: 240px;
  }
}

/* Visual polish layer */
:root {
  --paper: #eef3f4;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #192124;
  --muted: #647176;
  --line: #d8e2e3;
  --teal: #0b8f84;
  --teal-dark: #07665f;
  --coral: #de5b46;
  --gold: #ac7b25;
  --shadow-sm: 0 8px 22px rgba(19, 42, 42, 0.07);
  --shadow-md: 0 18px 42px rgba(19, 42, 42, 0.1);
}

body {
  background:
    linear-gradient(180deg, #f8fbfb 0, var(--paper) 310px),
    var(--paper);
}

.topbar {
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  min-height: 64px;
  padding: 0 26px;
  background: rgba(31, 39, 41, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(14, 26, 28, 0.16);
  backdrop-filter: blur(10px);
}

.brand {
  font-size: 17px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal), #18a66f);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.12);
}

.topnav {
  justify-self: center;
  gap: 8px;
}

.topnav a {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
}

.topnav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.ghost-button {
  min-height: 36px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.buy-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button,
.buy-button {
  background: linear-gradient(180deg, #10a093, var(--teal));
  box-shadow: 0 8px 18px rgba(11, 143, 132, 0.22);
}

.secondary-button {
  background: linear-gradient(180deg, #fff, #f8fbfb);
}

.primary-button,
.secondary-button,
.buy-button,
.ghost-button {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wholesale-shell {
  width: min(1320px, calc(100% - 32px));
  padding-top: 22px;
}

.shop-head {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 500px);
  padding: 30px 32px;
  background-color: var(--surface);
  border-color: rgba(216, 226, 227, 0.9);
  box-shadow: var(--shadow-sm);
}

.shop-head::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 143, 132, 0.08), rgba(222, 91, 70, 0.04) 46%, transparent),
    repeating-linear-gradient(135deg, rgba(11, 143, 132, 0.05) 0 1px, transparent 1px 18px);
}

.shop-head > * {
  position: relative;
}

.shop-head h1 {
  max-width: 760px;
  color: #142022;
  font-weight: 900;
}

.shop-head p {
  max-width: 760px;
  margin-bottom: 0;
}

.eyebrow {
  color: var(--teal-dark);
  letter-spacing: 0.1em;
}

.search-box {
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(216, 226, 227, 0.88);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(16, 42, 45, 0.08);
}

input,
select,
textarea {
  background: #fff;
  border-color: #d7e1e2;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b8cacb;
}

.notice-bar {
  min-height: 46px;
  margin: 14px 0;
  background: #fffaf0;
  border-color: #efd99d;
  box-shadow: 0 6px 18px rgba(172, 123, 37, 0.08);
}

.shop-layout {
  grid-template-columns: 248px 1fr;
  gap: 16px;
}

.category-panel,
.goods-panel,
.orders-panel,
.checkout-box,
.admin-card,
.admin-stats div {
  background: var(--surface);
  border-color: rgba(216, 226, 227, 0.95);
  box-shadow: var(--shadow-sm);
}

.category-panel {
  padding: 14px;
}

.panel-title {
  color: #4c5a5f;
}

.category-link {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 7px;
}

.category-link:hover {
  color: var(--teal-dark);
  background: #eaf6f3;
  border-color: #c8e7e1;
}

.category-link.active {
  color: white;
  background: linear-gradient(180deg, #11a094, var(--teal));
  box-shadow: 0 10px 20px rgba(11, 143, 132, 0.22);
}

.side-card {
  background: #f6faf8;
  border-style: solid;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.category-link {
  grid-template-columns: 54px 1fr auto;
  min-height: 70px;
  gap: 12px;
}

.category-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.goods-panel {
  border-radius: 8px;
}

.goods-head {
  padding: 20px 22px;
  background: linear-gradient(180deg, #fff, #fafcfc);
}

.goods-table th,
.admin-table th {
  color: #546165;
  background: #f3f7f7;
  letter-spacing: 0.02em;
}

.goods-table td,
.admin-table td {
  border-bottom-color: #edf2f2;
}

.goods-table tbody tr,
.admin-table tbody tr {
  transition: background 0.15s ease;
}

.goods-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: #fbfdfd;
}

.goods-info {
  grid-template-columns: 86px 1fr;
  gap: 14px;
}

.goods-image {
  width: 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(20, 34, 36, 0.08);
}

.goods-name strong {
  color: #182225;
}

.goods-badge,
.stock {
  border-radius: 6px;
}

.price {
  color: var(--coral);
  font-size: 19px;
}

.orders-panel {
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.account-page-panel {
  margin-top: 0;
}

.query-result a {
  color: var(--teal-dark);
  font-weight: 800;
}

.order-detail {
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfdfd;
  border: 1px solid #e4ecec;
  border-radius: 8px;
}

.balance-card div,
.checkout-summary > div,
.checkout-summary label,
.checkout-product,
.pay-preview {
  background: #f8fbfa;
}

.balance-card div {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.balance-card strong {
  color: #172224;
}

.order-filter-form,
.recharge-form {
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid #e3ebec;
  border-radius: 8px;
}

.checkout::backdrop {
  background: rgba(12, 23, 25, 0.62);
}

.checkout-box {
  box-shadow: var(--shadow-md);
}

.admin-main {
  width: min(1240px, calc(100% - 36px));
}

.admin-hero {
  padding: 24px;
  max-width: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-stats div {
  padding: 22px;
}

.admin-card {
  box-shadow: var(--shadow-sm);
}

.card-info {
  background: #f4f8f8;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .shop-head {
    grid-template-columns: 1fr;
  }

  .shop-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 14px;
  }

  .wholesale-shell,
  .admin-main {
    width: min(100% - 20px, 1280px);
  }

  .shop-head,
  .orders-panel,
  .admin-card {
    padding: 18px;
  }

  .search-box {
    padding: 8px;
  }
}
