:root {
  --bg: #f4f9ff;
  --surface: #ffffff;
  --ink: #1e2937;
  --muted: #64748b;
  --line: #d8e6f4;
  --green: #4aa8df;
  --green-dark: #287fb8;
  --coral: #4aa8df;
  --blue: #2f83c7;
  --shadow: 0 18px 42px rgba(45, 104, 148, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(47, 131, 199, 0.12);
  background: rgba(244, 249, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.nav a[aria-current="page"],
.nav a:hover {
  background: var(--surface);
  color: var(--ink);
}

.shell {
  flex: 1 0 auto;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: var(--blue);
}

.site-footer a:hover {
  color: var(--green-dark);
}

.shop-head,
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title.compact {
  align-items: center;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.22;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.32;
}

.searchbar {
  width: min(320px, 100%);
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 2px 0 8px;
}

.category-chip {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.category-chip.active,
.category-chip:hover {
  border-color: var(--green);
  background: #e8f5ff;
  color: var(--green);
}

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

input {
  height: 42px;
  padding: 0 12px;
}

select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 168, 223, 0.18);
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary,
.ghost,
.danger,
.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.primary {
  min-width: 108px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
}

.primary:hover {
  background: var(--green-dark);
}

.ghost {
  min-width: 76px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  min-width: 76px;
  padding: 0 12px;
  background: #fff0ed;
  color: #a63f30;
}

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

.product-card,
.panel,
.admin-item,
.order-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-card {
  overflow: hidden;
}

.product-image-wrap {
  aspect-ratio: 4 / 5;
  background: #dcecf8;
  cursor: pointer;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.product-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.product-title-link:hover h2,
.product-detail-link:hover {
  color: var(--green);
}

.price {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e7f4ff;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.product-description {
  min-height: 42px;
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.5;
}

.thumb-row,
.preview-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.thumb-row img,
.preview-strip img {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 6px;
  object-fit: cover;
  background: #eaf4fb;
}

.buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(58px, 1fr));
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7fd;
}

.segment {
  min-width: 58px;
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 4px rgba(31, 37, 40, 0.08);
}

.empty {
  grid-column: 1 / -1;
  padding: 34px;
  border: 1px dashed #b7d2e7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  text-align: center;
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-gate {
  width: min(460px, calc(100% - 32px));
}

.gate-form {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.token-field {
  display: grid;
  width: min(260px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.token-tools {
  display: grid;
  grid-template-columns: minmax(200px, 260px) auto;
  gap: 8px;
  align-items: end;
}

.token-summary {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.upload-form {
  display: grid;
  gap: 14px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
}

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

label span {
  font-weight: 700;
}

.file-picker input {
  height: auto;
  padding: 10px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  accent-color: var(--green);
}

.checkbox-line span {
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-text {
  min-height: 20px;
  color: var(--blue);
  font-size: 14px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

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

.admin-item,
.order-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  box-shadow: none;
}

.admin-item-head,
.order-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.admin-media {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
}

.admin-cover {
  width: 86px;
  height: 108px;
  border-radius: 6px;
  object-fit: cover;
  background: #eaf4fb;
}

.xhs-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-left: 3px solid var(--green);
  background: #f6fbff;
}

.xhs-box p,
.xhs-box pre {
  margin: 0;
}

.xhs-box pre {
  max-height: 180px;
  overflow: auto;
  color: #2d3a3d;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eef7fd;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.modal {
  width: min(460px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(31, 37, 40, 0.24);
}

.modal::backdrop {
  background: rgba(20, 28, 28, 0.38);
  backdrop-filter: blur(4px);
}

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

.token-form {
  display: grid;
  gap: 14px;
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef7fd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.paid {
  background: #e7f4ff;
  color: var(--green);
}

.badge.pending {
  background: #fff3df;
  color: #915e11;
}

.detail-shell {
  width: min(1240px, calc(100% - 32px));
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.detail-gallery {
  display: grid;
  gap: 12px;
}

.detail-hero-image {
  width: 100%;
  max-height: 76vh;
  border-radius: 8px;
  object-fit: contain;
  background: #dcecf8;
}

.detail-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.detail-thumb {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #eaf4fb;
  overflow: hidden;
}

.detail-thumb.active {
  border-color: var(--green);
}

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

.detail-info {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.detail-price {
  color: var(--green);
  font-size: 26px;
}

.back-link {
  color: var(--muted);
  font-size: 14px;
}

.pay-shell {
  width: min(640px, calc(100% - 32px));
}

.pay-box {
  display: grid;
  gap: 16px;
}

.pay-product {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.pay-product img {
  width: 88px;
  height: 112px;
  border-radius: 6px;
  object-fit: cover;
  background: #eaf4fb;
}

.qr-placeholder,
.qr-image {
  width: min(260px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 37, 40, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 37, 40, 0.08) 1px, transparent 1px),
    #fff;
  background-size: 22px 22px;
}

.qr-image {
  object-fit: contain;
  background: #fff;
}

.download-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: #edf8ff;
}

@media (max-width: 860px) {
  .shop-head,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

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

  .detail-info {
    position: static;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .topbar {
    padding: 0 16px;
  }

  .shell {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  h1 {
    font-size: 23px;
  }

  .buy-row,
  .form-actions,
  .admin-item-head,
  .order-head,
  .token-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .token-tools {
    grid-template-columns: 1fr;
  }

  .segmented,
  .primary,
  .ghost,
  .danger {
    width: 100%;
  }

  .admin-media,
  .pay-product {
    grid-template-columns: 1fr;
  }

  .admin-cover,
  .pay-product img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
  }
}
