:root {
  --bg: #171c28;
  --surface: #232b3c;
  --surface-2: #2b3346;
  --border: #333c52;
  --text: #e9edf6;
  --muted: #8b95ab;
  --accent: #ff5b4d;
  --gold: #f2c141;
  --primary: #4d7cff;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

button,
input,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
}

/* ---------- 登录页 ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at 30% 20%, #22304a 0%, #171c28 60%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 26px;
  font-size: 13px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--primary);
}

.login-card button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

.login-card button:hover {
  background: #3d68e8;
}

.login-error {
  margin-top: 14px;
  color: var(--accent);
  font-size: 13px;
  min-height: 20px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
}

.sync-info {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: #a9c0ff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ---------- 筛选栏 ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-item label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.filter-item input,
.filter-item select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 148px;
  color-scheme: dark;
}

.filter-item input:focus,
.filter-item select:focus {
  border-color: var(--primary);
}

.quick-range {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-range button {
  padding: 8px 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  font-size: 12px;
  transition: all 0.15s;
}

.quick-range button.active,
.quick-range button:hover {
  background: rgba(77, 124, 255, 0.16);
  border-color: var(--primary);
  color: #a9c0ff;
}

/* ---------- 小组大数字卡片 ---------- */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 24px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.group-card .name {
  color: var(--accent);
  font-size: 17px;
  font-weight: 500;
}

.group-card .value {
  color: var(--accent);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.group-card .foot {
  color: var(--muted);
  font-size: 12px;
}

.group-card.mine {
  border-color: rgba(255, 91, 77, 0.55);
  background: linear-gradient(150deg, #33283180, var(--surface));
}

.scope-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 91, 77, 0.16);
  border: 1px solid rgba(255, 91, 77, 0.45);
  color: #ff9c92;
  font-size: 12px;
  font-weight: 500;
  vertical-align: middle;
}

/* ---------- 榜单 ---------- */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

/* 小组账号只有一份榜单，铺满整行会很空旷 */
.board-grid:has(.board:only-child) {
  grid-template-columns: minmax(280px, 560px);
}

.board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
}

.board h3 {
  font-size: 14px;
  margin: 0 0 12px;
  font-weight: 600;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.board-row:last-child {
  border-bottom: none;
}

.rank {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #3a2c00;
  background: var(--gold);
}

.rank.plain {
  background: transparent;
  color: var(--muted);
}

.board-row .who {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-row .num {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.board .empty-row {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0 14px;
}

/* ---------- 卡片与图表 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 14px;
  margin: 0 0 14px;
  font-weight: 600;
}

.chart-box {
  width: 100%;
  height: 300px;
}

/* ---------- 明细表 ---------- */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.banner {
  background: rgba(255, 91, 77, 0.12);
  border: 1px solid rgba(255, 91, 77, 0.4);
  color: #ff9c92;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .container,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .group-card {
    min-height: 120px;
    padding: 16px;
  }
}
