:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --line: #dfe5dc;
  --text: #1f2a24;
  --muted: #687366;
  --green: #386641;
  --green-light: #edf5e8;
  --red: #bc4749;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.side {
  padding: 24px 18px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.brand {
  padding: 0 10px 24px;
  font-size: 22px;
  font-weight: 800;
}

.nav button {
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  background: var(--green-light);
  color: var(--green);
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.title {
  margin: 0;
  font-size: 28px;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.login-panel {
  width: min(430px, 100%);
  padding: 30px;
}

.field {
  margin-top: 16px;
}

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

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.btn {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  cursor: pointer;
}

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

.btn.danger {
  background: var(--red);
}

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

.stat {
  padding: 20px;
}

.stat-value {
  margin-top: 8px;
  color: var(--green);
  font-size: 30px;
  font-weight: 800;
}

.section {
  margin-top: 18px;
}

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

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

tr:last-child td {
  border-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.form-row input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--red);
  font-size: 14px;
}

.member-layout {
  min-height: 100vh;
}

.member-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 30px 22px;
}

.member-hero {
  padding: 28px;
  background: linear-gradient(135deg, #386641, #6a994e);
  color: #ffffff;
  border-radius: 10px;
}

.member-hero .subtitle {
  color: rgba(255, 255, 255, 0.76);
}

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

.product {
  padding: 18px;
}

.product-tag {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--green-light);
  color: var(--green);
  font-weight: 800;
  line-height: 44px;
  text-align: center;
}

.price {
  color: var(--red);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

/* ===== 平板适配（820px以下） ===== */
@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .nav button {
    width: auto;
    white-space: nowrap;
  }

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

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

/* ===== 手机适配（520px以下） ===== */
@media (max-width: 520px) {
  .member-main {
    padding: 16px 12px;
  }

  .member-hero {
    padding: 20px 16px;
  }

  .member-hero .title {
    font-size: 22px;
  }

  .stat {
    padding: 14px;
  }

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

  .product {
    padding: 14px;
  }

  .section-title {
    font-size: 16px;
  }

  .login-panel {
    padding: 24px 18px;
  }

  .field input,
  .field select {
    height: 44px;
    font-size: 15px;
  }

  .btn {
    height: 44px;
    width: 100%;
  }

  th, td {
    padding: 8px 10px;
    font-size: 12px;
  }

  table {
    font-size: 12px;
  }

  .footer {
    padding: 16px 12px;
    font-size: 12px;
  }
}
