:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-2: #edf4ef;
  --ink: #16241f;
  --muted: #64736c;
  --line: #dde7e1;
  --green: #159873;
  --green-dark: #0b6f57;
  --lime: #9ccb3d;
  --gold: #d99b2b;
  --danger: #c44536;
  --shadow: 0 22px 54px rgba(16, 47, 38, .12);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button,
input {
  font: inherit;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 14px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid rgba(221, 231, 225, .72);
  background: rgba(245, 247, 243, .88);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 168px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 42px;
  height: 42px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
}

.nav a {
  min-width: 68px;
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
}

.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  border-color: #b9c9c0;
  transform: translateY(-1px);
}

main {
  padding: 0 clamp(18px, 5vw, 72px) 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(360px, 1fr);
  align-items: center;
  gap: clamp(28px, 6vw, 76px);
  min-height: calc(100vh - 118px);
  padding: 36px 0 30px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 740px;
  margin-bottom: 22px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.lead {
  max-width: 640px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions,
.trust-row,
.toolbar,
.query-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #aebbb5;
  box-shadow: none;
}

.compact {
  min-height: 40px;
  padding: 0 14px;
}

.primary-button {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 24px rgba(22, 36, 31, .18);
}

.primary-button:hover {
  background: #263831;
}

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

.secondary-button:hover {
  border-color: #b9c9c0;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #f0c9c2;
  border-radius: 12px;
  background: #fff0ec;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

.trust-row {
  margin-top: 22px;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  color: var(--muted);
  font-size: 13px;
}

.hero-visual {
  margin: 0;
}

.hero-visual img {
  display: block;
  width: 100%;
  min-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 24px 42px rgba(22, 52, 43, .14));
}

.notice,
.order-query,
.support {
  margin: 18px 0 46px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notice {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 12px;
}

.notice p,
.order-query p,
.support p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar {
  justify-content: space-between;
  margin-top: 58px;
  margin-bottom: 18px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 420px);
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.tab.active,
.tab:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

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

.product-card {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(16, 47, 38, .08);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.product-image {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-image img {
  max-width: 46px;
  max-height: 46px;
  object-fit: contain;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e9f6e8;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

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

.low-stock {
  color: var(--danger);
  font-weight: 800;
}

.product-card p {
  color: var(--muted);
  line-height: 1.7;
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 20px;
}

.tags span {
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.price {
  font-size: 26px;
  font-weight: 900;
}

.price small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.order-query {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(320px, 1fr);
  align-items: start;
  gap: 22px;
  margin-top: 58px;
}

.query-form {
  justify-content: flex-end;
}

.query-form input,
.modal-panel input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #fbfcfb;
  color: var(--ink);
}

.query-form input {
  max-width: 380px;
}

.query-result {
  grid-column: 1 / -1;
}

.result-card {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.result-card code {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #13251f;
  color: #e8fff1;
  white-space: pre-wrap;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.support-grid article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.support-grid svg {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  color: var(--green);
}

.modal {
  width: min(94vw, 520px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(10, 20, 16, .46);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-panel label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.modal-desc {
  color: var(--muted);
  line-height: 1.7;
}

.checkout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-2);
}

.checkout-row strong {
  font-size: 26px;
}

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

.close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.empty {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed #b9c9c0;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.admin-live {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #bde0ce;
  border-radius: 999px;
  background: #e9f8ef;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

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

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 520px);
  align-items: end;
  gap: 28px;
  padding: 58px 0 28px;
}

.admin-hero h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 5.5vw, 66px);
}

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

.admin-metrics article {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(16, 47, 38, .08);
}

.admin-metrics strong {
  display: block;
  margin-bottom: 10px;
  font-size: 34px;
}

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

.admin-panel {
  margin: 18px 0 28px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.admin-board .admin-panel {
  height: 100%;
}

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

.section-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -2px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.section-tools.compact-tools {
  justify-content: flex-end;
  padding-block: 10px;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 420px);
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.admin-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pager:empty {
  display: none;
}

.pager button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.pager button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.page-state {
  white-space: nowrap;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table tr.is-inactive {
  background: #f7f8f6;
}

.admin-table tr.is-inactive td:first-child strong {
  color: var(--muted);
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-table td strong,
.admin-table td span {
  display: block;
}

.admin-table td span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.stock-pill {
  display: inline-grid;
  min-width: 52px;
  min-height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #e9f8ef;
  color: var(--green-dark);
  font-weight: 900;
}

.status-pill {
  display: inline-grid;
  min-width: 64px;
  min-height: 32px;
  place-items: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.status-pill.active {
  background: #e9f8ef;
  color: var(--green-dark);
}

.status-pill.inactive {
  background: #eef0ee;
  color: var(--muted);
}

.stock-pill.danger {
  background: #fff0ec;
  color: var(--danger);
}

.restock-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.restock-form input {
  width: 96px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
}

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

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

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

.product-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.product-form .wide {
  grid-column: span 2;
}

.product-form input,
.product-form select,
.product-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #fbfcfb;
  color: var(--ink);
}

.product-form textarea {
  min-height: 92px;
  padding-top: 12px;
  resize: vertical;
}

.product-form button {
  align-self: end;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.inline-form input {
  width: min(100%, 360px);
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
}

.category-manager {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.category-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eef0ee;
  color: var(--muted);
  cursor: pointer;
}

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

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

.admin-product-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.admin-product-card.is-inactive {
  background: #f4f6f3;
}

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

.admin-product-main h3 {
  margin-top: 12px;
}

.admin-product-stats {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.admin-product-stats strong {
  font-size: 38px;
  line-height: 1;
}

.admin-product-stats span,
.admin-product-stats small {
  color: var(--muted);
}

.admin-product-stats b {
  margin-top: 8px;
}

.card-restock-form {
  display: grid;
  gap: 12px;
}

.card-restock-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.card-restock-form textarea {
  width: 100%;
  min-height: 94px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.admin-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 20%, rgba(156, 203, 61, .14), transparent 32%),
    radial-gradient(circle at 86% 18%, rgba(21, 152, 115, .16), transparent 30%),
    var(--bg);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 28px;
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 12px;
  font-size: 42px;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #fbfcfb;
  color: var(--ink);
}

.login-error {
  min-height: 24px;
  color: var(--danger);
  font-weight: 800;
}

@media (max-width: 920px) {
  .hero,
  .order-query,
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

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

  .query-form {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 66px;
  }

  .nav {
    display: none;
  }

  main {
    padding-inline: 14px;
  }

  h1 {
    font-size: 42px;
  }

  .hero {
    padding-top: 24px;
  }

  .notice {
    grid-template-columns: 1fr;
  }

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

  .product-card {
    min-height: 0;
  }

  .hero-actions .primary-button,
  .hero-actions .secondary-button,
  .query-form .primary-button {
    width: 100%;
  }

  .admin-panel-head,
  .admin-actions,
  .restock-form {
    align-items: stretch;
    flex-direction: column;
  }

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

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

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

  .product-form .wide {
    grid-column: auto;
  }

  .inline-form,
  .section-tools,
  .admin-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-tools.compact-tools {
    align-items: flex-end;
  }

  .admin-search {
    width: 100%;
  }

  .pager {
    justify-content: flex-start;
  }

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

  .admin-product-stats {
    justify-items: start;
    text-align: left;
  }

  .query-form input {
    max-width: none;
  }
}
