.leaderboard-page {
  background: var(--hub-surface);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  padding: 22px 24px 28px;
  box-shadow: var(--hub-shadow-md);
}

.leaderboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hub-border);
}

.leaderboard-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hub-ink);
}

.leaderboard-lead {
  margin: 6px 0 0;
  color: var(--hub-muted);
  font-size: 14px;
}

.leaderboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.leaderboard-search-input {
  flex: 1 1 220px;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-sm);
  background: var(--hub-input-bg);
  color: var(--hub-ink);
  font: inherit;
  font-size: 14px;
  padding: 0 12px;
}

.leaderboard-search-input:focus-visible {
  outline: none;
  box-shadow: var(--hub-focus-ring);
}

.leaderboard-count {
  margin: 0;
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 650;
}

.leaderboard-status {
  color: var(--hub-muted);
  font-weight: 650;
  padding: 12px 0;
}

.leaderboard-status.is-error {
  color: var(--hub-bad);
}

.leaderboard-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-md);
}

.leaderboard-users-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leaderboard-users-table th,
.leaderboard-users-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--hub-border);
  vertical-align: middle;
  white-space: nowrap;
}

.leaderboard-users-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hub-muted);
  background: var(--hub-surface-muted);
}

.leaderboard-users-table tbody tr:last-child td {
  border-bottom: none;
}

.leaderboard-user-name {
  font-weight: 700;
  color: var(--hub-ink);
}

.leaderboard-user-email {
  color: var(--hub-muted);
}

.leaderboard-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.leaderboard-badge.is-active {
  background: color-mix(in srgb, #16a34a 12%, var(--hub-surface));
  color: #16a34a;
}

.leaderboard-badge.is-expired {
  background: color-mix(in srgb, #dc2626 10%, var(--hub-surface));
  color: #dc2626;
}

.leaderboard-expand-btn {
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-sm);
  background: var(--hub-surface);
  color: var(--hub-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px;
  cursor: pointer;
}

.leaderboard-expand-btn:hover {
  background: var(--hub-surface-muted);
}

.leaderboard-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leaderboard-clear-btn {
  border: 1px solid color-mix(in srgb, #dc2626 35%, var(--hub-border));
  border-radius: var(--hub-radius-sm);
  background: color-mix(in srgb, #dc2626 6%, var(--hub-surface));
  color: #dc2626;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px;
  cursor: pointer;
}

.leaderboard-clear-btn:hover:not(:disabled) {
  background: color-mix(in srgb, #dc2626 12%, var(--hub-surface));
}

.leaderboard-clear-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.leaderboard-clear-modal .dev-btn-primary.is-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.leaderboard-clear-modal .dev-btn-primary.is-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.leaderboard-clear-modal #clearStatsConfirmBtn[hidden] {
  display: none !important;
}

.leaderboard-detail-row td {
  padding: 0;
  background: var(--hub-surface-muted);
}

.leaderboard-detail-panel {
  padding: 14px 16px 16px;
}

.leaderboard-detail-plan {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--hub-muted);
}

.leaderboard-detail-empty {
  margin: 0;
  font-size: 13px;
  color: var(--hub-muted);
}

.leaderboard-detail-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.leaderboard-detail-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.leaderboard-detail-table th,
.leaderboard-detail-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--hub-border);
  white-space: nowrap;
}

.leaderboard-detail-table th {
  color: var(--hub-muted);
  font-weight: 650;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leaderboard-detail-table tbody tr:last-child td {
  border-bottom: none;
}
