:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --panel: #ffffff;
  --panel-2: #f4f5f8;
  --text: #141b2c;
  --muted: #6b7280;
  --line: #e4e6eb;
  --brand: #6c5ce7;
  --brand-2: #5a4bd1;
  --accent: #6c5ce7;
  --warn: #d97706;
  --bad: #e11d48;
  --good: #10b981;
  --shadow: 0 10px 30px rgba(20, 27, 44, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #0c1f22;
  color: #eef7f6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  font-size: 12px;
  color: #a5b9bc;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: #c9d8da;
  text-align: left;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  background: rgba(45, 212, 191, 0.14);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #a5b9bc;
  font-size: 12px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
}

.auth-panel {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
}

.auth-side {
  padding: 48px;
  color: #ecfeff;
  background:
    linear-gradient(rgba(8, 47, 50, 0.72), rgba(8, 47, 50, 0.72)),
    url("https://images.unsplash.com/photo-1558494949-ef010cbdcc31?auto=format&fit=crop&w=1500&q=80") center/cover;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
}

.auth-side h1 {
  font-size: 46px;
  line-height: 1.04;
  margin: 0 0 16px;
  max-width: 720px;
}

.auth-side p {
  font-size: 17px;
  line-height: 1.7;
  margin: 0;
  color: #cce8e8;
  max-width: 720px;
}

.auth-card {
  max-width: 430px;
  width: 100%;
  margin: 0 auto;
}

.auth-card h2 {
  font-size: 28px;
  margin: 0 0 8px;
}

.auth-card .muted {
  margin-bottom: 24px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  background: var(--panel-2);
  border-radius: 8px;
  margin-bottom: 18px;
}

.tabs button {
  height: 36px;
  border-radius: 6px;
  padding: 0 22px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tabs button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 20px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 7px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 82px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--bad);
}

.btn.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.notice {
  padding: 14px 16px;
  border: 1px solid #c9f0dd;
  border-radius: 8px;
  background: #eefbf4;
  color: #0f7a4d;
}

.warning {
  border-color: #fde1b8;
  background: #fff7ea;
  color: #9a5b08;
}

.error {
  color: var(--bad);
}

.success {
  color: var(--good);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.pill.good {
  background: #e8f7ee;
  color: #0f7a4d;
  border-color: #c9f0dd;
}

.pill.bad {
  background: #fdecef;
  color: #c81e3f;
  border-color: #fbc9d3;
}

.pill.warn {
  background: #fef3e2;
  color: #9a5b08;
  border-color: #fde1b8;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--panel-2);
}

td code,
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  background: var(--panel-2);
  color: #5a4bd1;
  padding: 3px 6px;
  border-radius: 6px;
}

.copy-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.copy-box code {
  display: block;
  overflow: auto;
  padding: 12px;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 27, 44, 0.4);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  border: 1px solid var(--line);
}

.modal .panel-header {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

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

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

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

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-side {
    min-height: 360px;
    order: -1;
  }

  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .content {
    padding: 14px;
  }

  .auth-panel,
  .auth-side {
    padding: 26px;
  }

  .auth-side h1 {
    font-size: 34px;
  }

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

/* ---------- 商城（CursorHub 风格） ---------- */

.shop-banner {
  background: linear-gradient(90deg, #f4f6fe, #f6f5ff);
  border: 1px solid #ddd9f7;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #4a3fb8;
}

.qq-line {
  background: #fff9ec;
  border: 1px solid #f5d9a8;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #9a5b08;
}

.sidebar-qq {
  background: rgba(108, 92, 231, 0.14);
  border: 1px solid rgba(108, 92, 231, 0.35);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-qq span {
  font-size: 12px;
  color: #a5b8ff;
}

.public-shop {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.public-shop-top {
  background: #ffffff;
  color: #141b2c;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.public-shop-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.public-shop-main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* CursorHub 布局：左商品列表 + 右详情 */
.shop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.shop-sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.shop-sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

.shop-sidebar-head .count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.shop-product-list {
  max-height: 520px;
  overflow: auto;
}

.shop-product-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}

.shop-product-item:hover {
  background: var(--panel-2);
}

.shop-product-item.active {
  background: #f1eeff;
  border-left: 3px solid var(--brand);
}

.shop-product-item .name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.shop-product-item .meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.shop-product-item .meta .price {
  color: var(--accent);
  font-weight: 600;
}

.shop-product-item .meta .stock {
  color: var(--good);
}

.shop-product-item .meta .stock.zero {
  color: var(--bad);
}

/* 商品详情 + 支付 */
.shop-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  display: grid;
  gap: 16px;
}

.shop-detail.empty {
  color: var(--muted);
  text-align: center;
  padding: 60px 20px;
}

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

.product-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.product-price .now {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
}

.product-price .was {
  font-size: 15px;
  color: var(--muted);
  text-decoration: line-through;
}

.product-price .save {
  font-size: 12px;
  color: #0f7a4d;
  background: #e8f7ee;
  border: 1px solid #c9f0dd;
  border-radius: 999px;
  padding: 3px 10px;
}

.product-desc,
.product-notice {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
  color: var(--text);
}

.product-notice {
  border-color: #fde1b8;
  background: #fff9ec;
  color: #9a5b08;
}

.product-desc .title,
.product-notice .title {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
}

/* 支付区 */
.pay-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 14px;
}

.pay-tabs {
  display: flex;
  gap: 8px;
}

.pay-tab {
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.pay-tab.active {
  background: #f1eeff;
  border-color: var(--brand);
  color: var(--brand);
}

.pay-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pay-qr {
  width: 210px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
}

.pay-qr img {
  display: block;
  width: 100%;
  border-radius: 6px;
}

.pay-qr.empty {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 40px 10px;
}

.pay-steps {
  flex: 1;
  min-width: 240px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.pay-steps strong {
  color: var(--text);
}

.pay-coupon {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pay-coupon input {
  flex: 1;
  min-width: 180px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--text);
}

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

.pay-actions .btn.buy {
  min-height: 46px;
  padding: 0 34px;
  font-size: 15px;
  font-weight: 700;
}

/* 订单 / 账号区块 */
.shop-block {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  gap: 12px;
}

.shop-block > h3 {
  margin: 0;
  font-size: 15px;
}

.order-result-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  background: var(--panel-2);
}

.order-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.order-result-row:last-child {
  border-bottom: 0;
}

.order-result-row span {
  color: var(--muted);
  font-size: 13px;
}

.order-result-row strong {
  font-size: 14px;
}

.qr-preview {
  margin-top: 8px;
  width: 110px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}

.qr-preview img {
  display: block;
  width: 100%;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }
  .shop-product-list {
    max-height: 260px;
  }
}

/* 卡密查看页（闲鱼自动发货） */
.card-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.card-box {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-box h1 {
  margin: 0;
  font-size: 20px;
}

.card-code {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #f1eeff;
  border: 1px dashed #b9b0f3;
  border-radius: 12px;
  padding: 16px;
}

.card-code code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  color: #4a3fb8;
  word-break: break-all;
}

.card-steps {
  display: grid;
  gap: 10px;
}

.card-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.card-step code {
  background: var(--panel-2);
  color: #5a4bd1;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  word-break: break-all;
}

.card-step-no {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.card-foot {
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
