:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.92);
  --line: #e5e5ea;
  --line-strong: #d1d1d6;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #8e8e93;
  --accent: #007aff;
  --accent-2: #0a84ff;
  --success: #248a3d;
  --danger: #d70015;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 122, 255, 0.08), transparent 32%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 58%, #fff 100%);
}

a {
  color: inherit;
}

.shell {
  width: min(100%, 820px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 20px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.adminShell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 42px 22px 72px;
}

.performanceShell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 46px 20px 70px;
}

.performanceHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.performanceHeader h1 {
  margin: 8px 0;
}

.performanceHeader p {
  margin: 0;
  color: var(--muted);
}

.performanceEyebrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.performanceStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.performanceStat {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.performanceStat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.performanceStat strong {
  font-size: clamp(25px, 4vw, 36px);
}

.performanceStat.featured {
  border-color: rgba(0, 122, 255, 0.22);
  background: linear-gradient(145deg, #eef7ff, #fff);
}

.performanceStat.paidStat {
  border-color: rgba(36, 138, 61, 0.22);
  background: linear-gradient(145deg, #effaf2, #fff);
}

.performanceList {
  display: grid;
  gap: 10px;
}

.performanceRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.performanceMain,
.performanceMoney {
  display: grid;
  gap: 5px;
}

.performanceMain span,
.performanceMoney span {
  color: var(--muted);
  font-size: 13px;
}

.performanceMoney {
  flex: 0 0 auto;
  text-align: right;
}

.performanceMoney strong {
  color: var(--success);
}

.commissionStatus {
  justify-self: end;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.commissionStatus.paid,
.paidCommission {
  color: var(--success);
}

.commissionStatus.paid {
  background: rgba(36, 138, 61, 0.12);
}

.commissionStatus.unpaid,
.unpaidCommission {
  color: #b45309;
}

.commissionStatus.unpaid {
  background: rgba(180, 83, 9, 0.1);
}

.emptyPerformance {
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.adminShell.loginOnly {
  width: min(100%, 460px);
  min-height: 100vh;
  padding: 42px 20px;
  display: grid;
  align-content: center;
}

.loginOnly .adminSiteNav {
  display: none;
}

.loginOnly .adminHeader {
  display: grid;
  justify-items: center;
  margin-bottom: 14px;
  text-align: center;
}

.loginOnly .brand {
  display: none;
}

.loginOnly h1 {
  margin: 0;
  font-size: 30px;
}

.loginOnly #loginPanel {
  margin-bottom: 0;
  padding: 28px;
}

.loginOnly #loginPanel h2 {
  display: none;
}

.loginOnly #loginPanel .fieldRow {
  grid-template-columns: 1fr;
}

.loginOnly #loginPanel button {
  width: 100%;
}

.loginOnly .appFooter {
  display: none;
}

.siteNav {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(16px);
}

.adminSiteNav {
  width: fit-content;
  margin: 0 0 22px auto;
}

.siteNavLink {
  min-width: 96px;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
}

.siteNavLink:hover,
.siteNavLink.active {
  background: #111827;
  color: #fff;
}

.appFooter {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.appFooter a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 750;
}

.panel {
  border: 1px solid rgba(229, 229, 234, 0.9);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.compactPanel {
  margin-bottom: 18px;
  padding: 24px;
}

.adminHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.brand,
.siteBrand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.mark,
.brandIcon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.brandName,
.brandSub,
.versionPill,
.siteHeader,
.topTabs,
.statusBadges,
.statusBadge,
.statusDot,
.siteFooter,
.landingShell,
.redeemLayout,
.sideStack,
.guideCard,
.historyCard,
.emptyHistory {
  display: none;
}

h1 {
  margin: 10px 0 12px;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 800;
}

h2 {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
}

.subtext {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.shopNotice {
  width: 100%;
  margin: -8px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(215, 0, 21, 0.18);
  border-radius: 12px;
  background: rgba(215, 0, 21, 0.08);
  color: #d70015;
}

.shopNoticeTrack {
  width: max-content;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  animation: shopNoticeScroll 18s linear infinite;
}

@keyframes shopNoticeScroll {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(-100%);
  }
}

.form,
.paymentForm,
.typeForm,
.adminForm,
.lookupForm {
  display: grid;
  gap: 14px;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.fieldRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.keyField {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

input,
select {
  height: 48px;
  padding: 0 14px;
}

input::placeholder,
textarea::placeholder {
  color: #b0b0b6;
}

input[type="file"] {
  padding: 12px;
}

textarea {
  min-height: 132px;
  padding: 14px 16px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(0, 122, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

input[readonly] {
  color: var(--muted);
  background: #f5f5f7;
}

button {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-2);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.secondaryButton {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondaryButton:hover {
  background: #f5f5f7;
}

.dangerButton {
  border: 1px solid rgba(215, 0, 21, 0.16);
  background: rgba(215, 0, 21, 0.08);
  color: var(--danger);
}

.dangerButton:hover {
  background: rgba(215, 0, 21, 0.12);
}

.redeemMeta {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.textLink,
.message a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 750;
}

.message {
  min-height: 36px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.6;
}

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

.message.error {
  color: var(--danger);
}

#adminContent {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

#adminContent[hidden] {
  display: none;
}

.adminNav {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.adminNavButton {
  width: 100%;
  justify-content: flex-start;
  height: 42px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-align: left;
}

.adminNavButton:hover,
.adminNavButton.active {
  background: #111827;
  color: #fff;
}

.adminWorkspace,
.adminPanel[hidden] {
  min-width: 0;
}

.adminPanel[hidden] {
  display: none;
}

.statsGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.statsGrid div,
.typeRow,
.tableRow,
.productCard,
.orderCard {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.statsGrid div {
  min-height: 96px;
  padding: 18px;
}

.statsGrid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 34px;
}

.statsGrid span,
.productCard p,
.tableRow span,
.orderCard span {
  color: var(--muted);
}

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

.lookupForm {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.typeForm {
  grid-template-columns: minmax(180px, 1fr) 130px minmax(180px, 1fr) auto;
  align-items: end;
}

.typeList,
.tableLike,
.orderResult,
.productGrid {
  display: grid;
  gap: 12px;
}

.typeList {
  margin: 18px 0;
}

.typeRow {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 120px minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.adminForm {
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.25fr) 120px 120px auto;
  align-items: end;
  padding-top: 4px;
}

.sectionTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tableRow {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.resourceRow {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.resourceRow > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.resourceRow strong,
.codeRow strong,
.orderCard strong {
  overflow-wrap: anywhere;
}

.codeRow {
  grid-template-columns: 180px minmax(200px, 1fr) auto;
  align-items: center;
}

.orderRecordRow {
  grid-template-columns: minmax(230px, 1.1fr) auto minmax(160px, 0.7fr) minmax(120px, 0.45fr);
  align-items: center;
}

.orderRecordRow > div,
.rebateRecordRow > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.rebateRecordRow {
  grid-template-columns: minmax(220px, 1.2fr) minmax(110px, 0.45fr) minmax(110px, 0.45fr) minmax(150px, 0.6fr) auto;
  align-items: center;
}

.statusPill {
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.statusPAID {
  background: rgba(36, 138, 61, 0.12);
  color: var(--success);
}

.statusPENDING {
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
}

.statusEXPIRED {
  background: rgba(215, 0, 21, 0.08);
  color: var(--danger);
}

.subSectionTitle {
  margin-top: 22px;
  font-size: 18px;
}

.miniForm {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(92px, auto) minmax(92px, 0.6fr) minmax(120px, auto) minmax(92px, auto);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.miniForm input,
.miniForm select,
.miniForm button,
.typeRow input,
.typeRow button {
  height: 40px;
  min-width: 0;
}

.codeBox {
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

.productCard,
.orderCard {
  padding: 18px;
}

.productCard {
  display: grid;
  min-height: 228px;
  gap: 14px;
  align-content: space-between;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.productImage {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  background: #f5f5f7;
}

.productCard:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 122, 255, 0.34);
  box-shadow: 0 18px 40px rgba(0, 122, 255, 0.12);
}

.emptyProduct {
  min-height: 150px;
  align-content: center;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.68);
}

.emptyProduct:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

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

.productCard h2 {
  margin: 0;
  font-size: 21px;
  overflow-wrap: anywhere;
}

.stockPill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.discountPill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(36, 138, 61, 0.12);
  color: var(--success);
  font-size: 12px;
  font-weight: 750;
}

.productPrice {
  display: block;
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.buyButton {
  width: 100%;
}

.largeCode {
  display: block;
  margin: 10px 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 22px;
}

.payQr {
  display: block;
  width: min(100%, 260px);
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
}

@media (max-width: 1180px) {
  .miniForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

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

  .adminNav {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell,
  .adminShell,
  .performanceShell {
    padding: 26px 14px 48px;
  }

  .adminHeader,
  .performanceHeader,
  .performanceStats,
  .fieldRow,
  .productGrid,
  .paymentForm,
  .lookupForm,
  .typeForm,
  .typeRow,
  .adminForm,
  .statsGrid,
  .codeRow,
  .orderRecordRow,
  .rebateRecordRow,
  .miniForm {
    grid-template-columns: 1fr;
  }

  .adminHeader,
  .performanceHeader,
  .siteNav,
  .appFooter,
  .redeemMeta {
    display: grid;
  }

  button {
    width: 100%;
  }

  .performanceRow {
    align-items: flex-start;
  }

  .performanceMoney {
    text-align: right;
  }
}
