:root {
  --bg: #f6f7f4;
  --paper: #ffffff;
  --ink: #18211f;
  --muted: #66736f;
  --line: #dce4df;
  --green: #1f8a5b;
  --green-dark: #126241;
  --gold: #d7972f;
  --coral: #d9684a;
  --graphite: #293332;
  --shadow: 0 16px 42px rgba(31, 48, 44, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 12px clamp(16px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  text-align: left;
}

.brand-logo {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 3px;
}

.nav-tabs,
.auth-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ef;
}

.nav-tab,
.auth-switch button {
  min-width: 68px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.nav-tab.is-active,
.auth-switch button.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(27, 48, 42, 0.08);
}

.userbar {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.ghost,
.userbar button,
.wide-action,
.search-panel button,
.primary,
.secondary,
.message-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.primary,
.search-panel button,
.wide-action {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.primary:hover,
.search-panel button:hover,
.wide-action:hover {
  background: var(--green-dark);
}

.message-button {
  position: relative;
  color: var(--green-dark);
}

.message-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--coral);
  font-size: 12px;
  font-weight: 900;
}

.message-badge.inline {
  vertical-align: middle;
}

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

.view {
  display: none;
}

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

.hero {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 24px;
  padding: 34px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.3) 24%, transparent 42%),
    linear-gradient(135deg, rgba(18, 98, 65, 0.95), rgba(31, 138, 91, 0.82) 48%, rgba(215, 151, 47, 0.72));
  box-shadow: var(--shadow);
}

.hero-badge {
  display: grid;
  place-items: center;
  width: clamp(112px, 16vw, 172px);
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 42px rgba(21, 50, 42, 0.2);
}

.hero-badge img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.hero-copy {
  max-width: 680px;
  color: #fff;
}

.eyebrow {
  margin: 0 0 10px;
  color: #f2f7d7;
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.14;
}

.hero-meta {
  margin: 14px 0 0;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.search-panel {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 620px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.search-panel input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  outline: 0;
}

.search-panel input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 138, 91, 0.14);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--paper);
  font-weight: 700;
}

.category-chip.is-active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.toolbar select {
  min-width: 140px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--paper);
}

.market-grid {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
}

.market-side,
.form-shell,
.account-shell,
.notice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(36, 52, 48, 0.07);
}

.market-side {
  align-self: start;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.wide {
  width: 100%;
}

.metric {
  padding: 16px;
  border-radius: 8px;
  background: #f0f5f1;
}

.metric span {
  display: block;
  color: var(--green-dark);
  font-size: 28px;
  font-weight: 900;
}

.metric p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
}

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

.section-head.compact {
  margin-bottom: 12px;
}

.page-head {
  margin-top: 8px;
}

.announcement-board {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(36, 52, 48, 0.07);
}

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

.announcement-item {
  display: grid;
  align-content: space-between;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.announcement-item.latest {
  border-color: rgba(31, 138, 91, 0.46);
  background: #f1f8f3;
}

.announcement-item strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.announcement-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

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

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(36, 52, 48, 0.07);
}

.product-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #e9f2ec, #f9ecd9);
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 8px;
  color: white;
  background: var(--graphite);
  font-size: 24px;
  font-weight: 900;
}

.status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.status.sold {
  background: var(--coral);
}

.pin-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #24180a;
  background: #ffd66e;
  font-size: 12px;
  font-weight: 900;
}

.product-content {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-content h3 {
  margin: 0;
  min-height: 48px;
  font-size: 18px;
  line-height: 1.35;
}

.product-desc {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f2ee;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.price {
  color: var(--coral);
  font-size: 22px;
  font-weight: 900;
}

.secondary {
  min-width: 82px;
}

.form-shell {
  display: grid;
  gap: 16px;
  max-width: 760px;
  padding: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--graphite);
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

.form-row,
.complaint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.complaint-grid {
  grid-template-columns: minmax(0, 760px) minmax(260px, 1fr);
  align-items: start;
  gap: 20px;
}

.notice-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.notice-panel h3 {
  margin: 0;
}

.notice-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.account-shell {
  min-height: 240px;
  padding: 18px;
}

.account-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.account-summary h3 {
  margin: 0;
}

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

.account-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.announcement-editor,
.announcement-history {
  grid-column: span 1;
}

.complaint-inbox {
  grid-column: 1 / -1;
}

.list-panel h3 {
  margin: 0 0 12px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-form {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.mini-item.unread {
  border-color: rgba(217, 104, 74, 0.5);
  background: #fff8f4;
}

.mini-item strong {
  overflow-wrap: anywhere;
}

.mini-item span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.complaint-item .secondary {
  justify-self: start;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed #bdc9c2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
}

.empty.slim {
  min-height: 96px;
}

.modal {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(22, 31, 30, 0.48);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 10px;
}

.modal-head h2 {
  margin: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

.auth-switch {
  margin: 0 18px 12px;
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.wechat-login {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.wechat-button {
  min-height: 42px;
  border: 1px solid #1aad19;
  border-radius: 8px;
  color: #fff;
  background: #1aad19;
  font-weight: 900;
}

.wechat-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
  background: #eef3ef;
}

.wechat-login p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-panel,
.complaint-inbox {
  grid-column: 1 / -1;
}

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

.admin-product-item .secondary,
.user-login-item .secondary {
  justify-self: start;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.product-modal {
  width: min(760px, calc(100% - 28px));
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) 1.1fr;
  gap: 18px;
  padding: 0 18px 18px;
}

.detail-copy {
  display: grid;
  align-content: start;
  gap: 12px;
}

.detail-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-width: 220px;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--graphite);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .brand,
  .userbar {
    justify-self: start;
  }

  .nav-tabs {
    width: 100%;
  }

  .nav-tab {
    flex: 1;
  }

  .market-grid,
  .account-columns,
  .detail-layout,
  .complaint-grid {
    grid-template-columns: 1fr;
  }

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

  .market-side {
    grid-template-columns: 1fr 1fr;
  }

  .market-side .wide-action,
  .market-side .wide {
    grid-column: 1 / -1;
  }

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

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 390px;
    padding: 22px;
  }

  .hero-badge {
    width: 112px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .search-panel {
    grid-column: 1;
  }

  .search-panel,
  .form-row,
  .toolbar,
  .market-side,
  .section-head,
  .account-summary {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .section-head,
  .account-summary {
    display: grid;
  }

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

  .announcement-list {
    grid-template-columns: 1fr;
  }

  .search-panel button,
  .toolbar select {
    width: 100%;
  }

  .brand span:last-child {
    overflow-wrap: anywhere;
  }
}
