:root {
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-dark: #4338ca;
  --accent: #06b6d4;
  --bg: #f5f6fb;
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e6e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #e11d48;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.16);
  --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #06b6d4 130%);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body > main {
  flex: 1 0 auto;
  width: 100%;
}

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

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

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
}

.container.admin-wide {
  max-width: 1160px;
}

/* ------------------------------- 顶部导航 ------------------------------- */

.topbar {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.brand .dot {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
  flex: 0 0 auto;
  overflow: hidden;
}

.brand .dot.has-icon {
  background: transparent;
  box-shadow: none;
}

.brand .dot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.topbar nav {
  display: flex;
  align-items: center;
}

.topbar nav a {
  margin-left: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

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

/* ------------------------------ 抽屉式搜索 ------------------------------ */

.search-toggle {
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.search-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.search-toggle svg {
  display: block;
}

.search-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  visibility: hidden;
}

.search-drawer.open {
  visibility: visible;
}

.search-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.search-drawer.open .search-drawer-backdrop {
  opacity: 1;
}

.search-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateY(-100%);
  transition: transform 0.28s ease;
  max-height: 82vh;
  overflow-y: auto;
}

.search-drawer.open .search-drawer-panel {
  transform: translateY(0);
}

.search-drawer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.search-bar input[type="search"] {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input[type="search"]:focus {
  border-color: var(--primary);
}

.search-results {
  margin-top: 16px;
}

.search-hint {
  padding: 18px 2px;
}

.search-count {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

/* ------------------------------- 首页轮播 ------------------------------- */

.banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 16px;
  aspect-ratio: 3 / 1;
  max-height: 360px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.banner-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.banner-slide.active {
  opacity: 1;
}

.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.banner-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: width 0.2s, background 0.2s;
}

.banner-dot.active {
  width: 20px;
  border-radius: 999px;
  background: #fff;
}

.banner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.banner:hover .banner-arrow {
  opacity: 1;
}

.banner-arrow.prev {
  left: 10px;
}

.banner-arrow.next {
  right: 10px;
}

/* --------------------------------- 页头 --------------------------------- */

.page {
  padding: 16px 0 72px;
}

h1 {
  font-size: 23px;
  margin: 0 0 6px;
}

h2 {
  font-size: 17px;
  margin: 0 0 12px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}

/* --------------------------------- 公告 --------------------------------- */

.announce {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 999px;
  padding: 6px 12px;
  max-width: 760px;
  margin: 0 auto 4px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.announce-tag {
  flex: none;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

.announce-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.announce-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
}

.announce-track * {
  display: inline;
  margin: 0;
}

.announce-track br {
  display: none;
}

.announce-track a {
  color: #b45309;
  text-decoration: underline;
}

.announce-viewport:hover .announce-track {
  animation-play-state: paused !important;
}

@keyframes announceScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* --------------------------------- 分类 --------------------------------- */

.cat-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
}

.cat-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px 7px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.cat-pill img,
.cat-pill .cat-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
}

.cat-pill .cat-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

.cat-pill:hover {
  color: var(--primary);
  border-color: #c7d2fe;
}

.cat-pill.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

.cat-pill.active .cat-dot {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* -------------------------------- 商品卡片 ------------------------------- */

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

.goods-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  color: inherit;
}

.goods-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.goods-card:hover .thumb img {
  transform: scale(1.05);
}

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 1px;
}

.goods-card .body {
  padding: 9px 11px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.goods-card .name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.goods-card .bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1px;
}

/* 竖排（单列列表）排列 */
.goods-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.goods-list .goods-card {
  flex-direction: row;
}

.goods-list .thumb {
  width: 108px;
  flex: none;
  aspect-ratio: 1 / 1;
}

.goods-list .body {
  padding: 10px 12px;
  justify-content: center;
  gap: 6px;
}

.goods-list .name {
  font-size: 14px;
  -webkit-line-clamp: 2;
}

.price {
  color: var(--danger);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}

.price small {
  font-size: 12px;
  font-weight: 600;
}

.stock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 999px;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.stock::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.stock.ok {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.stock.low {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.stock.out {
  color: #94a3b8;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.stock-big {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.stock-big::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.stock-big.ok {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.stock-big.low {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.stock-big.out {
  color: #64748b;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

/* --------------------------------- 通用 --------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gradient);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s;
  font-family: inherit;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.28);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.34);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 500;
}

.btn-ghost:hover {
  background: var(--bg-soft);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 6px 14px rgba(225, 29, 72, 0.25);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
  box-shadow: none;
}

.btn-sm.btn {
  box-shadow: none;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.query-modes {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 14px;
  background: var(--bg-soft);
  border-radius: 999px;
}

.query-mode {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.query-mode.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

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

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

.row > * {
  flex: 1;
  min-width: 140px;
}

.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.alert-ok {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-delivered {
  background: #dcfce7;
  color: #15803d;
}

.badge-hidden {
  background: #f1f5f9;
  color: #64748b;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: none;
  background: #fafbff;
}

tbody tr:hover {
  background: #fafbff;
}

tbody tr:last-child td {
  border-bottom: none;
}

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

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-select {
  width: auto;
  min-width: 150px;
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.col-check {
  width: 42px;
  text-align: center;
}

.col-check input {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
}

tbody tr.is-selected {
  background: rgba(79, 70, 229, 0.06);
}

.admin-wide .table-wrap table {
  min-width: 640px;
}

code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0;
}

.code-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0;
}

.code-line .code-box {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.code-line .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-item {
  padding: 12px 14px;
}

.order-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 13px;
  word-break: break-all;
}

.order-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.order-goods {
  color: var(--text);
  font-weight: 600;
}

.order-item-meta b {
  color: var(--text);
  font-weight: 600;
}

.order-item-more {
  margin-left: auto;
  color: var(--primary);
  font-size: 12.5px;
  text-decoration: none;
}

.order-item-more:hover {
  text-decoration: underline;
}

.order-item-note {
  margin: 8px 0 0;
  font-size: 12.5px;
}

.order-cards {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

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

.order-cards-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.order-cards .code-line {
  margin: 6px 0;
}

.order-cards .code-box {
  padding: 9px 12px;
  font-size: 12.5px;
}

/* --------------------------------- 标签页 -------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  background: #fff;
  padding: 0 8px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.tabs button {
  border: none;
  background: none;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.15s;
}

.tabs button:hover {
  color: var(--primary);
}

.tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tabs a {
  display: inline-block;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s;
}

.tabs a:hover {
  color: var(--primary);
}

.tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* --------------------------------- 统计卡 -------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient);
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
}

.stat .value {
  font-size: 23px;
  font-weight: 700;
  margin-top: 5px;
  line-height: 1.2;
}

/* ------------------------------ 支付方式选择 ----------------------------- */

.pay-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pay-option {
  flex: 1;
  min-width: 130px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
}

.pay-option:hover {
  border-color: #c7d2fe;
}

.pay-option.active {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.pay-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  background: var(--gradient);
  flex: none;
}

.pay-option[data-type="wxpay"] .pay-icon {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.pay-option[data-type="qqpay"] .pay-icon {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
}

.pay-option[data-type="alipay"] .pay-icon {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.pay-option[data-type="alipay_free"] .pay-icon {
  background: linear-gradient(135deg, #60a5fa, #0ea5e9);
}

/* -------------------------------- 客服浮窗 ------------------------------- */

.service-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.service-fab {
  border: none;
  background: var(--gradient);
  color: #fff;
  border-radius: 999px;
  padding: 11px 18px 11px 13px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.38);
  transition: transform 0.15s;
}

.service-fab:hover {
  transform: translateY(-2px);
}

.service-fab-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.service-panel {
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: serviceIn 0.18s ease;
}

@keyframes serviceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.service-panel-head {
  background: var(--gradient);
  color: #fff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.service-panel-body {
  padding: 14px 16px 16px;
}

.service-note {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
}

.service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  color: var(--text);
}

.service-row:last-child {
  border-bottom: none;
}

.service-label {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  width: 56px;
}

.service-value {
  flex: 1;
  word-break: break-all;
  font-weight: 500;
}

/* -------------------------------- 图片选择 ------------------------------- */

.image-picker {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.image-preview {
  width: 116px;
  height: 88px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  flex: none;
}

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

.image-picker .controls {
  flex: 1;
  min-width: 0;
}

.upload-tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* --------------------------------- 其他 --------------------------------- */

.muted {
  color: var(--muted);
  font-size: 13px;
}

.center {
  text-align: center;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 46px 0;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.mt-16 {
  margin-top: 16px;
}

.mb-16 {
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
}

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 580px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.channel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
}

.channel-card .channel-fields {
  margin-top: 4px;
  transition: opacity 0.15s;
}

.channel-card input:disabled,
.channel-card textarea:disabled,
.channel-card select:disabled {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}

.channel-card .channel-fields:has(input:disabled) {
  opacity: 0.55;
}

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

.channel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.switch input {
  width: auto;
  width: 38px;
  height: 22px;
  appearance: none;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0;
  border: none;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch input:checked {
  background: var(--primary);
}

.switch input:checked::after {
  transform: translateX(16px);
}

/* ------------------------------ 富文本编辑器 ----------------------------- */

.rte {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.rte-toolbar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  padding: 6px;
  background: #fafbff;
  border-bottom: 1px solid var(--border);
}

.rte-toolbar button {
  border: none;
  background: none;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  font-family: inherit;
  min-width: 30px;
}

.rte-toolbar button:hover {
  background: #eef2ff;
  color: var(--primary);
}

.rte-toolbar .rte-sep {
  width: 1px;
  background: var(--border);
  margin: 4px 3px;
}

.rte-body {
  min-height: 150px;
  max-height: 340px;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  line-height: 1.7;
}

.rte-body:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.rte-body img {
  max-width: 100%;
  border-radius: 8px;
}

.rte-body ul,
.rte-body ol {
  padding-left: 22px;
}

/* ------------------------------- 富文本展示 ------------------------------ */

.rich-text {
  font-size: 14.5px;
  color: #334155;
  line-height: 1.75;
  word-break: break-word;
}

.rich-text:empty {
  display: none;
}

.rich-text p {
  margin: 0 0 10px;
}

.rich-text p:last-child {
  margin-bottom: 0;
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4 {
  margin: 14px 0 8px;
  color: var(--text);
  line-height: 1.4;
}

.rich-text h1 {
  font-size: 19px;
}

.rich-text h2 {
  font-size: 17px;
}

.rich-text h3 {
  font-size: 15.5px;
}

.rich-text ul,
.rich-text ol {
  padding-left: 22px;
  margin: 0 0 10px;
}

.rich-text li {
  margin: 2px 0;
}

.rich-text img {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
}

.rich-text a {
  color: var(--primary);
  text-decoration: underline;
}

.rich-text blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--primary);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

.rich-text hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.buy-desc {
  margin: 0 0 18px;
}

/* -------------------------------- 购买页 -------------------------------- */

.buy-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 24px;
  align-items: start;
}

.buy-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.buy-image .thumb-placeholder {
  width: 100%;
  height: 100%;
  font-size: 56px;
}

/* ------------------------------ 商品图片放大查看 ------------------------------ */

.thumb.is-zoomable {
  cursor: zoom-in;
}

.thumb.is-zoomable img {
  transition: transform 0.25s ease;
}

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
}

.img-lightbox[hidden] {
  display: none;
}

.img-lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  background: #fff;
}

.img-lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

body.lb-open {
  overflow: hidden;
}

/* ------------------------------ 扫码支付弹窗 ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-card h3 {
  margin: 0 0 16px;
  font-size: 17px;
}

.modal-card-lg {
  max-width: 460px;
}

.modal-body {
  max-height: 58vh;
  overflow-y: auto;
  text-align: left;
  margin: 14px 0;
}

.modal-body h4 {
  margin: 14px 0 6px;
  font-size: 14px;
}

.modal-body .code-box {
  margin: 6px 0;
}

.qr-wrap {
  display: inline-flex;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.qr-wrap img {
  display: block;
  width: 220px;
  height: 220px;
}

.qr-amount {
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.qr-amount .price {
  display: inline-flex;
  margin-left: 4px;
  font-size: 20px;
}

.modal-card .btn-block {
  margin-top: 14px;
}

/* --------------------- 微信 / QQ 内打开提示（减少拦截） --------------------- */

.open-guide {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
}

.open-guide-arrow {
  position: absolute;
  top: 6px;
  right: 18px;
  font-size: 48px;
  line-height: 1;
  color: #fbbf24;
  animation: openGuideBounce 1s ease-in-out infinite;
}

@keyframes openGuideBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.open-guide-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(340px, calc(100vw - 40px));
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.open-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.open-guide-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.open-guide-title {
  font-weight: 600;
  margin: 0 0 8px;
}

.open-guide-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.open-guide-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.site-footer {
  margin-top: 48px;
  padding: 18px 0 26px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: center;
}

.footer-label {
  color: var(--text);
  font-weight: 600;
}

.footer-links a,
.footer-meta a {
  color: var(--muted);
  transition: color 0.15s;
}

.footer-links a:hover,
.footer-meta a:hover {
  color: var(--primary);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: center;
}

/* ------------------------------- 响应式布局 ------------------------------- */

/* 平板 / 小笔记本 */
@media (max-width: 900px) {
  .buy-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .buy-image {
    max-width: 460px;
    margin: 0 auto;
  }

  .page {
    padding-bottom: 56px;
  }
}

/* 手机 */
@media (max-width: 640px) {
  .container {
    padding: 0 13px;
  }

  .topbar-inner {
    height: auto;
    padding: 10px 0;
    flex-direction: column;
    gap: 8px;
  }

  .topbar nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .topbar nav a {
    margin: 0 9px;
  }

  .page {
    padding: 14px 0 48px;
  }

  h1 {
    font-size: 21px;
  }

  .card {
    padding: 15px 14px;
  }

  .banner {
    aspect-ratio: 16 / 9;
    max-height: none;
  }

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

  .goods-card .body {
    padding: 9px 10px 11px;
  }

  .announce {
    font-size: 12.5px;
    padding: 5px 10px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 9px 7px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 13px 14px;
  }

  .section-title {
    flex-wrap: wrap;
  }

  .image-picker {
    flex-wrap: wrap;
  }

  .image-preview {
    width: 100%;
    height: 132px;
  }

  .rte-body {
    min-height: 130px;
  }

  .modal {
    padding: 14px;
  }

  .modal-card {
    max-width: 100%;
    padding: 20px 16px;
  }

  .query-modes {
    display: flex;
    width: 100%;
  }

  .query-mode {
    flex: 1;
    padding: 6px 8px;
  }

  .footer-links,
  .footer-meta {
    gap: 6px 12px;
  }

  .service-widget {
    right: 14px;
    bottom: 14px;
  }

  .service-panel {
    width: calc(100vw - 28px);
  }
}

/* 小屏手机 */
@media (max-width: 400px) {
  .container {
    padding: 0 11px;
  }

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

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

  .brand {
    font-size: 16px;
  }

  .btn {
    padding: 10px 14px;
  }
}

/* 代理价展示 */
.price-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  vertical-align: 2px;
}

.price-old {
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.agent-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: #7c2d12;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
}

.agent-bar a {
  margin-left: auto;
  font-weight: 600;
  color: #b45309;
}

.agent-bar-tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #d97706;
}

/* --------------------------- 底部支付操作栏 --------------------------- */

.buy-bar {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
}

.buy-bar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.buy-bar-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.3;
}

.buy-bar-sum .price {
  font-size: 20px;
}

.buy-bar .btn {
  flex: none;
  min-width: 132px;
  margin: 0;
  padding: 11px 16px;
  font-weight: 600;
}

.has-buy-bar {
  padding-bottom: 82px;
}

.has-buy-bar .service-widget {
  bottom: 84px;
}
