:root {
  /* 白紫配色：主色为紫色，渐变第二色恢复为粉色（紫→粉渐变），背景与卡片保持白色基调 */
  --primary: #7c3aed;
  --primary2: #ec4899;
  --accent: #9333ea;
  --grad: linear-gradient(135deg, var(--primary), var(--primary2));
  --bg: #f7f5ff;
  --card: #ffffff;
  --text: #1f1530;
  --muted: #6b6580;
  --border: #e7e1fb;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15101f;
    --card: #1f1830;
    --text: #f1edfb;
    --muted: #a99fc4;
    --border: #322a4a;
  }
}
:root[data-theme="dark"] {
  --bg: #15101f;
  --card: #1f1830;
  --text: #f1edfb;
  --muted: #a99fc4;
  --border: #322a4a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.topbar {
  background: var(--grad);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.25);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 20px; font-weight: 700; color: #fff; }
.topbar a.link { color: #fff; opacity: 0.92; font-size: 14px; }

.search-box { display: flex; gap: 6px; flex: 1; max-width: 360px; }
.search-box input {
  flex: 1; border: none; border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
.search-box button {
  background: rgba(255,255,255,0.25); color: #fff; border: 1px solid rgba(255,255,255,0.5);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 14px;
}

.grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 20px 0; }
@media (min-width: 640px) { .grid.cols-2plus { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 2px 10px rgba(124,58,237,0.06);
}
.platform-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.platform-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(124,58,237,0.18); }
.platform-card.disabled { cursor: not-allowed; opacity: 0.55; }
.platform-card .icon {
  width: 56px; height: 56px; border-radius: 14px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 700;
  margin-bottom: 10px;
}
.platform-card h3 { margin: 4px 0; font-size: 18px; }
.platform-card p.intro { color: var(--muted); font-size: 13px; margin: 4px 0 10px; min-height: 36px; }
.pill { display: inline-block; background: #efe9ff; color: var(--primary); font-size: 12px; padding: 3px 10px; border-radius: 99px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--grad); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.danger { background: linear-gradient(135deg, #f87171, #ef4444); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: var(--card); color: var(--text);
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }
label.field { display: block; margin-bottom: 14px; }
label.field .label-text { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.error-text { color: var(--err); font-size: 13px; margin-top: 4px; }
.hint-text { color: var(--muted); font-size: 12px; margin-top: 4px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag.pending { background: #fef3c7; color: #92400e; }
.tag.confirming { background: #e0f2fe; color: #075985; }
.tag.paid { background: #dcfce7; color: #166534; }
.tag.shipped { background: #ede9fe; color: #5b21b6; }
.tag.cancelled { background: #fee2e2; color: #991b1b; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

.skeleton { background: linear-gradient(90deg, #ece6fb 25%, #f4effd 50%, #ece6fb 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; height: 110px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state, .error-state { text-align: center; padding: 60px 20px; color: var(--muted); }

details.guide { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; background: var(--card); }
details.guide summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.guide-step { margin: 10px 0; padding-left: 10px; border-left: 3px solid var(--accent); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f1530; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-err { background: #ef4444; }
.toast.toast-ok { background: #10b981; }

.footer-note { color: var(--muted); font-size: 12px; text-align: center; padding: 30px 0; }

.admin-shell { display: flex; min-height: 100vh; }
.admin-nav { width: 200px; background: var(--grad); color: #fff; padding: 20px 12px; flex-shrink: 0; }
.admin-nav a { display: block; color: #fff; opacity: 0.85; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px; font-size: 14px; }
.admin-nav a.active, .admin-nav a:hover { background: rgba(255,255,255,0.18); opacity: 1; }
.admin-main { flex: 1; padding: 24px; max-width: 1100px; }
@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .admin-nav { width: 100%; display: flex; overflow-x: auto; gap: 4px; }
  .admin-nav a { white-space: nowrap; margin-bottom: 0; }
}

.order-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: var(--card); }
.order-card .row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.counter-pill { background: var(--grad); color: #fff; border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; }

.qty-control { display: flex; align-items: center; gap: 10px; }
.qty-control button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 16px; }
.qty-control span { min-width: 30px; text-align: center; font-weight: 700; }

.qr-wrap { background: #fff; padding: 10px; border-radius: 12px; display: inline-block; }

.reminder-bar { background: #fef3c7; color: #92400e; padding: 8px 16px; text-align: center; font-size: 13px; }

/* 充值提醒：故意做得比普通卡片更亮眼，买家下单前/余额不足时都要第一眼看到 */
.topup-alert {
  display: flex; align-items: center; gap: 10px; margin: 16px 0; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 18px rgba(239,68,68,0.35);
}
.topup-alert .icon { font-size: 22px; animation: topup-pulse 1.6s ease-in-out infinite; flex-shrink: 0; }
.topup-alert a, .topup-alert .topup-alert-btn {
  color: #fff; text-decoration: underline; font-weight: 800; white-space: nowrap; background: rgba(255,255,255,0.22);
  border: none; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 14px; text-decoration: none; margin-left: auto;
}
.topup-alert a:hover, .topup-alert .topup-alert-btn:hover { background: rgba(255,255,255,0.34); }
.topup-alert.inline { margin-top: 10px; }
@keyframes topup-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .topup-alert .icon { animation: none; } }

/* 回收账号入口：紧跟在商品列表下面，用站点自己的紫→粉渐变做成和充值提醒同等
   醒目的横幅，方便卖家一眼看到"我们也收账号"这件事，而不是只藏在顶部小链接里。 */
.recycle-alert {
  display: flex; align-items: center; gap: 10px; margin: 16px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 18px rgba(124,58,237,0.35);
}
.recycle-alert .icon { font-size: 22px; flex-shrink: 0; }
.recycle-alert a {
  color: #fff; text-decoration: none; font-weight: 800; white-space: nowrap; background: rgba(255,255,255,0.22);
  border: none; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 14px; margin-left: auto;
}
.recycle-alert a:hover { background: rgba(255,255,255,0.34); }

/* 买家侧右下角客服聊天悬浮窗：做成带文字的胶囊按钮，并带光环动画，
   比单纯一个小圆点图标更容易被注意到 */
.chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chat-widget-nudge {
  background: #1f1530; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2); animation: chat-nudge-in .3s ease-out, chat-nudge-out .3s ease-in 5s forwards;
  position: relative;
}
.chat-widget-nudge::after {
  content: ''; position: absolute; bottom: -6px; right: 22px; border-width: 6px 6px 0 6px; border-style: solid;
  border-color: #1f1530 transparent transparent transparent;
}
@keyframes chat-nudge-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes chat-nudge-out { to { opacity: 0; transform: translateY(6px); visibility: hidden; } }
.chat-widget-toggle {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 16px; border-radius: 99px;
  background: var(--grad); color: #fff; border: none; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 22px rgba(124,58,237,0.45); position: relative;
}
.chat-widget-toggle .chat-widget-icon { font-size: 20px; }
.chat-widget-toggle::before {
  content: ''; position: absolute; inset: 0; border-radius: 99px; box-shadow: 0 0 0 0 rgba(124,58,237,0.55);
  animation: chat-widget-ring 2.4s ease-out infinite;
}
@keyframes chat-widget-ring {
  0% { box-shadow: 0 0 0 0 rgba(124,58,237,0.5); }
  70% { box-shadow: 0 0 0 14px rgba(124,58,237,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,58,237,0); }
}
@media (prefers-reduced-motion: reduce) { .chat-widget-toggle::before { animation: none; } .chat-widget-nudge { animation: none; } }
.chat-widget-toggle .chat-badge {
  position: absolute; top: -4px; right: -4px; background: var(--err); color: #fff; border-radius: 99px;
  font-size: 11px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.chat-widget-panel {
  position: absolute; bottom: 68px; right: 0; width: 320px; max-width: calc(100vw - 32px); height: 420px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-widget-header { background: var(--grad); color: #fff; padding: 12px 14px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.chat-widget-header .chat-widget-close { cursor: pointer; opacity: 0.85; font-size: 18px; }
.chat-widget-messages { flex: 1; overflow-y: auto; padding: 10px; }
.chat-widget-input-row { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chat-widget-input-row textarea { flex: 1; resize: none; height: 38px; }
@media (max-width: 480px) {
  .chat-widget-panel { width: calc(100vw - 32px); }
}

.chat-bubble-row { display: flex; margin-bottom: 10px; }
.chat-bubble-row.right { justify-content: flex-end; }
.chat-bubble { max-width: 80%; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; }
.chat-bubble-row.right .chat-bubble { background: var(--grad); color: #fff; border: none; }
.chat-bubble-sender { font-size: 11px; opacity: 0.7; margin-bottom: 2px; }
.chat-bubble-time { font-size: 10px; margin-top: 4px; }

/* 后台客服对话 */
.chat-admin-layout { display: grid; grid-template-columns: 220px 1fr 300px; gap: 14px; align-items: start; }
.chat-conv-list { max-height: 70vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.chat-conv-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.chat-conv-item:hover { background: var(--bg); }
.chat-conv-item.active { background: var(--bg); border-left: 3px solid var(--primary); }
.chat-conv-item.unread strong { color: var(--primary); }
.chat-thread-panel { border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; height: 70vh; }
.chat-thread-messages { flex: 1; overflow-y: auto; padding: 12px; }
.chat-reply-box { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }
.chat-reply-box textarea { flex: 1; resize: none; height: 44px; }
.chat-autoreply-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; max-height: 70vh; overflow-y: auto; }
.chat-rules-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.chat-rule-row { display: flex; gap: 4px; align-items: center; }
.chat-rule-row .rule-keyword-input { flex: 0 0 90px; }
.chat-rule-row .rule-reply-input { flex: 1; }
@media (max-width: 960px) {
  .chat-admin-layout { grid-template-columns: 1fr; }
  .chat-conv-list { max-height: 200px; }
  .chat-thread-panel { height: 50vh; }
}
