:root {
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7dde5;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --brand: #166b7a;
  --brand-dark: #0f4d58;
  --accent: #c75028;
  --danger: #b42318;
  --good: #238650;
  --warning: #a35b00;
  --shadow: 0 16px 42px rgba(31, 41, 51, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #eef4f5 0, #f8fafb 320px, #f5f7fa 100%);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(215, 221, 229, 0.8);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-topbar {
  background: rgba(248, 250, 251, 0.94);
}

.shop-topbar {
  align-items: center;
  padding: 8px clamp(18px, 4vw, 56px);
}

.shop-topbar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
}

.storefront-banner {
  position: relative;
  left: 50%;
  width: min(1560px, calc(100vw - 20px));
  height: clamp(240px, 28vw, 390px);
  margin: 0 0 30px;
  overflow: hidden;
  border-radius: 4px;
  background: #20333a;
  box-shadow: 0 12px 32px rgba(31, 41, 51, 0.1);
  transform: translateX(-50%);
}

.storefront-banner-track,
.storefront-banner-slide {
  position: absolute;
  inset: 0;
}

.storefront-banner-slide {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.storefront-banner-slide.active {
  visibility: visible;
  opacity: 1;
}

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

.storefront-banner-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(18, 30, 34, 0.9) 0%, rgba(18, 30, 34, 0.64) 42%, rgba(18, 30, 34, 0.08) 76%);
}

.storefront-banner-copy {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: clamp(26px, 6vw, 78px);
  width: min(540px, calc(100% - 110px));
  color: #fff;
  transform: translateY(-50%);
}

.storefront-banner-copy span {
  display: inline-block;
  margin-bottom: 12px;
  color: #b9ebd4;
  font-size: 13px;
  font-weight: 900;
}

.storefront-banner-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(27px, 3.1vw, 46px);
  line-height: 1.18;
}

.storefront-banner-copy p {
  max-width: 500px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  line-height: 1.75;
}

.banner-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  color: #fff;
  background: rgba(18, 30, 34, 0.45);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.banner-arrow:hover {
  background: rgba(18, 30, 34, 0.72);
}

.banner-arrow-previous { left: 14px; }
.banner-arrow-next { right: 14px; }

.banner-dots {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 18px;
  display: flex;
  gap: 8px;
}

.banner-dots button {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.banner-dots button.active {
  width: 24px;
  border-radius: 4px;
  background: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 240px;
}

.brand-logo-crop {
  display: block;
  width: 230px;
  height: 64px;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-logo-image {
  display: block;
  width: 230px;
  height: auto;
  transform: translateY(-26.18%);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-size: 26px;
  font-weight: 800;
}

h1 {
  font-size: clamp(20px, 2vw, 28px);
}

.brand p,
.section-title p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page-nav a,
.nav-button,
.primary-link,
.secondary-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 800;
  background: #fff;
}

.page-nav a.active,
.primary-link {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.secondary-link {
  color: var(--ink);
}

.nav-button {
  color: var(--ink);
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shop-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.compact-search {
  width: min(260px, 34vw);
}

.account-entry {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.account-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 150px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.account-menu button {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.account-menu button:hover {
  background: #edf6f4;
}

.cart-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.cart-btn:hover {
  border-color: var(--brand);
}

.cart-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 5px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

main {
  width: min(1240px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.shop-main {
  width: min(1180px, calc(100% - 32px));
}

.shop-view {
  display: none;
}

.shop-view.active {
  display: block;
}

.admin-shell {
  width: min(1320px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.05);
}

.admin-nav-item {
  border: 0;
  border-radius: 7px;
  padding: 12px 14px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  color: #fff;
  background: var(--brand);
}

.admin-content {
  min-width: 0;
}

.admin-view,
.order-subview,
.merchant-subview {
  display: none;
}

.admin-view.active,
.order-subview.active,
.merchant-subview.active {
  display: block;
}

.entry-page {
  display: grid;
  place-items: center;
}

.entry-card {
  width: min(420px, calc(100% - 32px));
  display: grid;
  gap: 16px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-page {
  width: min(460px, calc(100% - 32px));
  margin: 56px auto;
}

.login-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 51, 0.38);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.agreement-check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.agreement-check input {
  width: auto;
  margin-top: 4px;
}

.agreement-link {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-weight: 900;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
}

.agreement-link:hover {
  color: var(--brand-dark);
}

.agreement-content {
  max-height: min(60vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: #fff;
  line-height: 1.85;
}

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

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

.agreement-admin-panel {
  padding: 20px;
}

.stat,
.panel,
.product-card,
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.05);
}

.stat {
  padding: 18px;
}

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

.stat strong {
  font-size: 24px;
}

.shop-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.lower-grid,
.queue-panel {
  margin-top: 18px;
}

.overview-product-panel {
  margin-top: 18px;
}

.panel {
  padding: 20px;
}

.sidebar-panel {
  position: sticky;
  top: 116px;
}

.section-title {
  margin-bottom: 16px;
}

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

.section-title h2 {
  font-size: 22px;
}

.small-title {
  margin-top: 20px;
}

.small-title h2 {
  font-size: 18px;
}

.waiting-title {
  margin-top: 24px;
}

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

.form.compact {
  max-width: 420px;
}

.inject-form {
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 107, 122, 0.14);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.warning-btn,
.success-btn,
.buy-btn {
  border: 0;
  border-radius: 7px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
}

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

.primary-btn:hover,
.buy-btn:hover {
  background: var(--brand-dark);
}

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

.text-link-btn {
  border: 0;
  padding: 2px 0;
  color: var(--brand-dark);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.text-link-btn:hover {
  color: var(--brand);
  text-decoration: underline;
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.warning-btn {
  color: #fff;
  background: var(--warning);
}

.success-btn {
  color: #fff;
  background: var(--good);
}

.danger-btn:disabled,
.warning-btn:disabled,
.success-btn:disabled,
.primary-btn:disabled,
.buy-btn:disabled {
  color: var(--muted);
  background: #d8dee6;
  cursor: not-allowed;
}

.full-width {
  width: 100%;
  margin-top: 18px;
}

.dividend-process-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dividend-process-control div {
  display: grid;
  gap: 4px;
}

.dividend-process-control span {
  color: var(--muted);
  font-size: 13px;
}

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

.product-action-row {
  justify-content: flex-end;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  margin-bottom: 16px;
}

.segmented-control button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.segmented-control button.active {
  color: #fff;
  background: var(--brand);
}

.search {
  max-width: 280px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.product-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 168px 1fr;
}

.product-browser-card {
  width: 100%;
  grid-template-rows: auto 1fr;
  padding: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.product-browser-card .product-image {
  height: auto;
  aspect-ratio: 4 / 3;
}

.product-browser-card .product-body > p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-browser-card .product-body {
  grid-template-rows: auto 1fr auto;
}

.product-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  align-self: end;
}

.product-sales {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.product-browser-card:hover,
.product-browser-card:focus-visible {
  border-color: #91b9aa;
  box-shadow: 0 16px 38px rgba(31, 41, 51, 0.12);
  transform: translateY(-3px);
}

.product-image {
  width: 100%;
  height: 168px;
  object-fit: cover;
  background: #dfe8eb;
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

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

.product-title-row h3 {
  font-size: 17px;
}

.price {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

.product-card p,
.order-meta,
.mini-list {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.merchant-shop-grid {
  margin-top: 8px;
}

.merchant-shop-card {
  grid-template-rows: 150px 1fr;
}

.merchant-edit-card {
  width: 100%;
  padding: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.merchant-edit-card:hover {
  border-color: var(--brand);
  box-shadow: 0 14px 32px rgba(31, 41, 51, 0.1);
}

.merchant-shop-card .product-image {
  height: 150px;
}

.shop-empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #aeb7c2;
  text-align: center;
}

.shop-empty-state strong {
  font-size: 22px;
  color: #aeb7c2;
}

.wallet {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 8px;
  background: #edf6f4;
  margin-top: 16px;
}

.wallet.subtle {
  background: #f6f8fa;
}

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

.wallet strong {
  font-size: 26px;
  color: var(--brand-dark);
}

.account-page {
  max-width: 980px;
  margin: 0 auto;
}

.back-to-shop {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 16px;
}

.back-to-shop:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.profile-summary {
  display: grid;
  gap: 14px;
}

.profile-row {
  display: grid;
  gap: 14px;
}

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

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

.profile-summary .panel {
  display: grid;
  gap: 8px;
}

.profile-summary span {
  color: var(--muted);
  font-size: 14px;
}

.profile-summary strong {
  font-size: 26px;
}

.profile-actions {
  align-content: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ledger-row {
  grid-template-columns: minmax(0, 1.5fr) 0.7fr 1fr;
}

.amount-positive {
  color: #14804a;
  font-weight: 800;
}

.amount-negative {
  color: #b42318;
  font-weight: 800;
}

.password-panel {
  margin-top: 18px;
}

.cart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.05);
  overflow: hidden;
}

.cart-toolbar,
.cart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: #fff;
}

.cart-toolbar {
  border-bottom: 1px solid var(--line);
}

.cart-toolbar span {
  color: var(--muted);
  font-weight: 800;
}

.cart-list {
  display: grid;
}

.cart-row {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.cart-row.selected {
  background: #f1f8f6;
}

.cart-select {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.cart-row.selected .cart-select {
  border-color: var(--brand);
  background: var(--brand);
}

.cart-row.selected .cart-select span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
}

.cart-thumb {
  width: 72px;
  height: 72px;
  border-radius: 7px;
  object-fit: cover;
  background: #dfe8eb;
}

.cart-info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cart-info strong {
  overflow-wrap: anywhere;
}

.cart-info span {
  color: var(--muted);
  font-size: 14px;
}

.cart-price {
  color: var(--accent);
  white-space: nowrap;
}

.cart-footer {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
}

.cart-footer strong {
  color: var(--accent);
  font-size: 20px;
}

.cashback-section {
  display: grid;
  gap: 12px;
}

.cashback-section + .cashback-section {
  margin-top: 26px;
}

.cashback-section-title {
  font-size: 18px;
}

.order-summary-card {
  width: min(560px, 100%);
}

.checkout-confirm-card {
  max-height: min(760px, calc(100vh - 40px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.checkout-confirm-body {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.checkout-confirm-actions {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  background: #fff;
}

.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.order-summary-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.order-summary-grid span,
.order-summary-items h3 {
  color: var(--muted);
  font-size: 13px;
}

.order-summary-grid strong {
  overflow-wrap: anywhere;
}

.order-summary-items {
  display: grid;
  gap: 8px;
}

.payment-order-list {
  display: grid;
  gap: 16px;
}

.payment-order-block {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.payment-order-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.order-summary-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.order-summary-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-summary-item strong {
  color: var(--accent);
  white-space: nowrap;
}

.checkout-confirm-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-weight: 900;
}

.checkout-confirm-total span {
  color: var(--muted);
}

.checkout-confirm-total strong {
  color: var(--accent);
  font-size: 22px;
}

.rule-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.rule-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.order-list,
.mini-list {
  display: grid;
  gap: 12px;
}

.order-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 190px;
  gap: 16px;
  padding: 16px;
  align-items: center;
}

.rank {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf6f4;
  color: var(--brand);
  font-weight: 900;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecef;
  margin-top: 10px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--good);
}

.status-pill {
  justify-self: end;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-dark);
  background: #e6f3f1;
}

.status-pill.waiting {
  color: var(--warning);
  background: #fff3df;
}

.status-pill.expired {
  color: var(--warning);
  background: #fff3df;
}

.status-pill.done {
  color: var(--good);
  background: #e8f6ee;
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.metric-list span {
  color: var(--muted);
}

.metric-list strong {
  text-align: right;
}

.table-list {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.7fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.compact-row {
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
}

.compact-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-user-row {
  grid-template-columns: 0.85fr 1.05fr 0.95fr 0.8fr 0.7fr 0.85fr 0.85fr 0.85fr;
}

.merchant-product-row {
  grid-template-columns: 0.95fr minmax(0, 1.5fr) 0.75fr 0.8fr;
}

.merchant-settlement-row {
  grid-template-columns: 1fr minmax(0, 1.8fr) 0.8fr 0.9fr;
}

.merchant-all-product-row {
  grid-template-columns: 0.9fr minmax(0, 1.25fr) 0.8fr 1fr 0.85fr 0.75fr 0.6fr;
}

.address-row {
  grid-template-columns: 0.8fr 0.9fr minmax(0, 2fr);
}

.user-order-row {
  grid-template-columns: 1fr minmax(0, 1.25fr) 0.75fr 1.1fr 1fr 0.9fr 0.9fr;
}

.merchant-order-row {
  grid-template-columns: 1fr minmax(0, 1.25fr) 0.8fr 0.75fr 1fr minmax(0, 1.4fr) 0.7fr;
}

.admin-processing-order-row {
  grid-template-columns: 1fr minmax(0, 1.15fr) 0.75fr 0.95fr 0.75fr 0.9fr minmax(0, 1.25fr) 0.8fr;
}

.merchant-order-items {
  display: grid;
  gap: 10px;
}

.merchant-order-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.merchant-order-item img {
  width: 64px;
  height: 64px;
  border-radius: 7px;
  object-fit: cover;
  background: #dfe8eb;
}

.merchant-order-item div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.merchant-order-item .merchant-order-item-action {
  justify-items: end;
  text-align: right;
}

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

.mini-action {
  padding: 7px 9px;
  font-size: 12px;
}

.checkout-address-block {
  display: grid;
  gap: 10px;
}

.checkout-address-block h3 {
  color: var(--muted);
  font-size: 13px;
}

.checkout-address-list {
  display: grid;
  gap: 8px;
}

.address-choice {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.address-choice.selected {
  border-color: var(--brand);
  background: #edf6f4;
}

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

.checkout-address-form {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.compact-empty {
  padding: 14px;
}

.merchant-mark {
  display: inline-block;
  margin-right: 6px;
}

.promotion-stars {
  color: #d9a300;
  display: inline-block;
  font-size: 12px;
  margin-left: 5px;
  vertical-align: 1px;
}

.promotion-level-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.promotion-level-control > span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.promotion-level-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.promotion-level-buttons button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  padding: 7px 10px;
}

.promotion-level-buttons button.active {
  background: #fff7da;
  border-color: #d9a300;
  color: #8a6400;
  font-weight: 800;
}

.settlement-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 14px;
}

.form-tabs {
  margin-top: 6px;
}

.shop-market-tabs {
  flex: 0 0 auto;
  margin: 0;
}

.shop-market-tabs button {
  width: 112px;
  min-width: 112px;
}

.shop-market-tabs button[data-shop-market="voucher"].active {
  background: var(--accent);
}

.product-category-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0 2px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.product-category-nav button {
  flex: 0 0 auto;
  min-height: 40px;
  border: 0;
  border-radius: 4px;
  padding: 9px 18px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.product-category-nav button:hover {
  color: var(--brand);
  background: #edf4f4;
}

.product-category-nav button.active {
  padding-top: 6px;
  padding-bottom: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 19px;
}

.shopper-product-detail-card {
  width: min(860px, 100%);
  padding: 0;
  overflow: hidden;
}

.product-detail-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 41, 51, 0.5);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.shopper-product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  min-height: 470px;
}

.shopper-product-visual {
  min-height: 470px;
  background: #edf1f2;
}

.shopper-product-visual img {
  width: 100%;
  height: 100%;
  min-height: 470px;
  object-fit: cover;
}

.shopper-product-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 42px 34px 30px;
}

.product-detail-category {
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.shopper-product-info h2 {
  font-size: 28px;
  line-height: 1.25;
}

.product-detail-price {
  color: var(--accent);
  font-size: 27px;
}

.shopper-product-info > p {
  color: var(--muted);
  line-height: 1.75;
}

.product-detail-meta {
  display: grid;
  gap: 9px;
  margin: 4px 0 8px;
}

.product-detail-meta div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.product-detail-meta dt { color: var(--muted); }
.product-detail-meta dd { margin: 0; font-weight: 800; text-align: right; }

.product-detail-cart-btn {
  width: 100%;
  margin-top: auto;
}

.storefront-banner-admin-panel {
  margin-top: 18px;
  padding: 20px;
}

.storefront-category-admin-panel {
  margin-top: 18px;
  padding: 20px;
}

.category-editor-list {
  display: grid;
  gap: 8px;
}

.category-editor-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafb;
}

.category-editor-row.dragging {
  opacity: 0.5;
}

.category-drag-handle {
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: grab;
}

.category-drag-handle:active {
  cursor: grabbing;
}

.admin-product-edit-form {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafb;
}

.admin-product-readonly-grid {
  margin-bottom: 0;
}

.product-pagination {
  margin-top: 24px;
}

.banner-editor-list {
  display: grid;
  gap: 12px;
}

.banner-editor-row {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafb;
}

.banner-editor-heading,
.banner-editor-fields {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.banner-editor-fields label {
  flex: 1;
}

.banner-enabled-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-enabled-field input {
  width: auto;
}

.text-danger-btn {
  border: 0;
  padding: 4px;
  color: var(--danger);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  margin-top: 14px;
}

.switch-row input {
  width: 42px;
  height: 22px;
  accent-color: var(--brand);
}

.order-history-row,
.history-row {
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr 1fr;
}

.order-history-row {
  grid-template-columns: 1.25fr 0.75fr 0.8fr 0.9fr 0.75fr 1.2fr 1.1fr 1.1fr;
}

.compact-order-card {
  grid-template-columns: 56px minmax(0, 1fr) 150px;
  gap: 10px;
  padding: 10px 12px;
  box-shadow: none;
}

.compact-order-card .rank {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.compact-order-card .order-meta {
  font-size: 12px;
  line-height: 1.4;
}

.compact-order-card .progress {
  height: 7px;
  margin-top: 6px;
}

.compact-order-card .status-pill {
  padding: 5px 8px;
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination:empty {
  display: none;
}

.pagination button {
  padding: 7px 10px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.product-form-grid .wide-field {
  grid-column: 1 / -1;
}

.product-form-grid button {
  justify-self: start;
}

.product-form-grid .product-action-row button {
  justify-self: auto;
}

.admin-product-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe8eb;
}

.product-detail-description {
  text-align: left;
  overflow-wrap: anywhere;
}

.table-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: var(--soft);
}

.user-row {
  cursor: pointer;
}

.user-row:hover {
  border-color: var(--brand);
  background: #edf6f4;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.wide-modal {
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

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

.detail-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

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

.detail-grid strong {
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 8px;
  color: white;
  background: rgba(31, 41, 51, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1060px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar,
  .section-title.inline {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-actions {
    width: 100%;
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .shop-topbar-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .shop-topbar-inner .brand {
    width: 100%;
  }

  .shop-topbar-inner .shop-actions {
    order: 2;
  }

  .shop-topbar-inner .shop-market-tabs {
    order: 3;
    width: 100%;
  }

  .shop-topbar-inner .shop-market-tabs button {
    flex: 1;
  }

  .compact-search {
    flex: 1;
    width: auto;
  }

  .page-nav {
    justify-content: stretch;
  }

  .page-nav a {
    flex: 1;
    text-align: center;
  }

  .stats-grid,
  .shop-layout,
  .admin-grid,
  .admin-shell,
  .overview-stats,
  .detail-grid,
  .profile-summary,
  .profile-row,
  .profile-actions {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .sidebar-panel {
    position: static;
  }

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

  .storefront-banner {
    width: calc(100vw - 8px);
    height: 300px;
    margin-top: 0;
  }

  .storefront-banner-copy {
    left: 48px;
    width: calc(100% - 96px);
  }

  .storefront-banner-copy h2 {
    font-size: 30px;
  }

  .shopper-product-detail {
    grid-template-columns: 1fr;
  }

  .shopper-product-visual,
  .shopper-product-visual img {
    min-height: 240px;
    height: 240px;
  }

  .shopper-product-info {
    padding: 26px 22px 22px;
  }

  .banner-editor-fields {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    max-width: none;
  }

  .order-card,
  .cart-row,
  .admin-user-row,
  .merchant-product-row,
  .merchant-settlement-row,
  .merchant-all-product-row,
  .address-row,
  .user-order-row,
  .merchant-order-row,
  .admin-processing-order-row,
  .order-history-row,
  .history-row,
  .table-row {
    grid-template-columns: 1fr;
  }

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

  .rank,
  .status-pill {
    justify-self: start;
  }

  .cart-footer,
  .cart-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

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