:root {
  --ink: #1f2a2a;
  --muted: #687778;
  --paper: #f7f3ea;
  --panel: #fffdf8;
  --line: #ded7c8;
  --green: #26715d;
  --green-dark: #16523f;
  --red: #c8503f;
  --gold: #d7a437;
  --blue: #386f93;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

.shell {
  width: min(1080px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand span,
.eyebrow {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 7vw, 52px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(22px, 4vw, 31px);
}

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

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

a,
button,
.button {
  color: inherit;
}

.button,
button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: #edf2ee;
  color: var(--green-dark);
}

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

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.panel {
  padding: clamp(16px, 4vw, 24px);
  margin-bottom: 14px;
}

.rules {
  border-left: 6px solid var(--gold);
}

.rules summary {
  cursor: pointer;
  font-weight: 800;
}

.tabs,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  margin-bottom: 12px;
}

.tabs button {
  background: #ece8dc;
  color: var(--ink);
}

.tabs button.active {
  background: var(--green);
  color: #fff;
}

.rank-list,
.reward-list,
.group-list {
  display: grid;
  gap: 10px;
}

.rank-row,
.reward-row,
.group-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.rank-num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #f3ead3;
  color: #7d5710;
  font-weight: 900;
}

.metric {
  display: grid;
  gap: 2px;
  text-align: right;
}

.metric strong {
  font-size: 22px;
  color: var(--green-dark);
}

.muted,
small {
  color: var(--muted);
  line-height: 1.65;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 14px;
}

.stat span {
  color: var(--muted);
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  color: var(--green-dark);
}

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

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 11px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

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

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 9px;
  background: #edf0ed;
  font-size: 12px;
  font-weight: 900;
}

.pill.valid {
  color: var(--green-dark);
}

.pill.pending {
  color: var(--blue);
}

.pill.revoked {
  color: var(--red);
}

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

@media (max-width: 760px) {
  .topbar,
  .rank-row,
  .reward-row,
  .group-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .metric {
    text-align: left;
  }

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