:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #111827;
  --primary-soft: #f1f5f9;
  --success: #047857;
  --danger: #dc2626;
  --radius-lg: 12px;
  --radius-md: 10px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  --app-bottom-safe-space: calc(156px + env(safe-area-inset-bottom, 0px));
  --floating-cart-offset: calc(84px + env(safe-area-inset-bottom, 0px));
  --bottom-nav-offset: calc(16px + env(safe-area-inset-bottom, 0px));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

body.drawer-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1,
.hero h2,
.panel-heading h3,
.admin-block h4,
.admin-topbar h2,
.section-headline h3 {
  margin: 0;
}

.topbar-side {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.trust-item,
.feature-card,
.process-card,
.featured-card,
.summary-card,
.recharge-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.trust-item strong,
.summary-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.trust-item span,
.summary-card span,
.detail-item span,
.stat-card span {
  color: var(--muted);
}

.section-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.nav-pill,
.session-chip,
.badge,
.primary-button,
.secondary-button,
.ghost-button,
.buy-button,
.download-link,
.filter-chip {
  border-radius: 8px;
}

.nav-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 10px 14px;
}

.nav-pill.active {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.session-chip {
  min-height: 38px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.badge.subtle {
  background: #f9fafb;
}

.primary-button,
.secondary-button,
.ghost-button,
.buy-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 600;
  border: 1px solid transparent;
  font-size: 14px;
}

.primary-button,
.buy-button {
  background: var(--primary);
  color: #fff;
}

.secondary-button {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
}

.ghost-button {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
}

.download-link {
  background: #ecfdf5;
  color: var(--success);
  border-color: #a7f3d0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
}

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

.span-2,
.span-3 {
  grid-column: span 2;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.hero-copy h2 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.25;
  margin-bottom: 14px;
}

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

.inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.hero-stats,
.feature-grid,
.overview-grid,
.process-grid,
.featured-strip,
.account-summary-grid {
  display: grid;
  gap: 16px;
}

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

.feature-grid,
.process-grid,
.featured-strip,
.account-summary-grid,
.product-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.stat-card strong {
  display: block;
  font-size: 28px;
  margin-bottom: 6px;
}

.panel-heading,
.subheading,
.section-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-card {
  align-self: start;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-button {
  flex: 1;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.tab-button.active {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.stack-form,
.inline-form,
.search-field {
  display: grid;
  gap: 12px;
}

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

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.feature-inline-list,
.product-meta,
.package-meta,
.profile-grid,
.filter-cluster,
.product-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.feature-card h4,
.process-card h4,
.featured-card h4,
.product-card h4,
.package-card h4,
.order-card h4,
.profile-card h4,
.empty-state h4,
.recharge-note strong {
  margin: 0 0 8px;
}

.feature-card p,
.process-card p,
.featured-card p,
.product-card p,
.package-card p,
.order-card p,
.empty-state p,
.recharge-note p {
  margin: 0;
  color: var(--muted);
}

.process-index {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.market-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 220px;
  gap: 10px;
  margin-bottom: 14px;
}

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

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
}

.filter-chip.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #cbd5e1;
}

.featured-footer,
.product-footer,
.package-footer,
.order-footer,
.product-detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.product-card,
.package-card,
.order-card,
.admin-item,
.profile-card,
.admin-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.product-card,
.package-card,
.order-card,
.admin-item,
.profile-card,
.admin-block,
.summary-card,
.featured-card,
.recharge-note {
  padding: 14px;
}

.product-card {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.product-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  border-color: #cbd5e1;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 999px;
}

.pill-highlight {
  background: var(--primary-soft);
  color: var(--primary);
}

.price-mark,
.featured-footer strong {
  font-size: 18px;
  font-weight: 700;
}

.package-list,
.order-list,
.admin-list {
  display: grid;
  gap: 14px;
}

.payment-panel {
  margin-top: 6px;
}

.payment-qrcode-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
}

.payment-qrcode-wrap canvas {
  width: 220px;
  height: 220px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
}

.empty-state {
  padding: 18px;
  text-align: center;
  border: 1px dashed #d1d5db;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.product-empty {
  grid-column: 1 / -1;
}

.profile-item,
.detail-item {
  min-width: 120px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.profile-item strong,
.detail-item strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.order-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.order-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.order-tag.product {
  color: #1d4ed8;
  background: #eff6ff;
}

.order-tag.topup {
  color: var(--success);
  background: #ecfdf5;
}

.store-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 var(--app-bottom-safe-space);
}

.store-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 12;
}

.store-brand h1,
.hero-banner h2 {
  margin: 0;
}

.store-brand h1 {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.2;
}

.store-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.store-main {
  display: grid;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 16px;
  padding-bottom: 8px;
}

.section-card {
  padding: 16px;
}

.recharge-note,
.inline-cart-card {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.inline-cart-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #f8fafc;
}

.inline-cart-copy h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.inline-cart-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-cart-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.hero-banner h2 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
  margin-bottom: 14px;
}

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

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 320px;
  gap: 16px;
}

.cart-list,
.cart-summary-actions {
  display: grid;
  gap: 12px;
}

.cart-item,
.cart-summary {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 18px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.cart-item-copy h4,
.cart-summary strong {
  margin: 8px 0;
}

.cart-item-copy p {
  margin: 0;
  color: var(--muted);
}

.cart-item-side {
  display: grid;
  gap: 10px;
  justify-items: end;
  min-width: 120px;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.inline-actions.centered {
  justify-content: center;
}

.floating-cart-bar {
  position: fixed;
  left: 50%;
  bottom: var(--floating-cart-offset);
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  z-index: 19;
}

.floating-cart-copy {
  display: grid;
  gap: 2px;
}

.floating-cart-copy strong {
  font-size: 16px;
}

.floating-cart-copy span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.floating-cart-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: var(--bottom-nav-offset);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(520px, calc(100% - 24px));
  padding: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(14px);
  z-index: 20;
}

.bottom-nav-item {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
}

.nav-label {
  font-size: 12px;
}

.nav-badge {
  position: absolute;
  top: 8px;
  right: 14px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.38);
  backdrop-filter: blur(2px);
  z-index: 29;
}

.product-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100vh;
  padding: 20px;
  background: #fff;
  box-shadow: -18px 0 44px rgba(15, 23, 42, 0.16);
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.drawer-head,
.drawer-panel-row,
.drawer-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head h3,
.drawer-price {
  margin: 0;
}

.drawer-close {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 16px;
}

.drawer-price {
  font-size: 30px;
  font-weight: 700;
}

.drawer-summary {
  margin: 0;
  color: var(--muted);
}

.drawer-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

.drawer-panel-row span {
  color: var(--muted);
}

.drawer-actions {
  align-items: center;
  flex-wrap: wrap;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 24px 4px 0;
  color: var(--muted);
}

.site-footer p {
  margin: 8px 0 0;
}

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

.admin-page-body,
.auth-page-body {
  background: var(--bg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.admin-sidebar-nav,
.admin-sidebar-footer {
  display: grid;
  gap: 10px;
}

.admin-main {
  padding: 24px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-login-card,
.slim-card {
  margin-bottom: 18px;
}

.admin-section-block {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.admin-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.danger-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff5f5;
  color: var(--danger);
  font-weight: 600;
}

.auth-page-shell {
  width: min(980px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.auth-brand-panel,
.auth-form-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.visible {
  opacity: 1;
}

@media (max-width: 1024px) {
  .trust-strip,
  .content-grid,
  .hero,
  .market-toolbar,
  .admin-grid,
  .auth-page-shell,
  .hero-banner,
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  :root {
    --app-bottom-safe-space: calc(186px + env(safe-area-inset-bottom, 0px));
    --floating-cart-offset: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 16px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar,
  .admin-main,
  .auth-brand-panel,
  .auth-form-panel {
    padding: 20px;
  }

  .topbar,
  .store-topbar,
  .panel-heading,
  .subheading,
  .section-headline,
  .site-footer,
  .admin-topbar,
  .product-footer,
  .package-footer,
  .order-footer,
  .admin-item {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .cart-item,
  .cart-item-side {
    justify-items: stretch;
  }

  .inline-cart-card,
  .inline-cart-actions {
    grid-template-columns: 1fr;
  }

  .inline-cart-actions {
    display: grid;
  }

  .store-shell {
    width: min(100% - 16px, 1120px);
  }

  .store-topbar {
    top: 8px;
    padding: 12px 14px;
  }

  .floating-cart-bar {
    bottom: var(--floating-cart-offset);
    align-items: stretch;
    flex-direction: column;
  }

  .floating-cart-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-drawer {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(78vh, 720px);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 44px rgba(15, 23, 42, 0.16);
  }

  .section-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
  }

  .nav-pill {
    white-space: nowrap;
  }

  .inline-form.two {
    grid-template-columns: 1fr;
  }
}
