/* 公网商城 · 轻量样式 */
:root {
  --bg: #f6f7f9;
  --surface: #fff;
  --text: #1a1d23;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --danger: #b91c1c;
  --warn-bg: #fff7ed;
  --warn-text: #9a3412;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --max: 1080px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

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

.shop-shell { max-width: var(--max); margin: 0 auto; padding: 0 16px 48px; }

.shop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.shop-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.shop-brand:hover { text-decoration: none; color: var(--accent); }
.shop-nav { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.shop-nav a { color: var(--muted); font-size: 0.95rem; }
.shop-nav a:hover, .shop-nav a.is-active { color: var(--accent); }
.shop-header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.shop-checkout {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.shop-checkout:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.shop-user, .shop-signin {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}
.shop-signin { color: var(--accent); }
.shop-user:hover, .shop-signin:hover { text-decoration: underline; }
.shop-icon-btn {
  position: relative;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
}
.shop-icon-btn svg { width: 22px; height: 22px; display: block; }
.shop-icon-btn:hover { background: #eef2f4; text-decoration: none; }
.shop-icon-btn.is-active { color: var(--accent); }
.shop-search-toggle,
.shop-cart-icon { display: inline-flex; }
.shop-cart-icon .cart-count { position: absolute; top: 0; right: 0; margin-left: 0; }
.shop-locale { position: relative; }
.shop-locale-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 2px;
  cursor: pointer;
}
.shop-locale-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 96px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.shop-locale-menu button {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.shop-locale-menu button:hover { background: #f3f4f6; }
.shop-locale-menu button.is-selected { color: var(--accent); font-weight: 700; }
.shop-search {
  display: none;
  gap: 10px;
  margin: 0 0 16px;
}
.shop-search.is-open { display: flex; }
.shop-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
@media (max-width: 759px) {
  .shop-header {
    flex-wrap: nowrap;
    gap: 2px;
    padding: 8px 0 10px;
    margin-bottom: 10px;
  }
  .shop-brand { font-size: 1.05rem; margin-right: auto; }
  .shop-nav { display: none; }
  .shop-header-actions { gap: 2px; }
  .shop-checkout { height: 28px; padding: 0 8px; font-size: 0.78rem; }
  .shop-user, .shop-signin { max-width: 4.2rem; font-size: 0.85rem; padding: 0 4px; }
  .shop-search { margin-bottom: 12px; }
  .shop-search .btn { padding: 10px 14px; }
}

.banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }
.banner-error { background: #fef2f2; color: var(--danger); }
.banner-ok { background: #ecfdf5; color: #047857; }
.banner-info { background: #f0fdfa; color: #115e59; }
.banner-info a, .login-reco-link { color: inherit; font-weight: 600; margin-left: 6px; }

.purchase-panel { display: flex; flex-direction: column; gap: 8px; }
.purchase-lines, .purchase-cards { display: flex; flex-direction: column; gap: 8px; }
.purchase-line, .purchase-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}
.purchase-line.is-off { cursor: default; opacity: 0.72; }
.purchase-card img, .purchase-card-empty {
  width: 48px;
  height: 64px;
  object-fit: contain;
  background: #eef0f3;
  border-radius: 6px;
  flex-shrink: 0;
}
.purchase-card-copy, .purchase-account-sku { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.purchase-card .name, .purchase-account-sku .name { font-weight: 600; }
.purchase-card .sku { color: var(--muted); font-size: 0.85rem; }
.purchase-strip { margin-bottom: 16px; }
.purchase-account-sku { margin-top: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid {
  display: grid;
  /* 手机默认两列。minmax(200px) 在窄屏只能排一列，首屏会被一张大图占满。 */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 760px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
}
.product-card { display: flex; flex-direction: column; gap: 8px; overflow: hidden; padding: 0; }
.product-card a { color: inherit; text-decoration: none; display: block; }
.card-visual { position: relative; }
.card-visual-empty { aspect-ratio: 3/4; background: #eef0f3; }
.product-card img {
  width: 100%;
  aspect-ratio: 3/4;
  /* 人像是全身照，cover 会从中间裁掉头顶。contain 保留整个人。 */
  object-fit: contain;
  object-position: center center;
  background: #eef0f3;
  display: block;
}
.hover-params {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 52%;
  overflow: auto;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.94);
}
.hover-line {
  margin: 0 0 4px;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.hover-line:last-child { margin-bottom: 0; }
.hover-line .muted { margin-right: 6px; }
@media (hover: hover) and (pointer: fine) {
  .product-card:hover .hover-params { display: block; }
}
.product-card .meta { padding: 12px 14px 14px; }
.product-card .name { font-weight: 600; margin: 0 0 4px; }
.sku-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.product-card .sku, .product-card .price { margin: 0; color: var(--muted); font-size: 0.9rem; }
.product-card .price { color: var(--text); font-weight: 600; }
.color-swatches { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
  display: inline-block;
  flex: 0 0 auto;
}
.color-swatch.is-named {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 0 5px;
  font-size: 0.68rem;
  line-height: 1.4;
  background: #f3f4f6;
  color: var(--text);
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  margin-top: 6px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
}
.detail-media,
.detail > .card { min-width: 0; }
.detail-media img, .detail-media video {
  width: 100%;
  border-radius: var(--radius);
  background: #eef0f3;
  max-height: 720px;
  object-fit: contain;
}
.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 4px;
}
.gallery-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 80px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: none;
  border-radius: 0;
}
.gallery-thumb.is-selected { border-color: var(--accent); }
.spec-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 12px;
  font-size: 0.92rem;
  padding: 4px 0;
  align-items: start;
}
.spec-row span:last-child {
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.product-story { margin: 4px 0 8px; }
.story-headline {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 6px 0 0;
  line-height: 1.45;
}
.story-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  margin: 8px 0 0;
  color: var(--text);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}
.chip.is-selected:not(.chip-swatch) { border-color: var(--accent); background: #f0fdfa; color: var(--accent); }
.chip.chip-swatch {
  border-color: rgba(0, 0, 0, 0.22);
}
.chip.chip-swatch.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}
.chip:disabled { opacity: 0.45; cursor: not-allowed; }

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.shop-spec-row { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.shop-sort {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface);
  font: inherit;
  color: var(--text);
}

label.field { display: block; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }
label.field .field-label { display: block; }
label.field .field-tag { margin-left: 6px; font-size: 0.85em; }
label.field input, label.field select, label.field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
label.field.field-optional { color: #9ca3af; }
label.field.field-optional .field-tag { color: #9ca3af; }
label.field.field-optional input {
  color: #6b7280;
  border-color: #e5e7eb;
  background: #f3f4f6;
}
label.field.field-required .field-tag { color: #9a3412; font-weight: 600; }
.field-code {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}
.field-code input { flex: 1; margin-top: 0; }
.field-code .btn { white-space: nowrap; flex-shrink: 0; }
.hint-banner {
  background: #fff7ed;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 0 0 12px;
}
.hint-banner.hidden { display: none; }
.hint-banner.hint-sms {
  background: #ecfdf5;
  color: #047857;
}
.hint-banner.hint-email {
  background: #fff7ed;
  color: #9a3412;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: var(--danger); }
.btn-ok { background: #047857; }
.btn-ok:hover { background: #059669; }
#add-msg.banner { margin-top: 16px; margin-bottom: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table input[type="number"] { width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

.muted { color: var(--muted); }
.hint-faint { color: #d1d5db; }
input.ph-faint::placeholder { color: #d1d5db; opacity: 1; }
.err { color: var(--danger); }
.ok { color: #047857; }
.field-msg {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}
.field-msg[hidden] { display: none !important; }
label.field.has-error input,
label.field.has-error textarea,
label.field.field-optional.has-error input {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--text);
}
.account-page {
  width: 100%;
  max-width: 640px;
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-card { padding: 20px 22px 18px; }
.account-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.account-head .h1 { margin: 0; font-size: 1.25rem; }
.account-meta {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.account-badge {
  margin: 2px 0 0;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  color: #047857;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 2px 10px;
}
.profile-locked {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
  overflow: hidden;
}
.profile-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border-top: 1px solid #eef0f3;
}
.profile-row:first-child { border-top: none; }
.profile-locked .k {
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: var(--muted);
}
.profile-locked .v {
  margin: 0;
  text-align: right;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}
.profile-locked .v.is-empty { color: #9ca3af; }
.profile-locked-note {
  margin: 0;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  background: #f3f4f6;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}
.profile-edit { margin-top: 18px; }
.profile-section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.profile-edit label.field { margin-bottom: 14px; }
.profile-edit label.field:last-child { margin-bottom: 2px; }
.field-caption {
  margin: 6px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}
.account-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.account-actions > .field-msg { margin: 0 0 10px; }
.account-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.account-logout {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 2px;
  cursor: pointer;
}
.account-logout:hover { color: var(--danger); }
.account-past.card { padding: 18px 22px 16px; }
.account-past .h2 { margin: 0 0 8px; font-size: 1.05rem; }
.account-past .purchase-empty {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.account-past .purchase-account-sku { margin-top: 12px; }
.account-past .purchase-account-sku:first-of-type { margin-top: 4px; }
.account-past .banner { margin-bottom: 0; }
@media (max-width: 759px) {
  .account-card, .account-past.card { padding: 16px; }
  .account-actions-row { display: grid; grid-template-columns: 1fr 1fr; }
  .account-actions-row .btn { text-align: center; }
  .account-logout { grid-column: 1 / -1; margin-left: 0; justify-self: center; }
}

.h1 { font-size: 1.4rem; margin: 0 0 12px; }
.h2 { font-size: 1.1rem; margin: 0 0 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-row input { width: 88px; }
.thumb {
  width: 56px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef0f3;
}
.cart-count {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  margin-left: 4px;
  padding: 0 5px;
}
.hidden { display: none !important; }
.loading { color: var(--muted); padding: 24px 0; }
