:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #66716f;
  --line: #dce4e2;
  --brand: #08a6a0;
  --brand-dark: #057d79;
  --accent: #f2b84b;
  --danger: #c94f43;
  --soft: #eef8f7;
  --shadow: 0 16px 40px rgba(13, 42, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 166, 160, 0.14), transparent 34%),
    linear-gradient(225deg, rgba(242, 184, 75, 0.16), transparent 36%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

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

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

.brand {
  margin-bottom: 26px;
}

.brand strong {
  display: block;
  font-size: 20px;
}

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

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 11px 12px;
  border-radius: 7px;
  color: #34413f;
  font-weight: 700;
}

.nav a:hover,
.nav a.active {
  background: var(--soft);
  color: var(--brand-dark);
}

.content {
  min-width: 0;
  padding: 26px;
}

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

.topline h1,
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.topline p,
.auth-card p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 900;
}

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

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand-dark);
}

.flash.error {
  border-left-color: var(--danger);
  background: #fff0ee;
  color: #7d342c;
}

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: #33413f;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfd;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 108px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(8, 166, 160, 0.72);
  box-shadow: 0 0 0 4px rgba(8, 166, 160, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

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

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

.btn.secondary:hover {
  background: var(--soft);
}

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

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

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

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

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

.product-thumb {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  background: #eef1f1;
  object-fit: cover;
}

.copy-box {
  white-space: pre-wrap;
}

.public-page {
  min-height: 100vh;
  background: #e9edee;
}

.phone-shell {
  width: min(620px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: #f4f6f6;
}

.public-hero {
  padding: 24px 20px 54px;
  background: var(--brand);
  color: #fff;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  object-fit: cover;
}

.profile-name {
  font-size: 17px;
  font-weight: 900;
}

.profile-bio {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.public-hero h1 {
  margin: 20px 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.public-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

.group-invite {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  width: calc(100% - 24px);
  min-height: 94px;
  margin: -32px 12px 16px;
  padding: 12px 14px;
  border: 1px solid #29313a;
  border-radius: 8px;
  background: #1f272f;
  color: #fff;
  text-align: left;
  box-shadow: 0 10px 28px rgba(17, 27, 33, 0.18);
}

.group-invite:hover {
  background: #171e24;
}

.group-qr-preview {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 5px;
  background: #fff;
  color: #1f272f;
  font-size: 24px;
  font-weight: 900;
}

.group-qr-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-invite-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.group-invite-copy strong {
  font-size: 16px;
}

.group-invite-copy > span {
  color: #cbd3d8;
  font-size: 13px;
  line-height: 1.5;
}

.group-invite-arrow {
  color: #aeb9bf;
  font-size: 28px;
  line-height: 1;
  text-align: right;
}

.public-list {
  display: grid;
  gap: 14px;
  padding: 0 12px 32px;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 2px 4px 0;
  color: #53615f;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.section-label::before,
.section-label::after {
  flex: 1 1 0;
  height: 1px;
  background: #cbd3d2;
  content: "";
}

.profit-label {
  margin-right: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.more-label {
  margin-top: 4px;
}

.deal-card {
  overflow: hidden;
  border: 1px solid #e0e5e4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(22, 36, 34, 0.08);
}

.deal-main {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.deal-img {
  width: 116px;
  height: 116px;
  border: 1px solid #edf0ef;
  border-radius: 6px;
  background: #f5f7f7;
  object-fit: contain;
}

.deal-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 9px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f0f3f2;
}

.deal-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
}

.profit {
  color: #e84d3d;
  font-size: 18px;
  font-weight: 900;
}

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

.deal-actions {
  display: grid;
  grid-template-columns: minmax(92px, 0.72fr) minmax(150px, 1.28fr);
  gap: 10px;
  padding: 0 14px 14px;
}

.deal-actions .btn {
  min-height: 42px;
}

.report-button {
  border: 1px solid #d6dcda;
  background: #fff;
  color: #596563;
}

.report-button:hover {
  border-color: var(--brand);
  background: #f4f9f8;
  color: var(--brand-dark);
}

.empty {
  padding: 34px 18px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.modal-open {
  overflow: hidden;
}

.group-modal[hidden] {
  display: none;
}

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

.group-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 20, 24, 0.72);
}

.group-dialog {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  padding: 28px 24px 24px;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.group-dialog-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: transparent;
  color: #697472;
  font-size: 28px;
  line-height: 1;
}

.group-dialog-qr {
  display: grid;
  width: 210px;
  aspect-ratio: 1;
  margin: 0 auto 18px;
  place-items: center;
  overflow: hidden;
  border: 8px solid #f2f4f4;
  background: #fff;
}

.group-dialog-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.group-qr-empty {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.group-dialog h2 {
  margin: 0 0 9px;
  font-size: 21px;
}

.group-dialog p {
  margin: 0;
  color: #5f6b69;
  font-size: 14px;
  line-height: 1.7;
}

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

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

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

  .content {
    padding: 18px;
  }

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

  .topline {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .public-hero {
    padding: 20px 16px 50px;
  }

  .public-hero h1 {
    font-size: 25px;
  }

  .group-invite {
    grid-template-columns: 62px minmax(0, 1fr) 16px;
    gap: 10px;
    padding: 10px;
  }

  .group-qr-preview {
    width: 62px;
    height: 62px;
  }

  .group-invite-copy strong {
    font-size: 15px;
  }

  .group-invite-copy > span {
    font-size: 12px;
  }

  .deal-main {
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .deal-img {
    width: 98px;
    height: 108px;
  }

  .deal-title {
    font-size: 15px;
  }

  .deal-price {
    flex-wrap: wrap;
    gap: 4px 9px;
  }

  .deal-actions {
    grid-template-columns: 0.72fr 1.28fr;
    padding: 0 12px 12px;
  }
}
