:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e0ea;
  --text: #182230;
  --muted: #66758c;
  --blue: #1664e8;
  --blue-soft: #edf4ff;
  --amber: #f29b18;
  --amber-soft: #fff5df;
  --red: #d64545;
  --green: #18794e;
  --shadow: 0 14px 34px rgba(24, 34, 48, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(22, 100, 232, 0.14), transparent 24rem),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
  color: var(--text);
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px calc(104px + env(safe-area-inset-bottom, 0px));
}

.hero {
  padding: 20px 2px 16px;
}

.hero.compact {
  padding-top: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
}

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

h1 {
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.05;
}

.hero-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
}

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

.taobao-top-panel {
  padding-top: 14px;
}

.taobao-top-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.taobao-top-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-lite-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid #dbe4f2;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.top-lite-btn.accent {
  border-color: #cfe0ff;
  background: #edf4ff;
  color: var(--blue);
}

.wechat-entry {
  min-width: 164px;
  padding: 12px 16px;
  border: 1px solid #d8e2f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: 0 10px 24px rgba(22, 100, 232, 0.08);
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.wechat-entry-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.wechat-entry small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.taobao-top-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
  margin-bottom: 14px;
}

.taobao-top-metric {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f5f8fd;
  white-space: nowrap;
}

.taobao-top-note p {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  line-height: 1.6;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.refresh-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
}

.refresh-strip strong {
  color: var(--text);
}

.stats-strip > div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.stats-strip span {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.stats-strip small {
  color: var(--muted);
}

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

.stacked-mobile {
  align-items: flex-start;
  flex-direction: column;
}

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

.system-grid {
  display: grid;
  gap: 14px;
}

.system-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
}

.system-card.blue {
  background: linear-gradient(180deg, #ffffff 0%, var(--blue-soft) 100%);
  border-color: #cdddff;
}

.system-card.amber {
  background: linear-gradient(180deg, #ffffff 0%, var(--amber-soft) 100%);
  border-color: #f7dbac;
}

.system-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.system-card p {
  color: var(--muted);
  line-height: 1.5;
}

.card-stats {
  margin-top: 12px;
  font-weight: 600;
}

.entry-link,
.primary-btn,
.ghost-btn {
  min-width: 92px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.entry-link,
.primary-btn {
  background: var(--text);
  color: #fff;
}

.ghost-btn {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.back-link {
  color: inherit;
  text-decoration: none;
}

.dot {
  width: 4px;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
}

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

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 15px;
  background: #fff;
}

input,
select {
  height: 44px;
}

textarea {
  min-height: 108px;
  padding-top: 12px;
  padding-bottom: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(22, 100, 232, 0.2);
  border-color: var(--blue);
}

.help-text,
.status-line {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
  min-height: 24px;
}

.inline-hint {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-line.error {
  color: var(--red);
}

.status-line.success {
  color: var(--green);
}

.example-box {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.example-box > div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.example-box p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-all;
}

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

.queue-item,
.admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fcfdff;
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.item-code {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.item-code.small {
  font-size: 18px;
}

.item-meta,
.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.status-active {
  background: #e8f6ee;
  color: var(--green);
}

.status-hidden {
  background: #eef2f6;
  color: var(--muted);
}

.status-deleted {
  background: #fdecec;
  color: var(--red);
}

.pager,
.toolbar,
.item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pager {
  justify-content: space-between;
  margin-top: 14px;
}

.team-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.progress-card {
  gap: 14px;
}

.progress-block {
  margin: 10px 0 12px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1664e8 0%, #4d8df1 100%);
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.compact-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.compact-card-main {
  min-width: 0;
}

.compact-metrics {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.team-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.team-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.team-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.1;
}

.team-metric {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

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

.member-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.member-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.member-link {
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}

.copy-line {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.join-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.match-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(24, 34, 48, 0.32);
}

.modal-card {
  width: min(100%, 560px);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(24, 34, 48, 0.2);
  padding: 18px;
}

.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(calc(100vw - 24px), 420px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--text);
  box-shadow: 0 16px 36px rgba(24, 34, 48, 0.18);
  color: #fff;
}

.toast-item.error {
  background: #b42318;
}

.toast-item.fade-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-stack {
  display: grid;
  gap: 14px;
}

.team-share-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.team-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.team-share-row span {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}

.quick-entry-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.quick-entry-card strong {
  display: block;
  margin-bottom: 6px;
}

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

.wechat-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.wechat-qr-image {
  width: min(100%, 220px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 8px;
}

.admin-shell #adminUsersFilters {
  margin-bottom: 14px;
}

.admin-section-divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.checkbox-row span {
  margin-bottom: 0;
}

.taobao-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(calc(100vw - 24px), 520px);
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid rgba(217, 224, 234, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 36px rgba(24, 34, 48, 0.14);
  backdrop-filter: blur(12px);
}

.bottom-tab {
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.bottom-tab.active {
  background: var(--text);
  color: #fff;
}

.action-join-btn {
  background: var(--blue);
  color: #fff;
}

.action-report-btn {
  border-color: #f3cf96;
  background: #fff6e8;
  color: #b56a00;
}

.active-filter {
  border-color: #a9c7ff;
  background: #edf4ff;
  color: #1664e8;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1664e8;
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .hero {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .hero-copy {
    margin-top: 8px;
    font-size: 14px;
  }

  .topbar {
    gap: 6px;
    font-size: 13px;
    flex-wrap: wrap;
  }

  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel {
    padding: 14px;
  }

  .system-card {
    grid-template-columns: 1fr;
  }

  .example-box {
    grid-template-columns: 1fr;
  }

  .taobao-top-row,
  .taobao-top-note {
    flex-direction: column;
    align-items: stretch;
  }

  .wechat-entry {
    width: 100%;
    min-width: 0;
  }

  .taobao-top-links {
    width: 100%;
  }

  .top-lite-btn {
    flex: 1 1 calc(33.333% - 8px);
    min-width: 0;
  }

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

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

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

  .pager {
    gap: 12px;
  }

  .toolbar {
    width: 100%;
  }

  #taobaoMaxTeamLabel {
    width: 100%;
  }

  .toolbar .ghost-btn,
  .toolbar .primary-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .refresh-strip {
    width: 100%;
    justify-content: space-between;
    margin-top: 12px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .progress-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .compact-card-body {
    grid-template-columns: 1fr;
  }

  .compact-actions {
    width: 100%;
  }

  .compact-actions .ghost-btn,
  .compact-actions .primary-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .compact-metrics {
    white-space: normal;
  }

  .team-share-row {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-entry-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .modal-card {
    width: 100%;
    max-height: 86vh;
    border-radius: 16px;
    padding: 14px;
  }

  .taobao-bottom-nav {
    width: calc(100vw - 16px);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 6px;
  }

  .bottom-tab {
    height: 42px;
    font-size: 13px;
  }
}
